-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.ui.workbench;\r
-\r
-\r
-import org.eclipse.core.runtime.Assert;\r
-import org.eclipse.jface.action.IAction;\r
-import org.eclipse.jface.action.IContributionItem;\r
-import org.eclipse.jface.action.IContributionManager;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IStatusLineManager;\r
-import org.eclipse.ui.IActionBars;\r
-import org.eclipse.ui.IEditorPart;\r
-import org.eclipse.ui.actions.ActionFactory;\r
-import org.eclipse.ui.part.EditorActionBarContributor;\r
-\r
-\r
-\r
-\r
-\r
-/**\r
- * Manages the installation and removal of global actions for\r
- * the same type of editors.\r
- * <p>\r
- * If instantiated and used as-is, this contributor connects to all of the workbench defined\r
- * global editor actions the corresponding actions of the current editor. It also adds addition\r
- * actions for searching and navigation (go to line) as well as a set of status fields.</p>\r
- * <p>\r
- * Subclasses may override the following methods:\r
- * <ul>\r
- * <li><code>contributeToMenu</code> - extend to contribute to menu</li>\r
- * <li><code>contributeToToolBar</code> - reimplement to contribute to tool bar</li>\r
- * <li><code>contributeToStatusLine</code> - reimplement to contribute to status line</li>\r
- * <li><code>setActiveEditor</code> - extend to react to editor changes</li>\r
- * </ul>\r
- * </p>\r
- * @see org.eclipse.ui.texteditor.ITextEditorActionConstants\r
- */\r
-public class ResourceEditorActionContributor extends EditorActionBarContributor {\r
-\r
-\r
- /** The global actions to be connected with editor actions */\r
- private final static String[] ACTIONS= {\r
- ActionFactory.UNDO.getId(),\r
- ActionFactory.REDO.getId(),\r
- ActionFactory.CUT.getId(),\r
- ActionFactory.COPY.getId(),\r
- ActionFactory.PASTE.getId(),\r
- ActionFactory.DELETE.getId(),\r
- ActionFactory.SELECT_ALL.getId(),\r
- ActionFactory.FIND.getId(),\r
- ActionFactory.PRINT.getId(),\r
- ActionFactory.PROPERTIES.getId(),\r
- //ActionFactory.REVERT.getId(),\r
- };\r
-\r
- /**\r
- * Status field definition.\r
- * @since 3.0\r
- */\r
- @SuppressWarnings("unused")\r
- private static class StatusFieldDef {\r
-\r
- private String category;\r
- private String actionId;\r
- private boolean visible;\r
- private int widthInChars;\r
-\r
- private StatusFieldDef(String category, String actionId, boolean visible, int widthInChars) {\r
- Assert.isNotNull(category);\r
- this.category= category;\r
- this.actionId= actionId;\r
- this.visible= visible;\r
- this.widthInChars= widthInChars;\r
- }\r
- }\r
-\r
- /**\r
- * The status fields to be set to the editor\r
- * @since 3.0\r
- */\r
-// private final static StatusFieldDef[] STATUS_FIELD_DEFS= {\r
-// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_FIND_FIELD, null, false, EditorMessages.Editor_FindIncremental_reverse_name.length() + 15),\r
-// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE, null, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS + 1),\r
-// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE, ITextEditorActionDefinitionIds.TOGGLE_OVERWRITE, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS),\r
-// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION, ITextEditorActionConstants.GOTO_LINE, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS)\r
-// };\r
-\r
- /**\r
- * The active editor part.\r
- */\r
- private IEditorPart activeEditorPart;\r
- /**\r
- * The find next action.\r
- * @since 2.0\r
- */\r
-// private RetargetTextEditorAction fFindNext;\r
- /**\r
- * The find previous action.\r
- * @since 2.0\r
- */\r
-// private RetargetTextEditorAction fFindPrevious;\r
- /**\r
- * The incremental find action.\r
- * @since 2.0\r
- */\r
-// private RetargetTextEditorAction fIncrementalFind;\r
- /**\r
- * The reverse incremental find action.\r
- * @since 2.1\r
- */\r
-// private RetargetTextEditorAction fIncrementalFindReverse;\r
- /**\r
- * The go to line action.\r
- */\r
-// private RetargetTextEditorAction fGotoLine;\r
- /**\r
- * The word completion action.\r
- * @since 3.1\r
- */\r
-// private RetargetTextEditorAction fHippieCompletion;\r
- /**\r
- * The map of status fields.\r
- * @since 2.0\r
- */\r
-// private Map fStatusFields;\r
-\r
-\r
- /**\r
- * Creates an empty editor action bar contributor. The action bars are\r
- * furnished later via the <code>init</code> method.\r
- *\r
- * @see org.eclipse.ui.IEditorActionBarContributor#init(org.eclipse.ui.IActionBars, org.eclipse.ui.IWorkbenchPage)\r
- */\r
- public ResourceEditorActionContributor() {\r
-\r
-// fFindNext= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindNext."); //$NON-NLS-1$\r
-// fFindNext.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_NEXT);\r
-// fFindPrevious= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindPrevious."); //$NON-NLS-1$\r
-// fFindPrevious.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_PREVIOUS);\r
-// fIncrementalFind= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindIncremental."); //$NON-NLS-1$\r
-// fIncrementalFind.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_INCREMENTAL);\r
-// fIncrementalFindReverse= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindIncrementalReverse."); //$NON-NLS-1$\r
-// fIncrementalFindReverse.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_INCREMENTAL_REVERSE);\r
-// fGotoLine= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.GotoLine."); //$NON-NLS-1$\r
-// fGotoLine.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_GOTO);\r
-// fHippieCompletion= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.HippieCompletion."); //$NON-NLS-1$\r
-// fHippieCompletion.setActionDefinitionId(ITextEditorActionDefinitionIds.HIPPIE_COMPLETION);\r
-\r
-// fStatusFields= new HashMap(3);\r
-// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {\r
-// StatusFieldDef fieldDef= STATUS_FIELD_DEFS[i];\r
-// fStatusFields.put(fieldDef, new StatusLineContributionItem(fieldDef.category, fieldDef.visible, fieldDef.widthInChars));\r
-// }\r
- }\r
-\r
- /**\r
- * Returns the active editor part.\r
- *\r
- * @return the active editor part\r
- */\r
- protected final IEditorPart getActiveEditorPart() {\r
- return activeEditorPart;\r
- }\r
-\r
- /**\r
- * Returns the action registered with the given text editor.\r
- *\r
- * @param editor the editor, or <code>null</code>\r
- * @param actionId the action id\r
- * @return the action, or <code>null</code> if none\r
- */\r
- protected final IAction getAction(IResourceEditorPart editor, String actionId) {\r
- return null;\r
-// return (editor == null || actionId == null ? null : editor.getAction(actionId));\r
- }\r
-\r
- /**\r
- * The method installs the global action handlers for the given text editor.\r
- * <p>\r
- * This method cannot be overridden by subclasses.</p>\r
- *\r
- * @param part the active editor part\r
- * @since 2.0\r
- */\r
- private void doSetActiveEditor(IEditorPart part) {\r
-\r
- if (activeEditorPart == part)\r
- return;\r
-\r
-// if (fActiveEditorPart instanceof ITextEditorExtension) {\r
-// ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;\r
-// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)\r
-// extension.setStatusField(null, STATUS_FIELD_DEFS[i].category);\r
-// }\r
-\r
- activeEditorPart= part;\r
- IResourceEditorPart editor = (part instanceof IResourceEditorPart) ? (IResourceEditorPart) part : null;\r
-\r
- IActionBars actionBars= getActionBars();\r
- for (int i= 0; i < ACTIONS.length; i++)\r
- actionBars.setGlobalActionHandler(ACTIONS[i], getAction(editor, ACTIONS[i]));\r
-\r
-// fFindNext.setAction(getAction(editor, ITextEditorActionConstants.FIND_NEXT));\r
-// fFindPrevious.setAction(getAction(editor, ITextEditorActionConstants.FIND_PREVIOUS));\r
-// fIncrementalFind.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL));\r
-// fIncrementalFindReverse.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE));\r
-// fGotoLine.setAction(getAction(editor, ITextEditorActionConstants.GOTO_LINE));\r
-// fHippieCompletion.setAction(getAction(editor, ITextEditorActionConstants.HIPPIE_COMPLETION));\r
-//\r
-// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {\r
-// if (fActiveEditorPart instanceof ITextEditorExtension) {\r
-// StatusLineContributionItem statusField= (StatusLineContributionItem) fStatusFields.get(STATUS_FIELD_DEFS[i]);\r
-// statusField.setActionHandler(getAction(editor, STATUS_FIELD_DEFS[i].actionId));\r
-// ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;\r
-// extension.setStatusField(statusField, STATUS_FIELD_DEFS[i].category);\r
-// }\r
-// }\r
- }\r
-\r
- /**\r
- * The <code>BasicTextEditorActionContributor</code> implementation of this\r
- * <code>IEditorActionBarContributor</code> method installs the global\r
- * action handler for the given text editor by calling a private helper\r
- * method.\r
- * <p>\r
- * Subclasses may extend.</p>\r
- *\r
- * @param part {@inheritDoc}\r
- */\r
- public void setActiveEditor(IEditorPart part) {\r
- doSetActiveEditor(part);\r
- }\r
-\r
- /*\r
- * @see EditorActionBarContributor#contributeToMenu(IMenuManager)\r
- */\r
- public void contributeToMenu(IMenuManager menu) {\r
-\r
-// IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);\r
-// if (editMenu != null) {\r
-// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fIncrementalFindReverse);\r
-// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fIncrementalFind);\r
-// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fFindPrevious);\r
-// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fFindNext);\r
-//\r
-// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_OPEN));\r
-// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_INFORMATION));\r
-// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_ASSIST));\r
-// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_GENERATE));\r
-// addOrInsert(editMenu, new Separator(IWorkbenchActionConstants.MB_ADDITIONS));\r
-//\r
-// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, fHippieCompletion);\r
-// }\r
-//\r
-// IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);\r
-// if (navigateMenu != null) {\r
-// navigateMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fGotoLine);\r
-// }\r
- }\r
-\r
- /**\r
- * The <code>item</code> is {@link IContributionManager#add(IContributionItem) added} to\r
- * <code>menu</code> if no item with the same id currently exists. If there already is an\r
- * contribution item with the same id, the new item gets\r
- * {@link IContributionManager#insertAfter(String, IContributionItem) inserted after} it.\r
- * \r
- * @param menu the contribution manager\r
- * @param item the contribution item\r
- * @since 3.2\r
- */\r
- @SuppressWarnings("unused")\r
- private void addOrInsert(IContributionManager menu, IContributionItem item) {\r
- String id= item.getId();\r
- if (menu.find(id) == null)\r
- menu.add(item);\r
- else\r
- menu.insertAfter(id, item);\r
- }\r
-\r
- /*\r
- * @see EditorActionBarContributor#contributeToStatusLine(org.eclipse.jface.action.IStatusLineManager)\r
- * @since 2.0\r
- */\r
- public void contributeToStatusLine(IStatusLineManager statusLineManager) {\r
- super.contributeToStatusLine(statusLineManager);\r
-// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)\r
-// statusLineManager.add((IContributionItem)fStatusFields.get(STATUS_FIELD_DEFS[i]));\r
- }\r
-\r
- /*\r
- * @see org.eclipse.ui.IEditorActionBarContributor#dispose()\r
- * @since 2.0\r
- */\r
- public void dispose() {\r
- doSetActiveEditor(null);\r
- super.dispose();\r
- }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.ui.workbench;
+
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+
+
+
+
+/**
+ * Manages the installation and removal of global actions for
+ * the same type of editors.
+ * <p>
+ * If instantiated and used as-is, this contributor connects to all of the workbench defined
+ * global editor actions the corresponding actions of the current editor. It also adds addition
+ * actions for searching and navigation (go to line) as well as a set of status fields.</p>
+ * <p>
+ * Subclasses may override the following methods:
+ * <ul>
+ * <li><code>contributeToMenu</code> - extend to contribute to menu</li>
+ * <li><code>contributeToToolBar</code> - reimplement to contribute to tool bar</li>
+ * <li><code>contributeToStatusLine</code> - reimplement to contribute to status line</li>
+ * <li><code>setActiveEditor</code> - extend to react to editor changes</li>
+ * </ul>
+ * </p>
+ * @see org.eclipse.ui.texteditor.ITextEditorActionConstants
+ */
+public class ResourceEditorActionContributor extends EditorActionBarContributor {
+
+
+ /** The global actions to be connected with editor actions */
+ private final static String[] ACTIONS= {
+ ActionFactory.UNDO.getId(),
+ ActionFactory.REDO.getId(),
+ ActionFactory.CUT.getId(),
+ ActionFactory.COPY.getId(),
+ ActionFactory.PASTE.getId(),
+ ActionFactory.DELETE.getId(),
+ ActionFactory.SELECT_ALL.getId(),
+ ActionFactory.FIND.getId(),
+ ActionFactory.PRINT.getId(),
+ ActionFactory.PROPERTIES.getId(),
+ //ActionFactory.REVERT.getId(),
+ };
+
+ /**
+ * Status field definition.
+ * @since 3.0
+ */
+ @SuppressWarnings("unused")
+ private static class StatusFieldDef {
+
+ private String category;
+ private String actionId;
+ private boolean visible;
+ private int widthInChars;
+
+ private StatusFieldDef(String category, String actionId, boolean visible, int widthInChars) {
+ Assert.isNotNull(category);
+ this.category= category;
+ this.actionId= actionId;
+ this.visible= visible;
+ this.widthInChars= widthInChars;
+ }
+ }
+
+ /**
+ * The status fields to be set to the editor
+ * @since 3.0
+ */
+// private final static StatusFieldDef[] STATUS_FIELD_DEFS= {
+// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_FIND_FIELD, null, false, EditorMessages.Editor_FindIncremental_reverse_name.length() + 15),
+// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE, null, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS + 1),
+// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE, ITextEditorActionDefinitionIds.TOGGLE_OVERWRITE, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS),
+// new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION, ITextEditorActionConstants.GOTO_LINE, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS)
+// };
+
+ /**
+ * The active editor part.
+ */
+ private IEditorPart activeEditorPart;
+ /**
+ * The find next action.
+ * @since 2.0
+ */
+// private RetargetTextEditorAction fFindNext;
+ /**
+ * The find previous action.
+ * @since 2.0
+ */
+// private RetargetTextEditorAction fFindPrevious;
+ /**
+ * The incremental find action.
+ * @since 2.0
+ */
+// private RetargetTextEditorAction fIncrementalFind;
+ /**
+ * The reverse incremental find action.
+ * @since 2.1
+ */
+// private RetargetTextEditorAction fIncrementalFindReverse;
+ /**
+ * The go to line action.
+ */
+// private RetargetTextEditorAction fGotoLine;
+ /**
+ * The word completion action.
+ * @since 3.1
+ */
+// private RetargetTextEditorAction fHippieCompletion;
+ /**
+ * The map of status fields.
+ * @since 2.0
+ */
+// private Map fStatusFields;
+
+
+ /**
+ * Creates an empty editor action bar contributor. The action bars are
+ * furnished later via the <code>init</code> method.
+ *
+ * @see org.eclipse.ui.IEditorActionBarContributor#init(org.eclipse.ui.IActionBars, org.eclipse.ui.IWorkbenchPage)
+ */
+ public ResourceEditorActionContributor() {
+
+// fFindNext= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindNext."); //$NON-NLS-1$
+// fFindNext.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_NEXT);
+// fFindPrevious= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindPrevious."); //$NON-NLS-1$
+// fFindPrevious.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_PREVIOUS);
+// fIncrementalFind= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindIncremental."); //$NON-NLS-1$
+// fIncrementalFind.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_INCREMENTAL);
+// fIncrementalFindReverse= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.FindIncrementalReverse."); //$NON-NLS-1$
+// fIncrementalFindReverse.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_INCREMENTAL_REVERSE);
+// fGotoLine= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.GotoLine."); //$NON-NLS-1$
+// fGotoLine.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_GOTO);
+// fHippieCompletion= new RetargetTextEditorAction(EditorMessages.getBundleForConstructedKeys(), "Editor.HippieCompletion."); //$NON-NLS-1$
+// fHippieCompletion.setActionDefinitionId(ITextEditorActionDefinitionIds.HIPPIE_COMPLETION);
+
+// fStatusFields= new HashMap(3);
+// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {
+// StatusFieldDef fieldDef= STATUS_FIELD_DEFS[i];
+// fStatusFields.put(fieldDef, new StatusLineContributionItem(fieldDef.category, fieldDef.visible, fieldDef.widthInChars));
+// }
+ }
+
+ /**
+ * Returns the active editor part.
+ *
+ * @return the active editor part
+ */
+ protected final IEditorPart getActiveEditorPart() {
+ return activeEditorPart;
+ }
+
+ /**
+ * Returns the action registered with the given text editor.
+ *
+ * @param editor the editor, or <code>null</code>
+ * @param actionId the action id
+ * @return the action, or <code>null</code> if none
+ */
+ protected final IAction getAction(IResourceEditorPart editor, String actionId) {
+ return null;
+// return (editor == null || actionId == null ? null : editor.getAction(actionId));
+ }
+
+ /**
+ * The method installs the global action handlers for the given text editor.
+ * <p>
+ * This method cannot be overridden by subclasses.</p>
+ *
+ * @param part the active editor part
+ * @since 2.0
+ */
+ private void doSetActiveEditor(IEditorPart part) {
+
+ if (activeEditorPart == part)
+ return;
+
+// if (fActiveEditorPart instanceof ITextEditorExtension) {
+// ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;
+// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)
+// extension.setStatusField(null, STATUS_FIELD_DEFS[i].category);
+// }
+
+ activeEditorPart= part;
+ IResourceEditorPart editor = (part instanceof IResourceEditorPart) ? (IResourceEditorPart) part : null;
+
+ IActionBars actionBars= getActionBars();
+ for (int i= 0; i < ACTIONS.length; i++)
+ actionBars.setGlobalActionHandler(ACTIONS[i], getAction(editor, ACTIONS[i]));
+
+// fFindNext.setAction(getAction(editor, ITextEditorActionConstants.FIND_NEXT));
+// fFindPrevious.setAction(getAction(editor, ITextEditorActionConstants.FIND_PREVIOUS));
+// fIncrementalFind.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL));
+// fIncrementalFindReverse.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE));
+// fGotoLine.setAction(getAction(editor, ITextEditorActionConstants.GOTO_LINE));
+// fHippieCompletion.setAction(getAction(editor, ITextEditorActionConstants.HIPPIE_COMPLETION));
+//
+// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {
+// if (fActiveEditorPart instanceof ITextEditorExtension) {
+// StatusLineContributionItem statusField= (StatusLineContributionItem) fStatusFields.get(STATUS_FIELD_DEFS[i]);
+// statusField.setActionHandler(getAction(editor, STATUS_FIELD_DEFS[i].actionId));
+// ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;
+// extension.setStatusField(statusField, STATUS_FIELD_DEFS[i].category);
+// }
+// }
+ }
+
+ /**
+ * The <code>BasicTextEditorActionContributor</code> implementation of this
+ * <code>IEditorActionBarContributor</code> method installs the global
+ * action handler for the given text editor by calling a private helper
+ * method.
+ * <p>
+ * Subclasses may extend.</p>
+ *
+ * @param part {@inheritDoc}
+ */
+ public void setActiveEditor(IEditorPart part) {
+ doSetActiveEditor(part);
+ }
+
+ /*
+ * @see EditorActionBarContributor#contributeToMenu(IMenuManager)
+ */
+ public void contributeToMenu(IMenuManager menu) {
+
+// IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+// if (editMenu != null) {
+// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fIncrementalFindReverse);
+// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fIncrementalFind);
+// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fFindPrevious);
+// editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fFindNext);
+//
+// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_OPEN));
+// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_INFORMATION));
+// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_ASSIST));
+// addOrInsert(editMenu, new Separator(ITextEditorActionConstants.GROUP_GENERATE));
+// addOrInsert(editMenu, new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+//
+// editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, fHippieCompletion);
+// }
+//
+// IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
+// if (navigateMenu != null) {
+// navigateMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fGotoLine);
+// }
+ }
+
+ /**
+ * The <code>item</code> is {@link IContributionManager#add(IContributionItem) added} to
+ * <code>menu</code> if no item with the same id currently exists. If there already is an
+ * contribution item with the same id, the new item gets
+ * {@link IContributionManager#insertAfter(String, IContributionItem) inserted after} it.
+ *
+ * @param menu the contribution manager
+ * @param item the contribution item
+ * @since 3.2
+ */
+ @SuppressWarnings("unused")
+ private void addOrInsert(IContributionManager menu, IContributionItem item) {
+ String id= item.getId();
+ if (menu.find(id) == null)
+ menu.add(item);
+ else
+ menu.insertAfter(id, item);
+ }
+
+ /*
+ * @see EditorActionBarContributor#contributeToStatusLine(org.eclipse.jface.action.IStatusLineManager)
+ * @since 2.0
+ */
+ public void contributeToStatusLine(IStatusLineManager statusLineManager) {
+ super.contributeToStatusLine(statusLineManager);
+// for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)
+// statusLineManager.add((IContributionItem)fStatusFields.get(STATUS_FIELD_DEFS[i]));
+ }
+
+ /*
+ * @see org.eclipse.ui.IEditorActionBarContributor#dispose()
+ * @since 2.0
+ */
+ public void dispose() {
+ doSetActiveEditor(null);
+ super.dispose();
+ }
+}