Commit a50b3d54 authored by Romain Bioteau's avatar Romain Bioteau

fix(diagram) fix pool resize (#1569)

Closes BS-19297
parent ee393940
...@@ -32,6 +32,7 @@ import org.eclipse.gef.EditPart; ...@@ -32,6 +32,7 @@ import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request; import org.eclipse.gef.Request;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
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;
...@@ -57,26 +58,20 @@ public class CustomPoolEditPart extends PoolEditPart { ...@@ -57,26 +58,20 @@ public class CustomPoolEditPart extends PoolEditPart {
super(view); super(view);
} }
/**
* @return the currentSize
*/
public Dimension getCurrentSize() { public Dimension getCurrentSize() {
return currentSize; return currentSize;
} }
private static int CONSTANT_LEFT_MARGIN = 20; private static int CONSTANT_LEFT_MARGIN = 20;
private static int CONSTANT_RIGHT_MARGIN = 240; public static final int CONSTANT_DEFAULT_HEIGHT = 250;
private static int CONSTANT_DEFAULT_HEIGHT = 250;
public static final int MIN_POOL_WIDTH = 800; public static final int MIN_POOL_WIDTH = 800;
/** public static int getDefaultWidth() {
* @return the defaultWidth
*/
public int getDefaultWidth() {
if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() != null) { && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getClientArea().width && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() != null) {
- CONSTANT_RIGHT_MARGIN; return ((DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor()).getDiagramGraphicalViewer().getControl().getBounds().width;
} else { } else {
return MIN_POOL_WIDTH; return MIN_POOL_WIDTH;
} }
......
...@@ -16,6 +16,7 @@ package org.bonitasoft.studio.diagram.custom.providers; ...@@ -16,6 +16,7 @@ package org.bonitasoft.studio.diagram.custom.providers;
import java.util.ArrayList; import java.util.ArrayList;
import org.bonitasoft.studio.diagram.custom.parts.CustomPoolEditPart;
import org.bonitasoft.studio.model.process.diagram.edit.parts.MessageFlowEditPart; import org.bonitasoft.studio.model.process.diagram.edit.parts.MessageFlowEditPart;
import org.bonitasoft.studio.model.process.diagram.edit.parts.MessageFlowLabelEditPart; import org.bonitasoft.studio.model.process.diagram.edit.parts.MessageFlowLabelEditPart;
import org.bonitasoft.studio.model.process.diagram.edit.parts.SequenceFlowEditPart; import org.bonitasoft.studio.model.process.diagram.edit.parts.SequenceFlowEditPart;
...@@ -61,8 +62,8 @@ public class CustomProcessViewProvider extends ProcessViewProvider { ...@@ -61,8 +62,8 @@ public class CustomProcessViewProvider extends ProcessViewProvider {
node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle()); node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
final Size layoutConstraint = (Size) node.getLayoutConstraint(); final Size layoutConstraint = (Size) node.getLayoutConstraint();
if (layoutConstraint.getWidth() <= 0) { if (layoutConstraint.getWidth() <= 0) {
layoutConstraint.setWidth(((IPreferenceStore) preferencesHint.getPreferenceStore()).getDefaultInt("poolDefaultWidth")); layoutConstraint.setWidth(CustomPoolEditPart.getDefaultWidth());
layoutConstraint.setHeight(250); layoutConstraint.setHeight(CustomPoolEditPart.CONSTANT_DEFAULT_HEIGHT);
} }
return node; return node;
} }
......
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