public class OCLConsolePage extends org.eclipse.ui.part.Page implements MetaModelManagerListener
Modifier and Type | Class and Description |
---|---|
protected static class |
OCLConsolePage.CancelableEvaluationVisitor
CancelableEvaluationVisitor refines the EvaluationVisitor to poll the monitor foer cancelation at a variety of significant
evaluation events, such as feature vists and
#getValueFactory() . |
static class |
OCLConsolePage.ColorChoices |
static class |
OCLConsolePage.InterrogatableContentAssistant |
static class |
OCLConsolePage.InterrogatableContentAssistantFactory |
Modifier | Constructor and Description |
---|---|
protected |
OCLConsolePage(OCLConsole console)
Initializes me.
|
Modifier and Type | Method and Description |
---|---|
protected void |
append(java.lang.String text,
org.eclipse.swt.graphics.RGB rgb,
boolean bold)
Appends the specified text to the output viewer.
|
void |
createControl(org.eclipse.swt.widgets.Composite parent) |
void |
dispose()
Extends the inherited method to dispose of additional colour resources.
|
protected boolean |
evaluate(java.lang.String expression)
Evaluates an OCL expression using the OCL Interpreter's
OCLHelper
API. |
protected void |
flushEvents() |
protected org.eclipse.jface.viewers.ISelection |
getActiveSelection() |
org.eclipse.swt.widgets.Control |
getControl() |
org.eclipse.xtext.ui.editor.model.IXtextDocument |
getDocument(org.eclipse.emf.common.util.URI trimFragment) |
BaseDocument |
getEditorDocument() |
java.lang.String |
getLastOCLExpression()
Gets the editor image for the specified element.
|
MetaModelManager |
getMetaModelManager(org.eclipse.emf.ecore.EObject contextObject) |
void |
metaModelManagerDisposed(MetaModelManager metaModelManager)
Prints the specified
object to the output viewer. |
protected void |
refreshSelection(java.lang.Object selected) |
void |
reset() |
protected void |
resetDocument() |
void |
setFocus() |
protected OCLConsolePage(OCLConsole console)
oclConsole
- protected void append(java.lang.String text, org.eclipse.swt.graphics.RGB rgb, boolean bold)
text
- the text to appendcolor
- the color to print the text withbold
- whether to print the text boldpublic void createControl(org.eclipse.swt.widgets.Composite parent)
createControl
in interface org.eclipse.ui.part.IPage
createControl
in class org.eclipse.ui.part.Page
public void dispose()
dispose
in interface org.eclipse.ui.part.IPage
dispose
in class org.eclipse.ui.part.Page
protected boolean evaluate(java.lang.String expression)
OCLHelper
API.expression
- an OCL expressiontrue
on successful evaluation; false
if the expression failed to parse or evaluateprotected void flushEvents()
protected org.eclipse.jface.viewers.ISelection getActiveSelection()
public org.eclipse.swt.widgets.Control getControl()
getControl
in interface org.eclipse.ui.part.IPage
getControl
in class org.eclipse.ui.part.Page
public org.eclipse.xtext.ui.editor.model.IXtextDocument getDocument(org.eclipse.emf.common.util.URI trimFragment)
public BaseDocument getEditorDocument()
public java.lang.String getLastOCLExpression()
element
- a model element@NonNull public MetaModelManager getMetaModelManager(@Nullable org.eclipse.emf.ecore.EObject contextObject)
public void metaModelManagerDisposed(@NonNull MetaModelManager metaModelManager)
object
to the output viewer. The
object is converted to a string using the best matching EMF label
provider adapter if it is an EObject
; otherwise, just use
String.valueOf(java.lang.Object)
on it. If the
object
is a collection or an array, then we print each
element on a separate line.metaModelManagerDisposed
in interface MetaModelManagerListener
object
- the object or collection to printcolor
- the color to print the object
withbold
- whether to display it in bold text
private void print(Value value, Color color, boolean bold) {
CollectionValue collectionValue = value.isCollectionValue();
if (collectionValue != null) {
for (Value elementValue : collectionValue) {
append(String.valueOf(elementValue), color, bold);
}
}
else {
append(String.valueOf(value), color, bold);
}
/* Collection> toPrint;
if (object == null) {
toPrint = Collections.EMPTY_SET;
} else if (object instanceof Collection) {
toPrint = (Collection>) object;
} else if (object.getClass().isArray()) {
toPrint = Arrays.asList((Object[]) object);
} else {
toPrint = Collections.singleton(object);
}
for (Iterator> iter = toPrint.iterator(); iter.hasNext();) {
append(toString(iter.next()), color, bold);
} * /
// append(String.valueOf(object), color, bold);
scrollText();
}protected void refreshSelection(java.lang.Object selected)
public void reset()
protected void resetDocument()
public void setFocus()
setFocus
in interface org.eclipse.ui.part.IPage
setFocus
in class org.eclipse.ui.part.Page