Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ProB Rodin Plugin
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
ProB Rodin Plugin
Commits
07d51831
Commit
07d51831
authored
12 years ago
by
Sebastian Krings
Browse files
Options
Downloads
Patches
Plain Diff
add unit pragma to constants
parent
b5be35dd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
de.prob.ui/plugin.xml
+6
-0
6 additions, 0 deletions
de.prob.ui/plugin.xml
de.prob.ui/src/de/prob/ui/pragmas/UnitPragma.java
+24
-18
24 additions, 18 deletions
de.prob.ui/src/de/prob/ui/pragmas/UnitPragma.java
with
30 additions
and
18 deletions
de.prob.ui/plugin.xml
+
6
−
0
View file @
07d51831
...
...
@@ -1269,5 +1269,11 @@
descriptionId=
"de.prob.ui.unitPragma"
>
</attributeReference>
</attributeRelation>
<attributeRelation
elementTypeId=
"org.eventb.core.constant"
>
<attributeReference
descriptionId=
"de.prob.ui.unitPragma"
>
</attributeReference>
</attributeRelation>
</extension>
</plugin>
This diff is collapsed.
Click to expand it.
de.prob.ui/src/de/prob/ui/pragmas/UnitPragma.java
+
24
−
18
View file @
07d51831
...
...
@@ -2,8 +2,10 @@ package de.prob.ui.pragmas;
import
org.eclipse.core.runtime.IProgressMonitor
;
import
org.eventb.core.IVariable
;
import
org.eventb.core.basis.Constant
;
import
org.eventb.internal.ui.eventbeditor.manipulation.IAttributeManipulation
;
import
org.rodinp.core.IAttributeType
;
import
org.rodinp.core.IInternalElement
;
import
org.rodinp.core.IRodinElement
;
import
org.rodinp.core.RodinCore
;
import
org.rodinp.core.RodinDBException
;
...
...
@@ -11,52 +13,56 @@ import org.rodinp.core.RodinDBException;
import
de.prob.core.internal.Activator
;
public
class
UnitPragma
implements
IAttributeManipulation
{
public
static
IAttributeType
.
String
ATTRIBUTE
=
RodinCore
.
getStringAttrType
(
Activator
.
PLUGIN_ID
+
".unitPragma"
);
public
static
IAttributeType
.
String
ATTRIBUTE
=
RodinCore
.
getStringAttrType
(
Activator
.
PLUGIN_ID
+
".unitPragma"
);
public
UnitPragma
()
{
// empty constructor
}
private
I
Variable
asVariable
(
IRodinElement
element
)
{
assert
element
instanceof
IVariable
;
private
I
InternalElement
asInternalElement
(
IRodinElement
element
)
{
if
(
element
instanceof
IVariable
)
{
return
(
IVariable
)
element
;
}
else
if
(
element
instanceof
Constant
)
{
return
(
Constant
)
element
;
}
return
null
;
}
@Override
public
String
[]
getPossibleValues
(
IRodinElement
element
,
IProgressMonitor
monitor
)
{
public
String
[]
getPossibleValues
(
IRodinElement
element
,
IProgressMonitor
monitor
)
{
return
new
String
[]
{
""
,
"a"
,
"b"
,
"c"
};
}
@Override
public
String
getValue
(
IRodinElement
element
,
IProgressMonitor
monitor
)
throws
RodinDBException
{
return
as
Variable
(
element
).
getAttributeValue
(
ATTRIBUTE
);
return
as
InternalElement
(
element
).
getAttributeValue
(
ATTRIBUTE
);
}
@Override
public
boolean
hasValue
(
IRodinElement
element
,
IProgressMonitor
monitor
)
throws
RodinDBException
{
return
as
Variable
(
element
).
hasAttribute
(
ATTRIBUTE
);
return
as
InternalElement
(
element
).
hasAttribute
(
ATTRIBUTE
);
}
@Override
public
void
removeAttribute
(
IRodinElement
element
,
IProgressMonitor
monitor
)
throws
RodinDBException
{
as
Variable
(
element
).
removeAttribute
(
ATTRIBUTE
,
monitor
);
as
InternalElement
(
element
).
removeAttribute
(
ATTRIBUTE
,
monitor
);
}
@Override
public
void
setDefaultValue
(
IRodinElement
element
,
IProgressMonitor
monitor
)
throws
RodinDBException
{
asVariable
(
element
).
setAttributeValue
(
ATTRIBUTE
,
""
,
monitor
);
asInternalElement
(
element
).
setAttributeValue
(
ATTRIBUTE
,
""
,
monitor
);
}
@Override
public
void
setValue
(
IRodinElement
element
,
String
value
,
IProgressMonitor
monitor
)
throws
RodinDBException
{
asVariable
(
element
).
setAttributeValue
(
ATTRIBUTE
,
value
,
monitor
);
public
void
setValue
(
IRodinElement
element
,
String
value
,
IProgressMonitor
monitor
)
throws
RodinDBException
{
asInternalElement
(
element
).
setAttributeValue
(
ATTRIBUTE
,
value
,
monitor
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment