From f7b635aa00ee68ae7cbf8301c8be2c222fad4c7c Mon Sep 17 00:00:00 2001 From: Dani Megert Date: Mon, 24 Nov 2008 16:26:24 +0000 Subject: Fixed bug 138370: [misc] Simplify setup of ContentAssistAction --- .../templateeditor/editors/TemplateEditor.java | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui') diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java index 3dd22ce2656..48ea1bf77cc 100644 --- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java +++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2008 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 @@ -12,18 +12,14 @@ package org.eclipse.ui.examples.templateeditor.editors; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.text.source.ISourceViewer; - import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor; -import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; -import org.eclipse.ui.texteditor.TextOperationAction; +import org.eclipse.ui.texteditor.ITextEditorActionConstants; /** * A simple xml editor with template capabilities. */ public class TemplateEditor extends AbstractDecoratedTextEditor { - private static final String TEMPLATE_PROPOSALS= "template_proposals_action"; //$NON-NLS-1$ private ColorManager colorManager; /** @@ -44,14 +40,12 @@ public class TemplateEditor extends AbstractDecoratedTextEditor { protected void createActions() { super.createActions(); - IAction action= new TextOperationAction( - TemplateMessages.getResourceBundle(), - "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$ - this, - ISourceViewer.CONTENTASSIST_PROPOSALS); - action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); - setAction(TEMPLATE_PROPOSALS, action); - markAsStateDependentAction(TEMPLATE_PROPOSALS, true); + IAction action= getAction(ITextEditorActionConstants.CONTENT_ASSIST); + if (action != null) { + action.setText(TemplateMessages.getString("Editor.template_proposals_action.label")); //$NON-NLS-1$ + action.setToolTipText(TemplateMessages.getString("Editor.template_proposals_action.tooltip")); //$NON-NLS-1$ + action.setDescription(TemplateMessages.getString("Editor.template_proposals_action.description")); //$NON-NLS-1$ + } } } -- cgit v1.2.3