Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schindl2010-06-03 18:32:15 -0400
committerThomas Schindl2010-06-03 18:32:15 -0400
commit78c5da141ffd0445e2d15aa7711d771ff1938bf8 (patch)
tree41cb5662d5a47ecac4523f0929a245d4fce965a5
parent8cac42007927eed67a2cf63855e9920e10f29a25 (diff)
downloadorg.eclipse.e4.tools-78c5da141ffd0445e2d15aa7711d771ff1938bf8.tar.gz
org.eclipse.e4.tools-78c5da141ffd0445e2d15aa7711d771ff1938bf8.tar.xz
org.eclipse.e4.tools-78c5da141ffd0445e2d15aa7711d771ff1938bf8.zip
Bug 304584 - [Tooling] Implement Workbench-Model-Toolingv20100604-1515v20100603-1900
* implementing @Persist
-rw-r--r--bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java37
-rw-r--r--bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java40
-rw-r--r--bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java16
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java2
6 files changed, 44 insertions, 57 deletions
diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF
index 448e0f8a..518b39db 100644
--- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF
@@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.e4.ui.services;bundle-version="0.9.1",
org.eclipse.e4.core.di;bundle-version="0.9.0",
org.eclipse.e4.tools.services;bundle-version="1.0.0",
- org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0"
+ org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0",
+ org.eclipse.e4.ui.di;bundle-version="0.9.0"
Service-Component: OSGI-INF/selectionproviderfunction.xml
Export-Package: org.eclipse.e4.tools.compat.parts
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java
index 751b20a1..cd805dd0 100644
--- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java
+++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java
@@ -11,9 +11,12 @@
package org.eclipse.e4.tools.compat.parts;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.tools.compat.internal.PartHelper;
import org.eclipse.e4.tools.services.IDirtyProviderService;
+import org.eclipse.e4.ui.di.Persist;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -31,17 +34,22 @@ public abstract class DIEditorPart<C> extends EditorPart implements IDirtyProvid
this.clazz = clazz;
}
-//FIXME once @Persist is out of ui.workbench
-// @Override
-// public void doSave(IProgressMonitor monitor) {
-// // TODO Auto-generated method stub
-//
-// }
-//
-// @Override
-// public void doSaveAs() {
-// // TODO Auto-generated method stub
-// }
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ IEclipseContext saveContext = context.createChild();
+ ContextInjectionFactory.invoke(component, Persist.class, saveContext);
+ saveContext.dispose();
+ }
+
+ @Override
+ public void doSaveAs() {
+
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
@Override
public void init(IEditorSite site, IEditorInput input)
@@ -60,13 +68,6 @@ public abstract class DIEditorPart<C> extends EditorPart implements IDirtyProvid
}
-//
-// @Override
-// public boolean isSaveAsAllowed() {
-// // TODO Auto-generated method stub
-// return false;
-// }
-
@Override
public void createPartControl(Composite parent) {
component = PartHelper.creatComponent(parent, context, clazz, this);
diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java
index 6aa27be7..b9cb94eb 100644
--- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java
+++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java
@@ -10,7 +10,11 @@
******************************************************************************/
package org.eclipse.e4.tools.compat.parts;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.tools.services.IDirtyProviderService;
+import org.eclipse.e4.ui.di.Persist;
import org.eclipse.ui.ISaveablePart2;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
@@ -22,15 +26,19 @@ public abstract class DISaveableViewPart<C> extends DIViewPart<C> implements ISa
super(clazz);
}
-// public void doSave(IProgressMonitor monitor) {
-// // TODO Auto-generated method stub
-//
-// }
-//
-// public void doSaveAs() {
-// // TODO Auto-generated method stub
-//
-// }
+ public void doSave(IProgressMonitor monitor) {
+ IEclipseContext saveContext = getContext().createChild();
+ ContextInjectionFactory.invoke(getComponent(), Persist.class, saveContext);
+ saveContext.dispose();
+ }
+
+ public void doSaveAs() {
+
+ }
+
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
public void setDirtyState(boolean dirtyState) {
if( dirtyState != this.dirtyState ) {
@@ -48,15 +56,5 @@ public abstract class DISaveableViewPart<C> extends DIViewPart<C> implements ISa
getContext().declareModifiable(IDirtyProviderService.class);
getContext().set(IDirtyProviderService.class, this);
- }
-
-// public boolean isSaveAsAllowed() {
-// // TODO Auto-generated method stub
-// return false;
-// }
-//
-// public boolean isSaveOnCloseNeeded() {
-// // TODO Auto-generated method stub
-// return false;
-// }
-}
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java
index ec9134ae..a9544e07 100644
--- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java
@@ -10,7 +10,6 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.editor3x;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.e4.tools.compat.parts.DIEditorPart;
import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor;
@@ -22,21 +21,6 @@ public class E4WorkbenchModelEditor extends DIEditorPart<ApplicationModelEditor>
}
@Override
- public void doSave(IProgressMonitor monitor) {
- getComponent().doSave(monitor);
- }
-
- @Override
- public void doSaveAs() {
-
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Override
public void setFocus() {
getComponent().setFocus();
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF
index d2a835ec..b8003bef 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF
@@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0",
org.eclipse.e4.ui.workbench;bundle-version="0.9.1",
org.eclipse.e4.ui.services;bundle-version="0.9.1",
org.eclipse.equinox.registry;bundle-version="3.5.0",
- org.eclipse.e4.core.contexts;bundle-version="0.9.0"
+ org.eclipse.e4.core.contexts;bundle-version="0.9.0",
+ org.eclipse.e4.ui.di;bundle-version="0.9.0"
Bundle-ActivationPolicy: lazy
Import-Package: javax.inject;version="1.0.0",
org.eclipse.core.runtime.jobs,
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
index 48bc4b14..ab8bcd29 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
@@ -81,6 +81,7 @@ import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelCompo
import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor;
import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor;
import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor;
+import org.eclipse.e4.ui.di.Persist;
import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl;
import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl;
import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl;
@@ -484,6 +485,7 @@ public class ModelEditor {
return editorMap.get(eClass);
}
+ @Persist
public void doSave(@Optional IProgressMonitor monitor) {
if (modelProvider.isSaveable()) {
modelProvider.save();

Back to the top