Opening BPMN2 in Eclipse view instead of editor [message #1246135] |
Fri, 14 February 2014 19:06 |
|
Hi,
I want to open bpmn2 file in a view that does not have palette and dont allow editing of diagram .
I tried this way ...
private DiagramComposite diagramComposite;
public void createPartControl(Composite parent) {
diagramComposite = new DiagramComposite(this, parent, SWT.NONE);
diagramComposite.setLayout(new FillLayout());
diagramComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,true));
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getSelection();
diagramComposite.setInput(getEditorInput(selection));
}
private Bpmn2DiagramEditorInput getEditorInput(ISelection sel)throws Exception {
// String contents = getContents(sel) // my logic of getting contents
IStorage storage = new StringStorage(contents, node.getName());
IStorageEditorInput input = new StringInput(storage);
return convertToDiagramEditorInput(input);
}
private Bpmn2DiagramEditorInput convertToDiagramEditorInput(IEditorInput input) throws PartInitException {
URI modelUri = FileService.getInputUri(input);
if (modelUri == null)
throw new PartInitException("Not able");
String modelName = modelUri.trimFragment().trimFileExtension().lastSegment();
// We still need to create a Diagram object for this editor
final Diagram diagram = Graphiti.getPeCreateService().createDiagram(
"BPMN2", modelName, true); //$NON-NLS-1$
String diagramName = FileService.createTempName(modelName);
URI diagramUri = URI.createFileURI(diagramName);
FileService.createEmfFileForDiagram(diagramUri, diagram, null);
String providerId = GraphitiUi.getExtensionManager()
.getDiagramTypeProviderId(diagram.getDiagramTypeId());
return new Bpmn2DiagramEditorInput(modelUri, diagramUri, providerId);
}
As I found in code that... Type Provider ... Feature Provider are tightly coupled with editor as I am not opening it in editor so I am getting lot of issues....
I tried commenting out all code where it depending on editor (basically getting feature or tool for specific runtime)
Still not working ....
1. Is there any direct way or view available by bpmn2 so that I can use... ?
2. How can I restrict editing of diagram?
Thanks in advance
|
|
|
|
Powered by
FUDForum. Page generated in 0.03936 seconds