Home » Eclipse Projects » Eclipse Platform » Get MultiPageEditorPart from MultiPageEditorActionBarContributor
Get MultiPageEditorPart from MultiPageEditorActionBarContributor [message #163419] |
Fri, 28 November 2003 19:38  |
Eclipse User |
|
|
|
Using the multi-page editor example, I have create my own editor. Now,
I want to use the MultiPageEditorActionBarContributor code to action a menu
bar icon to perform some validation on what is in the editor.
How do I get the currently active MultiPageEditorPart instance when the
menu bar icon is selected.
The example just kicks off a Message Dialog, but doesn't show how to call
a method in the original editor. When the menu bar item is selected, I
want to call a method (validateArtifact) back in my MeetingEditor object
to operate on the editor contents.
Any help would be appreciated.
Example:
MeetingEditor.java - my multi-page editor
public class MeetingEditor extends MultiPageEditorPart {
...
public void validateArtifact() {
}
...
}
MeetingEditorContributor.java - shows the pulldown and menu item for editor
NOTE: See commented section below.
public class MeetingEditorContributor extends
MultiPageEditorActionBarContributor {
private IEditorPart activeEditorPart;
private Action sampleAction;
/**
* Creates a multi-page contributor.
*/
public MeetingEditorContributor() {
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));
}
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));
actionBars.updateActionBars();
}
}
private void createActions() {
sampleAction = new Action() {
public void run() {
///////////////////////////////////
// I want to call back to MeetingEditor object's validateArtifact method
// instead of this MessageDialog call
///////////////////////////////////
MessageDialog.openInformation(null, "editor Plug-in", "Sample Action
Executed");
}
};
sampleAction.setText("Validate Artifact");
sampleAction.setToolTipText("Validate Artifact");
sampleAction.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().
getImageDescriptor(ISharedImages.IMG_OBJS_TASK_TSK));
}
public void contributeToMenu(IMenuManager manager) {
IMenuManager menu = new MenuManager("&Artifact");
manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITION S, menu);
menu.add(sampleAction);
}
public void contributeToToolBar(IToolBarManager manager) {
manager.add(new Separator());
manager.add(sampleAction);
}
}
|
|
|
Re: Get MultiPageEditorPart from MultiPageEditorActionBarContributor [message #163463 is a reply to message #163419] |
Sat, 29 November 2003 00:01   |
Eclipse User |
|
|
|
Originally posted by: sma_r.hotmial.com
I think if you want the instance of the MultiPageeditorPart you can try
the following code(i think this is what you might need).
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
IEditorPart part = page.getActiveEditor();
I hope this helps you.
Syed
Don Dunne wrote:
> Using the multi-page editor example, I have create my own editor. Now,
> I want to use the MultiPageEditorActionBarContributor code to action a menu
> bar icon to perform some validation on what is in the editor.
> How do I get the currently active MultiPageEditorPart instance when the
> menu bar icon is selected.
> The example just kicks off a Message Dialog, but doesn't show how to call
> a method in the original editor. When the menu bar item is selected, I
> want to call a method (validateArtifact) back in my MeetingEditor object
> to operate on the editor contents.
> Any help would be appreciated.
> Example:
> MeetingEditor.java - my multi-page editor
> public class MeetingEditor extends MultiPageEditorPart {
> ...
> public void validateArtifact() {
> }
> ...
> }
> MeetingEditorContributor.java - shows the pulldown and menu item for editor
> NOTE: See commented section below.
> public class MeetingEditorContributor extends
> MultiPageEditorActionBarContributor {
> private IEditorPart activeEditorPart;
> private Action sampleAction;
> /**
> * Creates a multi-page contributor.
> */
> public MeetingEditorContributor() {
> 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));
> }
> 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));
> actionBars.updateActionBars();
> }
> }
> private void createActions() {
> sampleAction = new Action() {
> public void run() {
> ///////////////////////////////////
> // I want to call back to MeetingEditor object's validateArtifact method
> // instead of this MessageDialog call
> ///////////////////////////////////
> MessageDialog.openInformation(null, "editor Plug-in", "Sample Action
> Executed");
> }
> };
> sampleAction.setText("Validate Artifact");
> sampleAction.setToolTipText("Validate Artifact");
>
sampleAction.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().
> getImageDescriptor(ISharedImages.IMG_OBJS_TASK_TSK));
> }
> public void contributeToMenu(IMenuManager manager) {
> IMenuManager menu = new MenuManager("&Artifact");
> manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITION S, menu);
> menu.add(sampleAction);
> }
> public void contributeToToolBar(IToolBarManager manager) {
> manager.add(new Separator());
> manager.add(sampleAction);
> }
> }
|
|
|
Re: Get MultiPageEditorPart from MultiPageEditorActionBarContributor [message #163718 is a reply to message #163463] |
Sun, 30 November 2003 12:42   |
Eclipse User |
|
|
|
That gets me the visible editor on the page I'm on. What I'm looking for
is how do I get the instance of the object that created the editor page.
I need to call the "validateArtifact" method that is part of my object
extended from MultiPageEditorPart.
Let me try a different way: Open two different files with the same
editor (that I created from extending MultiPageEditorPart). I then push
the button was created by a MultiPageEditorActionBarContributor. How
do I get the instance of the editor that is currently active and not the
other one?
Syed wrote:
> I think if you want the instance of the MultiPageeditorPart you can try
> the following code(i think this is what you might need).
> IWorkbench workbench = PlatformUI.getWorkbench();
> IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
> workbench.getActiveWorkbenchWindow();
> IWorkbenchPage page = window.getActivePage();
> IEditorPart part = page.getActiveEditor();
> I hope this helps you.
> Syed
> Don Dunne wrote:
> > Using the multi-page editor example, I have create my own editor. Now,
> > I want to use the MultiPageEditorActionBarContributor code to action a menu
> > bar icon to perform some validation on what is in the editor.
> > How do I get the currently active MultiPageEditorPart instance when the
> > menu bar icon is selected.
> > The example just kicks off a Message Dialog, but doesn't show how to call
> > a method in the original editor. When the menu bar item is selected, I
> > want to call a method (validateArtifact) back in my MeetingEditor object
> > to operate on the editor contents.
> > Any help would be appreciated.
> > Example:
> > MeetingEditor.java - my multi-page editor
> > public class MeetingEditor extends MultiPageEditorPart {
> > ...
> > public void validateArtifact() {
> > }
> > ...
> > }
> > MeetingEditorContributor.java - shows the pulldown and menu item for editor
> > NOTE: See commented section below.
> > public class MeetingEditorContributor extends
> > MultiPageEditorActionBarContributor {
> > private IEditorPart activeEditorPart;
> > private Action sampleAction;
> > /**
> > * Creates a multi-page contributor.
> > */
> > public MeetingEditorContributor() {
> > 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));
> > }
> > 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));
> > actionBars.updateActionBars();
> > }
> > }
> > private void createActions() {
> > sampleAction = new Action() {
> > public void run() {
> > ///////////////////////////////////
> > // I want to call back to MeetingEditor object's validateArtifact method
> > // instead of this MessageDialog call
> > ///////////////////////////////////
> > MessageDialog.openInformation(null, "editor Plug-in", "Sample Action
> > Executed");
> > }
> > };
> > sampleAction.setText("Validate Artifact");
> > sampleAction.setToolTipText("Validate Artifact");
> >
>
sampleAction.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().
> > getImageDescriptor(ISharedImages.IMG_OBJS_TASK_TSK));
> > }
> > public void contributeToMenu(IMenuManager manager) {
> > IMenuManager menu = new MenuManager("&Artifact");
> > manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITION S, menu);
> > menu.add(sampleAction);
> > }
> > public void contributeToToolBar(IToolBarManager manager) {
> > manager.add(new Separator());
> > manager.add(sampleAction);
> > }
> > }
|
|
|
Re: Get MultiPageEditorPart from MultiPageEditorActionBarContributor [message #163726 is a reply to message #163718] |
Sun, 30 November 2003 13:35   |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
"Don Dunne" <donald.g.dunne@boeing.com> wrote in message
news:bqda6f$ot$1@eclipse.org...
> That gets me the visible editor on the page I'm on. What I'm looking for
> is how do I get the instance of the object that created the editor page.
> I need to call the "validateArtifact" method that is part of my object
> extended from MultiPageEditorPart.
>
> Let me try a different way: Open two different files with the same
> editor (that I created from extending MultiPageEditorPart). I then push
> the button was created by a MultiPageEditorActionBarContributor. How
> do I get the instance of the editor that is currently active and not the
> other one?
setActivePage() is called before you are asked to run. If you want the
MultiPageEditorPart instead of the active editor within that part, override
setActiveEditor() and remember it.
Bob
>
> Syed wrote:
>
> > I think if you want the instance of the MultiPageeditorPart you can try
> > the following code(i think this is what you might need).
>
> > IWorkbench workbench = PlatformUI.getWorkbench();
> > IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
> > workbench.getActiveWorkbenchWindow();
> > IWorkbenchPage page = window.getActivePage();
> > IEditorPart part = page.getActiveEditor();
>
> > I hope this helps you.
>
> > Syed
>
>
> > Don Dunne wrote:
>
> > > Using the multi-page editor example, I have create my own editor.
Now,
> > > I want to use the MultiPageEditorActionBarContributor code to action a
menu
> > > bar icon to perform some validation on what is in the editor.
>
> > > How do I get the currently active MultiPageEditorPart instance when
the
> > > menu bar icon is selected.
>
> > > The example just kicks off a Message Dialog, but doesn't show how to
call
> > > a method in the original editor. When the menu bar item is selected,
I
> > > want to call a method (validateArtifact) back in my MeetingEditor
object
> > > to operate on the editor contents.
>
> > > Any help would be appreciated.
>
> > > Example:
>
> > > MeetingEditor.java - my multi-page editor
>
> > > public class MeetingEditor extends MultiPageEditorPart {
> > > ...
> > > public void validateArtifact() {
> > > }
> > > ...
> > > }
>
> > > MeetingEditorContributor.java - shows the pulldown and menu item for
editor
>
> > > NOTE: See commented section below.
>
> > > public class MeetingEditorContributor extends
> > > MultiPageEditorActionBarContributor {
> > > private IEditorPart activeEditorPart;
> > > private Action sampleAction;
> > > /**
> > > * Creates a multi-page contributor.
> > > */
> > > public MeetingEditorContributor() {
> > > 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));
> > > }
>
> > > 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));
> > > actionBars.updateActionBars();
> > > }
> > > }
> > > private void createActions() {
> > > sampleAction = new Action() {
> > > public void run() {
>
> > > ///////////////////////////////////
> > > // I want to call back to MeetingEditor object's validateArtifact
method
> > > // instead of this MessageDialog call
> > > ///////////////////////////////////
> > > MessageDialog.openInformation(null, "editor Plug-in", "Sample Action
> > > Executed");
> > > }
> > > };
> > > sampleAction.setText("Validate Artifact");
> > > sampleAction.setToolTipText("Validate Artifact");
> > >
> >
>
sampleAction.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().
> > > getImageDescriptor(ISharedImages.IMG_OBJS_TASK_TSK));
> > > }
> > > public void contributeToMenu(IMenuManager manager) {
> > > IMenuManager menu = new MenuManager("&Artifact");
> > > manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITION S, menu);
> > > menu.add(sampleAction);
> > > }
> > > public void contributeToToolBar(IToolBarManager manager) {
> > > manager.add(new Separator());
> > > manager.add(sampleAction);
> > > }
> > > }
>
>
|
|
|
Re: Get MultiPageEditorPart from MultiPageEditorActionBarContributor [message #163775 is a reply to message #163726] |
Sun, 30 November 2003 15:00  |
Eclipse User |
|
|
|
That did it, thanks!!
Bob Foster wrote:
> "Don Dunne" <donald.g.dunne@boeing.com> wrote in message
> news:bqda6f$ot$1@eclipse.org...
> > That gets me the visible editor on the page I'm on. What I'm looking for
> > is how do I get the instance of the object that created the editor page.
> > I need to call the "validateArtifact" method that is part of my object
> > extended from MultiPageEditorPart.
> >
> > Let me try a different way: Open two different files with the same
> > editor (that I created from extending MultiPageEditorPart). I then push
> > the button was created by a MultiPageEditorActionBarContributor. How
> > do I get the instance of the editor that is currently active and not the
> > other one?
> setActivePage() is called before you are asked to run. If you want the
> MultiPageEditorPart instead of the active editor within that part, override
> setActiveEditor() and remember it.
> Bob
> >
> > Syed wrote:
> >
> > > I think if you want the instance of the MultiPageeditorPart you can try
> > > the following code(i think this is what you might need).
> >
> > > IWorkbench workbench = PlatformUI.getWorkbench();
> > > IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
> > > workbench.getActiveWorkbenchWindow();
> > > IWorkbenchPage page = window.getActivePage();
> > > IEditorPart part = page.getActiveEditor();
> >
> > > I hope this helps you.
> >
> > > Syed
> >
> >
> > > Don Dunne wrote:
> >
> > > > Using the multi-page editor example, I have create my own editor.
> Now,
> > > > I want to use the MultiPageEditorActionBarContributor code to action a
> menu
> > > > bar icon to perform some validation on what is in the editor.
> >
> > > > How do I get the currently active MultiPageEditorPart instance when
> the
> > > > menu bar icon is selected.
> >
> > > > The example just kicks off a Message Dialog, but doesn't show how to
> call
> > > > a method in the original editor. When the menu bar item is selected,
> I
> > > > want to call a method (validateArtifact) back in my MeetingEditor
> object
> > > > to operate on the editor contents.
> >
> > > > Any help would be appreciated.
> >
> > > > Example:
> >
> > > > MeetingEditor.java - my multi-page editor
> >
> > > > public class MeetingEditor extends MultiPageEditorPart {
> > > > ...
> > > > public void validateArtifact() {
> > > > }
> > > > ...
> > > > }
> >
> > > > MeetingEditorContributor.java - shows the pulldown and menu item for
> editor
> >
> > > > NOTE: See commented section below.
> >
> > > > public class MeetingEditorContributor extends
> > > > MultiPageEditorActionBarContributor {
> > > > private IEditorPart activeEditorPart;
> > > > private Action sampleAction;
> > > > /**
> > > > * Creates a multi-page contributor.
> > > > */
> > > > public MeetingEditorContributor() {
> > > > 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));
> > > > }
> >
> > > > 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));
> > > > actionBars.updateActionBars();
> > > > }
> > > > }
> > > > private void createActions() {
> > > > sampleAction = new Action() {
> > > > public void run() {
> >
> > > > ///////////////////////////////////
> > > > // I want to call back to MeetingEditor object's validateArtifact
> method
> > > > // instead of this MessageDialog call
> > > > ///////////////////////////////////
> > > > MessageDialog.openInformation(null, "editor Plug-in", "Sample Action
> > > > Executed");
> > > > }
> > > > };
> > > > sampleAction.setText("Validate Artifact");
> > > > sampleAction.setToolTipText("Validate Artifact");
> > > >
> > >
> >
> sampleAction.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().
> > > > getImageDescriptor(ISharedImages.IMG_OBJS_TASK_TSK));
> > > > }
> > > > public void contributeToMenu(IMenuManager manager) {
> > > > IMenuManager menu = new MenuManager("&Artifact");
> > > > manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITION S, menu);
> > > > menu.add(sampleAction);
> > > > }
> > > > public void contributeToToolBar(IToolBarManager manager) {
> > > > manager.add(new Separator());
> > > > manager.add(sampleAction);
> > > > }
> > > > }
> >
> >
|
|
|
Goto Forum:
Current Time: Thu Jul 17 20:09:06 EDT 2025
Powered by FUDForum. Page generated in 0.05714 seconds
|