Problem running the Editor for Directed Graphs as RCP application [message #249200] |
Thu, 04 June 2009 19:40  |
Eclipse User |
|
|
|
I am trying to run the Editor for Directed Graphs example, Step 17, as an
RCP application, and while I can create the directed graph in the editor
(i.e., add nodes and connections), I cannot delete anything: the keys
DELETE, UNDO (Ctl-z) and REDO (Ctl-y) have no effect.
Everything works fine if I start the Editor by selecting a file .par in
the Eclipse environment, so I assume the problem is in the way I start the
Editor in the RCP environment, but I followed exactly the example given
for the Digraph example, by adding corresponding classes GraphApplication,
GraphPerspective, GraphWorkbenchAdvisor, GraphWorkbenchWindowAdvisor, and
corresponding Extensions.
I also tried to replace the Text Editor with the Directed Graph Editor in
the RCP Text Editor example, and I obtain exactly the same behavior.
Can anybody tell me what is needed to have a GEF Editor fully work in an
RCP application?
Thanks in advance for any help
Andrea
Here is the code of the classes and the plugin.xml file:
public class GraphApplication implements IApplication {
public Object start(IApplicationContext context) throws Exception {
Display display = PlatformUI.createDisplay();
try {
int returnCode = PlatformUI.createAndRunWorkbench(display,
new GraphWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IApplication.EXIT_RESTART;
}
return IApplication.EXIT_OK;
} finally {
display.dispose();
}
}
public void stop() {
final IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null)
return;
final Display display = workbench.getDisplay();
display.syncExec(new Runnable() {
public void run() {
if (!display.isDisposed())
workbench.close();
}
});
}
public class GraphPerspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
}
}
public class GraphWorkbenchAdvisor extends WorkbenchAdvisor {
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
IWorkbenchWindowConfigurer configurer) {
return new GraphWorkbenchWindowAdvisor(configurer);
}
public String getInitialWindowPerspectiveId() {
return "org.jbpm.graph.perspective";
}
}
public class GraphWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
public GraphWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer
configurer) {
super(configurer);
}
public void postWindowCreate() {
try {
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
new Path("/project/file.par"));
getWindowConfigurer().getWindow().getActivePage().openEditor (
new FileInPlaceEditorInput(file),
"org.jbpm.graph.editor");
} catch (PartInitException e) {
e.printStackTrace();
}
super.postWindowCreate();
}
public void preWindowOpen() {
getWindowConfigurer().setInitialSize(new Point(450, 300));
getWindowConfigurer().setShowCoolBar(false);
getWindowConfigurer().setShowStatusLine(false);
getWindowConfigurer().setShowMenuBar(false);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
class="org.jbpm.graph.GraphEditor"
extensions="par"
icon="icons/graph.gif"
id="org.jbpm.graph.editor"
name="First jBPM Graph Editor"
contributorClass="org.jbpm.graph.ActionBarContributor">
</editor>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
class="org.jbpm.graph.rcp.GraphPerspective"
fixed="true"
icon="icons/graph.gif"
id="org.jbpm.graph.perspective"
name="%Perspective-Name">
</perspective>
</extension>
<extension
id="id1"
point="org.eclipse.core.runtime.applications">
<application
cardinality="singleton-global"
thread="main"
visible="true">
<run
class="org.jbpm.graph.rcp.GraphApplication">
</run>
</application>
</extension>
</plugin>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05837 seconds