diff options
| author | Bartosz Popiela | 2015-06-09 22:30:10 +0000 |
|---|---|---|
| committer | Brian de Alwis | 2015-10-27 11:19:14 +0000 |
| commit | 0f1063e7a18523b7e695bbfa338533eb8bada726 (patch) | |
| tree | 01227fb9e7e1d0ece82cf013752fb296a0d4f28c | |
| parent | 1ef722123ad16c527a53fc58c8c49c838c9b2026 (diff) | |
| download | eclipse.platform.ui-0f1063e7a18523b7e695bbfa338533eb8bada726.tar.gz eclipse.platform.ui-0f1063e7a18523b7e695bbfa338533eb8bada726.tar.xz eclipse.platform.ui-0f1063e7a18523b7e695bbfa338533eb8bada726.zip | |
Bug 413952 - Updating workbench context by WorkbenchConfigurer added
Change-Id: I2fab9f65292608ba6384156b855bd18f1f9834f0
Signed-off-by: Bartosz Popiela <bartoszpop@gmail.com>
3 files changed, 15 insertions, 15 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java index 48415ab7891..6a30ddb1c98 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java @@ -86,9 +86,12 @@ public class ResourceHandler implements IModelResourceHandler { * */ final private boolean deltaRestore; - final private boolean saveAndRestore; final private boolean clearPersistedState; + @Inject + @Named(IWorkbench.PERSIST_STATE) + private boolean saveAndRestore; + /** * Constructor. * @@ -97,10 +100,8 @@ public class ResourceHandler implements IModelResourceHandler { * @param deltaRestore */ @Inject - public ResourceHandler(@Named(IWorkbench.PERSIST_STATE) boolean saveAndRestore, - @Named(IWorkbench.CLEAR_PERSISTED_STATE) boolean clearPersistedState, + public ResourceHandler(@Named(IWorkbench.CLEAR_PERSISTED_STATE) boolean clearPersistedState, @Named(E4Workbench.DELTA_RESTORE) boolean deltaRestore) { - this.saveAndRestore = saveAndRestore; this.clearPersistedState = clearPersistedState; this.deltaRestore = deltaRestore; } diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java index 6036d306005..d26536ca576 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java @@ -3177,7 +3177,7 @@ UIEvents.Context.TOPIC_CONTEXT, /* package */ WorkbenchConfigurer getWorkbenchConfigurer() { if (workbenchConfigurer == null) { - workbenchConfigurer = new WorkbenchConfigurer(); + workbenchConfigurer = ContextInjectionFactory.make(WorkbenchConfigurer.class, e4Context); } return workbenchConfigurer; } diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java index e07dc53aad5..648a8b4ab7f 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java @@ -12,8 +12,10 @@ package org.eclipse.ui.internal; import java.util.HashMap; import java.util.Map; +import javax.inject.Inject; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.window.WindowManager; import org.eclipse.ui.IMemento; @@ -47,12 +49,6 @@ public final class WorkbenchConfigurer implements IWorkbenchConfigurer { private Map extraData = new HashMap(); /** - * Indicates whether workbench state should be saved on close and - * restored on subsequent open. - */ - private boolean saveAndRestore = false; - - /** * Indicates whether the workbench is being force to close. During * an emergency close, no interaction with the user should be done. */ @@ -68,6 +64,9 @@ public final class WorkbenchConfigurer implements IWorkbenchConfigurer { */ private boolean exitOnLastWindowClose = true; + @Inject + private IEclipseContext e4Context; + /** * Creates a new workbench configurer. * <p> @@ -75,7 +74,7 @@ public final class WorkbenchConfigurer implements IWorkbenchConfigurer { * only via {@link WorkbenchAdvisor#initialize WorkbenchAdvisor.initialize} * </p> */ - /* package */WorkbenchConfigurer() { + /* package */ WorkbenchConfigurer() { super(); } @@ -110,13 +109,13 @@ public final class WorkbenchConfigurer implements IWorkbenchConfigurer { @Override public boolean getSaveAndRestore() { - return saveAndRestore; + return (boolean) e4Context.get(org.eclipse.e4.ui.workbench.IWorkbench.PERSIST_STATE); } @Override public void setSaveAndRestore(boolean enabled) { - saveAndRestore = enabled; - } + e4Context.set(org.eclipse.e4.ui.workbench.IWorkbench.PERSIST_STATE, enabled); + } @Override public Object getData(String key) { |
