|
Re: Drilldown feature DiagramInput [message #690228 is a reply to message #690154] |
Wed, 29 June 2011 07:57 |
Michael Wenz Messages: 1931 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
Murthy,
we added these line to avoid the bug that one diagram can be opened in more
than one diagram editor (for one diagram type). To do that we needed to make
sure that the URI stored in the editor input is always the same for the same
diagram.
What I don't yet understand is why this affects your drill down behavior? Is
the new diagram that should be opened the same as the current one? If yes,
the drill down will not open a new editor, but the drill down feature's
intention is to open another diagram, not the same one again. What would be
displayed in the second diagram?
Michael
"Murthybhat" schrieb im Newsbeitrag news:iue9qf$u9v$1@news.eclipse.org...
Hello,
I am using the drilldown feature of graphiti to open navigate into my
selection. The code snippet i used to open up a new editor was as below:
Diagram diagram = ...
String providerId = ...
DiagramEditorInput editorInput = new
DiagramEditorInput(EcoreUtil.getURI(diagram),getDiagramEditor().getEditingDomain(),providerId);
But with the latest version of graphiti I am unable to do that. The only
thing I see that affects my feature that has changed is the
"createNormalizedUri()" method in DiagramEditorInput.java. If I comment out
the below two lines, it works like before.
URI trimFragment = ret.trimFragment();
ret = GraphitiUiInternal.getEmfService().mapDiagramFileUriToDiagramUri(ret);
Could someone please help me out and tell me what do i need to change to
adapt to the new functionality ?
Thanks in advance.
Best Regards,
Murthy
|
|
|
Re: Drilldown feature DiagramInput [message #690265 is a reply to message #690228] |
Wed, 29 June 2011 09:43 |
Murthy Bhat Messages: 159 Registered: July 2009 |
Senior Member |
|
|
Hello Michael,
I have the following scenario. I have a diagram editor which has some parent component and some child components. A Parent component can either have child components or more parent components. On double clicking of the parent, a new diagram is opened which is similar to the current diagram but the chosenparent as the root now.
My code looks something like this
@Override
public void execute(ICustomContext context) {
if(feature==DRILLDOWN_OPEN)
super.execute(context);
else if(feature==DRILLDOWN_CREATE)
createNewAndOpen(context);
}
private void createNewAndOpen(ICustomContext context) {
final String diagramTypeId = "DiagramType";
Child child = getChild(context);
final String diagramName = "Child";
Diagram diagram = Graphiti.getPeCreateService().createDiagram(diagramTypeId, diagramName, true);
//Associating diagram with context
link(diagram, child);
getDiagram().eResource().getContents().add(diagram);
String providerId = GraphitiUi.getExtensionManager().getDiagramTypeProviderId(diagram.getDiagramTypeId());
URI uri = EcoreUtil.getURI(child);
DiagramEditorInput editorInput = new DiagramEditorInput(uri, getDiagramEditor().getEditingDomain(), providerId);
try {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart openEditor = activePage.openEditor(editorInput, DiagramEditor.DIAGRAM_EDITOR_ID);
} catch (PartInitException e) {
String error = "Error while opening diagram editor";
ErrorDialog.openError(getShell(), "An error occured", null, status);
}
}
With those two lines in diagrameditorinput, the "normalized uri" is the same as the parent uri. And hence the same diagram is opened again. any thoughts ?
[Updated on: Wed, 29 June 2011 09:46] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05346 seconds