Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create a .xxx_diagram by Action
Create a .xxx_diagram by Action [message #79295] Tue, 21 November 2006 14:53 Go to next message
Eclipse UserFriend
Originally posted by: julias.frb.br

How one can call the digram creation wizard by a custom Action
(org.eclipse.jface.action.Action)?

Thanks
Julia
Re: Create a .xxx_diagram by Action [message #79310 is a reply to message #79295] Tue, 21 November 2006 14:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: julias.frb.br

Julia Sartori wrote:
> How one can call the digram creation wizard by a custom Action
> (org.eclipse.jface.action.Action)?
>
> Thanks
> Julia
Sorry, being more specific, i've created an Action that have:

public void run() {
try{
final HiperioncadCreationWizard theWiz = new
hiperioncad.diagram.part.HiperioncadCreationWizard();


final Shell shell =
RoxUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWi ndow().getShell();
final WizardDialog dialog = new WizardDialog(shell, (IWizard) theWiz);
dialog.create();

theWiz.init(RoxUIPlugin.getDefault().getWorkbench(), selection);
dialog.open();


}catch(Exception e){
e.printStackTrace();
}
}


but i keep getting this:

java.lang.NullPointerException
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.EditorWizardPage.initialPopulateContainerNameField(Edito rWizardPage.java:304)
at
org.eclipse.ui.dialogs.WizardNewFileCreationPage.createContr ol(WizardNewFileCreationPage.java:199)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.EditorWizardPage.createControl(EditorWizardPage.java:286 )
at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.ja va:180)
at
org.eclipse.jface.wizard.WizardDialog.createPageControls(Wiz ardDialog.java:614)
at
org.eclipse.jface.wizard.WizardDialog.createContents(WizardD ialog.java:502)
at org.eclipse.jface.window.Window.create(Window.java:426)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1124)
at org.eclipse.jface.window.Window.open(Window.java:785)
at
org.projetorox.rox.ui.actions.NewResourceAction.run(NewResou rceAction.java:61)
....


Help please!
Re: Create a .xxx_diagram by Action [message #79412 is a reply to message #79310] Tue, 21 November 2006 16:17 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Julia,

Can you take a look on generated ???InitDiagramFileAction ? Looks this is
implementation of such action.

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #79471 is a reply to message #79412] Tue, 21 November 2006 17:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: julias.frb.br

Alex,
the ???InitDiagramFileAction implements an IObjectActionDelegate and not
an IAction.
Because of this it does not implement the setActivePart method that the
InitDiagramFileAction needs..

How can i get the active workbench editpart in a common Action? is that
possible?
im trying to call the whole creation (ecore and diagram) from a simple
menu in my plugin, to ease the process to the final user (will click New
project, then New Diagram rather than New project, then right click on
the project, new, Example, Diagram)

if i could get the wizard to work from the action would be perfect! ^^

can you help me?
Thanks!


Alex Shatalin wrote:
> Hello Julia,
>
> Can you take a look on generated ???InitDiagramFileAction ? Looks this
> is implementation of such action.
>
> -----------------
> Alex Shatalin
>
>
Re: Create a .xxx_diagram by Action [message #79529 is a reply to message #79471] Tue, 21 November 2006 18:28 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Julia,

You can take a look on existing implementations of IAction interface dealing
with IObjectActionDelegate - org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.
In initDelegate() it is getting active part with the following code snippet:


final IWorkbenchPage page = window.getActivePage();
activePart = page.getActivePart();

window instance you can get using: PlatformUI.getWorkbench().getActiveWorkbenchWindow()

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #79558 is a reply to message #79529] Tue, 21 November 2006 18:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: julias.frb.br

Thanks Alex, i found out that i have to put the wizard to work, i did this:

try{
final HiperioncadCreationWizard theWiz = new HiperioncadCreationWizard();
theWiz.init(RoxUIPlugin.getDefault().getWorkbench(), selection);

final Shell shell =
RoxUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWi ndow().getShell();
final WizardDialog dialog = new WizardDialog(shell, theWiz);

dialog.open();
}catch(Exception e){
e.printStackTrace();
}

and im getting a NullPointerException on:
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.EditorWizardPage.initialPopulateContainerNameField(Edito rWizardPage.java:304)
at
org.eclipse.ui.dialogs.WizardNewFileCreationPage.createContr ol(WizardNewFileCreationPage.java:199)


do you have any clue?
thanks again =)

Alex Shatalin wrote:
> Hello Julia,
>
> You can take a look on existing implementations of IAction interface
> dealing with IObjectActionDelegate -
> org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy. In
> initDelegate() it is getting active part with the following code snippet:
>
>
> final IWorkbenchPage page = window.getActivePage();
> activePart = page.getActivePart();
>
> window instance you can get using:
> PlatformUI.getWorkbench().getActiveWorkbenchWindow()
>
> -----------------
> Alex Shatalin
>
>
Re: Create a .xxx_diagram by Action [message #79573 is a reply to message #79558] Tue, 21 November 2006 19:35 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Julia,

> and im getting a NullPointerException on:
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.Editor
> WizardPage.initialPopulateContainerNameField(EditorWizardPag e.java:304)

Well, I think the selection is null (you can check it in the debugger). You
should create StructuredSelection instance passing desired file as a parameter.
Then you are calling popup menu on some file the selection is equals to this
file, so corresponding parameter will be passed to ???InitDiagramFileAction...

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #79587 is a reply to message #79573] Tue, 21 November 2006 19:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: julias.frb.br

Thanks Alex! it worked!! ^^
(by the way, do you know how to show a grid automatically on the diagram?)

here's the final solution:

public void run() {
try{
HiperioncadCreationWizard theWiz = new HiperioncadCreationWizard();
IStructuredSelection selection = new
StructuredSelection(RoxUIPlugin.getDefault().getWorkbench(). getActiveWorkbenchWindow().getActivePage().getSelection());

theWiz.init(RoxUIPlugin.getDefault().getWorkbench(), selection);

WizardDialog dialog = new
WizardDialog(RoxUIPlugin.getDefault().getWorkbench().getActi veWorkbenchWindow().getShell(),
theWiz);

dialog.open();

}catch(Exception e){
e.printStackTrace();
}

}

Thanks!!

Alex Shatalin wrote:
> Hello Julia,
>
>> and im getting a NullPointerException on:
>> at
>> org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.Editor
>> WizardPage.initialPopulateContainerNameField(EditorWizardPag e.java:304)
>
> Well, I think the selection is null (you can check it in the debugger).
> You should create StructuredSelection instance passing desired file as a
> parameter. Then you are calling popup menu on some file the selection is
> equals to this file, so corresponding parameter will be passed to
> ???InitDiagramFileAction...
>
> -----------------
> Alex Shatalin
>
>
Re: Create a .xxx_diagram by Action [message #165266 is a reply to message #79587] Thu, 13 December 2007 13:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Hi Alex and Julia.

First, thank you Julia for posting your solution!

Second, is it possible to create the diagram without launching the
wizard? (The action creates a new diagram with default values)


Best Regards,

Tomas Zijdemans


Julia Sartori wrote:
> Thanks Alex! it worked!! ^^
> (by the way, do you know how to show a grid automatically on the diagram?)
>
> here's the final solution:
>
> public void run() {
> try{
> HiperioncadCreationWizard theWiz = new HiperioncadCreationWizard();
> IStructuredSelection selection = new
> StructuredSelection(RoxUIPlugin.getDefault().getWorkbench(). getActiveWorkbenchWindow().getActivePage().getSelection());
>
>
> theWiz.init(RoxUIPlugin.getDefault().getWorkbench(), selection);
>
> WizardDialog dialog = new
> WizardDialog(RoxUIPlugin.getDefault().getWorkbench().getActi veWorkbenchWindow().getShell(),
> theWiz);
>
> dialog.open();
>
> }catch(Exception e){
> e.printStackTrace();
> }
>
> }
>
> Thanks!!
>
> Alex Shatalin wrote:
>> Hello Julia,
>>
>>> and im getting a NullPointerException on:
>>> at
>>> org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.Editor
>>> WizardPage.initialPopulateContainerNameField(EditorWizardPag e.java:304)
>>
>> Well, I think the selection is null (you can check it in the
>> debugger). You should create StructuredSelection instance passing
>> desired file as a parameter. Then you are calling popup menu on some
>> file the selection is equals to this file, so corresponding parameter
>> will be passed to ???InitDiagramFileAction...
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: Create a .xxx_diagram by Action [message #169393 is a reply to message #79587] Wed, 23 January 2008 09:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

I have a follow up on this. Would it be possible to:
1. Create an action which opens a XYZdiagram.
2. Then loads that diagrams resource together with the diagram the
action was lanched from?

Diagram Partitioning does this. There is some code in the
opendiagrambehavior that syncs the resources. Maybe this code could be
made to work in an action?

That would be very cool!

Cheers,
Tomas Zijdemans


Julia Sartori wrote:
> Thanks Alex! it worked!! ^^
> (by the way, do you know how to show a grid automatically on the diagram?)
>
> here's the final solution:
>
> public void run() {
> try{
> HiperioncadCreationWizard theWiz = new HiperioncadCreationWizard();
> IStructuredSelection selection = new
> StructuredSelection(RoxUIPlugin.getDefault().getWorkbench(). getActiveWorkbenchWindow().getActivePage().getSelection());
>
>
> theWiz.init(RoxUIPlugin.getDefault().getWorkbench(), selection);
>
> WizardDialog dialog = new
> WizardDialog(RoxUIPlugin.getDefault().getWorkbench().getActi veWorkbenchWindow().getShell(),
> theWiz);
>
> dialog.open();
>
> }catch(Exception e){
> e.printStackTrace();
> }
>
> }
>
> Thanks!!
>
> Alex Shatalin wrote:
>> Hello Julia,
>>
>>> and im getting a NullPointerException on:
>>> at
>>> org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.Editor
>>> WizardPage.initialPopulateContainerNameField(EditorWizardPag e.java:304)
>>
>> Well, I think the selection is null (you can check it in the
>> debugger). You should create StructuredSelection instance passing
>> desired file as a parameter. Then you are calling popup menu on some
>> file the selection is equals to this file, so corresponding parameter
>> will be passed to ???InitDiagramFileAction...
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: Create a .xxx_diagram by Action [message #169432 is a reply to message #169393] Wed, 23 January 2008 10:46 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tomas,

Sorry, did not get the quiestion.
If you need this question - just copy the code from generated OpenDiagramEditPolicy
- it should contains all you need to open an editor for the diagram file.
By default parent- and child- diagrams will be stored in the same EMF Resource,
so parent diagram will be automatically loaded into the corresponsing ResourceSet
on openning child- one.

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #169481 is a reply to message #169432] Wed, 23 January 2008 12:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Alex Shatalin wrote:
> Hello Tomas,
>
> Sorry, did not get the quiestion.

Ok. Sorry for explaining unclear. I have 2 different diagrams. I want to
launch one of them from a popupaction (attached to an element in the
other diagram)


If you need this question - just copy
> the code from generated OpenDiagramEditPolicy - it should contains all
> you need to open an editor for the diagram file.

Ok. Guess It is this:
for (Iterator it = diagramFacet.eResource().getResourceSet()
..getResources().iterator(); it.hasNext();) {
Resource nextResource = (Resource) it.next();

if (nextResource.isLoaded() &&
!getEditingDomain().isReadOnly(nextResource)) {
nextResource.save(EditorDiagramEditorUtil .getSaveOptions());
}

}

> By default parent- and child- diagrams will be stored in the same EMF
> Resource, so parent diagram will be automatically loaded into the
> corresponsing ResourceSet on openning child- one.

I see. These diagrams are not parent/child (they are unrelated). Is this
still possible?


Thanks for helping!

Tomas Zijdemans
Re: Create a .xxx_diagram by Action [message #169550 is a reply to message #169481] Wed, 23 January 2008 18:05 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tomas,

> I see. These diagrams are not parent/child (they are unrelated). Is
> this still possible?
Well, OpenDiagramEditPolicy will put new "unrelated" diagram for the diagram
element you double-click on into the same diagram Resource, so it is possible.
If you need to store it in a different resource - you should modify DocumentProvider
to preload this resource on creating new instance of EditingDomain.

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #170334 is a reply to message #79587] Tue, 29 January 2008 10:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Julia Sartori wrote:
> Thanks Alex! it worked!! ^^
> (by the way, do you know how to show a grid automatically on the diagram?)
>
> here's the final solution:
>
> public void run() {
> try{
> HiperioncadCreationWizard theWiz = new HiperioncadCreationWizard();
> IStructuredSelection selection = new
> StructuredSelection(RoxUIPlugin.getDefault().getWorkbench(). getActiveWorkbenchWindow().getActivePage().getSelection());


Where does RoxUIPlugin come from? What kind of class is it?





>
>
> theWiz.init(RoxUIPlugin.getDefault().getWorkbench(), selection);
>
> WizardDialog dialog = new
> WizardDialog(RoxUIPlugin.getDefault().getWorkbench().getActi veWorkbenchWindow().getShell(),
> theWiz);
>
> dialog.open();
>
> }catch(Exception e){
> e.printStackTrace();
> }
>
> }
>
> Thanks!!
>
> Alex Shatalin wrote:
>> Hello Julia,
>>
>>> and im getting a NullPointerException on:
>>> at
>>> org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.Editor
>>> WizardPage.initialPopulateContainerNameField(EditorWizardPag e.java:304)
>>
>> Well, I think the selection is null (you can check it in the
>> debugger). You should create StructuredSelection instance passing
>> desired file as a parameter. Then you are calling popup menu on some
>> file the selection is equals to this file, so corresponding parameter
>> will be passed to ???InitDiagramFileAction...
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: Create a .xxx_diagram by Action [message #170358 is a reply to message #170334] Tue, 29 January 2008 11:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Nevermind :)

However: Is it possible to create this new diagram without using the
wizard (like diagrampartitioning does) ?


Regards,

Tomas


Tomas Zijdemans wrote:
> Julia Sartori wrote:
>> Thanks Alex! it worked!! ^^
>> (by the way, do you know how to show a grid automatically on the
>> diagram?)
>>
>> here's the final solution:
>>
>> public void run() {
>> try{
>> HiperioncadCreationWizard theWiz = new HiperioncadCreationWizard();
>> IStructuredSelection selection = new
>> StructuredSelection(RoxUIPlugin.getDefault().getWorkbench(). getActiveWorkbenchWindow().getActivePage().getSelection());
>
>
>
> Where does RoxUIPlugin come from? What kind of class is it?
>
>
>
>
>
>>
>>
>> theWiz.init(RoxUIPlugin.getDefault().getWorkbench(), selection);
>> WizardDialog dialog = new
>> WizardDialog(RoxUIPlugin.getDefault().getWorkbench().getActi veWorkbenchWindow().getShell(),
>> theWiz);
>> dialog.open();
>> }catch(Exception e){
>> e.printStackTrace();
>> }
>> }
>>
>> Thanks!!
>>
>> Alex Shatalin wrote:
>>> Hello Julia,
>>>
>>>> and im getting a NullPointerException on:
>>>> at
>>>> org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.wiza rds.Editor
>>>> WizardPage.initialPopulateContainerNameField(EditorWizardPag e.java:304)
>>>
>>> Well, I think the selection is null (you can check it in the
>>> debugger). You should create StructuredSelection instance passing
>>> desired file as a parameter. Then you are calling popup menu on some
>>> file the selection is equals to this file, so corresponding parameter
>>> will be passed to ???InitDiagramFileAction...
>>>
>>> -----------------
>>> Alex Shatalin
>>>
>>>
Re: Create a .xxx_diagram by Action [message #170366 is a reply to message #170358] Tue, 29 January 2008 11:27 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tomas,

> However: Is it possible to create this new diagram without using the
> wizard (like diagrampartitioning does) ?
Sure! just copy a code from diagram partitioning into your own action.

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #170396 is a reply to message #170366] Tue, 29 January 2008 12:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

> Sure! just copy a code from diagram partitioning into your own action.

Thanks for helping (again) Alex :)

I've basically just copied the code in (as you can see below). The only
thing that gave an error was:
EditPart targetEditPart = getTargetEditPart(request);
so I replaced it with:
EditPart targetEditPart = selectedElement;

My question is:
What do I put in the run method? - I guess the getOpenCommand have to be
called.. but with what kind of reqest as parameter?


Regards,

Tomas




public class UEMLBaseLaunchEditorAction implements IObjectActionDelegate {

public ClassNodeEditPart selectedElement;
public Shell shell;

public void run(IAction action) {


}

/**
* @generated
*/
protected Command getOpenCommand(Request request) {
EditPart targetEditPart = selectedElement;
if (false == targetEditPart.getModel() instanceof View) {
return null;
}
View view = (View) targetEditPart.getModel();
Style link = view.getStyle(NotationPackage.eINSTANCE
.getHintedDiagramLinkStyle());
if (false == link instanceof HintedDiagramLinkStyle) {
return null;
}
return new ICommandProxy(new OpenDiagramCommand(
(HintedDiagramLinkStyle) link));
}

/**
* @generated
*/
private static class OpenDiagramCommand extends
AbstractTransactionalCommand {

/**
* @generated
*/
private final HintedDiagramLinkStyle diagramFacet;

/**
* @generated
*/
OpenDiagramCommand(HintedDiagramLinkStyle linkStyle) {
// editing domain is taken for original diagram,
// if we open diagram from another file, we should use another
// editing domain
super(TransactionUtil.getEditingDomain(linkStyle),
Messages.CommandName_OpenDiagram, null);
diagramFacet = linkStyle;
}

// FIXME canExecute if !(readOnly && getDiagramToOpen == null), i.e.
// open works on ro diagrams only when there's associated diagram
// already

/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
try {
Diagram diagram = getDiagramToOpen();
if (diagram == null) {
diagram = intializeNewDiagram();
}
URI uri = EcoreUtil.getURI(diagram);
String editorName = uri.lastSegment()
+ "#" + diagram.eResource().getContents().indexOf(diagram);
//$NON-NLS-1$
IEditorInput editorInput = new URIEditorInput(uri, editorName);
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
page.openEditor(editorInput, getEditorID());
return CommandResult.newOKCommandResult();
} catch (Exception ex) {
throw new ExecutionException("Can't open diagram", ex);
}
}

/**
* @generated
*/
protected Diagram getDiagramToOpen() {
return diagramFacet.getDiagramLink();
}

/**
* @generated
*/
protected Diagram intializeNewDiagram() throws ExecutionException {
Diagram d = ViewService.createDiagram(getDiagramDomainElement(),
getDiagramKind(), getPreferencesHint());
if (d == null) {
throw new ExecutionException("Can't create diagram of '"
+ getDiagramKind() + "' kind");
}

diagramFacet.setDiagramLink(d);
assert diagramFacet.eResource() != null;
diagramFacet.eResource().getContents().add(d);
try {
for (Iterator it = diagramFacet.eResource().getResourceSet()
.getResources().iterator(); it.hasNext();) {
Resource nextResource = (Resource) it.next();
if (nextResource.isLoaded()
&& !getEditingDomain().isReadOnly(nextResource)) {
nextResource.save(EditorDiagramEditorUtil
.getSaveOptions());
}
}
} catch (IOException ex) {
throw new ExecutionException("Can't create diagram of '"
+ getDiagramKind() + "' kind", ex);
}
return d;
}

/**
* @generated
*/
protected EObject getDiagramDomainElement() {
// use same element as associated with EP
return ((View) diagramFacet.eContainer()).getElement();
}

/**
* @generated
*/
protected PreferencesHint getPreferencesHint() {
// XXX prefhint from target diagram's editor?
return EditorDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
}

/**
* @generated
*/
protected String getDiagramKind() {
return "Class";
}

/**
* @generated
*/
protected String getEditorID() {
return "org.ueml.uemlbase.editor.diagram.part.ClassDiagramEditorID";
}
}

public void selectionChanged(IAction action, ISelection selection) {
selectedElement = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection)
selection;
if (structuredSelection.getFirstElement() instanceof ClassNodeEditPart) {
selectedElement = (ClassNodeEditPart) structuredSelection
.getFirstElement();
}
}
}

public void setActivePart(IAction action, IWorkbenchPart targetPart) {
shell = targetPart.getSite().getShell();
}
}
Re: Create a .xxx_diagram by Action [message #170404 is a reply to message #170396] Tue, 29 January 2008 12:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

I've sort of worked it out by putting the code for doExecute into the
run method.

However, this method calls the initializer method (see under) which uses
a variable: diagramFacet. What should this be replaced with?





Diagram d = ViewService.createDiagram(getDiagramDomainElement(),
getDiagramKind(), getPreferencesHint());
if (d == null) {
throw new ExecutionException("Can't create diagram of '"
+ getDiagramKind() + "' kind");
}

diagramFacet.setDiagramLink(d);
assert diagramFacet.eResource() != null;
diagramFacet.eResource().getContents().add(d);
try {
for (Iterator it = diagramFacet.eResource().getResourceSet()
.getResources().iterator();
it.hasNext();) {
Resource nextResource = (Resource) it.next();
if (nextResource.isLoaded()) {
nextResource.save(EditorDiagramEditorUtil.getSaveOptions());
}
}
} catch (IOException ex) {
throw new ExecutionException("Can't create diagram of '"
+ getDiagramKind() + "' kind", ex);
}
return d;
Re: Create a .xxx_diagram by Action [message #170427 is a reply to message #170404] Tue, 29 January 2008 13:13 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tomas,

> I've sort of worked it out by putting the code for doExecute into the
> run method.
That's right!


> However, this method calls the initializer method (see under) which
> uses a variable: diagramFacet. What should this be replaced with?
diagramFacet is a kind of reference from original diagram node to the associated
diagram. In the sample of code you pasted here you are creating new diagram
and associating this newly created diagram with the diagram node via diagramFacet.
On next execution of this action you can check if corresponding association
was already created and use existing diagram instead of openning new one.

You can get diagramFacet instance from the original diagram element (EditPart)
by calling
(HintedDiagramLinkStyle) ((View) EditPart.getModel()).getStyle(NotationPackage.eINSTANCE.getH intedDiagramLinkStyle())

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #170458 is a reply to message #170427] Tue, 29 January 2008 13:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

This is a multi-part message in MIME format.
--------------030605000408000005030906
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Alex Shatalin wrote:

>
> You can get diagramFacet instance from the original diagram element
> (EditPart) by calling
> (HintedDiagramLinkStyle) ((View)
> EditPart.getModel()).getStyle(NotationPackage.eINSTANCE.getH intedDiagramLinkStyle())
>

Thanks! That got me a lot closer to a working solution. Now, however,
when I launch the action - I get a message that the action is unavailable.

Attaching the code.


--------------030605000408000005030906
Content-Type: text/plain;
name="UEMLBaseLaunchEditorAction.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="UEMLBaseLaunchEditorAction.java"

cGFja2FnZSBvcmcudWVtbC51ZW1sYmFzZS5lZGl0b3IuZGlhZ3JhbS5wYXJ0 Ow0KDQppbXBv
cnQgamF2YS5pby5JT0V4Y2VwdGlvbjsNCmltcG9ydCBqYXZhLnV0aWwuSXRl cmF0b3I7DQoN
CmltcG9ydCBvcmcuZWNsaXBzZS5jb3JlLmNvbW1hbmRzLkV4ZWN1dGlvbkV4 Y2VwdGlvbjsN
CmltcG9ydCBvcmcuZWNsaXBzZS5lbWYuY29tbW9uLnVpLlVSSUVkaXRvcklu cHV0Ow0KaW1w
b3J0IG9yZy5lY2xpcHNlLmVtZi5jb21tb24udXRpbC5VUkk7DQppbXBvcnQg b3JnLmVjbGlw
c2UuZW1mLmVjb3JlLkVPYmplY3Q7DQppbXBvcnQgb3JnLmVjbGlwc2UuZW1m LmVjb3JlLnJl
c291cmNlLlJlc291cmNlOw0KaW1wb3J0IG9yZy5lY2xpcHNlLmVtZi5lY29y ZS51dGlsLkVj
b3JlVXRpbDsNCmltcG9ydCBvcmcuZWNsaXBzZS5nbWYucnVudGltZS5kaWFn cmFtLmNvcmUu
cHJlZmVyZW5jZXMuUHJlZmVyZW5jZXNIaW50Ow0KaW1wb3J0IG9yZy5lY2xp cHNlLmdtZi5y
dW50aW1lLmRpYWdyYW0uY29yZS5zZXJ2aWNlcy5WaWV3U2VydmljZTsNCmlt cG9ydCBvcmcu
ZWNsaXBzZS5nbWYucnVudGltZS5ub3RhdGlvbi5EaWFncmFtOw0KaW1wb3J0 IG9yZy5lY2xp
cHNlLmdtZi5ydW50aW1lLm5vdGF0aW9uLkhpbnRlZERpYWdyYW1MaW5rU3R5 bGU7DQppbXBv
cnQgb3JnLmVjbGlwc2UuZ21mLnJ1bnRpbWUubm90YXR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ZCgpIHsN
CgkJcmV0dXJuICJDbGFzcyI7DQoJfQ0KDQoJcHVibGljIHZvaWQgc2VsZWN0 aW9uQ2hhbmdl
ZChJQWN0aW9uIGFjdGlvbiwgSVNlbGVjdGlvbiBzZWxlY3Rpb24pIHsNCgkJ c2VsZWN0ZWRF
bGVtZW50ID0gbnVsbDsNCgkJaWYgKHNlbGVjdGlvbiBpbnN0YW5jZW9mIElT dHJ1Y3R1cmVk
U2VsZWN0aW9uKSB7DQoJCQlJU3RydWN0dXJlZFNlbGVjdGlvbiBzdHJ1Y3R1 cmVkU2VsZWN0
aW9uID0gKElTdHJ1Y3R1cmVkU2VsZWN0aW9uKSBzZWxlY3Rpb247DQoJCQlp ZiAoc3RydWN0
dXJlZFNlbGVjdGlvbi5nZXRGaXJzdEVsZW1lbnQoKSBpbnN0YW5jZW9mIENs YXNzRGlhZ3Jh
bUVsZW1lbnRFZGl0UGFydCkgew0KCQkJCXNlbGVjdGVkRWxlbWVudCA9IChD bGFzc0RpYWdy
YW1FbGVtZW50RWRpdFBhcnQpIHN0cnVjdHVyZWRTZWxlY3Rpb24NCgkJCQkJ CS5nZXRGaXJz
dEVsZW1lbnQoKTsNCgkJCX0NCgkJfQ0KCX0NCg0KCXB1YmxpYyB2b2lkIHNl dEFjdGl2ZVBh
cnQoSUFjdGlvbiBhY3Rpb24sIElXb3JrYmVuY2hQYXJ0IHRhcmdldFBhcnQp IHsNCgkJc2hl
bGwgPSB0YXJnZXRQYXJ0LmdldFNpdGUoKS5nZXRTaGVsbCgpOw0KCX0NCn0N Cg==
--------------030605000408000005030906--
Re: Create a .xxx_diagram by Action [message #170472 is a reply to message #170458] Tue, 29 January 2008 14:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

I seem to have avoided the problem by moving the diagramFacet into the
init method, and changing methodcalls to reflect it (not longer being a
field variabel)

This now kinda works. It opens an editor of the same type as it's self.
So the final obstacle is to get it to open another type of editor. I
changed getEditorID - that worked - But the new editor uses the same
diagram element as the first editor (wrong kind).

I guess this has to do with diagramFacet being set with the selected
element:
diagramFacet = (HintedDiagramLinkStyle) ((View)
selectedElement.getModel()...

How can I make a new diagram element of the right kind?


Tomas Zijdemans wrote:
> Alex Shatalin wrote:
>
>>
>> You can get diagramFacet instance from the original diagram element
>> (EditPart) by calling
>> (HintedDiagramLinkStyle) ((View)
>> EditPart.getModel()).getStyle(NotationPackage.eINSTANCE.getH intedDiagramLinkStyle())
>>
>
> Thanks! That got me a lot closer to a working solution. Now, however,
> when I launch the action - I get a message that the action is unavailable.
>
> Attaching the code.
>
Re: Create a .xxx_diagram by Action [message #170587 is a reply to message #170472] Tue, 29 January 2008 19:52 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tomas,

AFAIU you have to choose correct diagram element while creating new diagram
- see OpenDiagramEditPolicy.intializeNewDiagram(). getDiagramDomainElement(),
getDiagramKind(), getPreferencesHint() methods are used there. You have to
modify these methods in accordance to return correct results for different
diagram type.

The rest should be working as is (taking into account getEditorID is already
changed). If you need to associate different diagrams with the same diagram
node then you have to attach several HintedDiagramLinkStyle instances to
each node and initialize/process them differently.

-----------------
Alex Shatalin
Re: Create a .xxx_diagram by Action [message #171521 is a reply to message #170587] Tue, 05 February 2008 16:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

This is a multi-part message in MIME format.
--------------000403030006060607090402
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Alex Shatalin wrote:
> Hello Tomas,
>
> AFAIU you have to choose correct diagram element while creating new
> diagram - see OpenDiagramEditPolicy.intializeNewDiagram().
> getDiagramDomainElement(), getDiagramKind(), getPreferencesHint()
> methods are used there. You have to modify these methods in accordance
> to return correct results for different diagram type.

Hi again!

I've tried twisting and hacking on this for quite some time now, but I
can't seem to nail it. Basic steps are: 1. Copy methods from a
OpenDiagram policy. 2. Get diagramfacet 3. Adjust Methods to point at
right kind of diagram.

I'm attaching the body of my action (without selectionChanged etc.). In
it's current state it won't start.

If you or anyone else have time to point out errors, I'd be very
grateful for it!


--------------000403030006060607090402
Content-Type: text/plain;
name="action.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="action.txt"

cHVibGljIHZvaWQgcnVuKElBY3Rpb24gYWN0aW9uKSB7DQoJdHJ5IHsNCgkJ RGlhZ3JhbSBk
aWFncmFtID0gZ2V0RGlhZ3JhbVRvT3BlbigpOw0KCQlpZiAoZGlhZ3JhbSA9 PSBudWxsKSB7
DQoJCQlkaWFncmFtID0gaW50aWFsaXplTmV3RGlhZ3JhbSgpOw0KCQl9DQoJ CVVSSSB1cmkg
PSBFY29yZVV0aWwuZ2V0VVJJKGRpYWdyYW0pOw0KCQlTdHJpbmcgZWRpdG9y TmFtZSA9IHVy
aS5sYXN0U2VnbWVudCgpDQoJCQkJKyAiIyIgKyBkaWFncmFtLmVSZXNvdXJj ZSgpLmdldENv
bnRlbnRzKCkuaW5kZXhPZihkaWFncmFtKTsgLy8kTk9OLU5MUy0xJA0KCQlJ RWRpdG9ySW5w
dXQgZWRpdG9ySW5wdXQgPSBuZXcgVVJJRWRpdG9ySW5wdXQodXJpLCBlZGl0 b3JOYW1lKTsN
CgkJSVdvcmtiZW5jaFBhZ2UgcGFnZSA9IFBsYXRmb3JtVUkuZ2V0V29ya2Jl bmNoKCkNCgkJ
CQkuZ2V0QWN0aXZlV29ya2JlbmNoV2luZG93KCkuZ2V0QWN0aXZlUGFnZSgp Ow0KCQlwYWdl
Lm9wZW5FZGl0b3IoZWRpdG9ySW5wdXQsIGdldEVkaXRvcklEKCkpOw0KCX0g Y2F0Y2ggKEV4
Y2VwdGlvbiBleCkgew0KCQl9DQp9DQoNCnByaXZhdGUgZmluYWwgSGludGVk RGlhZ3JhbUxp
bmtTdHlsZSBkaWFncmFtRmFjZXQgPSAoSGludGVkRGlhZ3JhbUxpbmtTdHls ZSkgKChWaWV3
KSBzZWxlY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ubHkoDQoJCQkJCQkJ bmV4dFJlc291
cmNlKSkgew0KCQkJCW5leHRSZXNvdXJjZS5zYXZlKEVkaXRvckRpYWdyYW1F ZGl0b3JVdGls
LmdldFNhdmVPcHRpb25zKCkpOw0KCQkJfQ0KCQl9DQoJfSBjYXRjaCAoSU9F eGNlcHRpb24g
ZXgpIHsNCgkJdGhyb3cgbmV3IEV4ZWN1dGlvbkV4Y2VwdGlvbigiQ2FuJ3Qg Y3JlYXRlIGRp
YWdyYW0gb2YgJyINCgkJCQkrIGdldERpYWdyYW1LaW5kKCkgKyAiJyBraW5k IiwgZXgpOw0K
CX0NCglyZXR1cm4gZDsNCn0NCgkNCnByb3RlY3RlZCBFT2JqZWN0IGdldERp YWdyYW1Eb21h
aW5FbGVtZW50KCkgew0KCXJldHVybiAoKFZpZXcpIGRpYWdyYW1GYWNldC5l Q29udGFpbmVy
KCkpLmdldEVsZW1lbnQoKTsNCn0NCgkNCnByb3RlY3RlZCBQcmVmZXJlbmNl c0hpbnQgZ2V0
UHJlZmVyZW5jZXNIaW50KCkgew0KCXJldHVybiBDbGFzc0RpYWdyYW1FZGl0 b3JQbHVnaW4u
RElBR1JBTV9QUkVGRVJFTkNFU19ISU5UOw0KfQ0KCQ0KcHJvdGVjdGVkIERp YWdyYW0gZ2V0
RGlhZ3JhbVRvT3BlbigpIHsNCglyZXR1cm4gZGlhZ3JhbUZhY2V0LmdldERp YWdyYW1MaW5r
KCk7DQp9DQoJDQpwcm90ZWN0ZWQgU3RyaW5nIGdldERpYWdyYW1LaW5kKCkg ew0KCXJldHVy
biAiQ2xhc3MiOw0KfQ0KCQ0KcHJvdGVjdGVkIFN0cmluZyBnZXRFZGl0b3JJ RCgpIHsNCgly
ZXR1cm4gIm9yZy51ZW1sLnVlbWxiYXNlLmVkaXRvci5kaWFncmFtLnBhcnQu Q2xhc3NEaWFn
cmFtRWRpdG9ySUQiOw0KfQ==
--------------000403030006060607090402--
Re: Create a .xxx_diagram by Action [message #171577 is a reply to message #171521] Tue, 05 February 2008 17:59 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tomas,

I suggest you debugging intializeNewDiagram() method to see which element
will be used as a "diagramDomainElement" in createDiagram() method call.

-----------------
Alex Shatalin
Previous Topic:Re: Problems with use of EMF contextmenu in GMF Editor
Next Topic:Multiple palette entries to draw same node with different values?
Goto Forum:
  


Current Time: Fri Dec 27 13:46:28 GMT 2024

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

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

Back to the top