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

Fixed Masked Connector End Issue #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/bin
.classpath
.project
/.settings
/.settings
/.idea
*.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public Element createElement(Project project, Element owner, Element client, Ele
CameoUtils.logGUI("Supplier port not from part property.");
firstMemberEnd.setRole((ConnectableElement) supplier);
}

Element clientPart = (Element) project.getElementByID(ImportXmlSysml.idConversion(xmlElement.getAttribute(XmlTagConstants.CLIENT_PART_WITH_PORT)));
if(clientPart != null) {
CameoUtils.logGUI("Client part found with id: " + clientPart.getID());
secondMemberEnd.setPartWithPort((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property)clientPart);
secondMemberEnd.setRole(((List<ConnectorEnd>) ((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property) clientPart).get_connectorEndOfPartWithPort()).get(0).getRole());
secondMemberEnd.setRole((ConnectableElement) client);
StereotypesHelper.addStereotype(secondMemberEnd, nestedConnectorEndStereotype);
StereotypesHelper.setStereotypePropertyValue(secondMemberEnd, elementPropertyPathStereotype, "propertyPath", clientPart);
} else {
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/org/aero/mtip/XML/Import/ImportXmlSysml.java
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,14 @@ public static String idConversion(String id) {
public static Element GetImportedOwner(XMLItem modelElement, HashMap<String, XMLItem> parsedXML) {
String ownerID = modelElement.getParent();
XMLItem ownerElement = parsedXML.get(ownerID);


// If an owner is specified by ID but no element is provided, attempt to query the project for an existing element
if(ownerID != null && ownerElement == null){
Element element = (Element) project.getElementByID(ownerID);
if(element != null){
return element;
}
}
if(modelElement.getParent().trim().isEmpty() || ownerElement == null) {
return primaryLocation; // Set owned equal to Primary model if no hasParent attribute in XML -> parent field in XMLItem == ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public ImportXmlSysmlAction(String id, String name) {
super(id, name, null, null);
}
public void actionPerformed(ActionEvent e) {
importXmlSysml();
}

public static void importXmlSysml() {
ImportXmlSysml.resetImportParameters();
Project project = Application.getInstance().getProject();
if(project == null) {
Expand Down