diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorContributor.java')
-rw-r--r-- | plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorContributor.java | 137 |
1 files changed, 64 insertions, 73 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorContributor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorContributor.java index 3bff197ec1d..7d1ec1d890e 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorContributor.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorContributor.java @@ -23,79 +23,70 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.part.MultiPageEditorActionBarContributor; import org.eclipse.ui.texteditor.StatusLineContributionItem; -/** - * Manages the installation/deinstallation of global actions for multi-page editors. Responsible for the redirection of - * global actions to the active editor. Multi-page contributor replaces the contributors for the individual editors in - * the multi-page editor. - */ public class ArtifactEditorContributor extends MultiPageEditorActionBarContributor { - private StatusLineContributionItem typeStatusItem; - private ShowInExplorerAction showInExplorerAction; - - /** - * Creates a multi-page contributor. - */ - public ArtifactEditorContributor() { - super(); - - createActions(); - } - - @Override - public void setActiveEditor(IEditorPart part) { - super.setActiveEditor(part); - Artifact artifact = (Artifact) part.getAdapter(Artifact.class); - if (artifact != null) { - typeStatusItem.setText(artifact.getArtifactType().getName()); - typeStatusItem.setImage(ArtifactImageManager.getImage(artifact)); - showInExplorerAction.setArtifact(artifact); - - RelationsComposite composite = (RelationsComposite) part.getAdapter(RelationsComposite.class); - if (composite != null) { - composite.getTreeViewer().addSelectionChangedListener( - new SelectionCountChangeListener(this.getActionBars().getStatusLineManager())); - } - } - } - - @Override - public void setActivePage(IEditorPart part) { - } - - private void createActions() { - typeStatusItem = new StatusLineContributionItem("skynet.artifactType", true, 25); - typeStatusItem.setToolTipText("The type of the artifact being edited."); - - showInExplorerAction = new ShowInExplorerAction(); - } - - @Override - public void contributeToStatusLine(IStatusLineManager statusLineManager) { - statusLineManager.add(typeStatusItem); - OseeContributionItem.addTo(statusLineManager); - } - - @Override - public void contributeToCoolBar(ICoolBarManager coolBarManager) { - coolBarManager.add(showInExplorerAction); - } - - private static class ShowInExplorerAction extends Action { - private Artifact artifact; - - public ShowInExplorerAction() { - setText("Show in Artifact Explorer"); - setToolTipText("Show the Artifact being edited in the Artifact Explorer"); - } - - public void setArtifact(Artifact artifact) { - this.artifact = artifact; - } - - @Override - public void run() { - ArtifactExplorer.revealArtifact(artifact); - } - } + private StatusLineContributionItem typeStatusItem; + private ShowInExplorerAction showInExplorerAction; + + public ArtifactEditorContributor() { + super(); + createActions(); + } + + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + Artifact artifact = (Artifact) part.getAdapter(Artifact.class); + if (artifact != null) { + typeStatusItem.setText(artifact.getArtifactType().getName()); + typeStatusItem.setImage(ArtifactImageManager.getImage(artifact)); + showInExplorerAction.setArtifact(artifact); + + RelationsComposite composite = (RelationsComposite) part.getAdapter(RelationsComposite.class); + if (composite != null) { + composite.getTreeViewer().addSelectionChangedListener( + new SelectionCountChangeListener(this.getActionBars().getStatusLineManager())); + } + } + } + + @Override + public void setActivePage(IEditorPart part) { + } + + private void createActions() { + typeStatusItem = new StatusLineContributionItem("skynet.artifactType", true, 25); + typeStatusItem.setToolTipText("The type of the artifact being edited."); + + showInExplorerAction = new ShowInExplorerAction(); + } + + @Override + public void contributeToStatusLine(IStatusLineManager statusLineManager) { + statusLineManager.add(typeStatusItem); + OseeContributionItem.addTo(statusLineManager); + } + + @Override + public void contributeToCoolBar(ICoolBarManager coolBarManager) { + coolBarManager.add(showInExplorerAction); + } + + private static class ShowInExplorerAction extends Action { + private Artifact artifact; + + public ShowInExplorerAction() { + setText("Show in Artifact Explorer"); + setToolTipText("Show the Artifact being edited in the Artifact Explorer"); + } + + public void setArtifact(Artifact artifact) { + this.artifact = artifact; + } + + @Override + public void run() { + ArtifactExplorer.revealArtifact(artifact); + } + } } |