|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.core.kivi.AbstractTriggerState
de.cau.cs.kieler.core.model.gmf.triggers.ModelChangeTrigger.ActiveEditorState
public static class ModelChangeTrigger.ActiveEditorState
A state about the model viewers currently visible, e.g. the current active editor or active
view. It contains lists of all active IWorkbenchPart
s and a list of all such parts
that contain a diagram, i.e. are compatible with the GraphicalFrameworkService
. Note
that the parts can be either IViewPart
s or IEditorPart
s.
A scenario is to use the last opened editor or view of a specific kind. You can obtain the
lists of currently open parts or diagram parts by
getOpenWorkbenchParts()
resp.
getOpenDiagrams()
. As the lists are ordered by the order in which
the parts were activated (freshest part is the first), they can be iterated with choosing the
first part that matches the right ID, e.g. by comparing their string IDs with
IWorkbenchPart.getSite()
and IWorkbenchPartSite#getID()
. This ensures to (1)
avoid doing something on a not supported editor or view and (2) to also be able to do
something when some other editor or view is in the focus. Note that this might also do
something on an editor that is not on top, i.e. not actually visible.
String relevantID = "my.editor.id"; IWorkbenchPart myPart = null; for(IWorkbenchPart part : activeEditorState.getOpenDiagrams()){ if(relevantID.equals(part.getSite().getID()){ myPart = part; break; } } if(myPart != null){ ... }
Constructor Summary | |
---|---|
ModelChangeTrigger.ActiveEditorState()
Default Constructor that can be used as a default state. |
|
ModelChangeTrigger.ActiveEditorState(IWorkbenchPart focused,
IWorkbenchPart opened,
IWorkbenchPart closed)
Constructor. |
Method Summary | |
---|---|
IWorkbenchPart |
getLastActiveDiagram()
Get the most recently opened editor or view that contains a diagram supported by the GraphicalFrameworkService . |
EObject |
getLastActiveSemanticModel()
Get the semantic model in shape of the root EObject that corresponds to the diagram or other editor that was last active. |
IWorkbenchPart |
getLastActiveWorkbenchPart()
Get the most recently opened editor or view. |
List<IWorkbenchPart> |
getOpenDiagrams()
Get a list of all IWorkbenchParts (editors and views) that contain a diagram supported by the GraphicalFrameworkService . |
List<IWorkbenchPart> |
getOpenWorkbenchParts()
Get a list of any active IWorkbenchParts. |
Class<? extends ITrigger> |
getTriggerClass()
Get the trigger class associated with this trigger state. |
void |
merge(ITriggerState previous)
Update the list of open diagram editors and views. |
Methods inherited from class de.cau.cs.kieler.core.kivi.AbstractTriggerState |
---|
finish, getKeyClass, getSequenceNumber, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ModelChangeTrigger.ActiveEditorState()
public ModelChangeTrigger.ActiveEditorState(IWorkbenchPart focused, IWorkbenchPart opened, IWorkbenchPart closed)
focused
- an editor just focusedopened
- a newly opened editorclosed
- an editor just closedMethod Detail |
---|
public IWorkbenchPart getLastActiveWorkbenchPart()
public IWorkbenchPart getLastActiveDiagram()
GraphicalFrameworkService
. Maybe null if there is no such.
public List<IWorkbenchPart> getOpenDiagrams()
GraphicalFrameworkService
. The order in the list is starting with the last
activated part. It will include all currently active parts.
IViewPart
or IEditorPart
public List<IWorkbenchPart> getOpenWorkbenchParts()
IViewPart
or
IEditorPart
public EObject getLastActiveSemanticModel()
public void merge(ITriggerState previous)
merge
in interface ITriggerState
merge
in class AbstractTriggerState
previous
- the previous instance of this trigger statepublic Class<? extends ITrigger> getTriggerClass()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |