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

Show subclauses in the navigator #1557

Merged
merged 3 commits into from Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions core/org.osate.ui/plugin.xml
Expand Up @@ -327,13 +327,15 @@
<selectionEnablement>
<or>
<instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.osate.xtext.aadl2.ui.resource.ContributedAadlStorage"/>
<instanceof value="org.osate.aadl2.AadlPackage"/>
<instanceof value="org.osate.aadl2.AnnexLibrary"/>
<instanceof value="org.osate.aadl2.Classifier"/>
<instanceof value="org.osate.aadl2.AnnexSubclause"/>
<instanceof value="org.osate.aadl2.PropertySet"/>
<instanceof value="org.osate.aadl2.Property"/>
<instanceof value="org.osate.aadl2.PropertyConstant"/>
<instanceof value="org.osate.aadl2.PropertyType"/>
<instanceof
value="org.osate.xtext.aadl2.ui.resource.ContributedAadlStorage">
</instanceof>
</or>
</selectionEnablement>
<editorInputEnablement>
Expand Down
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
import org.osate.aadl2.AadlPackage;
import org.osate.aadl2.ComponentImplementation;
import org.osate.aadl2.PackageSection;
import org.osate.aadl2.PropertySet;
import org.osate.aadl2.instance.ComponentInstance;
Expand Down Expand Up @@ -50,6 +51,8 @@ public Object[] getChildren(Object parentElement) {
} else if (parentElement instanceof ContributedAadlStorage) {
URI uri = ((ContributedAadlStorage) parentElement).getUri();
parentElement = resourceSet.getResource(uri, true);
} else if (parentElement instanceof ComponentImplementation) {
return ((ComponentImplementation) parentElement).getOwnedAnnexSubclauses().toArray();
} else if (!shouldExpand(parentElement)) {
return NO_CHILDREN;
}
Expand All @@ -69,6 +72,8 @@ public Object getParent(Object element) {
public boolean hasChildren(Object element) {
if (element instanceof IFile || element instanceof ContributedAadlStorage) {
return true;
} else if (element instanceof ComponentImplementation) {
return !((ComponentImplementation) element).getOwnedAnnexSubclauses().isEmpty();
} else if (!shouldExpand(element)) {
return false;
}
Expand Down
Expand Up @@ -28,6 +28,8 @@
import org.eclipse.xtext.nodemodel.impl.LeafNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.osate.aadl2.AadlPackage;
import org.osate.aadl2.AnnexLibrary;
import org.osate.aadl2.AnnexSubclause;
import org.osate.aadl2.Classifier;
import org.osate.aadl2.NamedElement;
import org.osate.aadl2.Property;
Expand Down Expand Up @@ -97,7 +99,8 @@ public void activateEditor(IWorkbenchPage page, IStructuredSelection structuredS

protected boolean shouldLink(Object o) {
return o instanceof AadlPackage || o instanceof Classifier || o instanceof Property
|| o instanceof PropertyConstant || o instanceof PropertyType;
|| o instanceof PropertyConstant || o instanceof PropertyType || o instanceof AnnexSubclause
|| o instanceof AnnexLibrary;
}

private int findOffset(NamedElement classifier) {
Expand Down