Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stereotypes feature #125

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7f35214
Update version and organize used icons resources
claudenirmf Jan 6, 2022
f062f14
Add FixStereotypesController
claudenirmf Jan 6, 2022
f58c843
Add check to invert associations if necessary
claudenirmf Jan 6, 2022
0cf64b4
Add warning on fix stereotypes action
claudenirmf Jan 7, 2022
00d4b31
Adjust invert association mechanism to keep reading direction
claudenirmf Jan 7, 2022
cd7fe96
Google Java Format
Jan 7, 2022
bd75404
Adds stereotypes mappings
claudenirmf Jan 7, 2022
ea83802
Google Java Format
Jan 7, 2022
31f51f2
Temporarily adds the reload button to the interface
claudenirmf Jan 7, 2022
b2e8c91
Bugfix StackOverflow on large models and stereotype name clashes
claudenirmf Jan 7, 2022
eccdf91
Google Java Format
Jan 7, 2022
8657c9e
Add mappings
claudenirmf Apr 6, 2022
f158a9b
Fix missing association end's type
claudenirmf Apr 6, 2022
a733deb
Update derivation serialization to have consistent direction
claudenirmf Apr 7, 2022
3728340
Update minimize property label
claudenirmf Apr 7, 2022
d5261e5
Google Java Format
Apr 7, 2022
1c73f46
Update feature name to Model Sanitize
claudenirmf Apr 8, 2022
1f6c380
Update deserialization of datatypes
claudenirmf Apr 8, 2022
68294c9
Update several mechanisms
claudenirmf Apr 9, 2022
e74e60b
Update association's apply stereotype
claudenirmf Apr 11, 2022
c925e26
Update model sanitize
claudenirmf Apr 11, 2022
ae0f9e8
WIP: repository sanitizer and general fixes
claudenirmf Apr 11, 2022
28edd59
Google Java Format
Apr 11, 2022
e9cfb91
Fixes bugs
claudenirmf Apr 18, 2022
8c53aac
Google Java Format
Apr 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>it.unibz.inf.ontouml</groupId>
<artifactId>ontouml-vp-plugin</artifactId>
<version>0.5.3</version>
<version>0.5.4</version>

<name>OntoUML 2 Plugin for Visual Paradigm</name>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public class OntoUMLPlugin implements VPPlugin {

public static final String PLUGIN_VERSION_RELEASE = "0.5.3";
public static final String PLUGIN_VERSION_RELEASE = "0.5.4";
public static final String PLUGIN_ID = "it.unibz.inf.ontouml.vp";
public static final String PLUGIN_NAME = "OntoUML Plugin";
public static final String PLUGIN_REPO = "https://github.com/OntoUML/ontouml-vp-plugin/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.vp.plugin.action.VPAction;
import com.vp.plugin.action.VPContext;
import com.vp.plugin.model.IAssociation;
import com.vp.plugin.model.IAssociationEnd;
import com.vp.plugin.model.IModelElement;
import it.unibz.inf.ontouml.vp.model.uml.Association;
import it.unibz.inf.ontouml.vp.utils.OntoUMLConstraintsManager;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void performAction() {
boolean shouldProceed = true;

if (shouldWarnAboutInvertingAssociations())
shouldProceed = ViewManagerUtils.associationInvertionWarningDialog();
shouldProceed = ViewManagerUtils.showInvertAssociationWarningDialog();

if (!shouldProceed) return;

Expand All @@ -58,11 +59,19 @@ public void performAction() {
.filter(Association::holdsBetweenClasses)
.forEach(
association -> {
if (doesRequireInverting(association))
Association.invertAssociation(association, true);

StereotypesManager.applyStereotype(
association, associationStereotypeId.getStereotype());
String stereotype = associationStereotypeId.getStereotype();
StereotypesManager.applyStereotype(association, stereotype);
IAssociationEnd sourceEnd =
!doesRequireInverting(association)
? Association.getSourceEnd(association)
: Association.getTargetEnd(association);
IAssociationEnd targetEnd =
!doesRequireInverting(association)
? Association.getTargetEnd(association)
: Association.getSourceEnd(association);

Association.setSourceEndProperties(association, sourceEnd);
Association.setTargetEndProperties(association, targetEnd);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils;
import java.awt.event.ActionEvent;

public class ModelActionController implements VPContextActionController {
public class InvertAssociationController implements VPContextActionController {

@Override
public void performAction(VPAction action, VPContext context, ActionEvent event) {
Expand All @@ -37,7 +37,7 @@ public void performAction(VPAction action, VPContext context, ActionEvent event)
case ActionIdManager.ASSOCIATION_ACTION_INVERT_ASSOCIATION:
ModelElement.forEachSelectedElement(
clickedAssociation,
selectedAssociation -> Association.invertAssociation(selectedAssociation, false));
selectedAssociation -> Association.invertAssociation(selectedAssociation));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package it.unibz.inf.ontouml.vp.controllers;

import com.vp.plugin.action.VPAction;
import com.vp.plugin.action.VPActionController;
import it.unibz.inf.ontouml.vp.utils.SimpleServiceWorker;
import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils;
import java.util.List;

public class ModelSanitizeController implements VPActionController {

private static final String MESSAGE_MODEL_SANITIZE_SUCCESS =
"Model sanitize executed successfully.";
private static final String MESSAGE_MODEL_IMPORT_UNEXPECTED_ERROR =
"Unexpected error performing model sanitize.";

private boolean shouldProceed = false;

@Override
public void update(VPAction vpAction) {}

@Override
public void performAction(VPAction vpAction) {
showFixStereotypesWarning();

if (!shouldProceed) return;

new SimpleServiceWorker(this::sanitizeModelTask).execute();
}

private void showFixStereotypesWarning() {
shouldProceed = ViewManagerUtils.showFixStereotypesWarningDialog();
}

private List<String> sanitizeModelTask(SimpleServiceWorker context) {
try {
if (!context.isCancelled()) {
ModelSanitizeManager.run();
ViewManagerUtils.log(MESSAGE_MODEL_SANITIZE_SUCCESS);
return List.of(MESSAGE_MODEL_SANITIZE_SUCCESS);
}

return List.of();
} catch (Exception e) {
e.printStackTrace();
ViewManagerUtils.log(MESSAGE_MODEL_IMPORT_UNEXPECTED_ERROR);
return List.of(MESSAGE_MODEL_IMPORT_UNEXPECTED_ERROR);
}
}
}
Loading