diff options
author | Dani Megert | 2008-11-24 16:26:24 +0000 |
---|---|---|
committer | Dani Megert | 2008-11-24 16:26:24 +0000 |
commit | f7b635aa00ee68ae7cbf8301c8be2c222fad4c7c (patch) | |
tree | 817c835db13527924d598e63f4b70565a7e78aa5 /org.eclipse.ui.examples.javaeditor | |
parent | 236426ad8e8774a94136bb0501cdbd4d5066d98f (diff) | |
download | eclipse.platform.text-f7b635aa00ee68ae7cbf8301c8be2c222fad4c7c.tar.gz eclipse.platform.text-f7b635aa00ee68ae7cbf8301c8be2c222fad4c7c.tar.xz eclipse.platform.text-f7b635aa00ee68ae7cbf8301c8be2c222fad4c7c.zip |
Fixed bug 138370: [misc] Simplify setup of ContentAssistActionv20081125-0800
Diffstat (limited to 'org.eclipse.ui.examples.javaeditor')
3 files changed, 14 insertions, 29 deletions
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java index 5a1d0badb54..45854859bc4 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.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 @@ -20,6 +20,7 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; import org.eclipse.ui.texteditor.RetargetTextEditorAction; import org.eclipse.ui.texteditor.TextEditorAction; @@ -75,8 +76,8 @@ public class JavaActionContributor extends TextEditorActionContributor { if (part instanceof ITextEditor) editor= (ITextEditor) part; - fContentAssistProposal.setAction(getAction(editor, "ContentAssistProposal")); //$NON-NLS-1$ - fContentAssistTip.setAction(getAction(editor, "ContentAssistTip")); //$NON-NLS-1$ + fContentAssistProposal.setAction(getAction(editor, ITextEditorActionConstants.CONTENT_ASSIST)); + fContentAssistTip.setAction(getAction(editor, ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION)); fTogglePresentation.setEditor(editor); fTogglePresentation.update(); diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java index 53de941520e..c5106b79ed3 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.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 @@ -40,9 +40,7 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; import org.eclipse.ui.texteditor.TextEditorAction; -import org.eclipse.ui.texteditor.TextOperationAction; import org.eclipse.ui.editors.text.TextEditor; @@ -112,15 +110,7 @@ public class JavaEditor extends TextEditor { protected void createActions() { super.createActions(); - IAction a= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS); //$NON-NLS-1$ - a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); - setAction("ContentAssistProposal", a); //$NON-NLS-1$ - - a= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$ - a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); - setAction("ContentAssistTip", a); //$NON-NLS-1$ - - a= new DefineFoldingRegionAction(JavaEditorMessages.getResourceBundle(), "DefineFoldingRegion.", this); //$NON-NLS-1$ + IAction a= new DefineFoldingRegionAction(JavaEditorMessages.getResourceBundle(), "DefineFoldingRegion.", this); //$NON-NLS-1$ setAction("DefineFoldingRegion", a); //$NON-NLS-1$ } 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$ + } } } |