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 310601 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistCommandAdapter.java (-10 / +14 lines)
Lines 13-19 Link Here
13
13
14
import org.eclipse.core.commands.AbstractHandler;
14
import org.eclipse.core.commands.AbstractHandler;
15
import org.eclipse.core.commands.ExecutionEvent;
15
import org.eclipse.core.commands.ExecutionEvent;
16
import org.eclipse.core.commands.IHandler;
17
import org.eclipse.core.expressions.EvaluationResult;
16
import org.eclipse.core.expressions.EvaluationResult;
18
import org.eclipse.core.expressions.Expression;
17
import org.eclipse.core.expressions.Expression;
19
import org.eclipse.core.expressions.ExpressionInfo;
18
import org.eclipse.core.expressions.ExpressionInfo;
Lines 55-60 Link Here
55
 */
54
 */
56
public class ContentAssistCommandAdapter extends ContentProposalAdapter {
55
public class ContentAssistCommandAdapter extends ContentProposalAdapter {
57
56
57
	private class ContentAssistHandler extends AbstractHandler {
58
		public Object execute(ExecutionEvent event) {
59
			openProposalPopup();
60
			return null;
61
		}
62
63
		void setEnabled(boolean enabled) {
64
			this.setBaseEnabled(enabled);
65
		}
66
	}
67
58
	// ID used in the decoration registry.
68
	// ID used in the decoration registry.
59
	private static final String CONTENT_ASSIST_DECORATION_ID = "org.eclipse.ui.fieldAssist.ContentAssistField"; //$NON-NLS-1$
69
	private static final String CONTENT_ASSIST_DECORATION_ID = "org.eclipse.ui.fieldAssist.ContentAssistField"; //$NON-NLS-1$
60
70
Lines 76-88 Link Here
76
	// a platform UI preference.
86
	// a platform UI preference.
77
	private static final int DEFAULT_AUTO_ACTIVATION_DELAY = 500;
87
	private static final int DEFAULT_AUTO_ACTIVATION_DELAY = 500;
78
88
79
	private IHandler proposalHandler = new AbstractHandler() {
89
	private ContentAssistHandler proposalHandler = new ContentAssistHandler();
80
		public Object execute(ExecutionEvent event) {
81
			openProposalPopup();
82
			return null;
83
		}
84
85
	};
86
	private ControlDecoration decoration;
90
	private ControlDecoration decoration;
87
91
88
	/**
92
	/**
Lines 255-260 Link Here
255
				decoration.hide();
259
				decoration.hide();
256
			}
260
			}
257
		}
261
		}
262
		proposalHandler.setEnabled(enabled);
258
	}
263
	}
259
264
260
	private void activateHandler(final Control control) {
265
	private void activateHandler(final Control control) {
Lines 267-274 Link Here
267
			final IHandlerActivation handlerActivation = hs.activateHandler(commandId,
272
			final IHandlerActivation handlerActivation = hs.activateHandler(commandId,
268
					proposalHandler, new Expression() {
273
					proposalHandler, new Expression() {
269
						public EvaluationResult evaluate(IEvaluationContext context) {
274
						public EvaluationResult evaluate(IEvaluationContext context) {
270
							return context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_NAME) == control
275
							return context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_NAME) == control ? EvaluationResult.TRUE
271
									&& ContentAssistCommandAdapter.this.isEnabled() ? EvaluationResult.TRUE
272
									: EvaluationResult.FALSE;
276
									: EvaluationResult.FALSE;
273
						}
277
						}
274
278

Return to bug 310601