Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2020-05-11 16:06:57 +0000
committerSarika Sinha2020-05-12 17:14:06 +0000
commit09da34b662da1271a061825437e872a022a206ed (patch)
tree0dc5bec76d6638b09d24646e11fe61a5845bd72d /org.eclipse.debug.ui
parent537cb2b909c67d19bb0da43fca9a89597c724996 (diff)
downloadeclipse.platform.debug-09da34b662da1271a061825437e872a022a206ed.tar.gz
eclipse.platform.debug-09da34b662da1271a061825437e872a022a206ed.tar.xz
eclipse.platform.debug-09da34b662da1271a061825437e872a022a206ed.zip
Bug 456304 - Import Breakpoints doesn't seem to support selectingI20200512-1800
multiple bookmarks at once Change-Id: Iaefced80efe41c1aef367c3a124b12f604c1de23
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java94
1 files changed, 92 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
index 177c36dfa..fba1257bb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Sebastian Schmidt and others.
+ * Copyright (c) 2012, 2020 Sebastian Schmidt and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -29,22 +29,37 @@ import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.actions.ImportBreakpointsOperation;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Widget;
/**
* @since 3.8
* @noextend This class is not intended to be subclassed by clients.
*/
-public class WizardImportBreakpointsSelectionPage extends WizardPage {
+public class WizardImportBreakpointsSelectionPage extends WizardPage implements Listener {
private EmbeddedBreakpointsViewer fTView;
private boolean fIsVisible;
+ private Button fSelectAll = null;
+ private Button fDeselectAll = null;
+ private ICheckStateListener fImportCheckListener = new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ updateCheckedState(event.getChecked());
+ }
+ };
protected WizardImportBreakpointsSelectionPage(String pageName) {
super(pageName, ImportExportMessages.WizardImportBreakpointsSelectionPage_2, null);
}
@@ -56,11 +71,27 @@ public class WizardImportBreakpointsSelectionPage extends WizardPage {
SWTFactory.createLabel(composite, ImportExportMessages.WizardExportBreakpointsPage_2, 1);
BreakpointManager breakpointManager = new BreakpointManager();
fTView = new EmbeddedBreakpointsViewer(composite, breakpointManager, null);
+ createButtonsGroup(composite);
BreakpointsViewer viewer = fTView.getViewer();
viewer.setLabelProvider(new DecoratingLabelProvider((ILabelProvider) viewer.getLabelProvider(), new BreakpointsPathDecorator()));
+ viewer.addCheckStateListener(fImportCheckListener);
setControl(composite);
}
+ /**
+ * Creates the buttons for selecting all or none of the elements.
+ *
+ * @param parent the parent control
+ */
+ private void createButtonsGroup(Composite parent) {
+ Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 3, 1, GridData.FILL_HORIZONTAL, 0,
+ 0);
+ fSelectAll = SWTFactory.createPushButton(composite, ImportExportMessages.WizardBreakpointsPage_1, null);
+ fSelectAll.addListener(SWT.Selection, this);
+ fDeselectAll = SWTFactory.createPushButton(composite, ImportExportMessages.WizardBreakpointsPage_2, null);
+ fDeselectAll.addListener(SWT.Selection, this);
+ }
+
public List<IMarker> getSelectedMarkers() {
if(!fIsVisible) {
return null;
@@ -110,4 +141,63 @@ public class WizardImportBreakpointsSelectionPage extends WizardPage {
public Image getImage() {
return DebugUITools.getImage(IInternalDebugUIConstants.IMG_WIZBAN_IMPORT_BREAKPOINTS);
}
+
+ @Override
+ public void handleEvent(Event event) {
+ Widget source = event.widget;
+ if (source == fSelectAll) {
+ handleSelectAllPressed();
+ } else if (source == fDeselectAll) {
+ handleDeselectAllPressed();
+ }
+
+ }
+
+ /**
+ * Handles the select all button pressed
+ *
+ */
+ private void handleSelectAllPressed() {
+ BreakpointsViewer viewer = fTView.getViewer();
+ viewer.getTree().selectAll();
+ viewer.setCheckedElements(viewer.getStructuredSelection().toArray());
+ viewer.setGrayedElements(new Object[] {});
+ viewer.getTree().deselectAll();
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ /**
+ * Handles the de-select all button pressed
+ *
+ */
+ private void handleDeselectAllPressed() {
+ BreakpointsViewer viewer = fTView.getViewer();
+ viewer.setCheckedElements(new Object[] {});
+ viewer.setGrayedElements(new Object[] {});
+ setErrorMessage(ImportExportMessages.WizardImportBreakpointsSelectionPage_1);
+ setPageComplete(false);
+ }
+
+ /**
+ * Update the checked state of the given element and all of its children.
+ *
+ * @param enable the checked status of the obj
+ */
+ private void updateCheckedState(boolean enable) {
+ if (!enable) {
+ int size = fTView.getCheckedElements().size();
+ if (size == 0) {
+ setErrorMessage(ImportExportMessages.WizardImportBreakpointsSelectionPage_1);
+ setPageComplete(false);
+ } else {
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+ } else {
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ }
}

Back to the top