Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 4364 Details for
Bug 35750
[Key Bindings] Accelerator Key doesn't work if items are added to Help menu
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
MultiPageEditorContributor.java
(text/plain), 4.28 KB, created by
Masaki Wakao
on 2003-03-27 05:57:40 EST
(
hide
)
Description:
MultiPageEditorContributor.java
Filename:
MIME Type:
Creator:
Masaki Wakao
Created:
2003-03-27 05:57:40 EST
Size:
4.28 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2000, 2003 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Common Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/cpl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >package KKK.editors; > > >import org.eclipse.ui.IActionBars; >import org.eclipse.ui.IEditorPart; >import org.eclipse.ui.part.MultiPageEditorActionBarContributor; >import org.eclipse.ui.texteditor.ITextEditor; >import org.eclipse.ui.texteditor.ITextEditorActionConstants; >import org.eclipse.ui.IWorkbenchActionConstants; >import org.eclipse.jface.action.*; >import org.eclipse.jface.dialogs.MessageDialog; >import org.eclipse.ui.PlatformUI; >import org.eclipse.ui.ISharedImages; > >/** > * Manages the installation/deinstallation of global actions for multi-page editors. > * Responsible for the redirection of global actions to the active editor. > * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor. > */ >public class MultiPageEditorContributor extends MultiPageEditorActionBarContributor { > private IEditorPart activeEditorPart; > private Action sampleAction; > /** > * Creates a multi-page contributor. > */ > public MultiPageEditorContributor() { > super(); > createActions(); > } > /** > * Returns the action registed with the given text editor. > * @return IAction or null if editor is null. > */ > protected IAction getAction(ITextEditor editor, String actionID) { > return (editor == null ? null : editor.getAction(actionID)); > } > /* (non-JavaDoc) > * Method declared in AbstractMultiPageEditorActionBarContributor. > */ > > public void setActivePage(IEditorPart part) { > if (activeEditorPart == part) > return; > > activeEditorPart = part; > > IActionBars actionBars = getActionBars(); > if (actionBars != null) { > > ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null; > > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.DELETE, > getAction(editor, ITextEditorActionConstants.DELETE)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.UNDO, > getAction(editor, ITextEditorActionConstants.UNDO)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.REDO, > getAction(editor, ITextEditorActionConstants.REDO)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.CUT, > getAction(editor, ITextEditorActionConstants.CUT)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.COPY, > getAction(editor, ITextEditorActionConstants.COPY)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.PASTE, > getAction(editor, ITextEditorActionConstants.PASTE)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.SELECT_ALL, > getAction(editor, ITextEditorActionConstants.SELECT_ALL)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.FIND, > getAction(editor, ITextEditorActionConstants.FIND)); > actionBars.setGlobalActionHandler( > IWorkbenchActionConstants.BOOKMARK, > getAction(editor, ITextEditorActionConstants.BOOKMARK)); > > IMenuManager fm = actionBars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_HELP); > if (null != fm) { > fm.removeAll(); > fm.setVisible(true); > fm.add(new Separator()); > } > actionBars.updateActionBars(); > } > } > private void createActions() { > sampleAction = new Action() { > public void run() { > MessageDialog.openInformation(null, "KKK Plug-in", "Sample Action Executed"); > } > }; > sampleAction.setText("Sample Action"); > sampleAction.setToolTipText("Sample Action tool tip"); > sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages(). > getImageDescriptor(ISharedImages.IMG_OBJS_TASK_TSK)); > } > public void contributeToMenu(IMenuManager manager) { > IMenuManager menu = new MenuManager("Editor &Menu"); > manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu); > menu.add(sampleAction); > } > public void contributeToToolBar(IToolBarManager manager) { > manager.add(new Separator()); > manager.add(sampleAction); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 35750
: 4364