Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schindl2011-03-30 22:05:10 +0000
committerThomas Schindl2011-03-30 22:05:10 +0000
commita19ddbb66d7bb69a2b61e141c2e2c3cbd9cfc5f0 (patch)
treea4e46558a1265df0645ad6f7a1f2922a09ce75c5
parent0c5298a3ed7433267301bd7aab5981c230c36c91 (diff)
downloadorg.eclipse.e4.tools-a19ddbb66d7bb69a2b61e141c2e2c3cbd9cfc5f0.tar.gz
org.eclipse.e4.tools-a19ddbb66d7bb69a2b61e141c2e2c3cbd9cfc5f0.tar.xz
org.eclipse.e4.tools-a19ddbb66d7bb69a2b61e141c2e2c3cbd9cfc5f0.zip
Bug 340413 - [ModelTooling] Make the live editor into a part so that it can be opened in 4.1
-rw-r--r--bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.liveeditor/icons/full/obj16/application_lightning.pngbin0 -> 656 bytes
-rw-r--r--bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/LivePartDelegator.java39
-rw-r--r--bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java13
-rw-r--r--bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java1
5 files changed, 54 insertions, 2 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF
index e4b46dae..d4fa5995 100644
--- a/bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF
@@ -17,7 +17,8 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.e4.core.contexts;bundle-version="0.9.0",
org.eclipse.e4.core.di;bundle-version="0.9.0",
org.eclipse.jface;bundle-version="3.6.0",
- org.eclipse.equinox.registry;bundle-version="3.5.0"
+ org.eclipse.equinox.registry;bundle-version="3.5.0",
+ org.eclipse.e4.ui.di;bundle-version="0.9.0"
Bundle-Vendor: %Bundle-Vendor
Service-Component: OSGI-INF/extensionlookup.xml
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/icons/full/obj16/application_lightning.png b/bundles/org.eclipse.e4.tools.emf.liveeditor/icons/full/obj16/application_lightning.png
new file mode 100644
index 00000000..7e91545c
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.emf.liveeditor/icons/full/obj16/application_lightning.png
Binary files differ
diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/LivePartDelegator.java b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/LivePartDelegator.java
new file mode 100644
index 00000000..1b431701
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/LivePartDelegator.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2011 BestSolution.at and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.e4.tools.emf.liveeditor;
+
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.tools.emf.ui.common.IModelResource;
+import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.model.application.MApplication;
+
+public class LivePartDelegator {
+ private ApplicationModelEditor instance;
+ private IEclipseContext childContext;
+
+ @Inject
+ public LivePartDelegator(IEclipseContext context, MApplication application) {
+ childContext = context.createChild("EditorContext");
+ MemoryModelResource resource = new MemoryModelResource(application);
+ childContext.set(IModelResource.class, resource);
+
+ instance = ContextInjectionFactory.make(ApplicationModelEditor.class, childContext);
+ }
+
+ @Focus
+ void focus() {
+ ContextInjectionFactory.invoke(instance, Focus.class, childContext);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java
index 054c29e3..9e507c73 100644
--- a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java
+++ b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java
@@ -16,6 +16,7 @@ import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
import org.eclipse.e4.ui.model.application.commands.MHandler;
import org.eclipse.e4.ui.model.application.commands.MKeyBinding;
+import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
public class ModelProcessor {
@@ -38,5 +39,17 @@ public class ModelProcessor {
if( application.getBindingTables().size() > 0 ) {
application.getBindingTables().get(0).getBindings().add(binding);
}
+
+ MPartDescriptor descriptor = org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory.INSTANCE.createPartDescriptor();
+ descriptor.setCategory("org.eclipse.e4.secondaryDataStack");
+ descriptor.setElementId("org.eclipse.e4.tools.emf.liveeditor.view");
+ descriptor.getTags().add("View");
+ descriptor.getTags().add("categoryTag:General");
+
+ descriptor.setLabel("Live Application Model");
+ descriptor.setContributionURI("platform:/plugin/org.eclipse.e4.tools.emf.liveeditor/org.eclipse.e4.tools.emf.liveeditor.LivePartDelegator");
+ descriptor.setContributorURI("platform:/plugin/org.eclipse.e4.tools.emf.liveeditor");
+ descriptor.setIconURI("platform:/plugin/org.eclipse.e4.tools.emf.liveeditor/icons/full/obj16/application_lightning.png");
+ application.getDescriptors().add(descriptor);
}
}
diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java
index b78af4ec..c825e8c5 100644
--- a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java
+++ b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java
@@ -50,7 +50,6 @@ public class OpenLiveDialogHandler {
MemoryModelResource resource = new MemoryModelResource(application);
childContext.set(IModelResource.class, resource);
childContext.set(Composite.class.getName(), shell);
- childContext.set(IModelResource.class, resource);
ContextInjectionFactory.make(ApplicationModelEditor.class, childContext);

Back to the top