Skip to content

Commit

Permalink
Disabled detaching of SubApp from Type from System Tree
Browse files Browse the repository at this point in the history
  • Loading branch information
sebHollersbacher committed Jul 24, 2024
1 parent 668ed80 commit ad5aecf
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISources;
import org.eclipse.ui.PlatformUI;
Expand Down Expand Up @@ -55,22 +56,25 @@ public void setEnabled(final Object evaluationContext) {
}

private static SubApp getSelectedSubApp(final Object selection) {
if (selection instanceof final IStructuredSelection structSel) {
if (!structSel.isEmpty() && (structSel.size() == 1)) {
return getSubApp(structSel.getFirstElement());
}
if (selection instanceof TreeSelection) {
return null;
}
if ((selection instanceof final IStructuredSelection structSel)
&& (!structSel.isEmpty() && (structSel.size() == 1))) {
return getSubApp(structSel.getFirstElement());
}
return null;
}

private static SubApp getSubApp(final Object currentElement) {
if (currentElement instanceof SubApp) {
return (SubApp) currentElement;
if (currentElement instanceof final SubApp subApp) {
return subApp;
}
if (currentElement instanceof final SubAppForFBNetworkEditPart subAppForFBNetworkEditPart) {
return subAppForFBNetworkEditPart.getModel();
}
if (currentElement instanceof SubAppForFBNetworkEditPart) {
return ((SubAppForFBNetworkEditPart) currentElement).getModel();
} else if (currentElement instanceof UISubAppNetworkEditPart) {
return (SubApp) ((UISubAppNetworkEditPart) currentElement).getModel().eContainer();
if (currentElement instanceof final UISubAppNetworkEditPart uiSubAppNetworkEditPart) {
return (SubApp) uiSubAppNetworkEditPart.getModel().eContainer();
}
return null;
}
Expand Down

0 comments on commit ad5aecf

Please sign in to comment.