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