Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2018-12-05 21:45:54 +0000
committerRyan T. Baldwin2018-12-05 21:45:54 +0000
commite9d56b26498517af97d301a6c02001f5d4c76933 (patch)
tree4c3b0319efa7e1de6b0cbcc21df0e8e4ca4535a0 /plugins
parent74e47e21bcab300afe548d86f5c50e96192ddfe1 (diff)
downloadorg.eclipse.osee-e9d56b26498517af97d301a6c02001f5d4c76933.tar.gz
org.eclipse.osee-e9d56b26498517af97d301a6c02001f5d4c76933.tar.xz
org.eclipse.osee-e9d56b26498517af97d301a6c02001f5d4c76933.zip
bug[ats_TW12027]: BLAM editors open with error on restart
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInput.java15
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInputFactory.java41
3 files changed, 62 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 1f8e77e57b0..e4e757d451b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -1638,4 +1638,12 @@
className="org.eclipse.osee.framework.ui.skynet.commit.CatchValidationChecks">
</commitActions>
</extension>
+ <extension id="org.eclipse.osee.framework.ui.skynet.blam.BlamEditorInputFactory"
+ name="Blam Editor Input Factory"
+ point="org.eclipse.ui.elementFactories">
+ <factory
+ class="org.eclipse.osee.framework.ui.skynet.blam.BlamEditorInputFactory"
+ id="org.eclipse.osee.framework.ui.skynet.blam.BlamEditorInputFactory">
+ </factory>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInput.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInput.java
index 1a361fe5c92..e201a550e69 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInput.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInput.java
@@ -14,12 +14,13 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.framework.core.data.Adaptable;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
/**
* @author Donald G. Dunne
*/
-public class BlamEditorInput implements IEditorInput, Adaptable {
+public class BlamEditorInput implements IEditorInput, IPersistableElement, Adaptable {
private final AbstractBlam blamOperation;
@@ -60,7 +61,7 @@ public class BlamEditorInput implements IEditorInput, Adaptable {
@Override
public IPersistableElement getPersistable() {
- return null;
+ return this;
}
@Override
@@ -73,4 +74,14 @@ public class BlamEditorInput implements IEditorInput, Adaptable {
return super.hashCode();
}
+ @Override
+ public void saveState(IMemento memento) {
+ BlamEditorInputFactory.saveState(memento, this);
+ }
+
+ @Override
+ public String getFactoryId() {
+ return BlamEditorInputFactory.ID;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInputFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInputFactory.java
new file mode 100644
index 00000000000..fdd64d216c6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditorInputFactory.java
@@ -0,0 +1,41 @@
+package org.eclipse.osee.framework.ui.skynet.blam;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+
+/**
+ * The factory which is capable of recreating class file editor inputs stored in a memento.
+ *
+ * @author Donald G. Dunne
+ */
+public class BlamEditorInputFactory implements IElementFactory {
+
+ public final static String ID = "org.eclipse.osee.framework.ui.skynet.blam.BlamEditorInputFactory"; //$NON-NLS-1$
+ private static final String BLAM_ID = "org.eclipse.osee.framework.ui.skynet.blam.id"; //$NON-NLS-1$;
+
+ @Override
+ public IAdaptable createElement(IMemento memento) {
+ try {
+ String blamId = memento.getString(BLAM_ID);
+ if (Strings.isValid(blamId)) {
+ for (AbstractBlam blam : BlamContributionManager.getBlamOperations()) {
+ if (blam.getName().equals(blamId)) {
+ return new BlamEditorInput(blam);
+ }
+
+ }
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ return null;
+ }
+
+ public static void saveState(IMemento memento, BlamEditorInput input) {
+ String id = input.getBlamOperation().getName();
+ memento.putString(BLAM_ID, id);
+ }
+
+}

Back to the top