java.lang.Object
org.modelversioning.emfprofile.application.registry.ui.observer.ActiveEditorObserver
All Implemented Interfaces:
PluginExtensionOperationsListener

public class ActiveEditorObserver extends Object implements PluginExtensionOperationsListener
It manages mapping of opened editors of interest to the generated id for an opened model in editor. It is also a PluginExtensionOperationsListener.
  • Field Details

  • Method Details

    • getLastActiveEditorPart

      public IWorkbenchPart getLastActiveEditorPart()
    • setViewer

      public void setViewer(TreeViewer viewer)
      To set the Tree Viewer from outside. After calling this method a part listener will be added on active page which registers activation of editors that can be decorated.
      Note: without setting a tree viewer the services of this class implementation will work properly.
      Parameters:
      viewer -
    • refreshViewer

      public void refreshViewer()
      Complete refresh of the viewer tree if needed.
    • refreshViewer

      public void refreshViewer(Object object)
      Collection can be provided as parameter. Refresh will be executed asynchronously for whole group of collection items in one runnable.
      Parameters:
      object - an viewer tree element or a collection of them.
    • updateViewer

      public void updateViewer(Object element)
      Updates the element of the viewer.
      Parameters:
      element - of the tree in question.
    • revealElement

      public void revealElement(Object element)
    • getModelIdForWorkbenchPart

      public String getModelIdForWorkbenchPart(IWorkbenchPart part)
    • applyStereotype

      public void applyStereotype(EObject eObject)
      Executes the operation of applying stereotypes on given EObject
      Specified by:
      applyStereotype in interface PluginExtensionOperationsListener
    • eObjectSelected

      public void eObjectSelected(EObject eObject)
      Notifies the extended plug-in that the new selection on an instance of EObject was registered.
      Specified by:
      eObjectSelected in interface PluginExtensionOperationsListener
    • setActivateViewFilter

      public void setActivateViewFilter(boolean activateFilter)
      Parameters:
      activateFilter - true or false
    • refreshDecorations

      public void refreshDecorations(Collection<EObject> eObjects)
      It calls the refreshDecoration(EObject) for each EObject.
      Note: This method can be used to refresh decorations when loading or unloading profile applications.
      Parameters:
      eObjects - collection of EObjects for which decorations must be refreshed.
    • refreshDecoration

      public void refreshDecoration(EObject eObject)
      The method collects all stereotypes applied to eObject from profile applications that can be found for this model in ProfileApplicationRegistry and then informs active editor decorator to decorate the eObject.
      Parameters:
      eObject - that has stereotype applications
    • cleanUp

      public void cleanUp()
      The cleanup is executed if the profile application view in workbench is closing, but not the Workbench. If the workbench is closing, then the clean-up will be executed in IWorkbenchListener.preShutdown(IWorkbench, boolean) which calls clean-up for all profile applications in DecoratableEditorPartListener.cleanUpForAllEditorParts().
    • setProfileApplicationChanged

      public void setProfileApplicationChanged()
      This method will be called from ProfileApplicationDecoratorReflectiveItemProviderAdapterFactory when notification is fired that an attribute is changed in properties view. Notifications will be fired for every change, but we are here only interested in scenario when only one tree element is selected and we can find profile application decorator from it, otherwise this method will do nothing.
    • findProfileApplicationDecorator

      public ProfileApplicationDecorator findProfileApplicationDecorator(EObject eObject)
      If we need ProfileApplicationDecorator because of its extended functionalities, and calling EObject.eContainer() will eventually return ProfileApplication but we cannot cast it to ProfileApplicationDecorator. Thus, the easiest way to get it is to ask the ProfileApplicationRegistry, which this method does for you.
      Parameters:
      eObject -
      Returns: