Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'releng/features/org.eclipse.ecf.filetransfer.httpclient4.feature/feature.xml')
-rw-r--r--releng/features/org.eclipse.ecf.filetransfer.httpclient4.feature/feature.xml2
1 files changed, 1 insertions, 1 deletions
diff --git a/releng/features/org.eclipse.ecf.filetransfer.httpclient4.feature/feature.xml b/releng/features/org.eclipse.ecf.filetransfer.httpclient4.feature/feature.xml
index 758cd5e82..db9b1f18f 100644
--- a/releng/features/org.eclipse.ecf.filetransfer.httpclient4.feature/feature.xml
+++ b/releng/features/org.eclipse.ecf.filetransfer.httpclient4.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.ecf.filetransfer.httpclient4.feature"
label="ECF Httpclient4 Filetransfer Provider"
- version="3.14.6.qualifier"
+ version="3.14.7.qualifier"
provider-name="Eclipse.org - ECF"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">

Back to the top

commands/internal/HandlerServiceHandler.java116
-rw-r--r--bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java111
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java8
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributionRecord.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuItemRenderer.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRendererFilter.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/RenderedToolBarRenderer.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarContributionRecord.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarRenderer.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarRenderer.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java72
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandProxy.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java93
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java4
-rw-r--r--tests/org.eclipse.e4.core.commands.tests/META-INF/MANIFEST.MF2
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/HandlerActivationTest.java4
35 files changed, 328 insertions, 200 deletions
diff --git a/bundles/org.eclipse.e4.core.commands/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.core.commands/META-INF/MANIFEST.MF
index 6dfce3c520..678baf991b 100644
--- a/bundles/org.eclipse.e4.core.commands/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.core.commands/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.e4.core.commands;singleton:=true
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 0.10.2.qualifier
Bundle-Activator: org.eclipse.e4.core.commands.internal.Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
@@ -12,6 +12,7 @@ Import-Package: javax.annotation;version="1.0.0",
javax.inject;version="1.0.0",
org.eclipse.core.commands,
org.eclipse.core.commands.common,
+ org.eclipse.core.expressions,
org.eclipse.e4.core.contexts,
org.eclipse.e4.core.services.log,
org.eclipse.e4.core.services.util,
diff --git a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/CommandServiceAddon.java b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/CommandServiceAddon.java
index 11242cc078..6bba4d5ace 100644
--- a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/CommandServiceAddon.java
+++ b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/CommandServiceAddon.java
@@ -16,6 +16,7 @@ import javax.annotation.PostConstruct;
import org.eclipse.core.commands.CommandManager;
import org.eclipse.e4.core.commands.internal.CommandServiceImpl;
import org.eclipse.e4.core.commands.internal.HandlerServiceCreationFunction;
+import org.eclipse.e4.core.commands.internal.HandlerServiceImpl;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -30,7 +31,7 @@ public class CommandServiceAddon {
CommandManager manager = context.get(CommandManager.class);
if (manager == null) {
manager = new CommandManager();
- setCommandFireEvents(manager, false);
+ // setCommandFireEvents(manager, false);
context.set(CommandManager.class, manager);
}
@@ -40,13 +41,15 @@ public class CommandServiceAddon {
// handler service - a mediator service
context.set(EHandlerService.class.getName(), new HandlerServiceCreationFunction());
+ // provide the initial application context, just in case.
+ HandlerServiceImpl.push(context);
}
/**
* @param manager
* @param b
*/
- private void setCommandFireEvents(CommandManager manager, boolean b) {
+ void setCommandFireEvents(CommandManager manager, boolean b) {
try {
Field f = CommandManager.class.getDeclaredField("shouldCommandFireEvents"); //$NON-NLS-1$
f.setAccessible(true);
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/ExpressionContext.java b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/ExpressionContext.java
index c6ed322c0a..9b57271828 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/ExpressionContext.java
+++ b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/ExpressionContext.java
@@ -9,20 +9,24 @@
* IBM Corporation - initial API and implementation
******************************************************************************/
-package org.eclipse.e4.ui.workbench.modeling;
+package org.eclipse.e4.core.commands;
import java.util.Collections;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.ui.services.IServiceConstants;
/**
*
*/
public class ExpressionContext implements IEvaluationContext {
- public static final String ALLOW_ACTIVATION = "org.eclipse.e4.ui.workbench.modeling.ExpressionContext.allowActivation"; //$NON-NLS-1$
+ /**
+ * See org.eclipse.e4.ui.services.IServiceConstants.ACTIVE_SELECTION
+ */
+ private static final String ORG_ECLIPSE_UI_SELECTION = "org.eclipse.ui.selection"; //$NON-NLS-1$
+
+ public static final String ALLOW_ACTIVATION = "org.eclipse.e4.core.commands.ExpressionContext.allowActivation"; //$NON-NLS-1$
public IEclipseContext eclipseContext;
public static IContextFunction defaultVariableConverter = null;
@@ -88,7 +92,7 @@ public class ExpressionContext implements IEvaluationContext {
if (defaultVariableConverter != null) {
sel = defaultVariableConverter.compute(eclipseContext);
} else {
- sel = eclipseContext.getActive(IServiceConstants.ACTIVE_SELECTION);
+ sel = eclipseContext.getActive(ORG_ECLIPSE_UI_SELECTION);
}
return sel == null ? Collections.EMPTY_LIST : sel;
}
diff --git a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/CommandServiceImpl.java b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/CommandServiceImpl.java
index efec69418a..3adf11f156 100644
--- a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/CommandServiceImpl.java
+++ b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/CommandServiceImpl.java
@@ -72,6 +72,7 @@ public class CommandServiceImpl implements ECommandService {
Command cmd = commandManager.getCommand(id);
if (!cmd.isDefined()) {
cmd.define(name, description, category, parameters);
+ cmd.setHandler(HandlerServiceImpl.getHandler(id));
}
return cmd;
}
diff --git a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceHandler.java b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceHandler.java
new file mode 100644
index 0000000000..9190068667
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceHandler.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.e4.core.commands.internal;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.e4.core.commands.ExpressionContext;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+
+/**
+ * Provide an IHandler to delegate calls to.
+ */
+public class HandlerServiceHandler extends AbstractHandler {
+
+ private static final String FAILED_TO_FIND_HANDLER_DURING_EXECUTION = "Failed to find handler during execution"; //$NON-NLS-1$
+ private String commandId;
+
+ public HandlerServiceHandler(String commandId) {
+ this.commandId = commandId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ IEclipseContext executionContext = getExecutionContext(evaluationContext);
+ if (executionContext == null) {
+ return;
+ }
+
+ IEclipseContext staticContext = (IEclipseContext) executionContext
+ .get(HandlerServiceImpl.STATIC_CONTEXT);
+ Object handler = HandlerServiceImpl.lookUpHandler(executionContext, commandId);
+ if (handler == null) {
+ setBaseEnabled(false);
+ return;
+ }
+ try {
+ Boolean result = ((Boolean) ContextInjectionFactory.invoke(handler, CanExecute.class,
+ executionContext, staticContext, Boolean.TRUE));
+ setBaseEnabled(result.booleanValue());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ IEclipseContext getExecutionContext(Object evalObj) {
+ if (evalObj instanceof IEclipseContext) {
+ return (IEclipseContext) evalObj;
+ }
+ if (evalObj instanceof ExpressionContext) {
+ return ((ExpressionContext) evalObj).eclipseContext;
+ }
+ if (evalObj instanceof IEvaluationContext) {
+ return getExecutionContext(((IEvaluationContext) evalObj).getParent());
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isHandled()
+ */
+ @Override
+ public boolean isHandled() {
+ IEclipseContext executionContext = HandlerServiceImpl.peek();
+ if (executionContext != null) {
+ Object handler = HandlerServiceImpl.lookUpHandler(executionContext, commandId);
+ return handler != null;
+
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEclipseContext executionContext = getExecutionContext(event.getApplicationContext());
+ if (executionContext == null) {
+ throw new ExecutionException(FAILED_TO_FIND_HANDLER_DURING_EXECUTION,
+ new NotHandledException(FAILED_TO_FIND_HANDLER_DURING_EXECUTION));
+ }
+
+ IEclipseContext staticContext = (IEclipseContext) executionContext
+ .get(HandlerServiceImpl.STATIC_CONTEXT);
+ Object handler = HandlerServiceImpl.lookUpHandler(executionContext, commandId);
+ if (handler == null) {
+ return null;
+ }
+ return ContextInjectionFactory.invoke(handler, Execute.class, executionContext,
+ staticContext, null);
+ }
+
+}
diff --git a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
index e8b565fa87..7e445801d8 100644
--- a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
+++ b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
@@ -12,10 +12,16 @@
package org.eclipse.e4.core.commands.internal;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.Map;
import javax.inject.Inject;
import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.e4.core.commands.EHandlerService;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
@@ -29,11 +35,34 @@ import org.eclipse.e4.core.services.log.Logger;
*
*/
public class HandlerServiceImpl implements EHandlerService {
- private static final String TMP_STATIC_CONTEXT = "tmp-staticContext"; //$NON-NLS-1$
+ static final String TMP_STATIC_CONTEXT = "tmp-staticContext"; //$NON-NLS-1$
public final static String H_ID = "handler::"; //$NON-NLS-1$
public final static String PARM_MAP = "parmMap::"; //$NON-NLS-1$
public final static String CAN_EXECUTE = "HandlerServiceImpl.canExecute"; //$NON-NLS-1$
public final static String NOT_HANDLED = "HandlerServiceImpl.notHandled"; //$NON-NLS-1$
+ public final static String STATIC_CONTEXT = "HandlerServiceImpl.staticContext"; //$NON-NLS-1$
+
+ private static LinkedList<IEclipseContext> contextStack = new LinkedList<IEclipseContext>();
+
+ public static IHandler getHandler(String commandId) {
+ return new HandlerServiceHandler(commandId);
+ }
+
+ static LinkedList<IEclipseContext> getContextStack() {
+ return contextStack;
+ }
+
+ public static void push(IEclipseContext ctx) {
+ getContextStack().addFirst(ctx);
+ }
+
+ static IEclipseContext pop() {
+ return getContextStack().poll();
+ }
+
+ static IEclipseContext peek() {
+ return getContextStack().peek();
+ }
/**
* @param context
@@ -45,32 +74,13 @@ public class HandlerServiceImpl implements EHandlerService {
return context.getActiveLeaf().get(H_ID + commandId);
}
- private IEclipseContext context;
-
- @Inject
- @Optional
- private Logger logger;
-
- public static Object preExecute = null;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.e4.core.commands.EHandlerService#activateHandler(java.lang.String,
- * java.lang.Object)
- */
- public void activateHandler(String commandId, Object handler) {
- String handlerId = H_ID + commandId;
- context.set(handlerId, handler);
- }
-
/**
* Fill in a temporary static context for execution.
*
* @param command
* @return a context not part of the normal hierarchy
*/
- private void addParms(ParameterizedCommand command, IEclipseContext staticContext) {
+ public static void addParms(ParameterizedCommand command, IEclipseContext staticContext) {
final Map parms = command.getParameterMap();
Iterator i = parms.entrySet().iterator();
while (i.hasNext()) {
@@ -81,12 +91,25 @@ public class HandlerServiceImpl implements EHandlerService {
staticContext.set(ParameterizedCommand.class, command);
}
+ private IEclipseContext context;
+
+ @Inject
+ @Optional
+ Logger logger;
+
+ public static Object preExecute = null;
+
/*
* (non-Javadoc)
*
- * @seeorg.eclipse.e4.core.commands.EHandlerService#canExecute(org.eclipse.core.commands.
- * ParameterizedCommand)
+ * @see org.eclipse.e4.core.commands.EHandlerService#activateHandler(java.lang.String,
+ * java.lang.Object)
*/
+ public void activateHandler(String commandId, Object handler) {
+ String handlerId = H_ID + commandId;
+ context.set(handlerId, handler);
+ }
+
public boolean canExecute(ParameterizedCommand command) {
final IEclipseContext staticContext = EclipseContextFactory.create(TMP_STATIC_CONTEXT);
try {
@@ -97,6 +120,21 @@ public class HandlerServiceImpl implements EHandlerService {
}
public boolean canExecute(ParameterizedCommand command, IEclipseContext staticContext) {
+ final IEclipseContext executionContext = getExecutionContext();
+ addParms(command, staticContext);
+ executionContext.set(STATIC_CONTEXT, staticContext);
+ push(executionContext);
+ try {
+ Command cmd = command.getCommand();
+ cmd.setEnabled(executionContext);
+ return cmd.isEnabled();
+ } finally {
+ pop();
+ executionContext.remove(STATIC_CONTEXT);
+ }
+ }
+
+ public boolean old_canExecute(ParameterizedCommand command, IEclipseContext staticContext) {
String commandId = command.getId();
Object handler = lookUpHandler(context, commandId);
if (handler == null) {
@@ -149,6 +187,33 @@ public class HandlerServiceImpl implements EHandlerService {
}
public Object executeHandler(ParameterizedCommand command, IEclipseContext staticContext) {
+ final IEclipseContext executionContext = getExecutionContext();
+ addParms(command, staticContext);
+ executionContext.set(STATIC_CONTEXT, staticContext);
+ push(executionContext);
+ try {
+ // Command cmd = command.getCommand();
+ return command.executeWithChecks(null, executionContext);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NotDefinedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NotEnabledException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NotHandledException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ pop();
+ executionContext.remove(STATIC_CONTEXT);
+ }
+ return null;
+ }
+
+ public Object old_executeHandler(ParameterizedCommand command, IEclipseContext staticContext) {
String commandId = command.getId();
final IEclipseContext executionContext = getExecutionContext();
addParms(command, staticContext);
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java
index 7f897b19dd..aaeda80f80 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java
@@ -223,8 +223,7 @@ public class StackDropAgent extends DropAgent {
// 'dropIndex' is now the index of the CTabItem to put ourselves before
// we need to adjust this to be a model index
- int ctfItemCount = dropCTF.getItemCount();
- if (dropIndex < ctfItemCount) {
+ if (dropIndex < dropCTF.getItemCount()) {
CTabItem item = dropCTF.getItem(dropIndex);
MUIElement itemModel = (MUIElement) item.getData(AbstractPartRenderer.OWNING_ME);
@@ -233,11 +232,6 @@ public class StackDropAgent extends DropAgent {
return;
dropIndex = itemModel.getParent().getChildren().indexOf(itemModel);
- // if the item is dropped at the last position, there is
- // no existing item to put ourselves before
- // so we'll just go to the end.
- } else if (dropIndex == ctfItemCount) {
- dropIndex = dropStack.getChildren().size();
}
if (dragElement instanceof MStackElement) {
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributionRecord.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributionRecord.java
index bff5aafb16..5d4bc123c3 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributionRecord.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ContributionRecord.java
@@ -11,6 +11,8 @@
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -32,7 +34,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.action.MenuManager;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuItemRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuItemRenderer.java
index c05e05fa77..c7f3bf9eb7 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuItemRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuItemRenderer.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.HashMap;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -30,7 +32,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
import org.eclipse.e4.ui.model.application.ui.menu.MItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.workbench.UIEvents;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.MenuItem;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
index c5f3befcdb..d95a776d30 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -52,7 +54,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MRenderedMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuFactoryImpl;
import org.eclipse.e4.ui.workbench.IResourceUtilities;
import org.eclipse.e4.ui.workbench.UIEvents;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.e4.ui.workbench.swt.util.ISWTResourceUtilities;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRendererFilter.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRendererFilter.java
index 6855518de9..90fdd64735 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRendererFilter.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRendererFilter.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.HashMap;
import java.util.HashSet;
import javax.inject.Inject;
@@ -36,7 +38,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MPopupMenu;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.e4.ui.workbench.swt.factories.IRendererFactory;
import org.eclipse.e4.ui.workbench.swt.modeling.MenuService;
import org.eclipse.jface.action.MenuManager;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java
index e4e1b63029..51b49d502c 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -24,7 +26,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/RenderedToolBarRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/RenderedToolBarRenderer.java
index 6e4a89b877..064b8da30a 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/RenderedToolBarRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/RenderedToolBarRenderer.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.HashMap;
import javax.inject.Inject;
@@ -26,7 +28,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarContributionRecord.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarContributionRecord.java
index f320b51454..96e4f678ec 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarContributionRecord.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarContributionRecord.java
@@ -11,6 +11,8 @@
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -26,7 +28,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarSeparator;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.action.ToolBarManager;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarRenderer.java
index 1f5be66b8a..cc68138361 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarRenderer.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -26,7 +28,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarSeparator;
import org.eclipse.e4.ui.model.application.ui.menu.MToolControl;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.jface.layout.RowLayoutFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarRenderer.java
index 69cadb9fe5..b09ced1663 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarRenderer.java
@@ -11,6 +11,8 @@
package org.eclipse.e4.ui.workbench.renderers.swt;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -26,7 +28,6 @@ import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow;
import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java
index 9d3291eae2..f6fe735eaf 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java
@@ -11,6 +11,8 @@
package org.eclipse.e4.ui.internal.workbench;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -41,7 +43,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarSeparator;
import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
index ae30b84fe4..124b7ce192 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
@@ -12,6 +12,7 @@
package org.eclipse.e4.ui.internal.workbench;
import java.util.List;
+import org.eclipse.e4.core.commands.ExpressionContext;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
@@ -21,7 +22,6 @@ import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.IWorkbench;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.emf.common.notify.Notifier;
public class E4Workbench implements IWorkbench {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
index 4138a282dc..3dd6bd1c55 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
@@ -51,7 +51,7 @@ public class CommandToModelProcessor {
CommandManager commandManager = context.get(CommandManager.class);
if (commandManager == null) {
commandManager = new CommandManager();
- setCommandFireEvents(commandManager, false);
+ // setCommandFireEvents(commandManager, false);
context.set(CommandManager.class, commandManager);
}
@@ -128,7 +128,7 @@ public class CommandToModelProcessor {
}
}
- private void setCommandFireEvents(CommandManager manager, boolean b) {
+ void setCommandFireEvents(CommandManager manager, boolean b) {
try {
Field f = CommandManager.class.getDeclaredField("shouldCommandFireEvents"); //$NON-NLS-1$
f.setAccessible(true);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
index 174379c3e5..64dd10151d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
@@ -11,6 +11,8 @@
package org.eclipse.ui.internal;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -25,7 +27,6 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuFactoryImpl;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
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 a96c2c236a..a2a2126384 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
@@ -30,9 +30,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.CommandManager;
-import org.eclipse.core.commands.CommandManagerEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.ICommandManagerListener;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.EventManager;
@@ -1874,21 +1872,6 @@ UIEvents.Context.TOPIC_CONTEXT,
appContext.set(IUpdateService.class, service);
service.readRegistry();
- Command[] cmds = commandManager.getAllCommands();
- for (int i = 0; i < cmds.length; i++) {
- Command cmd = cmds[i];
- cmd.setHandler(new MakeHandlersGo(this, cmd.getId()));
- }
-
- commandManager.addCommandManagerListener(new ICommandManagerListener() {
- public void commandManagerChanged(CommandManagerEvent commandManagerEvent) {
- if (commandManagerEvent.isCommandDefined()) {
- Command cmd = commandManagerEvent.getCommandManager().getCommand(
- commandManagerEvent.getCommandId());
- cmd.setHandler(new MakeHandlersGo(Workbench.this, cmd.getId()));
- }
- }
- });
return service;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index e42b1f0c74..612f8c43ae 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -172,6 +172,7 @@ import org.eclipse.ui.services.IDisposable;
import org.eclipse.ui.services.IEvaluationService;
import org.eclipse.ui.services.IServiceScopes;
import org.eclipse.ui.views.IViewDescriptor;
+import org.eclipse.ui.views.IViewRegistry;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
@@ -1141,6 +1142,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
// Setup internal flags to indicate window is in
// progress of closing and no update should be done.
+ closing = true;
updateDisabled = true;
try {
@@ -1165,7 +1167,6 @@ public class WorkbenchWindow implements IWorkbenchWindow {
windowClosed = workbench.close();
} else {
if (okToClose()) {
- closing = true;
windowClosed = hardClose(remove);
}
}
@@ -1414,46 +1415,43 @@ public class WorkbenchWindow implements IWorkbenchWindow {
return PlatformUI.getWorkbench();
}
- private void hideNonRestorableViews() {
- List<MPart> sharedPartsToRemove = new ArrayList<MPart>();
- List<MPlaceholder> phList = modelService
- .findElements(model, null, MPlaceholder.class, null);
- for (MPlaceholder ph : phList) {
- if (!(ph.getRef() instanceof MPart))
- continue;
-
- String partId = ph.getElementId();
-
- // If the id contains a ':' use the part before it as the
- // descriptor id
- int colonIndex = partId.indexOf(':');
- String descId = colonIndex == -1 ? partId : partId.substring(0, colonIndex);
- String secondaryId = colonIndex == -1 ? null : partId.substring(colonIndex + 1);
- IViewDescriptor regEntry = ((Workbench) workbench).getViewRegistry().find(descId);
- if (regEntry != null && !regEntry.isRestorable() && !("*".equals(secondaryId))) { //$NON-NLS-1$
- MElementContainer<MUIElement> phParent = ph.getParent();
- if (colonIndex != -1) {
- // if it's a multi-instance part remove it (and its MPart)
- if (!sharedPartsToRemove.contains(ph.getRef()))
- sharedPartsToRemove.add((MPart) ph.getRef());
- ph.getParent().getChildren().remove(ph);
- } else if (ph.isToBeRendered()) {
- // just hide it (so we remember where to open it again
- ph.setToBeRendered(false);
- }
-
- // We need to do our own cleanup here...
- int vc = modelService.countRenderableChildren(phParent);
- if (vc == 0) {
- phParent.setToBeRendered(false);
+ private void hideNonRestorablePlaceholder(MPlaceholder placeholder) {
+ MElementContainer<MUIElement> parent = placeholder.getParent();
+ // if this placeholder is currently the selected element, its parent
+ // needs to select something else
+ if (parent.getSelectedElement() == placeholder) {
+ // if nothing found just set it to null
+ MUIElement candidate = null;
+ // search for a valid candidate from the list of children
+ for (MUIElement element : parent.getChildren()) {
+ if (element.isVisible() && element.isToBeRendered() && element != placeholder) {
+ candidate = element;
+ break;
}
}
+
+ parent.setSelectedElement(candidate);
+ }
+
+ // this tag is only applied to editors technically speaking, but better
+ // safe than sorry
+ MUIElement ref = placeholder.getRef();
+ if (ref != null && ref.getTags().contains(EPartService.REMOVE_ON_HIDE_TAG)) {
+ parent.getChildren().remove(placeholder);
}
- // Remove the actual shared Parts for any placeholder that was removed
- List<MUIElement> seList = model.getSharedElements();
- for (MPart partToRemove : sharedPartsToRemove) {
- seList.remove(partToRemove);
+ placeholder.setToBeRendered(false);
+ }
+
+ private void hideNonRestorableViews() {
+ List<MPlaceholder> placeholders = modelService.findElements(model, null,
+ MPlaceholder.class, null);
+ IViewRegistry registry = getWorkbench().getViewRegistry();
+ for (MPlaceholder placeholder : placeholders) {
+ IViewDescriptor descriptor = registry.find(placeholder.getElementId());
+ if (descriptor != null && !descriptor.isRestorable()) {
+ hideNonRestorablePlaceholder(placeholder);
+ }
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java
index dc88e35c12..7034c58176 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java
@@ -22,6 +22,7 @@ import org.eclipse.core.commands.CommandManager;
import org.eclipse.core.commands.contexts.ContextManager;
import org.eclipse.core.commands.contexts.ContextManagerEvent;
import org.eclipse.core.commands.contexts.IContextManagerListener;
+import org.eclipse.e4.core.commands.internal.HandlerServiceImpl;
import org.eclipse.jface.bindings.Binding;
import org.eclipse.jface.bindings.BindingManager;
import org.eclipse.jface.bindings.BindingManagerEvent;
@@ -29,14 +30,12 @@ import org.eclipse.jface.bindings.IBindingManagerListener;
import org.eclipse.jface.bindings.Scheme;
import org.eclipse.jface.bindings.TriggerSequence;
import org.eclipse.jface.bindings.keys.ParseException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.CommandManagerEvent;
import org.eclipse.ui.commands.ICategory;
import org.eclipse.ui.commands.ICommand;
import org.eclipse.ui.commands.ICommandManager;
import org.eclipse.ui.commands.ICommandManagerListener;
import org.eclipse.ui.commands.IKeyConfiguration;
-import org.eclipse.ui.internal.MakeHandlersGo;
import org.eclipse.ui.internal.handlers.LegacyHandlerWrapper;
import org.eclipse.ui.internal.keys.SchemeLegacyWrapper;
import org.eclipse.ui.internal.util.Util;
@@ -288,7 +287,7 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
public ICommand getCommand(String commandId) {
final Command command = commandManager.getCommand(commandId);
if (!command.isDefined()) {
- command.setHandler(new MakeHandlersGo(PlatformUI.getWorkbench(), commandId));
+ command.setHandler(HandlerServiceImpl.getHandler(commandId));
}
return new CommandLegacyWrapper(command, bindingManager);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
index aa2ff02503..1e4df0eb21 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IExtensionDelta;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.e4.core.commands.internal.HandlerServiceImpl;
import org.eclipse.e4.ui.internal.workbench.Parameter;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchMessages;
@@ -206,6 +207,7 @@ public final class CommandPersistence extends RegistryPersistence {
}
if (!command.isDefined()) {
command.define(name, description, category, parameters, returnType, helpContextId);
+ command.setHandler(HandlerServiceImpl.getHandler(commandId));
}
readState(configurationElement, warningsToLog, command);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java
index f0810e4dbf..abd26d4313 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.internal.contexts;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -24,7 +26,6 @@ import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.contexts.RunAndTrack;
import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.services.EContextService;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISourceProvider;
import org.eclipse.ui.ISources;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandProxy.java
index 853ae62fc7..4e2c32ea4b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandProxy.java
@@ -24,6 +24,8 @@ import org.eclipse.core.commands.NotHandledException;
*
*/
public class CommandProxy {
+ private static boolean disabled = true;
+
private static Method firePreExecute = null;
private static Method getFirePreExecute() {
@@ -44,6 +46,8 @@ public class CommandProxy {
}
public static void firePreExecute(Command command, ExecutionEvent event) {
+ if (disabled)
+ return;
try {
getFirePreExecute().invoke(command, event);
} catch (IllegalArgumentException e) {
@@ -82,6 +86,8 @@ public class CommandProxy {
* @param e
*/
public static void fireNotHandled(Command command, NotHandledException e) {
+ if (disabled)
+ return;
try {
getFireNotHandled().invoke(command, e);
} catch (IllegalArgumentException e1) {
@@ -120,6 +126,8 @@ public class CommandProxy {
* @param exception
*/
public static void fireNotEnabled(Command command, NotEnabledException exception) {
+ if (disabled)
+ return;
try {
getFireNotEnabled().invoke(command, exception);
} catch (IllegalArgumentException e) {
@@ -158,6 +166,8 @@ public class CommandProxy {
* @param exception
*/
public static void firePostExecuteFailure(Command command, ExecutionException exception) {
+ if (disabled)
+ return;
try {
getFirePostExecuteFailure().invoke(command, exception);
} catch (IllegalArgumentException e) {
@@ -196,6 +206,8 @@ public class CommandProxy {
* @param returnValue
*/
public static void firePostExecuteSuccess(Command command, Object returnValue) {
+ if (disabled)
+ return;
try {
getFirePostExecuteSuccess().invoke(command, returnValue);
} catch (IllegalArgumentException e) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java
index 7e08b32118..ed66861ca7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java
@@ -11,6 +11,7 @@
package org.eclipse.ui.internal.handlers;
+import java.util.Collections;
import java.util.Map;
import javax.inject.Named;
import org.eclipse.core.commands.Command;
@@ -22,6 +23,7 @@ import org.eclipse.core.commands.IHandler2;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.e4.core.commands.ExpressionContext;
import org.eclipse.e4.core.commands.internal.HandlerServiceImpl;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.CanExecute;
@@ -29,7 +31,6 @@ import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.internal.workbench.Activator;
import org.eclipse.e4.ui.internal.workbench.Policy;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.MakeHandlersGo;
@@ -70,7 +71,8 @@ public class E4HandlerProxy implements IHandlerListener {
if (appContext == null) {
appContext = new ExpressionContext(context);
}
- ExecutionEvent event = new ExecutionEvent(command, parms, trigger, appContext);
+ ExecutionEvent event = new ExecutionEvent(command, parms == null ? Collections.EMPTY_MAP
+ : parms, trigger, appContext);
if (handler != null && handler.isHandled()) {
try {
final Object returnValue = handler.execute(event);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
index 2e2a79fd78..95f96cae95 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
@@ -23,7 +23,6 @@ import javax.inject.Named;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.HandlerEvent;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
@@ -40,6 +39,7 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.e4.core.commands.ECommandService;
import org.eclipse.e4.core.commands.EHandlerService;
+import org.eclipse.e4.core.commands.ExpressionContext;
import org.eclipse.e4.core.commands.internal.HandlerServiceImpl;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
@@ -49,15 +49,12 @@ import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.internal.workbench.Activator;
import org.eclipse.e4.ui.internal.workbench.Policy;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.ISourceProvider;
import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.internal.MakeHandlersGo;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.e4.compatibility.E4Util;
import org.eclipse.ui.internal.expressions.AndExpression;
@@ -148,93 +145,31 @@ public class LegacyHandlerService implements IHandlerService {
private static IHandlerActivation systemHandlerActivation;
- /*
- * We are obligated to return a non-null IHandlerActivation from our
- * activate calls. It is only used as a token, but must not return null from
- * certain methods. This token represents passing the MakeHandlerGo handler
- * back into the system.
- */
- private static IHandlerActivation getSystemHandlerActivation(IEclipseContext context, final String cmdId) {
- if (systemHandlerActivation == null) {
- final IWorkbench wb = context.get(IWorkbench.class);
- systemHandlerActivation = new IHandlerActivation() {
-
- public int compareTo(Object o) {
- return -1;
- }
-
- public void setResult(boolean result) {
- }
-
- public int getSourcePriority() {
- return 0;
- }
-
- public Expression getExpression() {
- return null;
- }
-
- public boolean evaluate(IEvaluationContext context) {
- return false;
- }
-
- public void clearResult() {
- }
-
- public boolean isActive(IEvaluationContext context) {
- return false;
- }
-
- public IHandlerService getHandlerService() {
- return (IHandlerService) wb.getService(IHandlerService.class);
- }
-
- public IHandler getHandler() {
- return null;
- }
-
- public int getDepth() {
- return 0;
- }
-
- public String getCommandId() {
- return cmdId;
- }
-
- public void clearActive() {
- }
- };
- }
- return systemHandlerActivation;
- }
public static IHandlerActivation registerLegacyHandler(final IEclipseContext context,
String id, final String cmdId, IHandler handler, Expression activeWhen) {
- if (handler instanceof MakeHandlersGo) {
- final String msg = "Invalid Handler MakeHandlerGo"; //$NON-NLS-1$
- WorkbenchPlugin.log(msg, new Exception(msg));
- return getSystemHandlerActivation(context, cmdId);
- }
+
ECommandService cs = (ECommandService) context.get(ECommandService.class.getName());
Command command = cs.getCommand(cmdId);
- boolean handled = command.isHandled();
- boolean enabled = command.isEnabled();
+ // boolean handled = command.isHandled();
+ // boolean enabled = command.isEnabled();
E4HandlerProxy handlerProxy = new E4HandlerProxy(command, handler);
HandlerActivation activation = new HandlerActivation(context, cmdId, handler, handlerProxy,
activeWhen);
addHandlerActivation(activation);
EHandlerService hs = context.get(EHandlerService.class);
hs.activateHandler(cmdId, new HandlerSelectionFunction(cmdId));
- boolean handledChanged = handled != command.isHandled();
- boolean enabledChanged = enabled != command.isEnabled();
- if (handledChanged || enabledChanged) {
- IHandler proxy = command.getHandler();
- if (proxy instanceof MakeHandlersGo) {
- ((MakeHandlersGo) proxy).fireHandlerChanged(new HandlerEvent(proxy, enabledChanged,
- handledChanged));
- }
- }
+ // boolean handledChanged = handled != command.isHandled();
+ // boolean enabledChanged = enabled != command.isEnabled();
+ // if (handledChanged || enabledChanged) {
+ // IHandler proxy = command.getHandler();
+ // if (proxy instanceof MakeHandlersGo) {
+ // ((MakeHandlersGo) proxy).fireHandlerChanged(new HandlerEvent(proxy,
+ // enabledChanged,
+ // handledChanged));
+ // }
+ // }
return activation;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
index 3a511f5eec..ca1aaac784 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
@@ -11,6 +11,8 @@
package org.eclipse.ui.internal.menus;
+import org.eclipse.e4.core.commands.ExpressionContext;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -23,7 +25,6 @@ import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution;
import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuFactoryImpl;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.e4.ui.workbench.renderers.swt.ContributionRecord;
import org.eclipse.e4.ui.workbench.renderers.swt.ToolBarContributionRecord;
import org.eclipse.jface.action.ContributionManager;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
index 289bde5dbd..3b9ebe6006 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
@@ -18,7 +18,7 @@ import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
+import org.eclipse.e4.core.commands.ExpressionContext;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java