diff options
Diffstat (limited to 'org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/RecipeEditorActionContributor.java')
-rw-r--r-- | org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/RecipeEditorActionContributor.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/RecipeEditorActionContributor.java b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/RecipeEditorActionContributor.java new file mode 100644 index 0000000..b4ae491 --- /dev/null +++ b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/RecipeEditorActionContributor.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.openembedded.bc.ui.editors.bitbake; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.editors.text.TextEditorActionContributor; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; +import org.eclipse.ui.texteditor.RetargetTextEditorAction; + +public class RecipeEditorActionContributor extends TextEditorActionContributor { + + private RetargetTextEditorAction fContentAssist; + + public RecipeEditorActionContributor() { + fContentAssist= new RetargetTextEditorAction(RecipeEditorMessages.getBundle(), "contentAssist."); //$NON-NLS-1$ + fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); + } + + @Override + public void contributeToMenu(IMenuManager menu) { + super.contributeToMenu(menu); + + IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); + if (editMenu != null) { + editMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fContentAssist); + } + } + + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + if (part instanceof ITextEditor) { + fContentAssist.setAction(getAction((ITextEditor) part, BitBakeFileEditor.CONTENT_ASSIST)); + } + } +} |