Skip to content
Snippets Groups Projects
Commit bfcc7aa1 authored by Kevin Kassin's avatar Kevin Kassin
Browse files

documented and refactored more classes

the multipage editor now uses the grouping feature references too
parent 18963605
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 23 deletions
......@@ -130,7 +130,7 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern {
if (addContext.getNewObject() instanceof Relation) {
Relation relation = (Relation) addContext.getNewObject();
if (relation.getType() == Type.FULFILLMENT)
return true && EditPolicyService.canAdd(addContext, this.getDiagram());
return EditPolicyService.canAdd(addContext, this.getDiagram());
}
return false;
}
......
......@@ -2,6 +2,7 @@ package group;
import org.eclipse.graphiti.util.IColorConstant;
import org.framed.iorm.ui.UILiterals;
import org.framed.iorm.ui.palette.PaletteView;
public class Literals {
......@@ -28,6 +29,11 @@ public class Literals {
*/
public final String DIAGRAM_KIND = "group_diagram";
/**
* the palette view of this module's pattern
*/
public final PaletteView paletteView = PaletteView.TOPLEVEL_VIEW;
/**
* identifiers used for the group
* <p>
......
......@@ -109,7 +109,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
if(addContext.getNewObject() instanceof Relation) {
Relation relation = (Relation) addContext.getNewObject();
if(relation.getType() == Type.INHERITANCE)
return true && EditPolicyService.canAdd(addContext, this.getDiagram());
return EditPolicyService.canAdd(addContext, this.getDiagram());
}
return false;
}
......@@ -173,7 +173,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
!(sourceShape.equals(targetShape))) {
if(typeReferences.getTypes().contains(sourceShape.getType()))
if(targetShape.getType() == sourceShape.getType())
return true && EditPolicyService.canCreate(createContext, this.getDiagram());
return EditPolicyService.canCreate(createContext, this.getDiagram());
} }
return false;
}
......
......@@ -2,6 +2,7 @@ package compartment;
import org.eclipse.graphiti.util.IColorConstant;
import org.framed.iorm.ui.UILiterals;
import org.framed.iorm.ui.palette.PaletteView;
public class Literals {
......@@ -28,6 +29,11 @@ public class Literals {
*/
public final String DIAGRAM_KIND = "compartment_diagram";
/**
* the palette view of this module's patterns
*/
public final PaletteView paletteView = PaletteView.COMPARTMENT_VIEW;
/**
* identifiers used for compartment types
* <p>
......
......@@ -161,7 +161,7 @@ public abstract class AbstractInterRelationshipConstraintPattern extends FRaMEDC
!(sourceConnection.equals(targetConnection))) {
if(sourceConnection.getType() == Type.RELATIONSHIP)
if(targetConnection.getType() == sourceConnection.getType())
return true && EditPolicyService.canCreate(createContext, this.getDiagram());
return EditPolicyService.canCreate(createContext, this.getDiagram());
} }
return false;
}
......
......@@ -164,7 +164,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
if(addContext.getNewObject() instanceof Relation) {
Relation relation = (Relation) addContext.getNewObject();
if(relation.getType() == Type.RELATIONSHIP) {
return true && EditPolicyService.canAdd(addContext, this.getDiagram());
return EditPolicyService.canAdd(addContext, this.getDiagram());
} }
return false;
}
......@@ -271,7 +271,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
if(sourceShape.getContainer() == targetShape.getContainer()) {
if(typeReferences.getTypes().contains(sourceShape.getType()))
if(targetShape.getType() == sourceShape.getType())
return true && EditPolicyService.canCreate(createContext, this.getDiagram());
return EditPolicyService.canCreate(createContext, this.getDiagram());
} }
return false;
}
......
......@@ -68,7 +68,7 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt
!(sourceShape.equals(targetShape))) {
if(sourceShape.getType() == Type.ROLE_TYPE)
if(targetShape.getType() == sourceShape.getType())
return true && EditPolicyService.canCreate(createContext, this.getDiagram());
return EditPolicyService.canCreate(createContext, this.getDiagram());
} }
return false;
}
......
......@@ -39,12 +39,12 @@ import org.framed.iorm.ui.UIUtil;
import org.framed.iorm.ui.editPolicy.EditPolicyService;
import org.framed.iorm.ui.exceptions.InvalidTypeOfEditorInputException;
import org.framed.iorm.ui.exceptions.TransformationFailedException;
import org.framed.iorm.ui.palette.PaletteView;
import org.framed.iorm.ui.subeditors.FRaMEDDiagramEditor;
import org.framed.iorm.ui.subeditors.FRaMEDFeatureEditor;
import org.framed.iorm.ui.subeditors.FRaMEDTextViewer;
import org.framed.iorm.ui.providers.DiagramTypeProvider; //*import for javadoc link
import org.framed.iorm.ui.providers.ToolBehaviorProvider;
import org.framed.iorm.ui.references.AbstractGroupingFeatureReference;
import org.framed.iorm.ui.references.ModelFeatureReference;
import org.framed.iorm.ui.wizards.RoleModelWizard; //*import for javadoc link
......@@ -60,6 +60,9 @@ import org.framed.iorm.ui.wizards.RoleModelWizard; //*import for javadoc link
*/
public class MultipageEditor extends FormEditor implements ISelectionListener, IWorkbenchListener {
/**
* the reference to the model feature
*/
ModelFeatureReference modelFeatureReferences = new ModelFeatureReference();
/**
......@@ -67,12 +70,6 @@ public class MultipageEditor extends FormEditor implements ISelectionListener, I
*/
private final String DIAGRAM_PROVIDER_ID = UILiterals.DIAGRAM_PROVIDER_ID;
//TODO fix
/**
* the value for the property diagram kind of compartment types diagram gathered from {@link IdentifierLiterals}
*/
private final String DIAGRAM_KIND_COMPARTMENTTYPE_DIAGRAM = "compartment_diagram";
/**
* name literals for the pages of the multipage editor and the model feature
* <p>
......@@ -247,14 +244,14 @@ public class MultipageEditor extends FormEditor implements ISelectionListener, I
if(getEditorInput() instanceof DiagramEditorInput) {
Resource resource = UIUtil.getResourceFromEditorInput(getEditorInput());
Diagram diagram = UIUtil.getDiagramForResourceOfDiagramEditorInput(resource);
if(UIUtil.isDiagram_KindValue(diagram, DIAGRAM_KIND_COMPARTMENTTYPE_DIAGRAM)) {
for(AbstractGroupingFeatureReference agfr : UIUtil.getGroupingFeatureReferences()) {
if(UIUtil.isDiagram_KindValue(diagram, agfr.getDiagramKind())) {
ToolBehaviorProvider toolBehaviorProvider =
(ToolBehaviorProvider) editorDiagram.getDiagramTypeProvider().getCurrentToolBehaviorProvider();
toolBehaviorProvider.setPaletteType(PaletteView.COMPARTMENT_VIEW);
toolBehaviorProvider.setPaletteType(agfr.getPaletteView());
} }
editorDiagram.getDiagramBehavior().refreshPalette();
}
}
}
} }
/**
* This method add pages to the multipage editor if the editor input is of type {@link IFileEditorInput}
......
package org.framed.iorm.ui.references;
import org.framed.iorm.model.Type;
import org.framed.iorm.ui.palette.PaletteView;
/**
* This is the abstract superclass for references which contain informations about feature patterns that can
......@@ -26,6 +27,11 @@ public abstract class AbstractGroupingFeatureReference {
SHAPE_ID_NAME,
SHAPE_ID_TYPEBODY;
/**
* the palette view of the grouping feature when stepped in it
*/
protected PaletteView paletteView;
/**
* getter method for modelType
* @return the model type
......@@ -65,4 +71,12 @@ public abstract class AbstractGroupingFeatureReference {
public String getShapeIdTypebody() {
return SHAPE_ID_TYPEBODY;
}
/**
* getter method for paletteView
* @return the palette view of the grouping feature when stepped in it
*/
public PaletteView getPaletteView() {
return paletteView;
}
}
......@@ -22,5 +22,6 @@ public class CompartmentGroupingFeatureReference extends AbstractGroupingFeature
SHAPE_ID_CONTAINER = literals.SHAPE_ID_COMPARTMENTTYPE_CONTAINER;
SHAPE_ID_NAME = literals.SHAPE_ID_COMPARTMENTTYPE_NAME;
SHAPE_ID_TYPEBODY = literals.SHAPE_ID_COMPARTMENTTYPE_TYPEBODY;
paletteView = literals.paletteView;
}
}
......@@ -22,5 +22,6 @@ public class GroupGroupingFeatureReference extends AbstractGroupingFeatureRefere
SHAPE_ID_CONTAINER = literals.SHAPE_ID_GROUP_CONTAINER;
SHAPE_ID_NAME = literals.SHAPE_ID_GROUP_NAME;
SHAPE_ID_TYPEBODY = literals.SHAPE_ID_GROUP_TYPEBODY;
paletteView = literals.paletteView;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment