Commit 983ff7c7 authored by Romain Bioteau's avatar Romain Bioteau

Merge remote-tracking branch 'origin/master' into dev

parents 79ea33c2 1a1ff57f
...@@ -94,7 +94,6 @@ public class UpdatePoolSizeCommand extends AbstractTransactionalCommand { ...@@ -94,7 +94,6 @@ public class UpdatePoolSizeCommand extends AbstractTransactionalCommand {
setRequest1.setResizeDirection(PositionConstants.NORTH); setRequest1.setResizeDirection(PositionConstants.NORTH);
setRequest1.setSizeDelta(new Dimension(0,-150)); setRequest1.setSizeDelta(new Dimension(0,-150));
gep.getDiagramEditDomain().getDiagramCommandStack().execute(gep.getCommand(setRequest1)); gep.getDiagramEditDomain().getDiagramCommandStack().execute(gep.getCommand(setRequest1));
for(Object o : gep.getChildren()){ for(Object o : gep.getChildren()){
if(o instanceof CustomPoolCompartmentEditPart){ if(o instanceof CustomPoolCompartmentEditPart){
for(CustomLaneEditPart lane : ((CustomPoolCompartmentEditPart)o).getPoolLanes()){ for(CustomLaneEditPart lane : ((CustomPoolCompartmentEditPart)o).getPoolLanes()){
...@@ -114,7 +113,6 @@ public class UpdatePoolSizeCommand extends AbstractTransactionalCommand { ...@@ -114,7 +113,6 @@ public class UpdatePoolSizeCommand extends AbstractTransactionalCommand {
setRequest1.setResizeDirection(PositionConstants.SOUTH); setRequest1.setResizeDirection(PositionConstants.SOUTH);
setRequest1.setSizeDelta(new Dimension(0,150)); setRequest1.setSizeDelta(new Dimension(0,150));
gep.getDiagramEditDomain().getDiagramCommandStack().execute(gep.getCommand(setRequest1)); gep.getDiagramEditDomain().getDiagramCommandStack().execute(gep.getCommand(setRequest1));
for(Object o : gep.getChildren()){ for(Object o : gep.getChildren()){
if(o instanceof CustomPoolCompartmentEditPart){ if(o instanceof CustomPoolCompartmentEditPart){
for(CustomLaneEditPart lane : ((CustomPoolCompartmentEditPart)o).getPoolLanes()){ for(CustomLaneEditPart lane : ((CustomPoolCompartmentEditPart)o).getPoolLanes()){
...@@ -135,13 +133,11 @@ public class UpdatePoolSizeCommand extends AbstractTransactionalCommand { ...@@ -135,13 +133,11 @@ public class UpdatePoolSizeCommand extends AbstractTransactionalCommand {
epToMove.add(lane); epToMove.add(lane);
} }
} }
} }
setRequest1.setEditParts(epToMove); setRequest1.setEditParts(epToMove);
setRequest1.setResizeDirection(PositionConstants.EAST); setRequest1.setResizeDirection(PositionConstants.EAST);
setRequest1.setSizeDelta(new Dimension(-150,0)); setRequest1.setSizeDelta(new Dimension(-150,0));
if(gep.getFigure().getSize().width > gep.getFigure().getMinimumSize().width ){ if(gep.getFigure().getSize().width - 150 > gep.getFigure().getMinimumSize().width ){
gep.getDiagramEditDomain().getDiagramCommandStack().execute(gep.getCommand(setRequest1)); gep.getDiagramEditDomain().getDiagramCommandStack().execute(gep.getCommand(setRequest1));
for(Object o : gep.getChildren()){ for(Object o : gep.getChildren()){
if(o instanceof CustomPoolCompartmentEditPart){ if(o instanceof CustomPoolCompartmentEditPart){
......
...@@ -168,12 +168,6 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple ...@@ -168,12 +168,6 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple
hideSelection(); hideSelection();
layer = getLayer(LayerConstants.HANDLE_LAYER); layer = getLayer(LayerConstants.HANDLE_LAYER);
/*
* need to flush in order to have the new correct size of the host
* figure
*/
// poolEditPart.getViewer().flush();
//FIXME
Rectangle ref = sourceFigure.getBounds(); Rectangle ref = sourceFigure.getBounds();
if (ref.x == 0 && ref.y == 0 && ref.height == 0 && ref.width == 0) { if (ref.x == 0 && ref.y == 0 && ref.height == 0 && ref.width == 0) {
...@@ -205,7 +199,6 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple ...@@ -205,7 +199,6 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple
result = ((AbstractConnectionEditPart) host).getSource(); result = ((AbstractConnectionEditPart) host).getSource();
} }
EditPart tempEditPart = result;
/*first search for a CustomLaneEditPart*/ /*first search for a CustomLaneEditPart*/
while(!(result instanceof CustomPoolEditPart) && result != null){ while(!(result instanceof CustomPoolEditPart) && result != null){
result = result.getParent() ; result = result.getParent() ;
...@@ -231,7 +224,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple ...@@ -231,7 +224,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple
Rectangle ref = sourceFigure.getBounds(); Rectangle ref = sourceFigure.getBounds();
IFigure f = new ImageFigure(Pics.getImage(PicsConstants.plusBlack)); IFigure f = new ImageFigure(Pics.getImage(PicsConstants.plusBlack));
f.setSize(20, 20); f.setSize(20, 20);
f.setLocation(ref.getRight().translate(10, -20)); f.setLocation(ref.getRight().getCopy().translate(10, -20));
f.getBounds().performScale(zoom) ; f.getBounds().performScale(zoom) ;
f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.ADD_RIGHT)); f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.ADD_RIGHT));
layer.add(f); layer.add(f);
...@@ -253,7 +246,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple ...@@ -253,7 +246,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple
Rectangle ref = sourceFigure.getBounds(); Rectangle ref = sourceFigure.getBounds();
IFigure f = new ImageFigure(Pics.getImage(PicsConstants.plusBlack)); IFigure f = new ImageFigure(Pics.getImage(PicsConstants.plusBlack));
f.setSize(20, 20); f.setSize(20, 20);
f.setLocation(ref.getBottom().translate(20, 0)); f.setLocation(ref.getBottom().getCopy().translate(20, 0));
f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.ADD_BOTTOM)); f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.ADD_BOTTOM));
f.getBounds().performScale(zoom); f.getBounds().performScale(zoom);
layer.add(f); layer.add(f);
...@@ -274,7 +267,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple ...@@ -274,7 +267,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple
Rectangle ref = sourceFigure.getBounds(); Rectangle ref = sourceFigure.getBounds();
IFigure f = new ImageFigure(Pics.getImage(PicsConstants.minusBlack)); IFigure f = new ImageFigure(Pics.getImage(PicsConstants.minusBlack));
f.setSize(20, 20); f.setSize(20, 20);
f.setLocation(ref.getBottom().translate(20, -20)); f.setLocation(ref.getBottom().getCopy().translate(20, -20));
f.getBounds().performScale(zoom); f.getBounds().performScale(zoom);
f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.REMOVE_BOTTOM)); f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.REMOVE_BOTTOM));
layer.add(f); layer.add(f);
...@@ -298,7 +291,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple ...@@ -298,7 +291,7 @@ public class UpdateSizePoolSelectionEditPolicy extends SelectionEditPolicy imple
Rectangle ref = sourceFigure.getBounds(); Rectangle ref = sourceFigure.getBounds();
IFigure f = new ImageFigure(Pics.getImage(PicsConstants.minusBlack)); IFigure f = new ImageFigure(Pics.getImage(PicsConstants.minusBlack));
f.setSize(20, 20); f.setSize(20, 20);
f.setLocation(ref.getLeft().translate(-25, -10)); f.setLocation(ref.getLeft().getCopy().translate(-25, -10));
f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.REMOVE_RIGHT)); f.addMouseListener(new MouseListenerForSpan(UpdateSizePoolSelectionEditPolicy.REMOVE_RIGHT));
f.getBounds().performScale(zoom); f.getBounds().performScale(zoom);
......
...@@ -81,9 +81,7 @@ public class CustomLaneEditPart extends LaneEditPart { ...@@ -81,9 +81,7 @@ public class CustomLaneEditPart extends LaneEditPart {
@Override @Override
protected NodeFigure createNodePlate() { protected NodeFigure createNodePlate() {
final NodeFigure figure = new DefaultSizeNodeFigure(getMapMode().DPtoLP(975), getMapMode().DPtoLP(100)); return new DefaultSizeNodeFigure(getMapMode().DPtoLP(975), getMapMode().DPtoLP(100));
figure.setMinimumSize(new Dimension(975, 100));
return figure;
} }
@Override @Override
...@@ -202,7 +200,7 @@ public class CustomLaneEditPart extends LaneEditPart { ...@@ -202,7 +200,7 @@ public class CustomLaneEditPart extends LaneEditPart {
} }
final CustomPoolEditPart parent = (CustomPoolEditPart) getParent().getParent(); final CustomPoolEditPart parent = (CustomPoolEditPart) getParent().getParent();
int width = parent.getFigure().getSize().width; int width = parent.getCurrentSize().width;
int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
if (height == -1) { if (height == -1) {
...@@ -345,7 +343,7 @@ public class CustomLaneEditPart extends LaneEditPart { ...@@ -345,7 +343,7 @@ public class CustomLaneEditPart extends LaneEditPart {
setBackgroundColor(THIS_BACK); setBackgroundColor(THIS_BACK);
this.setPreferredSize(new Dimension(getMapMode().DPtoLP(975), this.setPreferredSize(new Dimension(getMapMode().DPtoLP(975),
getMapMode().DPtoLP(100))); getMapMode().DPtoLP(100)));
setMinimumSize(new Dimension(getMapMode().DPtoLP(975), setMinimumSize(new Dimension(-1,
getMapMode().DPtoLP(100))); getMapMode().DPtoLP(100)));
createContents(); createContents();
} }
......
...@@ -35,6 +35,8 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; ...@@ -35,6 +35,8 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx; import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
...@@ -71,8 +73,10 @@ public class CustomPoolEditPart extends PoolEditPart { ...@@ -71,8 +73,10 @@ public class CustomPoolEditPart extends PoolEditPart {
* @return the defaultWidth * @return the defaultWidth
*/ */
public int getDefaultWidth() { public int getDefaultWidth() {
if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() != null) { if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getClientArea().width - CONSTANT_RIGHT_MARGIN; && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() != null) {
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getClientArea().width
- CONSTANT_RIGHT_MARGIN;
} else { } else {
return MIN_POOL_WIDTH; return MIN_POOL_WIDTH;
} }
...@@ -188,6 +192,13 @@ public class CustomPoolEditPart extends PoolEditPart { ...@@ -188,6 +192,13 @@ public class CustomPoolEditPart extends PoolEditPart {
figure.setUseLocalCoordinates(true); figure.setUseLocalCoordinates(true);
return primaryShape = figure; return primaryShape = figure;
} }
@Override
protected NodeFigure createNodePlate() {
NodeFigure nodeFigure = new DefaultSizeNodeFigure(new Dimension(-1, 100));
nodeFigure.setMinimumSize(new Dimension(-1, 100));
return nodeFigure;
}
public class CustomPoolFigure extends PoolFigure { public class CustomPoolFigure extends PoolFigure {
...@@ -205,7 +216,6 @@ public class CustomPoolEditPart extends PoolEditPart { ...@@ -205,7 +216,6 @@ public class CustomPoolEditPart extends PoolEditPart {
* @generated * @generated
*/ */
public CustomPoolFigure() { public CustomPoolFigure() {
final GridLayout layoutThis = new GridLayout(); final GridLayout layoutThis = new GridLayout();
layoutThis.numColumns = 2; layoutThis.numColumns = 2;
layoutThis.makeColumnsEqualWidth = false; layoutThis.makeColumnsEqualWidth = false;
...@@ -222,12 +232,12 @@ public class CustomPoolEditPart extends PoolEditPart { ...@@ -222,12 +232,12 @@ public class CustomPoolEditPart extends PoolEditPart {
getMapMode().DPtoLP(getDefaultHeight())); getMapMode().DPtoLP(getDefaultHeight()));
this.setSize(defaultSize); this.setSize(defaultSize);
this.setPreferredSize(defaultSize); this.setPreferredSize(defaultSize);
setMinimumSize(new Dimension(getMapMode().DPtoLP(MIN_POOL_WIDTH), getMapMode().DPtoLP(100))); setMinimumSize(new Dimension(MIN_POOL_WIDTH, getMapMode().DPtoLP(100)));
currentSize = new Dimension(defaultSize); currentSize = new Dimension(defaultSize);
setLocation(new Point(20, 20)); setLocation(new Point(20, 20));
createContents(); createContents();
} }
@Override @Override
public void validate() { public void validate() {
super.validate(); super.validate();
...@@ -422,7 +432,8 @@ public class CustomPoolEditPart extends PoolEditPart { ...@@ -422,7 +432,8 @@ public class CustomPoolEditPart extends PoolEditPart {
super.setFont(fontData); super.setFont(fontData);
if (fontData != null && ((Element) resolveSemanticElement()).getName() != null) { if (fontData != null && ((Element) resolveSemanticElement()).getName() != null) {
final Font font = new Font(Display.getCurrent(), fontData); final Font font = new Font(Display.getCurrent(), fontData);
final int height = FigureUtilities.getStringExtents(((Element) resolveSemanticElement()).getName(), font).height; final int height = FigureUtilities.getStringExtents(((Element) resolveSemanticElement()).getName(),
font).height;
font.dispose(); font.dispose();
((CustomPoolFigure) getContentPane()).getLabelGridData().widthHint = height + 2; ((CustomPoolFigure) getContentPane()).getLabelGridData().widthHint = height + 2;
} }
......
...@@ -283,9 +283,7 @@ public class TransitionConditionContribution implements IExtensibleGridPropertyS ...@@ -283,9 +283,7 @@ public class TransitionConditionContribution implements IExtensibleGridPropertyS
if (eObject instanceof SequenceFlow) { if (eObject instanceof SequenceFlow) {
final SourceElement source = ((SequenceFlow) eObject).getSource(); final SourceElement source = ((SequenceFlow) eObject).getSource();
final boolean sourceIdAndGateway = source instanceof ANDGateway; final boolean sourceIdAndGateway = source instanceof ANDGateway;
final TargetElement target = ((SequenceFlow) eObject).getTarget(); return !(source instanceof BoundaryEvent) && !sourceIdAndGateway;
final boolean targetIsAndGateway = target instanceof ANDGateway && !(source instanceof XORGateway);
return !(source instanceof BoundaryEvent) && !sourceIdAndGateway && !targetIsAndGateway;
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment