Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Milestones 0.10.0.v20130319-1346 remarks
Milestones 0.10.0.v20130319-1346 remarks [message #1053017] Wed, 01 May 2013 22:01 Go to next message
Marek Jagielski is currently offline Marek Jagielski
Messages: 59
Registered: April 2012
Member
Hi,
I switched from version 0.9.2 to 0.10.0.v20130319-1346 in my juno eclipse. I remarked some issues. Are they planed behaviors prepared for new release?

1. Making grid invisible in way:
ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
IFigure gridFigure = ((LayerManager)rootEditPart).getLayer(LayerConstants.GRID_LAYER);
gridFigure.setVisible(false);


now color of the background is gray instead of white (Btw, in my case it even looks nicer).

2. Adding a shape to diagram is not followed by UpadeteFeature.

3. And of course getDiagramEditor() from AbstractFeature is deprecated. Is there already guide to make a migration. Particulary, I have problmes with:
* void selectPictogramElements(PictogramElement[])
* IEditorInput getEditorInput()

Thanks,

Marek
Re: Milestones 0.10.0.v20130319-1346 remarks [message #1053071 is a reply to message #1053017] Thu, 02 May 2013 06:34 Go to previous messageGo to next message
Marek Jagielski is currently offline Marek Jagielski
Messages: 59
Registered: April 2012
Member
For 3, sorry, I found an issue here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=352120#c30
Re: Milestones 0.10.0.v20130319-1346 remarks [message #1053083 is a reply to message #1053071] Thu, 02 May 2013 07:17 Go to previous messageGo to next message
Marek Jagielski is currently offline Marek Jagielski
Messages: 59
Registered: April 2012
Member
For point 3 the problem is that methods moved to DiagramBehavior:
* void selectPictogramElements(PictogramElement[])
* IDiagramEditorInput getInput()

are now protected, so I can't access them from MyGFPropertySection or MyAbstractFeature.

Is the proper way to access asked functionalities is only to subclass DiagramBehavior ?

Marek
Re: Milestones 0.10.0.v20130319-1346 remarks [message #1053143 is a reply to message #1053083] Thu, 02 May 2013 12:29 Go to previous messageGo to next message
Marek Jagielski is currently offline Marek Jagielski
Messages: 59
Registered: April 2012
Member
Ok, I found the solutions for all my points. Sorry for bothering.

Point 2
I added in MyAddFeature:
updatePictogramElement(containerShape)

However it is strange that in versions 0.9.0-2 update was executed without this line.

Point 3
I found that selectPictogramElements is available by interface DiagramContainer
getDiagramContainer().selectPictogramElements(withoutLabelsArray)

For getEditorInput() in my case I could make a workaround with getDiagram().eResource to get information I need.

Point 1
For this point it is possible to remove grid lines by setting grid with setGridUnit to -1. Although it is interesting from where came this gray background color.

Thanks,
Marek
Re: Milestones 0.10.0.v20130319-1346 remarks [message #1053159 is a reply to message #1053143] Thu, 02 May 2013 14:31 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard Traetteberg
Messages: 594
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 02.05.13 09.29, Marek Jagielski wrote:
> Point 1
> For this point it is possible to remove grid lines by setting grid with
> setGridUnit to -1. Although it is interesting from where came this gray
> background color.

I'm guessing it's the color of the layer beneath the grid, or the color
of the underlying composite, if there is such layer.

Hallvard
Re: Milestones 0.10.0.v20130319-1346 remarks [message #1053534 is a reply to message #1053017] Mon, 06 May 2013 08:29 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1577
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Marek,

thanks for your feedback. Although you were able to overcome all the issues,
I would like to check back on a few points:

1. The different background color when removing the grid is odd. At least
this is a different behavior than before, so would you please file this as a
bug?

2. What is the exact shape/GA structure you are creating? It seems strange
that the update happened automatically before.

3. The only reason to make the method getEditorInput protected was to reduce
the public API of that class. Nevertheless, it might make sense to make that
method public for specific use cases. If you think that this is a common
issue feel free to open a bug for this as well.

Thanks,
Michael
Re: Milestones 0.10.0.v20130319-1346 remarks [message #1054952 is a reply to message #1053534] Wed, 08 May 2013 05:45 Go to previous message
Marek Jagielski is currently offline Marek Jagielski
Messages: 59
Registered: April 2012
Member
Hi,
So for:

1. I created a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=407510

2. Now in my code I added lines with upadates:


@Override
public PictogramElement add(IAddContext context) {
final Task addedTask = (Task) context.getNewObject();
final ContainerShape target = context.getTargetContainer();

final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final IGaService gaService = Graphiti.getGaService();

final ContainerShape containerShape = peCreateService.createContainerShape(target, true);

int width = 0;
int height = 0;
width = context.getWidth() <= 0 ? getWidth() : context.getWidth();
height = context.getHeight() <= 0 ? getHeight() : context.getHeight();

final Rectangle invisibleRectangle = gaService.createInvisibleRectangle(containerShape);
gaService.setLocationAndSize(invisibleRectangle, context.getX(), context.getY(), width, height);

// create and set visible rectangle inside invisible rectangle
RoundedRectangle roundedRectangle = gaService.createRoundedRectangle(invisibleRectangle, 20, 20);
roundedRectangle.setParentGraphicsAlgorithm(invisibleRectangle);
roundedRectangle.setStyle(getStyle());
if(!addedTask.isAtomic()) roundedRectangle.setLineStyle(LineStyle.DOT);
gaService.setLocationAndSize(roundedRectangle, 0, 0, width, height);

insertInside(peCreateService, gaService, width, height, containerShape, invisibleRectangle, addedTask);

ContainerShape labelShape = addLabel(target, addedTask.getId(), width, height, context.getX(), context.getY());

link(containerShape, new Object[] {addedTask, labelShape});
link(labelShape, new Object[] {addedTask, containerShape});

updatePictogramElement(labelShape);
layoutPictogramElement(labelShape);
addInternalPorts(addedTask, containerShape);
updatePictogramElement(containerShape);

return containerShape;
}


But really the change of version affected like a whole system. Because I needed to add updates also in properties sections. It is probably that my code depends on something that before executed updates (Something maybe connected with EMF model). However before my code wasn't correct without explicitly invoking an update.

3. In fact, my workaround for me is ok. With creating an issue I would wait for the others users if they are affected.

Thanks,

Marek
Previous Topic:Load domain model from diagram file
Next Topic:How to avoid overlapping of shapes
Goto Forum:
  


Current Time: Wed Aug 20 12:35:27 EDT 2014

Powered by FUDForum. Page generated in 0.02049 seconds