Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2019-10-15 08:07:19 +0000
committerSarika Sinha2019-10-15 08:21:10 +0000
commit645ef1bda6a975fcdf23cc96ee616ec469f55d7f (patch)
tree5461f1282a8b4f6b30b7cdd338d9073ecbefa5ad
parent328ede8151787d91885389f35e43534148b4e2b6 (diff)
downloadeclipse.platform.debug-645ef1bda6a975fcdf23cc96ee616ec469f55d7f.tar.gz
eclipse.platform.debug-645ef1bda6a975fcdf23cc96ee616ec469f55d7f.tar.xz
eclipse.platform.debug-645ef1bda6a975fcdf23cc96ee616ec469f55d7f.zip
Bug 498365 - Add collapse all to Debug ViewI20191015-1800
Change-Id: I0c1febb5633fe00e2892664cdcb4778a1ef8d474 Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
-rw-r--r--org.eclipse.debug.ui/plugin.properties4
-rw-r--r--org.eclipse.debug.ui/plugin.xml13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java116
3 files changed, 131 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties
index 8c23489a4..43bc3bd37 100644
--- a/org.eclipse.debug.ui/plugin.properties
+++ b/org.eclipse.debug.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2017 IBM Corporation and others.
+# Copyright (c) 2000, 2019 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -116,6 +116,8 @@ RemoveAllBreakpointsAction.tooltip=Remove All Breakpoints
RemoveAllExpressionsAction.tooltip=Remove All Expressions
RemoveAllTerminatedAction.label=Remove &All Terminated
RemoveAllTerminatedAction.tooltip=Remove All Terminated Launches
+CollapseAllAction.label=Collapse All
+CollapseAllAction.tooltip=Collapse All
RemoveBreakpointAction.tooltip=Remove Selected Breakpoints
RemoveExpressionAction.tooltip=Remove Selected Expressions
ResumeAction.label=Resu&me
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index 94107c87b..1f9528ec2 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2005, 2018 IBM Corporation and others.
+ Copyright (c) 2005, 2019 IBM Corporation and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
@@ -776,6 +776,17 @@
label="%RemoveAllTerminatedAction.label"
tooltip="%RemoveAllTerminatedAction.tooltip">
</action>
+ <action
+ id="org.eclipse.debug.ui.debugview.toolbar.collapseAll"
+ toolbarPath="threadGroup"
+ hoverIcon="$nl$/icons/full/elcl16/collapseall.png"
+ class="org.eclipse.debug.internal.ui.actions.LaunchCollapseAllAction"
+ disabledIcon="$nl$/icons/full/dlcl16/collapseall.png"
+ icon="$nl$/icons/full/elcl16/collapseall.png"
+ helpContextId="collapse_all_action_context"
+ label="%CollapseAllAction.label"
+ tooltip="%CollapseAllAction.tooltip">
+ </action>
</viewContribution>
<!-- Contributions to Breakpoints View Toolbar -->
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java
new file mode 100644
index 000000000..fcd2067a4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2019 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
+import org.eclipse.debug.internal.ui.views.launch.LaunchView;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.handlers.CollapseAllHandler;
+
+/**
+ * CollapseAllAction for Debug Launch view
+ */
+public class LaunchCollapseAllAction extends AbstractRemoveAllActionDelegate implements ILaunchesListener2 {
+
+ private IViewPart fView;
+ private TreeModelViewer fViewer;
+
+ @Override
+ public void init(IViewPart view) {
+ fView = view;
+ LaunchView debugView = getView().getAdapter(LaunchView.class);
+ if (debugView != null) {
+ debugView.setAction(getActionId(), getAction());
+ }
+ Viewer viewer = ((LaunchView) getView()).getViewer();
+ if (viewer instanceof TreeModelViewer) {
+ fViewer = (TreeModelViewer) viewer;
+ }
+ super.init(view);
+ }
+
+ private IViewPart getView() {
+ return fView;
+ }
+
+ private String getActionId() {
+ return CollapseAllHandler.COMMAND_ID;
+ }
+
+
+ @Override
+ public void run(IAction action) {
+ if (!(getView() instanceof LaunchView)) {
+ return;
+ }
+ if (fViewer != null) {
+ try {
+ fViewer.getControl().setRedraw(false);
+ fViewer.collapseAll();
+ } finally {
+ fViewer.getControl().setRedraw(true);
+ }
+ }
+ }
+
+ @Override
+ protected void initialize() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
+ }
+
+ @Override
+ protected boolean isEnabled() {
+ if (!(getView() instanceof LaunchView)) {
+ return false;
+ }
+ if (fViewer != null && fViewer.getInput() != null) {
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ if (launches != null && launches.length > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ update();
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ update();
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ // nothing to do
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ // nothing to do
+ }
+}

Back to the top