Opening an Editor programmatically... [message #183890] |
Wed, 08 June 2005 12:13 |
Eclipse User |
|
|
|
Originally posted by: timo.glaesser.gmx.net
Is there a way to open an editor programmatically? I have a few views.
One is used for typing queries another view may display a graphical
version of that query i.e. a QueryExecutionPlan. Is there a way to
notify the editor directly without writing the query into a file and
having to click on it to open up the editor?
Thanks in advance
Timo&*
|
|
|
Re: Opening an Editor programmatically... [message #183918 is a reply to message #183890] |
Wed, 08 June 2005 15:03 |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
This isn't really a GEF specific question. However, views and editors are
part of the Eclipse workbench and they are pretty easy to open giving they
have been created already. Here is an example of opening a view.
IWorkbench workBench = PlatformUI.getWorkbench();
IWorkbenchWindow myworkbenchWindow =
workBench.getActiveWorkbenchWindow();
IWorkbenchPage page = myworkbenchWindow.getActivePage();
try {
IViewPart view = page.showView("com.ti.ccstudio.setup.views.Setup");
} catch (PartInitException e) {
ErrorDialog.openError(myworkbenchWindow.getShell(),
WorkbenchMessages.getString("ShowView.errorTitle"), //$NON-NLS-1$
e.getMessage(), e.getStatus());
}
Regards,
Harsh Sabikhi
|
|
|
Re: Opening an Editor programmatically... [message #183983 is a reply to message #183918] |
Wed, 08 June 2005 19:20 |
Eclipse User |
|
|
|
Originally posted by: timo.glaesser.gmx.net
That's show the editor... but is there a defined way how I can set a
model that's not loaed from a file but created programatically?
Timo&*
Harsh Sabikhi wrote:
> This isn't really a GEF specific question. However, views and editors
> are part of the Eclipse workbench and they are pretty easy to open
> giving they have been created already. Here is an example of opening a
> view.
>
> IWorkbench workBench = PlatformUI.getWorkbench();
> IWorkbenchWindow myworkbenchWindow =
> workBench.getActiveWorkbenchWindow();
> IWorkbenchPage page = myworkbenchWindow.getActivePage();
> try {
> IViewPart view =
> page.showView("com.ti.ccstudio.setup.views.Setup");
> } catch (PartInitException e) {
> ErrorDialog.openError(myworkbenchWindow.getShell(),
> WorkbenchMessages.getString("ShowView.errorTitle"),
> //$NON-NLS-1$
> e.getMessage(), e.getStatus());
> }
>
>
> Regards,
>
> Harsh Sabikhi
>
>
|
|
|
|
Re: Opening an Editor programmatically... [message #184739 is a reply to message #183890] |
Thu, 16 June 2005 04:17 |
Eclipse User |
|
|
|
Originally posted by: Angel.Roman.prismtech.com
Timo Mika Gläßer wrote:
> Is there a way to open an editor programmatically? I have a few views.
> One is used for typing queries another view may display a graphical
> version of that query i.e. a QueryExecutionPlan. Is there a way to
> notify the editor directly without writing the query into a file and
> having to click on it to open up the editor?
>
> Thanks in advance
>
> Timo&*
Search for this:
Re: Launching an editor without a file - openEditor()
One way to do this is to create a QueryPlanEditorInput class.
such as:
public class QueryPlanEditorInput implements IEditorInput
{
//fill up the implementation of the IEditorInput interface
//add this to the class after you satisfy the IEditorInput
private QueryExecutionPlan m_qExecPlan;
public void setQueryExecutionPlan(QueryExecutionPlan qep)
{
m_qExecPlan = qep;
}
public QueryExecutionPlan getQueryExecutionPlan()
{
return m_qExecPlan;
}
}
Open the editor programmatically however instead of passing a
IFileEditorInput pass in an instance of QueryPlanEditorInput with the
model inserted into it via
myQueryEditorInput.setQueryExecutionPlan(myQep);
In the setInput method of the graphical editor. get the query model from
the IEditorInput by downcasting to QueryPlanEditorInput and doing a
getQueryExecutionPlan() on it. Now you should have the model you created
programmatically.
Regards,
Angel
|
|
|
Powered by
FUDForum. Page generated in 0.05171 seconds