|
|
|
|
|
|
|
|
Re: Compatibility with EMF/CDO [message #870197 is a reply to message #868576] |
Mon, 07 May 2012 08:43 |
Erdal Karaca Messages: 854 Registered: July 2009 |
Senior Member |
|
|
So, I have derived my EditorPart from DiagramEditor like the following...
Problem: When dropping objects from the palette, the appropriate AddFeature/CreateFeature of the diagram feature provider is called, but the visual elements are not shown in the editor. Did I skip some important settings? Or maybe, I am missing some additional settings in my custom editor?
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
getUpdateBehavior().createEditingDomain();
// super.super.init(...);
{
setSite(site);
setInput(input);
getCommandStack().addCommandStackListener(this);
getSite().getWorkbenchWindow().getSelectionService()
.addSelectionListener(this);
initializeActionRegistry();
}
getUpdateBehavior().init();
}
@Override
protected void doSetInput(IEditorInput input) {
MyEditorInput diagramEditorInput = (MyEditorInput) input;
// determine filename
Assert.isNotNull(input, "The IEditorInput must not be null"); //$NON-NLS-1$
Diagram diagram = diagramEditorInput.getDiagram();
// can happen if editor is started with invalid URI
Assert.isNotNull(diagram, "No Diagram found for URI '" //$NON-NLS-1$
+ "'. . See the error log for details."); //$NON-NLS-1$
String providerId = diagramEditorInput.getProviderId();
Assert.isNotNull(
providerId,
"DiagramEditorInput does not convey a Provider ID '" + diagramEditorInput //$NON-NLS-1$
+ "'. . See the error log for details."); //$NON-NLS-1$
// get according diagram-type-provider
IDiagramTypeProvider diagramTypeProvider = GraphitiUi
.getExtensionManager().createDiagramTypeProvider(providerId);
Assert.isNotNull(
diagramTypeProvider,
"could not find diagram type provider for " + diagram.getDiagramTypeId()); //$NON-NLS-1$
diagramTypeProvider.init(diagram, this);
IConfigurationProvider configurationProvider = new ConfigurationProvider(
this, diagramTypeProvider);
setConfigurationProvider(configurationProvider);
getRefreshBehavior().handleAutoUpdateAtStartup();
registerBusinessObjectsListener();
registerDiagramResourceSetListener();
refreshTitle();
}
@Override
public void doSave(IProgressMonitor monitor) {
getResourceAccess().save();
}
Notes:
- I have changed the visibility of some protected methods to public
- I have refactored the contents of org.eclipse.graphiti.ui.editor.DiagramEditor.setInput(IEditorInput) and introduced a doSetInput to allow to call EditorInput.setInput
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04714 seconds