Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Create diagram with elements within
Create diagram with elements within [message #683505] Mon, 13 June 2011 22:12 Go to next message
Filipe Araujo is currently offline Filipe AraujoFriend
Messages: 4
Registered: June 2011
Junior Member
Hi,

I want to create a diagram with 3 pictograms elements by default, i'm trying this in a class that extends AbstractDrillDownFeature and in the method execute:

//run diagram
super.execute(context);
//try to insert the elements
CreateContext test = new CreateContext();
Diagram diag = getDiagram();
test.setTargetContainer(diag);
int res = 10;
for (FlowElement subFlowElement : subprocess.getFlowElements())
{

teste.setLocation(res, res);
teste.setSize(-1, -1);
res = res+40;
diag.eResource().getContents().add(subFlowElement);
link(container, subFlowElement);
addGraphicalRepresentation(teste, subFlowElement);
}

I initialized the flowelements (setnextid(), setname()) before the execute call. I've try also something like this but with no result:

// provide information to support direct-editing directly
// after object creation (must be activated additionally)
final IDirectEditingInfo directEditingInfo = getFeatureProvider().getDirectEditingInfo();
// set container shape for direct editing after object creation
directEditingInfo.setMainPictogramElement(containerShape);
// set shape and graphics algorithm where the editor for
// direct editing shall be opened after object creation
directEditingInfo.setPictogramElement(shape);
directEditingInfo.setGraphicsAlgorithm(text);

Thank you very much i would appreciate any help.

Filipe Araújo

[Updated on: Mon, 13 June 2011 23:16]

Report message to a moderator

Re: New diagram with elements within [message #683691 is a reply to message #683505] Tue, 14 June 2011 08:50 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1923
Registered: July 2009
Location: Walldorf, Germany
Senior Member
I assume you would like to create a new Diagram and create the new elements
in there? What you do with the coding below is adding the stuff to the
current diagram (getDiagram returns the currently opened diagram). Besides
the concrete location inside the diagram is missing.

You might want to take a look into the classes
CreateDiagramWithAllClassesHandler and AddAllClassesCommand in the Graphiti
tutorial; they create a new diagram and add stuff to it (actually they do it
from the explorer, but this should very similarly also be possible from
within a feature).

HTH,
Michael


"Filipe Araujo" schrieb im Newsbeitrag
news:it61fi$vqf$1@news.eclipse.org...

Hi,

I want to create a diagram with 3 pictograms elements by default, i'm
trying this in the override of execute of the class
AbstractDrillDownFeature:

//run diagram
super.execute(context);
//try to insert the elements
CreateContext test = new CreateContext();
Diagram diag = getDiagram();
test.setTargetContainer(diag);
int res = 10;
for (FlowElement subFlowElement : subprocess.getFlowElements())
{

teste.setLocation(res, res);
teste.setSize(-1, -1);
res = res+40;
diag.eResource().getContents().add(subFlowElement);
link(container, subFlowElement);
addGraphicalRepresentation(teste, subFlowElement);
}

I initialized the flowelements (setnextid(), setname()) before the execute
call. I've try also something like this but with no result:

// provide information to support direct-editing directly
// after object creation (must be activated additionally)
final IDirectEditingInfo directEditingInfo =
getFeatureProvider().getDirectEditingInfo();
// set container shape for direct editing after object creation
directEditingInfo.setMainPictogramElement(containerShape);
// set shape and graphics algorithm where the editor for
// direct editing shall be opened after object creation
directEditingInfo.setPictogramElement(shape);
directEditingInfo.setGraphicsAlgorithm(text);

Thank you very much i would appreciate any help.

Filipe Araújo
Re: New diagram with elements within [message #684277 is a reply to message #683691] Wed, 15 June 2011 10:35 Go to previous messageGo to next message
Filipe Araujo is currently offline Filipe AraujoFriend
Messages: 4
Registered: June 2011
Junior Member
I want to create the new elements on Drill-Down Behavior, i.e, on the sub-workflow. I want to create something like the composite behavior, i.e, when I open the diagram will contain 2 tasks and 1 sub-workflow. I'm looking on the graphiti help and i'm not finding that classes.

Thanks for the help. Smile

Edit: I've just found the classes, thanks.

[Updated on: Wed, 15 June 2011 11:41]

Report message to a moderator

Re: New diagram with elements within [message #684326 is a reply to message #684277] Wed, 15 June 2011 12:15 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1923
Registered: July 2009
Location: Walldorf, Germany
Senior Member
These classes are part of the org.eclipse.graphiti.examples.tutorial plugin
that is again part of our SDK download. After installation in your IDE the
sources will be available.

Michael

"Filipe Araujo" schrieb im Newsbeitrag
news:ita1ci$2db$1@news.eclipse.org...

I want to create the new elements on Drill-Down Behavior, i.e, on the
sub-workflow. I want to create something like the composite behavior, i.e,
when I open the diagram will contains 2 tasks and 1 sub-workflow. I'm
looking on the graphiti help and i'm not finding that classes.
Re: New diagram with elements within [message #684376 is a reply to message #684326] Wed, 15 June 2011 14:02 Go to previous messageGo to next message
Filipe Araujo is currently offline Filipe AraujoFriend
Messages: 4
Registered: June 2011
Junior Member
I don't understand how can i insert the graphical shape of the elements, i.e, i created the method getDiagrams(), getNewDiagram(), getExistingDiagram() like the tutorial, after super.execute(context) the diagram opens then I write something like this:

CreateContext teste = new CreateContext();
Diagram diag = getDiagrams().iterator().next();
teste.setTargetContainer(diag);
int res = 10;
for (FlowElement subFlowElement : subprocess.getFlowElements())
{

teste.setLocation(res, res);
teste.setSize(-1, -1);
res = res+40;
diag.eResource().getContents().add(subFlowElement);
addGraphicalRepresentation(teste, subFlowElement);
}
the diagram is recognized in getDiagrams() but when I call addGraphical.. the shapes don't appear. How can I get the active diagram?

getDiagram() gives me the diagram parent.

Like I said before I want to create the elements when I expand to a sub-workflow, with a class that extends AbstractDrillDownFeature.

[Updated on: Wed, 15 June 2011 14:06]

Report message to a moderator

Re: New diagram with elements within [message #684567 is a reply to message #684376] Wed, 15 June 2011 20:38 Go to previous message
Filipe Araujo is currently offline Filipe AraujoFriend
Messages: 4
Registered: June 2011
Junior Member
Thanks guys, i've just done what i want. Smile Just follow the advice of Michael. Smile Thanks a lot.
Previous Topic:Strong "org.eclipse.ide" dependency
Next Topic:Selection Listener in Graphiti Diagram
Goto Forum:
  


Current Time: Thu Nov 26 10:44:19 GMT 2020

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

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

Back to the top