Commit 86722c03 authored by Romain Bioteau's avatar Romain Bioteau

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

Conflicts:
	community/bundles/plugins/org.bonitasoft.studio.diagram.custom/src/org/bonitasoft/studio/diagram/custom/parts/CustomPoolEditPart.java
	community/bundles/plugins/org.bonitasoft.studio.diagram.custom/src/org/bonitasoft/studio/diagram/custom/providers/CustomProcessViewProvider.java
parents db0d2991 dc35dd73
......@@ -63,18 +63,17 @@ public class CustomPoolEditPart extends PoolEditPart {
}
private static int CONSTANT_LEFT_MARGIN = 20;
private static final int CONSTANT_RIGHT_MARGIN = 600;
public static final int CONSTANT_DEFAULT_HEIGHT = 250;
public static final int MIN_POOL_WIDTH = 800;
public static int getDefaultWidth() {
int width = 0;
if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() != null) {
return ((DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor()).getDiagramGraphicalViewer().getControl().getBounds().width - 100;
} else {
return MIN_POOL_WIDTH;
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() != null) {
width = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getClientArea().width - CONSTANT_RIGHT_MARGIN;
}
return Math.max(MIN_POOL_WIDTH, width);
}
/**
......
......@@ -62,7 +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"));
int defaultInt = ((IPreferenceStore) preferencesHint.getPreferenceStore()).getDefaultInt("poolDefaultWidth");
layoutConstraint.setWidth(defaultInt > 0 ? defaultInt : 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