Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Philipp Steghöfer2021-04-10 04:33:51 -0400
committerJan-Philipp Steghöfer2021-04-12 07:17:59 -0400
commit8b5d98c985efeeb00b5b0de4435e8d5efb5220a9 (patch)
treee56c1a80abef5255ba46fff784e0a41785d01506
parente7f3132644afe59c910bd50488a22029cbfc82fe (diff)
downloadorg.eclipse.capra-8b5d98c985efeeb00b5b0de4435e8d5efb5220a9.tar.gz
org.eclipse.capra-8b5d98c985efeeb00b5b0de4435e8d5efb5220a9.tar.xz
org.eclipse.capra-8b5d98c985efeeb00b5b0de4435e8d5efb5220a9.zip
Added ability to remove links to matrix view
So far, Eclipse Capra has lacked a way to delete trace links from the user interface. This change adds this ability to the matrix view. The selected link in the matrix view can now be deleted with a click on the corresponding toolbar button. Caution: right now, this action is not undoable. Change-Id: Icc40b5eb5de6ccb2ef8fae8ba47ad9f608fe138b
-rw-r--r--bundles/org.eclipse.capra.ui.matrix/src/org/eclipse/capra/ui/matrix/views/TraceabilityMatrixView.java20
-rw-r--r--bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/adapters/ConnectionAdapter.java8
2 files changed, 28 insertions, 0 deletions
diff --git a/bundles/org.eclipse.capra.ui.matrix/src/org/eclipse/capra/ui/matrix/views/TraceabilityMatrixView.java b/bundles/org.eclipse.capra.ui.matrix/src/org/eclipse/capra/ui/matrix/views/TraceabilityMatrixView.java
index 2ce243d8..be785300 100644
--- a/bundles/org.eclipse.capra.ui.matrix/src/org/eclipse/capra/ui/matrix/views/TraceabilityMatrixView.java
+++ b/bundles/org.eclipse.capra.ui.matrix/src/org/eclipse/capra/ui/matrix/views/TraceabilityMatrixView.java
@@ -30,6 +30,7 @@ import org.eclipse.capra.core.helpers.EMFHelper;
import org.eclipse.capra.core.helpers.EditingDomainHelper;
import org.eclipse.capra.core.helpers.ExtensionPointHelper;
import org.eclipse.capra.core.helpers.TraceHelper;
+import org.eclipse.capra.ui.adapters.ConnectionAdapter;
import org.eclipse.capra.ui.helpers.SelectionSupportHelper;
import org.eclipse.capra.ui.matrix.TraceabilityMatrixBodyToolTip;
import org.eclipse.capra.ui.matrix.TraceabilityMatrixColumnHeaderDataProvider;
@@ -123,6 +124,7 @@ public class TraceabilityMatrixView extends ViewPart {
private static final String LINK_LABEL = "LINKED"; // When there is a link between
private NatTable traceMatrixTable;
+ private Action deleteLinkAction;
private Action refreshAction;
private Action showAllAction;
private Action exportExcelAction;
@@ -431,6 +433,8 @@ public class TraceabilityMatrixView extends ViewPart {
}
private void fillLocalPullDown(IMenuManager manager) {
+ manager.add(deleteLinkAction);
+ manager.add(new Separator());
manager.add(refreshAction);
manager.add(showAllAction);
manager.add(new Separator());
@@ -438,11 +442,27 @@ public class TraceabilityMatrixView extends ViewPart {
}
private void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(deleteLinkAction);
manager.add(refreshAction);
manager.add(showAllAction);
}
private void makeActions() {
+ deleteLinkAction = new Action() {
+ @Override
+ public void run() {
+ if (selectedModels != null && !selectedModels.isEmpty()
+ && selectedModels.get(0) instanceof ConnectionAdapter) {
+ ConnectionAdapter adapter = (ConnectionAdapter) selectedModels.get(0);
+ Connection connection = adapter.getConnection();
+ EObject traceModel = persistenceAdapter.getTraceModel(resourceSet);
+ traceAdapter.deleteTrace(List.of(connection), traceModel);
+ showAllAction.run();
+ }
+ }
+ };
+ deleteLinkAction.setText("Delete Link");
+ deleteLinkAction.setToolTipText("Delete Link");
refreshAction = new Action() {
@Override
public void run() {
diff --git a/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/adapters/ConnectionAdapter.java b/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/adapters/ConnectionAdapter.java
index cacb196b..4a1bbd19 100644
--- a/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/adapters/ConnectionAdapter.java
+++ b/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/adapters/ConnectionAdapter.java
@@ -121,4 +121,12 @@ public class ConnectionAdapter implements IPropertySource {
connection.getTlink().eSet(feature, value);
}
+ /**
+ * Provides the connection represented by this adapter.
+ *
+ * @return the connection
+ */
+ public Connection getConnection() {
+ return this.connection;
+ }
}

Back to the top