diff options
author | jmisinco | 2014-01-14 21:38:29 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2014-03-04 19:41:56 +0000 |
commit | 90fd32a166c709b0e389d339b3ec5c8cfc4cd7ce (patch) | |
tree | fa00f78ff0c440692c75f322edbbfdbdddb32843 /plugins/org.eclipse.osee.framework.core.dsl.ui.integration | |
parent | 12f7c60f1408eb1f595acc00a622a4da9805a559 (diff) | |
download | org.eclipse.osee-90fd32a166c709b0e389d339b3ec5c8cfc4cd7ce.tar.gz org.eclipse.osee-90fd32a166c709b0e389d339b3ec5c8cfc4cd7ce.tar.xz org.eclipse.osee-90fd32a166c709b0e389d339b3ec5c8cfc4cd7ce.zip |
bug[ats_Z7K56]: Possible to open multiple copies of the same SRE artifact
Change-Id: I09a8ded2461391f4be5558a9027d6f49f6993d15
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.dsl.ui.integration')
-rw-r--r-- | plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/AbstractDslRenderer.java | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/AbstractDslRenderer.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/AbstractDslRenderer.java index f8a4c46dc3f..c125cb7b709 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/AbstractDslRenderer.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/AbstractDslRenderer.java @@ -36,13 +36,14 @@ import org.eclipse.swt.program.Program; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.part.FileEditorInput; /** * @author Jonathan E. Jensen */ public abstract class AbstractDslRenderer extends FileSystemRenderer { + private static final String DEFAULT_EDITOR_ID = "org.eclipse.osee.framework.core.dsl.OseeDsl"; protected static final String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.render.dsl.editor.command"; protected AbstractDslRenderer() { @@ -124,6 +125,10 @@ public abstract class AbstractDslRenderer extends FileSystemRenderer { return NO_MATCH; } + protected String getEditorId() { + return DEFAULT_EDITOR_ID; + } + @Override public final void open(final List<Artifact> artifacts, final PresentationType presentationType) { @@ -137,7 +142,7 @@ public abstract class AbstractDslRenderer extends FileSystemRenderer { if (file != null) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage(); - IDE.openEditor(page, file); + page.openEditor(new DslEditorInput(file, artifacts), getEditorId()); } } catch (Exception ex) { OseeLog.log(DslUiIntegrationConstants.class, OseeLevel.SEVERE_POPUP, ex); @@ -158,4 +163,34 @@ public abstract class AbstractDslRenderer extends FileSystemRenderer { public final Program getAssociatedProgram(Artifact artifact) throws OseeCoreException { throw new OseeCoreException("should not be called"); } + + private static class DslEditorInput extends FileEditorInput { + + private final List<Artifact> artifacts; + + public DslEditorInput(IFile file, List<Artifact> artifacts) { + super(file); + this.artifacts = artifacts; + } + + @Override + public boolean equals(Object obj) { + boolean toReturn = false; + if (obj instanceof DslEditorInput) { + List<Artifact> toCheck = ((DslEditorInput) obj).artifacts; + toReturn = toCheck.size() == artifacts.size(); + if (toReturn) { + for (Artifact art : toCheck) { + if (!artifacts.contains(art)) { + toReturn = false; + break; + + } + } + } + } + return toReturn; + } + + } } |