Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Opening an Editor programmatically...
Opening an Editor programmatically... [message #183890] Wed, 08 June 2005 12:13 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #183989 is a reply to message #183983] Wed, 08 June 2005 19:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Search this newsgroup.

"Timo Mika Gl
Re: Opening an Editor programmatically... [message #184739 is a reply to message #183890] Thu, 16 June 2005 04:17 Go to previous message
Eclipse UserFriend
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
Previous Topic:RetargetAction --- Custom requests --- Copy paste actions
Next Topic:old thread: direct edit tutorial/examples? (Andreas Holtz recommends good incremental GEF tutorial)
Goto Forum:
  


Current Time: Tue Dec 10 15:07:21 GMT 2024

Powered by FUDForum. Page generated in 0.05171 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top