Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 137091 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/EditorReference.java (-1 / +1 lines)
Lines 405-411 Link Here
405
            
405
            
406
            EditorSite site = new EditorSite(this, part, manager.page, descr);
406
            EditorSite site = new EditorSite(this, part, manager.page, descr);
407
            
407
            
408
            site.setActionBars(new EditorActionBars(manager.page, site, getId()));
408
            site.setActionBars(new EditorActionBars(manager.page, site.getWorkbenchWindow(), getId()));
409
            try {
409
            try {
410
                part.init(site, input);
410
                part.init(site, input);
411
            } catch (PartInitException e) {
411
            } catch (PartInitException e) {
(-)Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java (-1 / +23 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.internal;
11
package org.eclipse.ui.internal;
12
12
13
import org.eclipse.core.expressions.Expression;
13
import org.eclipse.jface.action.ActionContributionItem;
14
import org.eclipse.jface.action.ActionContributionItem;
14
import org.eclipse.jface.action.ContributionManager;
15
import org.eclipse.jface.action.ContributionManager;
15
import org.eclipse.jface.action.GroupMarker;
16
import org.eclipse.jface.action.GroupMarker;
Lines 31-36 Link Here
31
import org.eclipse.ui.IWorkbenchPart;
32
import org.eclipse.ui.IWorkbenchPart;
32
import org.eclipse.ui.SubActionBars2;
33
import org.eclipse.ui.SubActionBars2;
33
import org.eclipse.ui.actions.RetargetAction;
34
import org.eclipse.ui.actions.RetargetAction;
35
import org.eclipse.ui.internal.expressions.AndExpression;
36
import org.eclipse.ui.internal.expressions.LegacyEditorContributionExpression;
34
import org.eclipse.ui.internal.misc.Policy;
37
import org.eclipse.ui.internal.misc.Policy;
35
import org.eclipse.ui.internal.provisional.presentations.IActionBarPresentationFactory;
38
import org.eclipse.ui.internal.provisional.presentations.IActionBarPresentationFactory;
36
import org.eclipse.ui.services.IServiceLocator;
39
import org.eclipse.ui.services.IServiceLocator;
Lines 89-94 Link Here
89
	
92
	
90
	private IActionBarPresentationFactory actionBarPresentation;
93
	private IActionBarPresentationFactory actionBarPresentation;
91
94
95
	private WorkbenchPage workbenchPage;
96
92
	/**
97
	/**
93
	 * Constructs the EditorActionBars for an editor.
98
	 * Constructs the EditorActionBars for an editor.
94
	 */
99
	 */
Lines 98-103 Link Here
98
		this.type = type;
103
		this.type = type;
99
		this.actionBarPresentation = ((WorkbenchWindow) page
104
		this.actionBarPresentation = ((WorkbenchWindow) page
100
				.getWorkbenchWindow()).getActionBarPresentationFactory();
105
				.getWorkbenchWindow()).getActionBarPresentationFactory();
106
		this.workbenchPage = page;
101
	}
107
	}
102
108
103
	/**
109
	/**
Lines 327-333 Link Here
327
		super.partChanged(part);
333
		super.partChanged(part);
328
		if (part instanceof IEditorPart) {
334
		if (part instanceof IEditorPart) {
329
			IEditorPart editor = (IEditorPart) part;
335
			IEditorPart editor = (IEditorPart) part;
330
			setServiceLocator(editor.getEditorSite());
336
//			setServiceLocator(editor.getEditorSite());
331
			if (editorContributor != null) {
337
			if (editorContributor != null) {
332
				editorContributor.setActiveEditor(editor);
338
				editorContributor.setActiveEditor(editor);
333
			}
339
			}
Lines 470-473 Link Here
470
			}
476
			}
471
		}
477
		}
472
	}
478
	}
479
480
	private AndExpression fEditorHandlerExpression = null;
481
	
482
	/* (non-Javadoc)
483
	 * @see org.eclipse.ui.SubActionBars#getHandlerExpression()
484
	 */
485
	protected Expression getHandlerExpression() {
486
		if (fEditorHandlerExpression == null) {
487
			fEditorHandlerExpression = new AndExpression();
488
			fEditorHandlerExpression.add(super.getHandlerExpression());
489
			fEditorHandlerExpression
490
					.add(new LegacyEditorContributionExpression(type,
491
							workbenchPage.getWorkbenchWindow()));
492
		}
493
		return fEditorHandlerExpression;
494
	}
473
}
495
}
(-)Eclipse UI/org/eclipse/ui/internal/EditorManager.java (-2 / +2 lines)
Lines 301-307 Link Here
301
		}
301
		}
302
302
303
		// Create a new action bar set.
303
		// Create a new action bar set.
304
		actionBars = new EditorActionBars(page, site, type);
304
		actionBars = new EditorActionBars(page, site.getWorkbenchWindow(), type);
305
		actionBars.addRef();
305
		actionBars.addRef();
306
		actionCache.put(type, actionBars);
306
		actionCache.put(type, actionBars);
307
307
Lines 333-339 Link Here
333
333
334
		// Create a new action bar set.
334
		// Create a new action bar set.
335
		// Note: It is an empty set.
335
		// Note: It is an empty set.
336
		EditorActionBars actionBars = new EditorActionBars(page, site, type);
336
		EditorActionBars actionBars = new EditorActionBars(page, site.getWorkbenchWindow(), type);
337
		actionBars.addRef();
337
		actionBars.addRef();
338
		actionCache.put(type, actionBars);
338
		actionCache.put(type, actionBars);
339
339
(-)Eclipse UI/org/eclipse/ui/internal/PartSite.java (+2 lines)
Lines 536-541 Link Here
536
		buffer.append(getPluginId());
536
		buffer.append(getPluginId());
537
		buffer.append(",registeredName="); //$NON-NLS-1$
537
		buffer.append(",registeredName="); //$NON-NLS-1$
538
		buffer.append(getRegisteredName());
538
		buffer.append(getRegisteredName());
539
		buffer.append(",hashCode="); //$NON-NLS-1$
540
		buffer.append(hashCode());
539
		buffer.append(')');
541
		buffer.append(')');
540
		return buffer.toString();
542
		return buffer.toString();
541
	}
543
	}
(-)Eclipse UI/org/eclipse/ui/internal/handlers/HandlerAuthority.java (+3 lines)
Lines 144-149 Link Here
144
	final void activateHandler(final IHandlerActivation activation) {
144
	final void activateHandler(final IHandlerActivation activation) {
145
		// First we update the handlerActivationsByCommandId map.
145
		// First we update the handlerActivationsByCommandId map.
146
		final String commandId = activation.getCommandId();
146
		final String commandId = activation.getCommandId();
147
		if ("org.eclipse.jdt.ui.edit.text.java.open.external.javadoc".equals(commandId)) { //$NON-NLS-1$
148
			System.out.println();
149
		}
147
		final Object value = handlerActivationsByCommandId.get(commandId);
150
		final Object value = handlerActivationsByCommandId.get(commandId);
148
		if (value instanceof SortedSet) {
151
		if (value instanceof SortedSet) {
149
			final SortedSet handlerActivations = (SortedSet) value;
152
			final SortedSet handlerActivations = (SortedSet) value;
(-)Eclipse UI/org/eclipse/ui/internal/handlers/SlaveHandlerService.java (-1 / +1 lines)
Line 1 Link Here
1
/*******************************************************************************
 * Copyright (c) 2006 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.ui.internal.handlers;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
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.core.expressions.Expression;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.ISourceProvider;
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.expressions.AndExpression;

/**
 * A handler service which delegates almost all responsibility to the parent
 * service. It is only responsible for disposing of locally activated handlers
 * when it is disposed.
 * <p>
 * This class is not intended for use outside of the
 * <code>org.eclipse.ui.workbench</code> plug-in.
 * </p>
 * 
 * @since 3.2
 */
public class SlaveHandlerService implements IHandlerService {

	/**
	 * The default expression to use when
	 * {@link #activateHandler(String, IHandler)} is called. Handlers
	 * contributed using that method will only be active when this service is
	 * active. However, this expression will be used for conflict resolution.
	 */
	protected final Expression defaultExpression;

	/**
	 * A collection of source providers. The listeners are not
	 * activated/deactivated, but they will be removed when this service is
	 * disposed.
	 */
	private Collection fSourceProviders = new ArrayList();

	/**
	 * A map of the local activation to the parent activations. If this service
	 * is inactive, then all parent activations are <code>null</code>.
	 * Otherwise, they point to the corresponding activation in the parent
	 * service.
	 */
	protected final Map localActivationsToParentActivations = new HashMap();

	/**
	 * The parent handler service to which all requests are ultimately routed.
	 * This value is never <code>null</code>.
	 */
	protected final IHandlerService parent;

	/**
	 * The activations registered with the parent handler service. This value is
	 * never <code>null</code>.
	 */
	protected final Set parentActivations = new HashSet();

	/**
	 * Constructs a new instance.
	 * 
	 * @param parentHandlerService
	 *            The parent handler service for this slave; must not be
	 *            <code>null</code>.
	 * @param defaultExpression
	 *            The default expression to use if none is provided. This is
	 *            primarily used for conflict resolution. This value may be
	 *            <code>null</code>.
	 */
	public SlaveHandlerService(final IHandlerService parentHandlerService,
			final Expression defaultExpression) {
		if (parentHandlerService == null) {
			throw new NullPointerException(
					"The parent handler service cannot be null"); //$NON-NLS-1$
		}

		this.defaultExpression = defaultExpression;
		this.parent = parentHandlerService;
	}

	public final IHandlerActivation activateHandler(
			final IHandlerActivation childActivation) {
		final String commandId = childActivation.getCommandId();
		final IHandler handler = childActivation.getHandler();
		final Expression childExpression = childActivation.getExpression();
		final AndExpression expression;
		if (childExpression instanceof AndExpression) {
			expression = (AndExpression) childExpression;
		} else {
			expression = new AndExpression();
			if (childExpression != null) {
				expression.add(childExpression);
			}
		}
		if (defaultExpression != null) {
			expression.add(defaultExpression);
		}
		final int depth = childActivation.getDepth() + 1;
		final IHandlerActivation localActivation = new HandlerActivation(
				commandId, handler, expression, depth, this);

		return doActivation(localActivation);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler) {
		final IHandlerActivation localActivation = new HandlerActivation(
				commandId, handler, defaultExpression,
				IHandlerActivation.ROOT_DEPTH, this);
		return doActivation(localActivation);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler, final Expression expression) {
		return activateHandler(commandId, handler, expression, false);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler, final Expression expression,
			final boolean global) {
		if (global) {
			final IHandlerActivation activation = parent.activateHandler(
					commandId, handler, expression, global);
			parentActivations.add(activation);
			return activation;
		}

		final AndExpression andExpression;
		if (expression instanceof AndExpression) {
			andExpression = (AndExpression) expression;
		} else {
			andExpression = new AndExpression();
			if (expression != null) {
				andExpression.add(expression);
			}
		}
		if (defaultExpression != null) {
			andExpression.add(defaultExpression);
		}
		final IHandlerActivation localActivation = new HandlerActivation(
				commandId, handler, andExpression,
				IHandlerActivation.ROOT_DEPTH, this);
		return doActivation(localActivation);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler, final Expression expression,
			final int sourcePriorities) {
		return activateHandler(commandId, handler, expression);
	}

	public final void addSourceProvider(final ISourceProvider provider) {
		if (!fSourceProviders.contains(provider)) {
			fSourceProviders.add(provider);
		}
		parent.addSourceProvider(provider);
	}

	public final ExecutionEvent createExecutionEvent(final Command command,
			final Event event) {
		return parent.createExecutionEvent(command, event);
	}

	public final ExecutionEvent createExecutionEvent(
			final ParameterizedCommand command, final Event event) {
		return parent.createExecutionEvent(command, event);
	}

	public final void deactivateHandler(final IHandlerActivation activation) {
		final IHandlerActivation parentActivation;
		if (localActivationsToParentActivations.containsKey(activation)) {
			parentActivation = (IHandlerActivation) localActivationsToParentActivations
					.remove(activation);
		} else {
			parentActivation = activation;
		}

		if (parentActivation != null) {
			parent.deactivateHandler(parentActivation);
			parentActivations.remove(parentActivation);
		}
	}

	public final void deactivateHandlers(final Collection activations) {
		Object[] array = activations.toArray();
		for (int i = 0; i < array.length; i++) {
			deactivateHandler((IHandlerActivation) array[i]);
			array[i] = null;
		}
	}

	public final void dispose() {
		parent.deactivateHandlers(parentActivations);
		parentActivations.clear();
		localActivationsToParentActivations.clear();

		// Remove any "resource", like listeners, that were associated
		// with this service.
		if (!fSourceProviders.isEmpty()) {
			Object[] array = fSourceProviders.toArray();
			for (int i = 0; i < array.length; i++) {
				removeSourceProvider((ISourceProvider) array[i]);
			}
			fSourceProviders.clear();
		}
	}

	protected IHandlerActivation doActivation(
			final IHandlerActivation localActivation) {
		final IHandlerActivation parentActivation;
		parentActivation = parent.activateHandler(localActivation);
		parentActivations.add(parentActivation);
		localActivationsToParentActivations.put(localActivation,
				parentActivation);
		return localActivation;
	}

	public final Object executeCommand(final ParameterizedCommand command,
			final Event event) throws ExecutionException, NotDefinedException,
			NotEnabledException, NotHandledException {
		return parent.executeCommand(command, event);
	}

	public final Object executeCommand(final String commandId, final Event event)
			throws ExecutionException, NotDefinedException,
			NotEnabledException, NotHandledException {
		return parent.executeCommand(commandId, event);
	}

	public final IEvaluationContext getCurrentState() {
		return parent.getCurrentState();
	}

	public final void readRegistry() {
		parent.readRegistry();
	}

	public final void removeSourceProvider(final ISourceProvider provider) {
		fSourceProviders.remove(provider);
		parent.removeSourceProvider(provider);
	}

	public final void setHelpContextId(final IHandler handler,
			final String helpContextId) {
		parent.setHelpContextId(handler, helpContextId);
	}

}
1
/*******************************************************************************
 * Copyright (c) 2006 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.ui.internal.handlers;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
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.core.expressions.Expression;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.ISourceProvider;
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.expressions.AndExpression;

/**
 * A handler service which delegates almost all responsibility to the parent
 * service. It is only responsible for disposing of locally activated handlers
 * when it is disposed.
 * <p>
 * This class is not intended for use outside of the
 * <code>org.eclipse.ui.workbench</code> plug-in.
 * </p>
 * 
 * @since 3.2
 */
public class SlaveHandlerService implements IHandlerService {

	/**
	 * The default expression to use when
	 * {@link #activateHandler(String, IHandler)} is called. Handlers
	 * contributed using that method will only be active when this service is
	 * active. However, this expression will be used for conflict resolution.
	 */
	protected final Expression defaultExpression;

	/**
	 * A collection of source providers. The listeners are not
	 * activated/deactivated, but they will be removed when this service is
	 * disposed.
	 */
	private Collection fSourceProviders = new ArrayList();

	/**
	 * A map of the local activation to the parent activations. If this service
	 * is inactive, then all parent activations are <code>null</code>.
	 * Otherwise, they point to the corresponding activation in the parent
	 * service.
	 */
	protected final Map localActivationsToParentActivations = new HashMap();

	/**
	 * The parent handler service to which all requests are ultimately routed.
	 * This value is never <code>null</code>.
	 */
	protected final IHandlerService parent;

	/**
	 * The activations registered with the parent handler service. This value is
	 * never <code>null</code>.
	 */
	protected final Set parentActivations = new HashSet();

	/**
	 * Constructs a new instance.
	 * 
	 * @param parentHandlerService
	 *            The parent handler service for this slave; must not be
	 *            <code>null</code>.
	 * @param defaultExpression
	 *            The default expression to use if none is provided. This is
	 *            primarily used for conflict resolution. This value may be
	 *            <code>null</code>.
	 */
	public SlaveHandlerService(final IHandlerService parentHandlerService,
			final Expression defaultExpression) {
		if (parentHandlerService == null) {
			throw new NullPointerException(
					"The parent handler service cannot be null"); //$NON-NLS-1$
		}

		this.defaultExpression = defaultExpression;
		this.parent = parentHandlerService;
	}

	public final IHandlerActivation activateHandler(
			final IHandlerActivation childActivation) {
		final String commandId = childActivation.getCommandId();
		final IHandler handler = childActivation.getHandler();
		final Expression childExpression = childActivation.getExpression();
		final AndExpression expression;
//		if (childExpression instanceof AndExpression) {
//			expression = (AndExpression) childExpression;
//		} else {
//			expression = new AndExpression();
//			if (childExpression != null) {
//				expression.add(childExpression);
//			}
//		}
		
		expression = new AndExpression();
		if (childExpression != null) {
			expression.add(childExpression);
		}

		if (defaultExpression != null) {
			expression.add(defaultExpression);
		}
		final int depth = childActivation.getDepth() + 1;
		final IHandlerActivation localActivation = new HandlerActivation(
				commandId, handler, expression, depth, this);

		return doActivation(localActivation);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler) {
		final IHandlerActivation localActivation = new HandlerActivation(
				commandId, handler, defaultExpression,
				IHandlerActivation.ROOT_DEPTH, this);
		return doActivation(localActivation);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler, final Expression expression) {
		return activateHandler(commandId, handler, expression, false);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler, final Expression expression,
			final boolean global) {
		if (global) {
			final IHandlerActivation activation = parent.activateHandler(
					commandId, handler, expression, global);
			parentActivations.add(activation);
			return activation;
		}

		final AndExpression andExpression;
//		if (expression instanceof AndExpression) {
//			andExpression = (AndExpression) expression;
//		} else {
		andExpression = new AndExpression();
		if (expression != null) {
			andExpression.add(expression);
		}

		if (defaultExpression != null) {
			andExpression.add(defaultExpression);
		}
		final IHandlerActivation localActivation = new HandlerActivation(
				commandId, handler, andExpression,
				IHandlerActivation.ROOT_DEPTH, this);
		return doActivation(localActivation);
	}

	public final IHandlerActivation activateHandler(final String commandId,
			final IHandler handler, final Expression expression,
			final int sourcePriorities) {
		return activateHandler(commandId, handler, expression);
	}

	public final void addSourceProvider(final ISourceProvider provider) {
		if (!fSourceProviders.contains(provider)) {
			fSourceProviders.add(provider);
		}
		parent.addSourceProvider(provider);
	}

	public final ExecutionEvent createExecutionEvent(final Command command,
			final Event event) {
		return parent.createExecutionEvent(command, event);
	}

	public final ExecutionEvent createExecutionEvent(
			final ParameterizedCommand command, final Event event) {
		return parent.createExecutionEvent(command, event);
	}

	public final void deactivateHandler(final IHandlerActivation activation) {
		final IHandlerActivation parentActivation;
		if (localActivationsToParentActivations.containsKey(activation)) {
			parentActivation = (IHandlerActivation) localActivationsToParentActivations
					.remove(activation);
		} else {
			parentActivation = activation;
		}

		if (parentActivation != null) {
			parent.deactivateHandler(parentActivation);
			parentActivations.remove(parentActivation);
		}
	}

	public final void deactivateHandlers(final Collection activations) {
		Object[] array = activations.toArray();
		for (int i = 0; i < array.length; i++) {
			deactivateHandler((IHandlerActivation) array[i]);
			array[i] = null;
		}
	}

	public final void dispose() {
		parent.deactivateHandlers(parentActivations);
		parentActivations.clear();
		localActivationsToParentActivations.clear();

		// Remove any "resource", like listeners, that were associated
		// with this service.
		if (!fSourceProviders.isEmpty()) {
			Object[] array = fSourceProviders.toArray();
			for (int i = 0; i < array.length; i++) {
				removeSourceProvider((ISourceProvider) array[i]);
			}
			fSourceProviders.clear();
		}
	}

	protected IHandlerActivation doActivation(
			final IHandlerActivation localActivation) {
		final IHandlerActivation parentActivation;
		parentActivation = parent.activateHandler(localActivation);
		parentActivations.add(parentActivation);
		localActivationsToParentActivations.put(localActivation,
				parentActivation);
		return localActivation;
	}

	public final Object executeCommand(final ParameterizedCommand command,
			final Event event) throws ExecutionException, NotDefinedException,
			NotEnabledException, NotHandledException {
		return parent.executeCommand(command, event);
	}

	public final Object executeCommand(final String commandId, final Event event)
			throws ExecutionException, NotDefinedException,
			NotEnabledException, NotHandledException {
		return parent.executeCommand(commandId, event);
	}

	public final IEvaluationContext getCurrentState() {
		return parent.getCurrentState();
	}

	public final void readRegistry() {
		parent.readRegistry();
	}

	public final void removeSourceProvider(final ISourceProvider provider) {
		fSourceProviders.remove(provider);
		parent.removeSourceProvider(provider);
	}

	public final void setHelpContextId(final IHandler handler,
			final String helpContextId) {
		parent.setHelpContextId(handler, helpContextId);
	}

}
(-)Eclipse UI/org/eclipse/ui/SubActionBars.java (-5 / +16 lines)
Lines 50-63 Link Here
50
	 * over handlers contributed to the {@link IHandlerService}.
50
	 * over handlers contributed to the {@link IHandlerService}.
51
	 */
51
	 */
52
	private static final Expression EXPRESSION = new Expression() {
52
	private static final Expression EXPRESSION = new Expression() {
53
		public final EvaluationResult evaluate(final IEvaluationContext context) {
54
			return EvaluationResult.TRUE;
55
		}
56
57
		public final void collectExpressionInfo(final ExpressionInfo info) {
53
		public final void collectExpressionInfo(final ExpressionInfo info) {
58
			info
54
			info
59
					.addVariableNameAccess(SourcePriorityNameMapping.LEGACY_LEGACY_NAME);
55
					.addVariableNameAccess(SourcePriorityNameMapping.LEGACY_LEGACY_NAME);
60
		}
56
		}
57
58
		public final EvaluationResult evaluate(final IEvaluationContext context) {
59
			return EvaluationResult.TRUE;
60
		}
61
	};
61
	};
62
62
63
	/**
63
	/**
Lines 317-322 Link Here
317
	}
317
	}
318
318
319
	/**
319
	/**
320
	 * The expression used for action handler activation. This method should not
321
	 * be extended or overridden by subclasses.
322
	 * 
323
	 * @return the expression for use with action handler activation.
324
	 * @since 3.2
325
	 */
326
	protected Expression getHandlerExpression() {
327
		return EXPRESSION;
328
	}
329
330
	/**
320
	 * Returns the abstract menu manager. If items are added or removed from the
331
	 * Returns the abstract menu manager. If items are added or removed from the
321
	 * manager be sure to call <code>updateActionBars</code>.
332
	 * manager be sure to call <code>updateActionBars</code>.
322
	 * 
333
	 * 
Lines 506-512 Link Here
506
					final IHandler actionHandler = new ActionHandler(handler);
517
					final IHandler actionHandler = new ActionHandler(handler);
507
					final IHandlerActivation activation = service
518
					final IHandlerActivation activation = service
508
							.activateHandler(commandId, actionHandler,
519
							.activateHandler(commandId, actionHandler,
509
									EXPRESSION);
520
									getHandlerExpression());
510
					activationsByActionId.put(actionID, activation);
521
					activationsByActionId.put(actionID, activation);
511
				}
522
				}
512
			}
523
			}
(-)Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorContributionExpression.java (+3 lines)
Lines 90-95 Link Here
90
90
91
	public final EvaluationResult evaluate(final IEvaluationContext context)
91
	public final EvaluationResult evaluate(final IEvaluationContext context)
92
			throws CoreException {
92
			throws CoreException {
93
		if ("org.eclipse.jdt.ui.CompilationUnitEditor".equals(activeEditorId)) { //$NON-NLS-1$
94
			System.out.println();
95
		}
93
		final EvaluationResult result = super.evaluate(context);
96
		final EvaluationResult result = super.evaluate(context);
94
		if (result == EvaluationResult.FALSE) {
97
		if (result == EvaluationResult.FALSE) {
95
			return result;
98
			return result;

Return to bug 137091