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

dokumented and refactored the src source folder

parent fe4ee31b
No related branches found
No related tags found
No related merge requests found
Showing
with 315 additions and 241 deletions
......@@ -95,6 +95,7 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern {
}
//TODO
//If the target of a fulfillment was changed the wizard to choose the fulfilled roles has to be opened.</li>
@Override
public void postReconnect(IReconnectionContext context) {
if(context.getReconnectType() == ReconnectionContext.RECONNECT_TARGET) {
......
......@@ -581,7 +581,7 @@ public class GroupPattern extends FRaMEDShapePattern implements IPattern {
//at creation no diagram is existing so catch this
List<String> modelElementsNames = null;
try {
modelElementsNames = UIUtil.getGroupOrCompartmentTypeElementNames(pictogramElement, getDiagram(), Type.GROUP);
modelElementsNames = UIUtil.getGroupingFeaturesModelElementNames(pictogramElement, getDiagram(), Type.GROUP);
} catch(NoDiagramFoundException e) { return Reason.createFalseReason(); }
//model element names in model container of shape
List<String> pictogramElementsNames = util.getContentPreviewElementsNames(pictogramElement);
......@@ -628,7 +628,7 @@ public class GroupPattern extends FRaMEDShapePattern implements IPattern {
modelContainerShape.getChildren().clear();
for(ModelElement modelElement : groupModel.getElements()) {
Shape groupElementShape = pictogramElementCreateService.createShape(modelContainerShape, true);
Text groupElementText = graphicAlgorithmService.createText(groupElementShape, UIUtil.getGroupOrCompartmentTypeElementText(modelElement));
Text groupElementText = graphicAlgorithmService.createText(groupElementShape, UIUtil.getGroupingFeaturesElementText(modelElement));
groupElementText.setForeground(manageColor(literals.COLOR_TEXT));
UIUtil.setShape_IdValue(groupElementShape, literals.SHAPE_ID_GROUP_ELEMENT);
}
......@@ -734,7 +734,7 @@ public class GroupPattern extends FRaMEDShapePattern implements IPattern {
if(shape instanceof ContainerShape) {
for(AbstractInnerGroupingReference reference : innerGroupingReferences) {
if(UIUtil.isShape_IdValue(shape, reference.getShapeIdContainer())) {
innerGroupsOrCompartmentTypesToDelete.add(UIUtil.getTypeBodyForGroupingContainer((ContainerShape) shape, reference.getShapeIdTypebody()));
innerGroupsOrCompartmentTypesToDelete.add(UIUtil.getTypeBodyForGroupingFeaturesContainer((ContainerShape) shape, reference.getShapeIdTypebody()));
}
}
} }
......
......@@ -750,7 +750,7 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte
//at creation no diagram is existing so catch this
List<String> modelElementsNames = null;
try {
modelElementsNames = UIUtil.getGroupOrCompartmentTypeElementNames(pictogramElement, getDiagram(), Type.COMPARTMENT_TYPE);
modelElementsNames = UIUtil.getGroupingFeaturesModelElementNames(pictogramElement, getDiagram(), Type.COMPARTMENT_TYPE);
} catch(NoDiagramFoundException e) { return Reason.createFalseReason(); }
//check for update: different names, different amount of attibutes/ operations
......@@ -834,7 +834,7 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte
for(ModelElement modelElement : compartmentModel.getElements()) {
if(modelElement instanceof org.framed.iorm.model.Shape) {
Shape elementShape = pictogramElementCreateService.createShape(modelContainerShape, true);
Text elementText = graphicAlgorithmService.createText(elementShape, UIUtil.getGroupOrCompartmentTypeElementText(modelElement));
Text elementText = graphicAlgorithmService.createText(elementShape, UIUtil.getGroupingFeaturesElementText(modelElement));
elementText.setForeground(manageColor(literals.COLOR_TEXT));
UIUtil.setShape_IdValue(elementShape, literals.SHAPE_ID_COMPARTMENTTYPE_ELEMENT);
counter++;
......@@ -946,7 +946,7 @@ public class CompartmentTypePattern extends FRaMEDShapePattern implements IPatte
if(shape instanceof ContainerShape) {
for(AbstractInnerGroupingReference reference : innerGroupingReferences) {
if(UIUtil.isShape_IdValue(shape, reference.getShapeIdContainer()))
innerGroupsOrCompartmentTypesToDelete.add(UIUtil.getTypeBodyForGroupingContainer((ContainerShape) shape, reference.getShapeIdTypebody()));
innerGroupsOrCompartmentTypesToDelete.add(UIUtil.getTypeBodyForGroupingFeaturesContainer((ContainerShape) shape, reference.getShapeIdTypebody()));
} } }
//Step 4
IEditorReference[] openEditors = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
......
......@@ -71,6 +71,9 @@ public abstract class AbstractInterRelationshipConstraintPattern extends FRaMEDC
}
//TODO
//<li>If a inter relationship constraint was reconnected the connection need to be connected to the anchor
//* used in the graphiti pictogram model which is another than used in the business model. See
//* {@link RelationshipPattern#add} for further informations.</li>
@Override
public void postReconnect(IReconnectionContext context) {
Connection connection = context.getConnection();
......
......@@ -99,6 +99,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
}
//TODO
//li>If a relationship was reconnected its intra relationship constraints need to be reconnected to.</li
@Override
public void postReconnect(IReconnectionContext context) {
Connection connection = context.getConnection();
......@@ -113,6 +114,8 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
}
//TODO
//Also deletes intra and inter relationship constraints when deleting relationships. This is needed to
//be done explicitly because graphiti does not automaticly deletes the business object of these constraints.
public void delete(FRaMEDDeleteConnectionFeature deleteConnectionFeature, IDeleteContext deleteContext) {
Connection connection = (Connection) deleteContext.getPictogramElement();
Relation relation = (Relation) getBusinessObjectForPictogramElement(connection);
......
......@@ -31,6 +31,8 @@ public abstract class FRaMEDConnectionPattern extends AbstractConnectionPattern
/**
* the {@link Type} of business object the pattern creates
* <p>
* The standard value is null, but sub classes can set the attribute if needed.
*/
protected Type modelType = null;
......@@ -41,7 +43,9 @@ public abstract class FRaMEDConnectionPattern extends AbstractConnectionPattern
/**
* the identifier or the path for the icon of the create feature
* TODO standard value
* <p>
* The image id has to be set, so there is no standard value. Meanwhile the standard value of the path
* is an empty string, but sub classes can set the attribute if needed.
*/
protected String ICON_IMG_ID,
ICON_IMG_PATH= "";
......@@ -80,38 +84,68 @@ public abstract class FRaMEDConnectionPattern extends AbstractConnectionPattern
/**
* getter method for the icon file path for the create feature in this pattern
* @return the image file path for the icon of the create feature
* TODO standard value erklren
*/
public String getCreateImagePath() {
return ICON_IMG_PATH ;
}
//TODO doku standard value erklren
/**
* getter method for the model type of the pattern
* @return the model type of the pattern
*/
public Type getModelType() {
return modelType;
}
/**
* get method for the fpd
* getter method for the fpd
* @return the feature palette descriptor
*/
public FeaturePaletteDescriptor getFeaturePaletteDescriptor() {
return FPD;
}
//TODO doku standard op to not be implmented if null returned
/**
* encapsulates if and which custom feature should be used when double clicking a pictogram element
* created by the pattern
* <p>
* The standard implementation gives back null since most pattern don't use a double click feature. A
* sub class can override this implementation if needed.
* @param customFeatures the list of possible custom feature to call
* @return the custom feature that should be used when double clicking a pictogram element
* created by the pattern or null if none should be called
*/
public IFeature getDoubleClickFeature(ICustomFeature[] customFeatures) {
return null;
}
//TODO doku standard op, false
/**
* checks if connection can be reconnected
* <p>
* The standard implementation returns false to handle reconnects more safely.
* A sub class can override this implementation if needed.
* @param context contains information about the reconnect
* @return if a reconnect can be executed
*/
public boolean canReconnect(IReconnectionContext context) {
return false;
}
//TODO doku standard op do nothing
/**
* executes needed action after a reconnect was successful
* <p>
* The standard implementation does nothing. A sub class can override this implementation if needed.
* @param context contains information about the reconnect
*/
public void postReconnect(IReconnectionContext context) {}
//TODO doku standard does nothing to be overwritten by pattern if needed
/**
* executes needed actions when a connection is deleted
* <p>
* /**
* The standard implementation does nothing. A sub class can override this implementation if needed.
* @param deleteConnectionFeature the managing delete feature for all connections
* @param deleteContext contains informations about the deletion
*/
public void delete(FRaMEDDeleteConnectionFeature deleteConnectionFeature, IDeleteContext deleteContext) {};
}
......@@ -2,24 +2,32 @@ package org.framed.iorm.ui;
import org.eclipse.emf.ecore.EObject;
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.PictogramElement;
/**
* This class is an abstract super class for the graphiti custom features.
* <p>
* It collects common attributes and operations of these classes.
* @author Kevin Kassin
*/
public abstract class FRaMEDCustomFeature extends AbstractCustomFeature {
/**
* the custom features name
*/
protected String FEATURE_NAME;
/**
* class constructor
* @param featureProvider
* @param featureProvider the feature provider the custom feature belongs to
*/
public FRaMEDCustomFeature(IFeatureProvider featureProvider) {
super(featureProvider);
}
/**
* get method for the features name
* getter method for the features name
* @return the name of the feature
*/
@Override
......@@ -28,16 +36,11 @@ public abstract class FRaMEDCustomFeature extends AbstractCustomFeature {
}
/**
* this operation encapsulates when the custom feature should be visible in the context menu, to be overwritten by sub
* classes
* this operation encapsulates when the custom feature should be visible in the context menu
* <p>
* This operation needs to be implemented by sub classes.
* @return if the custom feature should be visible in the context menu
*/
public abstract boolean contextMenuExpression(PictogramElement pictogramElement,
EObject businessObject);
/**
* the execute operation of the feature, to overwrite by the sub classes
*/
public void execute(ICustomContext context) {}
}
......@@ -13,15 +13,18 @@ import org.framed.iorm.model.Relation;
import org.framed.iorm.ui.providers.FeatureProvider;
/**
* This graphiti custom feature is used to disabling the possibility of deleting connection decorators and the
* This graphiti delete feature is used to disabling the possibility of deleting connection decorators and the
* "Are you sure?" message when deleting connections.
* <p>
* It is returned by the operation {@link FeatureProvider#getDeleteFeatureAdditional}.
* It also calls the {@link FRaMEDConnectionPattern#delete(FRaMEDDeleteConnectionFeature, IDeleteContext)} operation to get
* pattern specific deletion behavior.
* @author Kevin Kassin
*/
public class FRaMEDDeleteConnectionFeature extends DefaultDeleteFeature {
//TODO
/**
* the list of connection patterns known to the feature provider to which this feature belongs to
*/
private List<IConnectionPattern> connectionFeatures;
/**
......@@ -41,12 +44,9 @@ public class FRaMEDDeleteConnectionFeature extends DefaultDeleteFeature {
return !(deleteContext.getPictogramElement() instanceof ConnectionDecorator);
}
//TODO
/**
* disables the "Are you sure?" message when deleting connections
* <p>
* Also deletes intra and inter relationship constraints when deleting relationships. This is needed to
* be done explicitly because graphiti does not automaticly deletes the business object of these constraints.
* calls pattern specific deletion behavior for the connection patterns (Step 1) and
* disables the "Are you sure?" message when deleting connections (Step 2)
*/
@Override
public void delete(IDeleteContext deleteContext) {
......@@ -64,7 +64,9 @@ public class FRaMEDDeleteConnectionFeature extends DefaultDeleteFeature {
}
//TODO publish
/**
* publishes the deleteBusinessObject(Object) operation of the super class
*/
public void deleteBusinessObject(Object object) {
super.deleteBusinessObject(object);
}
......
......@@ -9,15 +9,19 @@ import org.eclipse.graphiti.pattern.IConnectionPattern;
import org.framed.iorm.model.Relation;
import org.framed.iorm.ui.providers.FeatureProvider;
import relationship.RelationshipPattern;
/**
* This class manages checks and needed changes to the business model when reconnecting relations
* <p>
* It uses the {@link FRaMEDConnectionPattern#canReconnect(IReconnectionContext)} and
* {@link FRaMEDConnectionPattern#postReconnect(IReconnectionContext)} operations to get
* pattern specific reconnect behavior.
* @author Kevin Kassin
*/
public class FRaMEDReconnectFeature extends DefaultReconnectionFeature {
//TODO
/**
* the list of connection patterns known to the feature provider to which this feature belongs to
*/
private List<IConnectionPattern> connectionFeatures;
/**
......@@ -29,10 +33,10 @@ public class FRaMEDReconnectFeature extends DefaultReconnectionFeature {
connectionFeatures = ((FeatureProvider) getFeatureProvider()).getConnectionPatterns();
}
//TODO doku with steps?
/**
* decides if a reconnect can be executed by delegating the decision depending in the type of the relation to
* reconnect
* decides if a reconnect can be executed by delegating the decision to the
* {@link FRaMEDConnectionPattern#canReconnect(IReconnectionContext)} implementations of the
* connection patterns
*/
@Override
public boolean canReconnect(IReconnectionContext context) {
......@@ -46,30 +50,13 @@ public class FRaMEDReconnectFeature extends DefaultReconnectionFeature {
return false;
}
//TODO overhaul doku
/**
* Executes needed action after a reconnect was succesful using the following steps:
* Executes needed action after a reconnect was successful using the following steps:
* <p>
* Step 1: For every reconnect the source or target of the relations business object has to be changed
* using {@link #changeSourceOrTargetOfRelation}.<br>
* Step 2: load dynamicly
*
*
*
* Depending on the type of the reconnected relation there can be additional needed actions to do.
*
*
*
*
*
*
* <ul>
* <li>If a inter relationship constraint was reconnected the connection need to be connected to the anchor
* used in the graphiti pictogram model which is another than used in the business model. See
* {@link RelationshipPattern#add} for further informations.</li>
* <li>If the target of a fulfillment was changed the wizard to choose the fulfilled roles has to be opened.</li>
* <li>If a relationship was reconnected its intra relationship constraints need to be reconnected to.</li>
* </ul>
* Step 2: It calls the {@link FRaMEDConnectionPattern#postReconnect(IReconnectionContext)} implementations to
* execute pattern specific reconnect behavior.
*/
@Override
public void postReconnect(IReconnectionContext context) {
......
......@@ -44,7 +44,8 @@ public abstract class FRaMEDShapePattern extends AbstractPattern {
/**
* the {@link Type} of business object the pattern creates
* TODO standard value erklren
* <p>
* The standard value is null, but sub classes can set the attribute if needed.
*/
protected Type modelType = null;
......@@ -55,13 +56,19 @@ public abstract class FRaMEDShapePattern extends AbstractPattern {
/**
* the identifier or the path for the icon of the create feature
*
* TODO standard value erklren
* <p>
* The image id has to be set, so there is no standard value. Meanwhile the standard value of the path
* is an empty string, but sub classes can set the attribute if needed.
*/
protected String ICON_IMG_ID,
ICON_IMG_PATH = "";
//TODO standard value erklren
/**
* the kind of the diagram that the pattern creates
* <p>
* The standard value for this attribute is null, most features don't create own diagrams. Of course this attribute
* can be set by sub classes if needed.
*/
protected String DIAGRAM_KIND = null;
/**
......@@ -102,20 +109,31 @@ public abstract class FRaMEDShapePattern extends AbstractPattern {
return ICON_IMG_PATH;
}
//TODO doku
/**
* getter method for the model type of the pattern
* @return the model type of the pattern
*/
public Type getModelType() {
return modelType;
}
/**
* get method for the fpd
* getter method for the fpd
* @return the feature palette descriptor
*/
public FeaturePaletteDescriptor getFeaturePaletteDescriptor() {
return FPD;
}
//TODO doku standard op to not be implmented if null returned
/**
* encapsulates if and which custom feature should be used when double clicking a pictogram element
* created by the pattern
* <p>
* The standard implementation gives back null since most pattern don't use a double click feature.
* @param customFeatures the list of possible custom feature to call
* @return the custom feature that should be used when double clicking a pictogram element
* created by the pattern or null if none should be called
*/
public IFeature getDoubleClickFeature(ICustomFeature[] customFeatures) {
return null;
}
......@@ -134,7 +152,7 @@ public abstract class FRaMEDShapePattern extends AbstractPattern {
* updates the list of the groups or compartment types content of in which an element is added, deleted or renamed
*/
protected void updateContainingGroupOrCompartmentType() {
ContainerShape groupTypeBodyToUpdate = UIUtil.getGroupTypeBodyForGroupsDiagram(getDiagram());
ContainerShape groupTypeBodyToUpdate = UIUtil.getTypebodyForGroupingFeaturesDiagram(getDiagram());
updatePictogramElement(groupTypeBodyToUpdate);
}
......
This diff is collapsed.
package org.framed.iorm.ui.multipage;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
......@@ -139,46 +138,36 @@ public class MultipageEditorSynchronizationService {
* creates an equivalent editor input for another editor input depending on the editor input of the synchronization base
* using the following steps:
* <p>
* Step 1: If the editor input of the synchronization base is of the right type it gets its resource. Otherwise it throws
* Step 1: It gets a list of all references that contain informations about features that can group other objects.<br>
* Step 2: If the editor input of the synchronization base is of the right type it gets its resource. Otherwise it throws
* an {@link InvalidTypeOfEditorInputException}.<br>
* Step 2: If the editor input of the multipage editor that is not the synchronize base is of the type {@link IFileEditorInput},
* Step 4: If the editor input of the multipage editor that is not the synchronize base is of the type {@link IFileEditorInput},
* return an file editor input for the synchronization base.<br>
* Step 3: If the editor input of the multipage editor that is not the synchronize base is of the type {@link DiagramEditorInput},
* Step 4: If the editor input of the multipage editor that is not the synchronize base is of the type {@link DiagramEditorInput},
* get the diagram of the editor input, search with its name the same diagram in the synchronization base and create a
* diagram editor input with the found diagram.<br>
* Step 4: If neither Step 2 or 3 can be executed throw an {@link InvalidTypeOfEditorInputException}.
* Step 5: If neither Step 2 or 3 can be executed throw an {@link InvalidTypeOfEditorInputException}.
* @param baseEditorInput the editor input of the synchronization base
* @param changedEditorInput the editor input of the multipage editor that is not the synchronization base
* @return an equivalent editor input for another editor input depending on the editor input of the synchronization base
* @throws InvalidTypeOfEditorInputException
*/
private static IEditorInput getEquivalentEditorInput(IEditorInput baseEditorInput, IEditorInput changedEditorInput) {
//TODO doku Step0... load grouping references dynamicly
List<Class<?>> classes = UIUtil.findSourceJavaClasses();
List<AbstractGroupingFeatureReference> groupingFeatures = new ArrayList<AbstractGroupingFeatureReference>();
for(Class<?> cl : classes) {
if(!Modifier.isAbstract(cl.getModifiers())) {
if(UIUtil.getSuperClasses(cl).contains(AbstractGroupingFeatureReference.class)) {
Object object = null;
try {
object = cl.newInstance();
} catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); }
if(object != null) groupingFeatures.add((AbstractGroupingFeatureReference) object);
} } }
//Step 1
List<AbstractGroupingFeatureReference> groupingFeatures = UIUtil.getGroupingFeatureReferences();
//Step 2
Resource baseResource = null;
if(baseEditorInput instanceof IFileEditorInput || baseEditorInput instanceof DiagramEditorInput)
baseResource = UIUtil.getResourceFromEditorInput(baseEditorInput);
else throw new InvalidTypeOfEditorInputException();
//Step 2
//Step 3
if(changedEditorInput instanceof IFileEditorInput)
return UIUtil.getIFileEditorInputForResource(baseResource);
//Step 3
//Step 4
if(changedEditorInput instanceof DiagramEditorInput) {
Resource changedEditorResource = UIUtil.getResourceFromEditorInput(changedEditorInput);
Diagram changedEditorDiagram = UIUtil.getDiagramForResourceOfDiagramEditorInput(changedEditorResource);
Type type = null;
//TODO doku?
for(AbstractGroupingFeatureReference agfr : groupingFeatures) {
if(UIUtil.isDiagram_KindValue(changedEditorDiagram, agfr.getDiagramKind()))
type = agfr.getModelType();
......@@ -188,7 +177,7 @@ public class MultipageEditorSynchronizationService {
UIUtil.getDiagramFromResourceByName(baseResource, changedEditorDiagram.getName(), type);
return DiagramEditorInput.createEditorInput(equivalentDiagramInBaseResource, DIAGRAM_PROVIDER_ID);
}
//Step 4
//Step 5
throw new InvalidTypeOfEditorInputException();
}
}
......@@ -130,14 +130,14 @@ public class FeatureProvider extends DefaultFeatureProviderWithPatterns {
}
/**
* publish the getPatterns() operation of its super type
* publishes the getPatterns() operation of its super type
*/
public List<IPattern> getPatterns() {
return super.getPatterns();
}
/**
* publish the getConnectionPatterns() operation of its super type
* publishes the getConnectionPatterns() operation of its super type
*/
public List<IConnectionPattern> getConnectionPatterns() {
return super.getConnectionPatterns();
......
......@@ -27,12 +27,6 @@ import org.eclipse.graphiti.tb.IContextMenuEntry;
import org.framed.iorm.ui.palette.FeaturePaletteDescriptor;
import org.framed.iorm.ui.palette.PaletteView;
import org.framed.iorm.ui.palette.ViewVisibility;
import customFeatures.StepInFeature;
import customFeatures.StepInNewTabFeature;
import customFeatures.StepOutFeature;
import relationship.EditRelationshipFeature;
import org.framed.iorm.ui.providers.FeatureProvider; //*import for javadoc link
import org.framed.iorm.featuremodel.FRaMEDConfiguration;
import org.framed.iorm.featuremodel.FRaMEDFeature;
......@@ -99,12 +93,7 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
}
//TODO overhaul doku
/**
* set the context menu for a specific context, for example a right clicked pictogram element.
* <p>
* This operation controls which custom features are shown in the context menu depending on the
* right clicked pictogram element. It does this using the following steps:<br>
* Step 1: It gathers the selected pictogram element and its business object.
/* Step 1: It gathers the selected pictogram element and its business object.
* Step 2: It iterates over all custom feature to probably add to the list of custom feature to show in
* the context menu.<br>
* Step 3: If its the {@link ChangeConfigurationFeature}, never add it to this list.<br>
......@@ -121,6 +110,16 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
* Step 8: If its the {@link ResetLayoutForElementFeature} add it to the context menu if a relationships connection or
* connection decorator is right clicked. Also add it if a role types body shape or occurence constraint is selected.
*/
/**
* set the context menu for a specific context, for example a right clicked pictogram element.
* <p>
* This operation controls which custom features are shown in the context menu depending on the
* right clicked pictogram element. It does this using the following steps:<br>
* Step 1: It gathers the selected pictogram element and its business object.<br>
* Step 2: It uses calls the specific {@link FRaMEDCustomFeature#contextMenuExpression(PictogramElement, EObject)}
* implications to decide if a feature should be visible in the context menu.
*/
@Override
public IContextMenuEntry[] getContextMenu(ICustomContext customContext) {
IContextMenuEntry[] superContextEntries = super.getContextMenu(customContext);
......@@ -139,17 +138,15 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
return contextMenuEntries.toArray(new IContextMenuEntry[contextMenuEntries.size()]);
}
//TODO doku anpassen
/**
* builds the palette of the editor using the following steps
* <p>
* Step 1: It creates the different palette categories.<br>
* Step 2: See {@link #getListOfFramedFeatureNames()}.<br>
* Step 3: It adds create features of shape patterns to the correct categories according to the {@link FeatureManager}
* using the operation {@link #addShapeFeature}.<br>
* Step 4: It adds create features of connection patterns to the correct categories according to the {@link FeatureManager}
* using the operation {@link #addConnectionFeature}.<br>
* Step 5: It adds the categories with the added features to the palette.
* Step 3: It access all (a) {@link FRaMEDShapePattern}s and (b) {@link FRaMEDConnectionPattern}s of the feature provider and
* adds them to the correct categories if fitting using (a) {@link #addShapeFeature(FRaMEDShapePattern, List)} and
* (b) {@link #addConnectionFeature(FRaMEDConnectionPattern, List)}.
* Step 4: It adds the categories with the added features to the palette.
*/
@Override
public IPaletteCompartmentEntry[] getPalette() {
......@@ -162,16 +159,17 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
//Step 2
List<String> framedFeatureNames = getListOfFramedFeatureNames();
//Step 3
//(a)
for(IPattern iPattern : ((FeatureProvider) getFeatureProvider()).getPatterns()) {
if(iPattern instanceof FRaMEDShapePattern)
addShapeFeature((FRaMEDShapePattern) iPattern, framedFeatureNames);
}
//Step 4
//(b)
for(IConnectionPattern iConPattern : ((FeatureProvider) getFeatureProvider()).getConnectionPatterns()) {
if(iConPattern instanceof FRaMEDConnectionPattern)
addConnectionFeature((FRaMEDConnectionPattern) iConPattern, framedFeatureNames);
}
//Step 5
//Step 4
pallete.add(entityCategory);
pallete.add(propertiesCategory);
pallete.add(relationsCategory);
......@@ -278,9 +276,12 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
break;
} } } }
//TODO doku
/**
* enables the edit features for relationships and fulfillments when double clicking such a relation
* enables the double click feature for shapes and connections
* <p>
* To do this it uses (a) {@link FRaMEDConnectionPattern#getDoubleClickFeature(ICustomFeature[])} and
* (b) {@link FRaMEDShapePattern#getDoubleClickFeature(ICustomFeature[])} to decide if and which custom
* feature should called when double clicking a pictogram element of the pattern.
*/
@Override
public ICustomFeature getDoubleClickFeature(IDoubleClickContext context) {
......@@ -288,14 +289,15 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
PictogramElement pictogramElement = context.getPictogramElements()[0];
EObject businessObject = UIUtil.getBusinessObjectIfExactlyOne(pictogramElement);
ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
//(a)
if(businessObject instanceof Relation) {
//Step 4
for(IConnectionPattern iConPattern : ((FeatureProvider) getFeatureProvider()).getConnectionPatterns()) {
if(iConPattern instanceof FRaMEDConnectionPattern) {
FRaMEDConnectionPattern framedConnectionPattern = (FRaMEDConnectionPattern) iConPattern;
if(framedConnectionPattern.getModelType() == ((Relation) businessObject).getType())
return (ICustomFeature) framedConnectionPattern.getDoubleClickFeature(customFeatures);
} } }
//(b)
if(businessObject instanceof org.framed.iorm.model.Shape) {
for(IPattern iPattern : ((FeatureProvider) getFeatureProvider()).getPatterns()) {
if(iPattern instanceof FRaMEDShapePattern) {
......
......@@ -2,33 +2,66 @@ package org.framed.iorm.ui.references;
import org.framed.iorm.model.Type;
//TODO doku fr alles!
/**
* This is the abstract superclass for references which contain informations about feature patterns that can
* group other objects.
* @author Kevin Kassin
*/
public abstract class AbstractGroupingFeatureReference {
/**
* the model type of the grouping feature
*/
protected Type modelType;
/**
* the kind of diagram the grouping feature creates
*/
protected String DIAGRAM_KIND;
/**
* some shape ids of the grouping feature's pattern
*/
protected String SHAPE_ID_CONTAINER,
SHAPE_ID_NAME,
SHAPE_ID_TYPEBODY;
/**
* getter method for modelType
* @return the model type
*/
public Type getModelType() {
return modelType;
}
/**
* getter method for DIAGRAM_KIND
* @return the diagram kind
*/
public String getDiagramKind() {
return DIAGRAM_KIND;
}
/**
* getter method for SHAPE_ID_CONTAINER
* @return the shape id of the container
*/
public String getShapeIdContainer() {
return SHAPE_ID_CONTAINER;
}
/**
* getter method for SHAPE_ID_NAME
* @return the shape id of the name shape
*/
public String getShapeIdName() {
return SHAPE_ID_NAME;
}
/**
* getter method for SHAPE_ID_TYPEBODY
* @return the shape id of the typebody
*/
public String getShapeIdTypebody() {
return SHAPE_ID_TYPEBODY;
}
......
......@@ -2,11 +2,20 @@ package org.framed.iorm.ui.references;
import org.framed.iorm.model.Type;
//TODO Doku fr alles
/**
* This is the grouping feature reference which contain informations about the compartment type
* @author Kevin Kassin
*/
public class CompartmentGroupingFeatureReference extends AbstractGroupingFeatureReference {
/**
* the compartment type's literals
*/
compartment.Literals literals = new compartment.Literals();
/**
* class constructor
*/
public CompartmentGroupingFeatureReference() {
modelType = Type.COMPARTMENT_TYPE;
DIAGRAM_KIND = literals.DIAGRAM_KIND;
......
......@@ -2,11 +2,20 @@ package org.framed.iorm.ui.references;
import org.framed.iorm.model.Type;
//TODO Doku fr alles
/**
* This is the grouping feature reference which contain informations about the group
* @author Kevin Kassin
*/
public class GroupGroupingFeatureReference extends AbstractGroupingFeatureReference {
/**
* the group's literals
*/
group.Literals literals = new group.Literals();
/**
* class constructor
*/
public GroupGroupingFeatureReference() {
modelType = Type.GROUP;
DIAGRAM_KIND = literals.DIAGRAM_KIND;
......
package org.framed.iorm.ui.references;
//TODO
/**
* The reference class to the model feature
* @author Kevin Kassin
*/
public class ModelFeatureReference {
/**
* the model feature's literals
*/
model.Literals modelLiterals = new model.Literals();
/**
* the model features name
*/
public final String MODEL_FEATURE_NAME = modelLiterals.FEATURE_NAME;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment