running editor programatically [message #198196] |
Wed, 07 March 2007 10:27 |
Eclipse User |
|
|
|
Originally posted by: raushansharma2004.yahoo.com
hi,
i want to know how to run an editor programmatically.
i have written editor in MyEditor class
i have created one toolbar button ,what i require is when this button
is pressed, the editor should be called.can someone give me its solution
|
|
|
Re: running editor programatically [message #198220 is a reply to message #198196] |
Wed, 07 March 2007 11:06 |
Eclipse User |
|
|
|
Originally posted by: Markus.Bon.qgrp.com
The standard way to open an editor is using openEditor(...) from
org.eclipse.ui.ide.IDE:
IFile myFile = ...
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
IEditorPart editor = IDE.openEditor(page,myFile);
This opens the editor which is associated to the type of file you selected.
If you want to specify the editor to be opened explicitely (e.G. your
MyEditor), you can open the editor with a call like this:
IWorkbenchWindow workbenchWindow =
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
workbenchWindow.getActivePage().openEditor(myFile, editorID, true);
regards
Markus
raushan schrieb:
> hi, i want to know how to run an editor programmatically.
> i have written editor in MyEditor class
> i have created one toolbar button ,what i require is when this
> button is pressed, the editor should be called.can someone give me its
> solution
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.07842 seconds