diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/AbstractStepInFeature.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/AbstractStepInFeature.java index d33f8f02b0f416cf7963e5f419214eb3bf224fc7..ff4f09d9fe6f0ee364fccf73cc517b11d46010d9 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/AbstractStepInFeature.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/AbstractStepInFeature.java @@ -1,11 +1,9 @@ package org.framed.iorm.ui.graphitifeatures; -import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.graphiti.features.IFeatureProvider; import org.eclipse.graphiti.features.context.ICustomContext; import org.eclipse.graphiti.features.custom.AbstractCustomFeature; import org.eclipse.graphiti.mm.pictograms.Shape; -import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; import org.framed.iorm.ui.literals.IdentifierLiterals; import org.framed.iorm.ui.multipage.MultipageEditor; @@ -74,24 +72,6 @@ public abstract class AbstractStepInFeature extends AbstractCustomFeature { return false; } - /** - * manages to close a given multipage editor at the next reasonable opportunity usind the operation - * {@link Display#asyncExec} - * <p> - * It also saves the multipage editor before closing it to clean up the dirty state of the whole workbench. - * @param multipageEditorToClose - */ - public static void closeMultipageEditorWhenPossible(MultipageEditor multipageEditorToClose) { - Display display = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay(); - display.asyncExec(new Runnable() { - @Override - public void run() { - multipageEditorToClose.getDiagramEditor().doSave(new NullProgressMonitor()); - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(multipageEditorToClose, false); - } - }); - } - /** * to be overriden in subclasses */ diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/StepInFeature.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/StepInFeature.java index 5a3cca2d309102804e878bd8ce3f398c8495f2f2..04bea31e2fa758d1937878518e83fc09c679ca3c 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/StepInFeature.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/StepInFeature.java @@ -62,7 +62,7 @@ public class StepInFeature extends AbstractStepInFeature { //Step 1 MultipageEditor multipageEditorToClose = (MultipageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - closeMultipageEditorWhenPossible(multipageEditorToClose); + GeneralUtil.closeMultipageEditorWhenPossible(multipageEditorToClose); //Step 2 ContainerShape typeBodyShape = (ContainerShape) context.getPictogramElements()[0]; Type type = null; diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/multipage/MultipageEditor.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/multipage/MultipageEditor.java index de82c4f7edda7e45408e7ec90d6f3f72d7926fac..644a6dc311463578babe4e3f14dc85bff6156fdb 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/multipage/MultipageEditor.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/multipage/MultipageEditor.java @@ -11,6 +11,7 @@ import org.eclipse.graphiti.mm.pictograms.Diagram; import org.eclipse.graphiti.ui.editor.DiagramEditorInput; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorInput; @@ -413,8 +414,18 @@ public class MultipageEditor extends FormEditor implements ISelectionListener, I } if(unsavedChangesInOtherMultipageEditors) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - MessageDialog.openInformation(shell, MESSAGE_UNSAVED_CHANGES_IN_OTHER_MULTIPAGE_EDITORS_TITLE, MESSAGE_UNSAVED_CHANGES_IN_OTHER_MULTIPAGE_EDITORS_TEXT); - } + MessageDialog dialog = new MessageDialog(shell, + MESSAGE_UNSAVED_CHANGES_IN_OTHER_MULTIPAGE_EDITORS_TITLE, null, + MESSAGE_UNSAVED_CHANGES_IN_OTHER_MULTIPAGE_EDITORS_TEXT, MessageDialog.ERROR, + new String[] {"Save All", "OK"}, 0); + int result = dialog.open(); + if(result == 0) { + Display display = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay(); + display.asyncExec(new Runnable() { + @Override + public void run() { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(false); + } }); } } activeWorkbenchPart = (MultipageEditor) part; } } } } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/CompartmentTypePattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/CompartmentTypePattern.java index 56ae018e2e87849b55cff211d0e031093957916f..dd2f39a09d76d9de93c759550f7fe634597b222e 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/CompartmentTypePattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/CompartmentTypePattern.java @@ -587,7 +587,7 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte * If its not clear what the different shapes means, see {@link #add} for reference. */ @Override - public boolean layout(ILayoutContext layoutContext) { + public boolean layout(ILayoutContext layoutContext) { boolean layoutChanged = false; int newHeight, newWidth, newY; Shape indicatorDotsShapeToDelete; @@ -650,7 +650,9 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte EList<Shape> attributes = attributeContainerShape.getChildren(); //set place of attributes for(int m = 0; m<attributes.size(); m++) { - attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text attributeText = (Text) attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + attributeText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + attributeText.setWidth(newWidth); } //set all attributes visible indicatorDotsShapeToDelete = null; @@ -691,7 +693,9 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte EList<Shape> operations = operationContainerShape.getChildren(); //set place of attributes for(int m = 0; m<operations.size(); m++) { - operationContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text operationText = (Text) operationContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + operationText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + operationText.setWidth(newWidth); } //set all operations visible indicatorDotsShapeToDelete = null; @@ -760,7 +764,7 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte PropertyUtil.setShape_IdValue(indicatorDotsShape, SHAPE_ID_COMPARTMENTTYPE_INDICATOR_DOTS); } layoutChanged = true; - } } } } + } } } } return layoutChanged; } @@ -953,7 +957,7 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte } return super.canResizeShape(resizeContext); } - + //delete feature //~~~~~~~~~~~~~~ /** diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/DataTypePattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/DataTypePattern.java index e8f7c142c4959bd00560548feb92baec688d6002..17abbf42f4a40b1fd275c1f29da127f7ddb96ca3 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/DataTypePattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/DataTypePattern.java @@ -602,7 +602,9 @@ public class DataTypePattern extends FRaMEDShapePattern implements IPattern { EList<Shape> attributes = attributeContainerShape.getChildren(); //set place of attributes for(int m = 0; m<attributes.size(); m++) { - attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text attributeText = (Text) attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + attributeText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + attributeText.setWidth(newWidth); } //set all attributes visible indicatorDotsShapeToDelete = null; @@ -643,7 +645,9 @@ public class DataTypePattern extends FRaMEDShapePattern implements IPattern { EList<Shape> operations = operationContainerShape.getChildren(); //set place of operations for(int m = 0; m<operations.size(); m++) { - operationContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text operationText = (Text) operationContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + operationText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + operationText.setWidth(newWidth); } //set all operations visible indicatorDotsShapeToDelete = null; diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/NaturalTypePattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/NaturalTypePattern.java index 75969512292ed86a9d94317c2a22019bfc7b187e..91a4b722f43d19c27cb2651f9b423a0a09d7b764 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/NaturalTypePattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/NaturalTypePattern.java @@ -594,7 +594,9 @@ public class NaturalTypePattern extends FRaMEDShapePattern implements IPattern { EList<Shape> attributes = attributeContainerShape.getChildren(); //set places of attributes for(int m = 0; m<attributes.size(); m++) { - attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text attributeText = (Text) attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + attributeText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + attributeText.setWidth(newWidth); } //set all attributes visible and delete indicator dots indicatorDotsShapeToDelete = null; @@ -635,7 +637,9 @@ public class NaturalTypePattern extends FRaMEDShapePattern implements IPattern { EList<Shape> operations = operationContainerShape.getChildren(); //set place of operations for(int m = 0; m<operations.size(); m++) { - operationContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text operationText = (Text) operationContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + operationText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + operationText.setWidth(newWidth); } //set all operations visible indicatorDotsShapeToDelete = null; diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java index 01633dd232dc17c38990cd57892553eb87377b76..8e648bc810d9b14ed9f353c59cfa0eb1a710bb51 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java @@ -618,7 +618,9 @@ public class RoleTypePattern extends FRaMEDShapePattern implements IPattern { EList<Shape> attributes = attributeContainerShape.getChildren(); //set places of attributes for(int m = 0; m<attributes.size(); m++) { - attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text attributeText = (Text) attributeContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + attributeText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + attributeText.setWidth(newWidth); } //set all attributes visible and delete indicator dots indicatorDotsShapeToDelete = null; @@ -659,7 +661,9 @@ public class RoleTypePattern extends FRaMEDShapePattern implements IPattern { EList<Shape> operations = operationContainerShape.getChildren(); //set place of operations for(int m = 0; m<operations.size(); m++) { - operationContainerShape.getChildren().get(m).getGraphicsAlgorithm().setY(newY+m*HEIGHT_OPERATION_SHAPE); + Text operationText = (Text) operationContainerShape.getChildren().get(m).getGraphicsAlgorithm(); + operationText.setY(newY+m*HEIGHT_OPERATION_SHAPE); + operationText.setWidth(newWidth); } //set all operations visible indicatorDotsShapeToDelete = null;