public class OpenWithMenu extends ContributionItem
An OpenWithMenu
is used to populate a menu with
"Open With" actions. One action is added for each editor which is applicable
to the selected file. If the user selects one of these items, the corresponding
editor is opened on the file.
This class may be instantiated; it is not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
static String |
ID
The id of this action.
|
Constructor and Description |
---|
OpenWithMenu(IWorkbenchPage page)
Deprecated.
As there is no way to set the file with this constructor use a
different constructor.
|
OpenWithMenu(IWorkbenchPage page,
IAdaptable file)
Constructs a new instance of
OpenWithMenu . |
Modifier and Type | Method and Description |
---|---|
void |
fill(Menu menu,
int index)
The default implementation of this
IContributionItem
method does nothing. |
boolean |
isDynamic()
The default implementation of this
IContributionItem
method returns false . |
protected void |
openEditor(IEditorDescriptor editorDescriptor,
boolean openUsingDescriptor)
Opens the given editor on the selected file.
|
dispose, fill, fill, fill, getId, getParent, isDirty, isEnabled, isGroupMarker, isSeparator, isVisible, saveWidgetState, setId, setParent, setVisible, toString, update, update
public static final String ID
public OpenWithMenu(IWorkbenchPage page)
OpenWithMenu
.page
- the page where the editor is opened if an item within
the menu is selectedpublic OpenWithMenu(IWorkbenchPage page, IAdaptable file)
OpenWithMenu
.page
- the page where the editor is opened if an item within
the menu is selectedfile
- the selected filepublic void fill(Menu menu, int index)
ContributionItem
IContributionItem
method does nothing. Subclasses may override.fill
in interface IContributionItem
fill
in class ContributionItem
menu
- the parent menuindex
- the index where the controls are inserted,
or -1
to insert at the endpublic boolean isDynamic()
ContributionItem
IContributionItem
method returns false
. Subclasses may override.isDynamic
in interface IContributionItem
isDynamic
in class ContributionItem
true
if this item is dynamic, and
false
for normal itemsprotected void openEditor(IEditorDescriptor editorDescriptor, boolean openUsingDescriptor)
editorDescriptor
- the editor descriptor, or null for the system editoropenUsingDescriptor
- use the descriptor's editor ID for opening if false (normal case),
or use the descriptor itself if true (needed to fix bug 178235).
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.