Skip to content

Commit

Permalink
Plugin Update Automation (#61)
Browse files Browse the repository at this point in the history
* Retrieve releases from GitHub

* Updates release download

* Updates interfaces and download

* Updates periodic lookup for new releases

* Update plugin.xml and general bugfix

* Bugfix

* Improved plugin toolbar

* Extracted nested classes from ViewUtils

* General refactoring and update of releases serialization

* Refactoring

* Refactoring

* Refactoring

* BugFix

Replaces ZonedDateTime serialization to strings

* Refactoring

* Refactoring

* Fixed null pointer bug

Co-authored-by: Tiago Prince Sales <[email protected]>
  • Loading branch information
claudenirmf and tgoprince authored Aug 20, 2020
1 parent 40cf15f commit 114bb25
Show file tree
Hide file tree
Showing 71 changed files with 2,921 additions and 2,587 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ Stereotypes and meta-properties that are essential to OntoUML modeling are easil

Notice that beyond the full list of stereotypes, a dynamic list of stereotypes is also available. This dynamic list is usually preferred during modeling as it filters wrong stereotypes for your class or association based on, respectively, their super/sub classes and their associated classes. The full list, however, tends to provide a faster and more flexible option during model fixing and refactoring.

![GIF showing a OntoUML model being edited](./resources/feature-modeling.gif)
![GIF showing a OntoUML model being edited](./docs/feature-modeling.gif)

![A screenshot of a suggested list of stereotypes in a context menu](./resources/feature-suggested-stereotypes.png)
![A screenshot of a suggested list of stereotypes in a context menu](./docs/feature-suggested-stereotypes.png)

![A screenshot of meta-properties editing in context menu](./resources/feature-meta-properties.png)
![A screenshot of meta-properties editing in context menu](./docs/feature-meta-properties.png)

![A screenshot of restricted instances menu selection](./resources/feature-restricte-to.png)
![A screenshot of restricted instances menu selection](./docs/feature-restricte-to.png)

Try selecting multiple elements to fast update your models!

#### Smart Paint

Automatic diagram painting based on the possible instances of classes with highlighted ultimate sortals (i.e., «kind», «collective», «quantity», «relator», «mode», and «quality») for improved model readability.

![A screenshot of an automatically painted diagram](./resources/feature-smart-paint.png)
![A screenshot of an automatically painted diagram](./docs/feature-smart-paint.png)

#### Smart Modeling

Expand All @@ -63,7 +63,7 @@ Automatic verification of OntoUML syntactical rules which are reported to the us

The Diagram Verification feature performs the verification of the whole model but only displays issues about elements present in the currently open diagram, facilitating the user's task of fixing models.

![A gif exemplifying the model verification feature](./resources/feature-verification.gif)
![A gif exemplifying the model verification feature](./docs/feature-verification.gif)

#### Model Transformation to OWL with gUFO

Expand All @@ -73,15 +73,15 @@ Users must select the elements that shall be exported to gUFO either selecting f

**WARNING**: the transformation feature require the presence of no verification errors among the exported entities. In addition, partial transformations of the model should be executed with care as they may introduce violations of some syntactical constraint.

![A screenshot showing the "transformation to gUFO" window](./resources/feature-gufo.png)
![A screenshot showing the "transformation to gUFO" window](./docs/feature-gufo.png)

#### Continuous Updates

The cloud-based features offered in the plugin are periodically updated. Updates in these features usually do not require updates in the Visual Paradigm plugin.

And last, but not least, this project is supported by the [OntoUML.org](https://ontouml.org/) community and its set of features will only grow, incorporating new and updated OntoUML technologies.

![A screenshot showing the toolbar of the OntoUML plugin](./resources/feature-toolbar.png)
![A screenshot showing the toolbar of the OntoUML plugin](./docs/feature-toolbar.png)

In order to update to a new version of the plugin, please download the latest [release](https://github.com/OntoUML/ontouml-vp-plugin/releases) as a ZIP file and select it through the "Update Plugin" button in the plugin (available from version 0.3.0).

Expand All @@ -93,9 +93,9 @@ ___

To **install** or **update** the **OntoUML Plugin for Visual Paradigm**, please go to our [releases page](https://github.com/OntoUML/ontouml-vp-plugin/releases) and download the ZIP file `ontouml-vp-plugin` in the latest release. Then go to `Help > Install Plugin` in the top of your window and, after clicking `Install from a zip of plugin` and `Next`, select the download release.

![Install plugin window](./resources/toolbar-help-install.png)
![Install plugin window](./docs/toolbar-help-install.png)

![Install plugin window](./resources/install-plugin-dialog.png)
![Install plugin window](./docs/install-plugin-dialog.png)

For more details, check out this [guide](https://knowhow.visual-paradigm.com/openapi/how-to-deploy-plugins-to-vp-application/).

Expand Down Expand Up @@ -229,11 +229,11 @@ ___

### Why do I get the error message "The ID [...] is already in use"?

![Error message: ID already in use](./resources/faq-id-in-use.png)
![Error message: ID already in use](./docs/faq-id-in-use.png)

Each Visual Paradigm plugin must (i) have an ID, and (ii) be installed in a specific folder. If you are updating to a new version of the plugin, it may occur that the name of the folder has changed. In this case, Visual Paradigm will think that you are trying to install a new plugin with an ID already in use instead of updating it.

![Install plugin window](./resources/install-plugin-dialog-folder-path.png)
![Install plugin window](./docs/install-plugin-dialog-folder-path.png)

To solve this issue, go to the `plugins` folder listed in the "Install Plugin" window (see above) and delete your old plugin folder before installing the new version. You may be required to re-open the application for that to take effect.

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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.3.1-SNAPSHOT</version>
<version>0.4.0-alpha1</version>

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

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.vp.plugin.model.factory.IModelElementFactory;

import it.unibz.inf.ontouml.vp.listeners.ProjectListener;
import it.unibz.inf.ontouml.vp.utils.ViewUtils;

/**
* Implementation of VPPlugin responsible for configuring OntoUML Plugin's
Expand All @@ -20,10 +19,12 @@
*/
public class OntoUMLPlugin implements VPPlugin {

public static final String PLUGIN_VERSION_RELEASE = "0.3.1";
public static final String PLUGIN_VERSION_RELEASE = "0.4.0alpha1";
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/";
public static final String PLUGIN_REPO_OWNER = "OntoUML";
public static final String PLUGIN_REPO_NAME = "ontouml-vp-plugin";

public static IModelElement[] allModelElements;
public static boolean isPluginActive;
Expand Down Expand Up @@ -86,7 +87,7 @@ public static boolean getConfigWindowOpen() {
}

public static void reload() {
ViewUtils.log("Reloading plugin: "+PLUGIN_ID);
// ViewUtils.log("Reloading plugin: "+PLUGIN_ID);
ApplicationManager.instance().reloadPluginClasses(PLUGIN_ID);
// TODO: try to integrate listener to the reload process
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
import com.vp.plugin.model.ITaggedValue;
import com.vp.plugin.model.factory.IModelElementFactory;

import it.unibz.inf.ontouml.vp.features.constraints.ActionIds;
import it.unibz.inf.ontouml.vp.model.Class;
import it.unibz.inf.ontouml.vp.model.ModelElement;
import it.unibz.inf.ontouml.vp.utils.Configurations;
import it.unibz.inf.ontouml.vp.utils.StereotypeUtils;
import it.unibz.inf.ontouml.vp.views.SelectMultipleOptionsDialog;
import it.unibz.inf.ontouml.vp.views.SetOrderDialog;
import it.unibz.inf.ontouml.vp.model.Configurations;
import it.unibz.inf.ontouml.vp.model.uml.Class;
import it.unibz.inf.ontouml.vp.model.uml.ModelElement;
import it.unibz.inf.ontouml.vp.utils.ActionIdManager;
import it.unibz.inf.ontouml.vp.utils.StereotypesManager;
import it.unibz.inf.ontouml.vp.views.SelectRestrictionsView;
import it.unibz.inf.ontouml.vp.views.SetOrderView;

/**
* Implementation of context sensitive action of change OntoUML stereotypes in model elements.
*
* @author Claudenir Fonseca
* @author Victor Viola
*/
public class ApplyProperties implements VPContextActionController {
public class ApplyPropertiesController implements VPContextActionController {

@Override
public void performAction(VPAction action, VPContext context, ActionEvent event) {
Expand All @@ -44,30 +44,30 @@ public void performAction(VPAction action, VPContext context, ActionEvent event)
final IClass clickedClass = (IClass) context.getModelElement();

switch (action.getActionId()) {
case ActionIds.PROPERTY_SET_RESTRICTED_TO:
case ActionIdManager.PROPERTY_SET_RESTRICTED_TO:
this.setRestrictedTo(context, clickedClass);
break;

case ActionIds.PROPERTY_SET_IS_ABSTRACT:
case ActionIdManager.PROPERTY_SET_IS_ABSTRACT:
final boolean isAbstract = clickedClass.isAbstract();
forEachSelectedClass(context, cla -> cla.setAbstract(!isAbstract));
break;

case ActionIds.PROPERTY_SET_IS_DERIVED:
case ActionIdManager.PROPERTY_SET_IS_DERIVED:
final boolean isDerived = ModelElement.getIsDerived(clickedClass);
forEachSelectedClass(context, selected -> {
ModelElement.setIsDerived(selected, !isDerived);
});
break;
case ActionIds.PROPERTY_SET_IS_EXTENSIONAL:
setBooleanTaggedValue(context, clickedClass, StereotypeUtils.PROPERTY_IS_EXTENSIONAL);
case ActionIdManager.PROPERTY_SET_IS_EXTENSIONAL:
setBooleanTaggedValue(context, clickedClass, StereotypesManager.PROPERTY_IS_EXTENSIONAL);
break;

case ActionIds.PROPERTY_SET_IS_POWERTYPE:
setBooleanTaggedValue(context, clickedClass, StereotypeUtils.PROPERTY_IS_POWERTYPE);
case ActionIdManager.PROPERTY_SET_IS_POWERTYPE:
setBooleanTaggedValue(context, clickedClass, StereotypesManager.PROPERTY_IS_POWERTYPE);
break;

case ActionIds.PROPERTY_SET_ORDER:
case ActionIdManager.PROPERTY_SET_ORDER:
setOrderProperty(context, clickedClass);
break;
}
Expand All @@ -83,47 +83,47 @@ public void update(VPAction action, VPContext context) {
}

final IClass _class = (IClass) context.getModelElement();
final String stereotype = StereotypeUtils.getUniqueStereotypeName(_class);
final Set<String> allClassStereotypes = StereotypeUtils.getOntoUMLClassStereotypeNames();
final String stereotype = StereotypesManager.getUniqueStereotypeName(_class);
final Set<String> allClassStereotypes = StereotypesManager.getOntoUMLClassStereotypeNames();

switch (action.getActionId()) {
case ActionIds.PROPERTY_SET_RESTRICTED_TO:
case ActionIdManager.PROPERTY_SET_RESTRICTED_TO:
if (allClassStereotypes.contains(stereotype)) {
final boolean isSmartModelingEnabled =
Configurations.getInstance()
.getProjectConfigurations()
.isSmartModellingEnabled();
final List<String> nonFixedRestrictedTo =
Arrays.asList(StereotypeUtils.STR_CATEGORY,
StereotypeUtils.STR_MIXIN,
StereotypeUtils.STR_PHASE_MIXIN,
StereotypeUtils.STR_ROLE_MIXIN,
StereotypeUtils.STR_HISTORICAL_ROLE_MIXIN);
Arrays.asList(StereotypesManager.STR_CATEGORY,
StereotypesManager.STR_MIXIN,
StereotypesManager.STR_PHASE_MIXIN,
StereotypesManager.STR_ROLE_MIXIN,
StereotypesManager.STR_HISTORICAL_ROLE_MIXIN);

action.setEnabled(!isSmartModelingEnabled ||
nonFixedRestrictedTo.contains(stereotype));
} else {
action.setEnabled(false);
}
break;
case ActionIds.PROPERTY_SET_IS_ABSTRACT:
case ActionIdManager.PROPERTY_SET_IS_ABSTRACT:
action.setEnabled(true);
action.setSelected(_class.isAbstract());
break;
case ActionIds.PROPERTY_SET_IS_DERIVED:
case ActionIdManager.PROPERTY_SET_IS_DERIVED:
action.setEnabled(true);
action.setSelected(ModelElement.getIsDerived(_class));
break;
case ActionIds.PROPERTY_SET_IS_EXTENSIONAL:
action.setEnabled(StereotypeUtils.STR_COLLECTIVE.equals(stereotype));
case ActionIdManager.PROPERTY_SET_IS_EXTENSIONAL:
action.setEnabled(StereotypesManager.STR_COLLECTIVE.equals(stereotype));
action.setSelected(Class.getIsExtensional(_class));
break;
case ActionIds.PROPERTY_SET_IS_POWERTYPE:
action.setEnabled(StereotypeUtils.STR_TYPE.equals(stereotype));
case ActionIdManager.PROPERTY_SET_IS_POWERTYPE:
action.setEnabled(StereotypesManager.STR_TYPE.equals(stereotype));
action.setSelected(Class.getIsPowertype(_class));
break;
case ActionIds.PROPERTY_SET_ORDER:
action.setEnabled(_class.hasStereotype(StereotypeUtils.STR_TYPE));
case ActionIdManager.PROPERTY_SET_ORDER:
action.setEnabled(_class.hasStereotype(StereotypesManager.STR_TYPE));
break;
}
}
Expand All @@ -150,11 +150,11 @@ private void forEachSelectedClass(VPContext context, Consumer<IClass> consumer)
}

private void setBooleanTaggedValue(VPContext context, IClass clickedClass, String metaProperty) {
final ITaggedValue booleanTaggedValue = StereotypeUtils.reapplyStereotypeAndGetTaggedValue(clickedClass, metaProperty);
final ITaggedValue booleanTaggedValue = StereotypesManager.reapplyStereotypeAndGetTaggedValue(clickedClass, metaProperty);
final boolean value = booleanTaggedValue != null && Boolean.parseBoolean(booleanTaggedValue.getValueAsString());

forEachSelectedClass(context, cla -> {
ITaggedValue taggedValue = StereotypeUtils.reapplyStereotypeAndGetTaggedValue(cla, metaProperty);
ITaggedValue taggedValue = StereotypesManager.reapplyStereotypeAndGetTaggedValue(cla, metaProperty);

if (taggedValue == null)
return;
Expand All @@ -165,17 +165,17 @@ private void setBooleanTaggedValue(VPContext context, IClass clickedClass, Strin

private void setOrderProperty(VPContext context, IClass clickedClass) {
final ITaggedValue baseTaggedValue =
StereotypeUtils.reapplyStereotypeAndGetTaggedValue(clickedClass, StereotypeUtils.PROPERTY_ORDER);
StereotypesManager.reapplyStereotypeAndGetTaggedValue(clickedClass, StereotypesManager.PROPERTY_ORDER);

if (baseTaggedValue == null)
return;

final SetOrderDialog dialog = new SetOrderDialog(baseTaggedValue.getValueAsString());
final SetOrderView dialog = new SetOrderView(baseTaggedValue.getValueAsString());
ApplicationManager.instance().getViewManager().showDialog(dialog);
final String order = dialog.getOrder();

forEachSelectedClass(context, cla -> {
ITaggedValue taggedValue = StereotypeUtils.reapplyStereotypeAndGetTaggedValue(cla, StereotypeUtils.PROPERTY_ORDER);
ITaggedValue taggedValue = StereotypesManager.reapplyStereotypeAndGetTaggedValue(cla, StereotypesManager.PROPERTY_ORDER);

if (taggedValue == null)
return;
Expand All @@ -189,7 +189,7 @@ private void setRestrictedTo(VPContext context, IClass clickedClass) {
String currentRestrictions = Class.getRestrictedTo(clickedClass);
currentRestrictions = currentRestrictions == null ? "" : currentRestrictions;

final SelectMultipleOptionsDialog dialog = new SelectMultipleOptionsDialog(currentRestrictions);
final SelectRestrictionsView dialog = new SelectRestrictionsView(currentRestrictions);
ApplicationManager.instance().getViewManager().showDialog(dialog);
final String newRestrictions = dialog.getSelectedValues();

Expand Down
Loading

0 comments on commit 114bb25

Please sign in to comment.