Skip to content

Commit

Permalink
Merge pull request #178 from Open-MBEE/release/4.2.1
Browse files Browse the repository at this point in the history
Release/4.2.1
  • Loading branch information
ivan-gomes authored Mar 23, 2020
2 parents f77cda5 + 238bf81 commit d5ad8b6
Show file tree
Hide file tree
Showing 34 changed files with 87 additions and 3,113 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pipeline {
}
}
stage('Publish Snapshot') {
when { branch 'develop' }
when { anyOf { branch 'develop' ; branch 'release/**' } }
steps {
sh './gradlew \
-PbuildNumber=$BUILD_NUMBER \
Expand Down
9 changes: 5 additions & 4 deletions build.gradle

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=4.2.0
version=4.2.1
group=org.openmbee.magicdraw.mdk
descriptorFile=MDR_Plugin_Model_Development_Kit_91110_descriptor.xml
magicdDrawGroupName=gov.nasa.jpl.cae.magicdraw.mdk
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/gov/nasa/jpl/mbee/mdk/MDKPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import gov.nasa.jpl.mbee.mdk.cli.AutomatedViewGenerator;
import gov.nasa.jpl.mbee.mdk.mms.sync.status.SyncStatusConfigurator;
import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
import gov.nasa.jpl.mbee.mdk.systems_reasoner.SRConfigurator;
import gov.nasa.jpl.mbee.mdk.util.MDUtils;

import java.io.File;
Expand Down Expand Up @@ -94,11 +93,6 @@ public void init() {
acm.addMainMenuConfigurator(new MMSConfigurator());
EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader());

SRConfigurator srConfigurator = new SRConfigurator();
acm.addSearchBrowserContextConfigurator(srConfigurator);
acm.addContainmentBrowserContextConfigurator(srConfigurator);
acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, srConfigurator);

acm.addMainToolbarConfigurator(new SyncStatusConfigurator());

DiagramDescriptor viewDiagramDescriptor = Application.getInstance().getDiagramDescriptor(ViewDiagramConfigurator.DIAGRAM_NAME);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gov/nasa/jpl/mbee/mdk/actions/LockAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gov.nasa.jpl.mbee.mdk.actions;

import com.nomagic.magicdraw.actions.MDAction;
import com.nomagic.magicdraw.annotation.Annotation;
import com.nomagic.magicdraw.annotation.AnnotationAction;
import com.nomagic.magicdraw.core.Project;
Expand All @@ -8,7 +9,6 @@
import com.nomagic.task.RunnableWithProgress;
import com.nomagic.ui.ProgressStatusRunner;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
import gov.nasa.jpl.mbee.mdk.systems_reasoner.actions.SRAction;

import javax.annotation.CheckForNull;
import java.awt.event.ActionEvent;
Expand All @@ -20,12 +20,12 @@
/**
* Created by igomes on 12/5/16.
*/
public class LockAction extends SRAction implements AnnotationAction {
public class LockAction extends MDAction implements AnnotationAction {
private final Element element;
private final boolean recursive;

public LockAction(Element element, boolean recursive) {
super("Lock" + (recursive ? " Recursively" : ""));
super("Lock" + (recursive ? " Recursively" : ""), "Lock" + (recursive ? " Recursively" : ""), null, null);
this.element = element;
this.recursive = recursive;
}
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/gov/nasa/jpl/mbee/mdk/emf/EMFExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,16 @@ private enum Processor {
objectNode.put(MDKConstants.TYPE_KEY, "Mount");
objectNode.put(MDKConstants.MOUNTED_ELEMENT_ID_KEY, Converters.getIProjectToIdConverter().apply(attachedProject) + MDKConstants.PRIMARY_MODEL_ID_SUFFIX);
objectNode.put(MDKConstants.MOUNTED_ELEMENT_PROJECT_ID_KEY, Converters.getIProjectToIdConverter().apply(attachedProject));
String branchName;
EsiUtils.EsiBranchInfo esiBranchInfo = null;
if (isRemote && (esiBranchInfo = EsiUtils.getCurrentBranch(attachedProject)) == null) {
EsiUtils.EsiBranchInfo branchInfo = EsiUtils.getCurrentBranch(attachedProject);
if (isRemote && branchInfo == null) {
return null;
}
if (!isRemote || (branchName = esiBranchInfo.getName()) == null || branchName.equals("trunk")) {
String branchName;
if (!isRemote || (branchName = branchInfo.getName()) == null || "trunk".equals(branchName)) {
branchName = "master";
}
objectNode.put(MDKConstants.MOUNTED_REF_ID_KEY, branchName);
String branchId = "master".equals(branchName) ? "master" : branchInfo.getID().toString();
objectNode.put(MDKConstants.MOUNTED_REF_ID_KEY, branchId);
objectNode.put(MDKConstants.TWC_VERSION_KEY, isRemote ? ProjectUtilities.versionToInt(ProjectUtilities.getVersion(attachedProject).getName()) : -1);
return objectNode;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gov.nasa.jpl.mbee.mdk.mms.actions;

import com.nomagic.magicdraw.actions.MDAction;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
Expand All @@ -10,7 +11,6 @@
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.mms.sync.mms.MMSDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.systems_reasoner.actions.SRAction;
import gov.nasa.jpl.mbee.mdk.util.Changelog;
import gov.nasa.jpl.mbee.mdk.util.Utils;
import gov.nasa.jpl.mbee.mdk.validation.ValidationRule;
Expand All @@ -27,9 +27,9 @@
/**
* Created by igomes on 12/5/16.
*/
public class DetailedSyncStatusAction extends SRAction {
public class DetailedSyncStatusAction extends MDAction {
public DetailedSyncStatusAction() {
super(DetailedSyncStatusAction.class.getSimpleName());
super(DetailedSyncStatusAction.class.getSimpleName(), DetailedSyncStatusAction.class.getSimpleName(), null, null);
}

private static final ValidationSuite validationSuite = new ValidationSuite("Sync Status");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gov.nasa.jpl.mbee.mdk.mms.sync.status.actions;

import com.nomagic.magicdraw.actions.MDAction;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
import com.nomagic.ui.ProgressStatusRunner;
Expand All @@ -11,7 +12,6 @@
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.mms.sync.mms.MMSDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.status.ui.SyncStatusFrame;
import gov.nasa.jpl.mbee.mdk.systems_reasoner.actions.SRAction;
import gov.nasa.jpl.mbee.mdk.util.Changelog;

import javax.annotation.CheckForNull;
Expand All @@ -24,14 +24,14 @@
/**
* Created by igomes on 8/16/16.
*/
public class SyncStatusAction extends SRAction {
public class SyncStatusAction extends MDAction {
public static final String NAME = "Unsynced";

private SyncStatusFrame syncStatusFrame;


public SyncStatusAction() {
super(NAME);
super(NAME, NAME, null, null);
update();
}

Expand Down
145 changes: 65 additions & 80 deletions src/main/java/gov/nasa/jpl/mbee/mdk/model/GenericTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@

import com.nomagic.generictable.GenericTableManager;
import com.nomagic.magicdraw.core.Application;

import com.nomagic.magicdraw.dependencymatrix.configuration.MatrixDataHelper;
import com.nomagic.magicdraw.dependencymatrix.datamodel.MatrixData;
import com.nomagic.magicdraw.dependencymatrix.datamodel.cell.AbstractMatrixCell;
import com.nomagic.magicdraw.properties.*;
import com.nomagic.magicdraw.properties.ui.ObjectListProperty;
import com.nomagic.magicdraw.uml.DiagramType;

import com.nomagic.uml2.ext.jmi.helpers.ModelHelper;
import com.nomagic.uml2.ext.jmi.helpers.StereotypesHelper;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Diagram;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;

import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.InstanceSpecification;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement;

import gov.nasa.jpl.mbee.mdk.docgen.DocGenProfile;
import gov.nasa.jpl.mbee.mdk.docgen.docbook.*;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaProjectEventListenerAdapter;
Expand All @@ -26,9 +21,12 @@
import gov.nasa.jpl.mbee.mdk.util.GeneratorUtils;
import gov.nasa.jpl.mbee.mdk.util.MatrixUtil;
import gov.nasa.jpl.mbee.mdk.util.Utils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

public class GenericTable extends Table {

Expand Down Expand Up @@ -206,102 +204,89 @@ public List<List<DocumentElement>> getHeaders(Diagram genericTable, List<String>

public List<List<DocumentElement>> getBody(Diagram d, Collection<Element> rowElements, List<String> columnIds, boolean forViewEditor) {
List<List<DocumentElement>> res = new ArrayList<>();
for (Element e : rowElements) {
if (skipIfNoDoc && ModelHelper.getComment(e).trim().isEmpty()) {
for (Element rowElement : rowElements) {
if (skipIfNoDoc && ModelHelper.getComment(rowElement).trim().isEmpty()) {
continue;
}
List<DocumentElement> row = new ArrayList<>();
int count = 0;
for (String cid : columnIds) {
for (String columnId : columnIds) {
if (count == 0) {
count++;
continue;
}
if (skipColumnIds.contains(cid)) {
if (skipColumnIds.contains(columnId)) {
continue;
}
DBTableEntry entry = new DBTableEntry();

Property cellValue = GenericTableManager.getCellValue(d, e, cid);
if (cellValue instanceof ElementProperty) {
Element cellelement = ((ElementProperty) cellValue).getElement();
if (cellelement instanceof NamedElement) {
entry.addElement(new DBParagraph(((NamedElement) cellelement).getName(), cellelement, From.NAME));
}
}
else if (cellValue instanceof StringProperty) {
if (cid.contains("documentation")) {
entry.addElement(new DBParagraph(cellValue.getValue(), e, From.DOCUMENTATION));

}
else {
entry.addElement(new DBParagraph(cellValue.getValue()));
}
}
else if (cellValue instanceof NumberProperty) {
entry.addElement(new DBParagraph(cellValue.getValue()));
}
else if (cellValue instanceof ElementListProperty) {
for (Element listEl : ((ElementListProperty) cellValue).getValue()) {
if (listEl instanceof NamedElement) {
entry.addElement(new DBParagraph(((NamedElement) listEl).getName(), listEl, From.NAME));
}
}
}
else if (cellValue instanceof ElementInstanceProperty) {
Object value = cellValue.getValue();

if (value instanceof List) {
for (Object o : (List) value) {
if (o instanceof InstanceSpecification) {
entry.addElement(new DBParagraph(((InstanceSpecification) o).getName(), (Element) o, From.NAME));
}
}
}
}
else if (cellValue instanceof AbstractChoiceProperty) {
if (cellValue instanceof ChoiceProperty) {
int index = ((ChoiceProperty) cellValue).getIndex();
if (index > -1) {
Object choice = ((ChoiceProperty) cellValue).getChoice().get(index);
entry.addElement(new DBParagraph(choice.toString()));
}
}
else {
for (Object choice : ((AbstractChoiceProperty) cellValue).getChoice()) {
if (choice instanceof String) {
entry.addElement(new DBParagraph(choice.toString()));
}
}
}
}
else {
Application.getInstance().getGUILog().log("[WARNING] Cell value omitted: " + cellValue.toString() + ".");
}
Property property = GenericTableManager.getCellValue(d, rowElement, columnId);
DBTableEntry entry = buildTableEntry(property, columnId, rowElement);
row.add(entry);
}
res.add(row);
}
return res;
}

public List<Object> getTableValues(Object o) {
List<Object> res = new ArrayList<>();
if (o instanceof Object[]) {
Object[] a = (Object[]) o;
for (int i = 0; i < a.length; i++) {
res.addAll(getTableValues(a[i]));
private DBTableEntry buildTableEntry(Property property, String columnId, Element rowElement) {
DBTableEntry entry = new DBTableEntry();
if (property instanceof ElementProperty) {
Element element = ((ElementProperty) property).getElement();
if (element instanceof NamedElement) {
entry.addElement(new DBParagraph(((NamedElement) element).getName(), element, From.NAME));
}
}
else if (o instanceof Collection) {
for (Object oo : (Collection) o) {
res.addAll(getTableValues(oo));
else if (property instanceof StringProperty) {
if (columnId.contains("documentation")) {
entry.addElement(new DBParagraph(property.getValue(), rowElement, From.DOCUMENTATION));
}
else {
entry.addElement(new DBParagraph(property.getValue()));
}
}
else if (o != null) {
res.add(o);
else if (property instanceof NumberProperty) {
entry.addElement(new DBParagraph(property.getValue()));
}
return res;
else if (property instanceof ElementListProperty) {
for (Element listEl : ((ElementListProperty) property).getValue()) {
if (listEl instanceof NamedElement) {
entry.addElement(new DBParagraph(((NamedElement) listEl).getName(), listEl, From.NAME));
}
}
}
else if (property instanceof ElementInstanceProperty) {
Object value = property.getValue();

if (value instanceof List) {
for (Object o : (List<?>) value) {
if (o instanceof InstanceSpecification) {
entry.addElement(new DBParagraph(((InstanceSpecification) o).getName(), (Element) o, From.NAME));
}
}
}
}
else if (property instanceof AbstractChoiceProperty) {
if (property instanceof ChoiceProperty) {
int index = ((ChoiceProperty) property).getIndex();
if (index > -1) {
Object choice = ((ChoiceProperty) property).getChoice().get(index);
entry.addElement(new DBParagraph(choice.toString()));
}
}
else {
for (Object choice : ((AbstractChoiceProperty) property).getChoice()) {
if (choice instanceof String) {
entry.addElement(new DBParagraph(choice.toString()));
}
}
}
}
else if (property instanceof ObjectListProperty) {
entry.addElements(Arrays.stream(((ObjectListProperty) property).getValue()).map(DBParagraph::new).collect(Collectors.toList()));
}
else {
Application.getInstance().getGUILog().log("[WARNING] Unknown cell value omitted: " + property.toString() + ".");
}
return entry;
}

public void setSkipIfNoDoc(boolean b) {
Expand Down
Loading

0 comments on commit d5ad8b6

Please sign in to comment.