Commit db0d2991 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 a50b3d54 c24d888e
...@@ -18,6 +18,7 @@ import java.lang.reflect.InvocationTargetException; ...@@ -18,6 +18,7 @@ import java.lang.reflect.InvocationTargetException;
import org.bonitasoft.studio.common.log.BonitaStudioLog; import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryManager; import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.diagram.custom.parts.CustomPoolEditPart;
import org.bonitasoft.studio.diagram.custom.repository.DiagramFileStore; import org.bonitasoft.studio.diagram.custom.repository.DiagramFileStore;
import org.bonitasoft.studio.diagram.custom.repository.NewDiagramFactory; import org.bonitasoft.studio.diagram.custom.repository.NewDiagramFactory;
import org.bonitasoft.studio.model.process.ProcessPackage; import org.bonitasoft.studio.model.process.ProcessPackage;
...@@ -61,7 +62,7 @@ public class NewDiagramCommandHandler extends AbstractHandler { ...@@ -61,7 +62,7 @@ public class NewDiagramCommandHandler extends AbstractHandler {
final NewDiagramFactory diagramFactory = new NewDiagramFactory( final NewDiagramFactory diagramFactory = new NewDiagramFactory(
RepositoryManager.getInstance().getCurrentRepository(), RepositoryManager.getInstance().getCurrentRepository(),
BonitaStudioPreferencesPlugin.getDefault().getPreferenceStore()); BonitaStudioPreferencesPlugin.getDefault().getPreferenceStore());
diagramFactory.setDefaultPoolWidth(getDefaultWidth()); diagramFactory.setDefaultPoolWidth(CustomPoolEditPart.getDefaultWidth());
final IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); final IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
try { try {
progressService.run(true, false, new IRunnableWithProgress() { progressService.run(true, false, new IRunnableWithProgress() {
...@@ -81,14 +82,6 @@ public class NewDiagramCommandHandler extends AbstractHandler { ...@@ -81,14 +82,6 @@ public class NewDiagramCommandHandler extends AbstractHandler {
return diagramFileStore; return diagramFileStore;
} }
private int getDefaultWidth() {
if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() != null) {
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getClientArea().width - 600;
}
return 800;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#isEnabled() * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
......
...@@ -71,7 +71,7 @@ public class CustomPoolEditPart extends PoolEditPart { ...@@ -71,7 +71,7 @@ public class CustomPoolEditPart extends PoolEditPart {
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() != null) { && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() != null) {
return ((DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() return ((DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor()).getDiagramGraphicalViewer().getControl().getBounds().width; .getActiveEditor()).getDiagramGraphicalViewer().getControl().getBounds().width - 100;
} else { } else {
return MIN_POOL_WIDTH; return MIN_POOL_WIDTH;
} }
......
...@@ -62,7 +62,7 @@ public class CustomProcessViewProvider extends ProcessViewProvider { ...@@ -62,7 +62,7 @@ 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(CustomPoolEditPart.getDefaultWidth()); layoutConstraint.setWidth(((IPreferenceStore) preferencesHint.getPreferenceStore()).getDefaultInt("poolDefaultWidth"));
layoutConstraint.setHeight(CustomPoolEditPart.CONSTANT_DEFAULT_HEIGHT); layoutConstraint.setHeight(CustomPoolEditPart.CONSTANT_DEFAULT_HEIGHT);
} }
return node; return node;
......
...@@ -202,9 +202,6 @@ public class NewDiagramFactory { ...@@ -202,9 +202,6 @@ public class NewDiagramFactory {
return mapping; return mapping;
} }
/**
* @return the artifact
*/
public DiagramFileStore getNewDiagramFileStore() { public DiagramFileStore getNewDiagramFileStore() {
return fileStore; return fileStore;
} }
......
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