summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorVincent Lorenzo2013-02-11 16:02:54 (EST)
committer Paul Webster2013-02-11 16:02:54 (EST)
commit27a987a40ef6dca83ede1e757fd579b4fc0091b8 (patch)
treeeadcdf61d5df7d7398eb1cd15b2ee338235cd6c8
parente404d76455c18a19223890106ef82bf76cca5ef5 (diff)
downloadeclipse.platform.ui-27a987a40ef6dca83ede1e757fd579b4fc0091b8.zip
eclipse.platform.ui-27a987a40ef6dca83ede1e757fd579b4fc0091b8.tar.gz
eclipse.platform.ui-27a987a40ef6dca83ede1e757fd579b4fc0091b8.tar.bz2
Bug 341923 - Improve CheckedTreeSelectionDialog : Add the possibility tov20130211-210254
choose the style of the TreeViewer
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java62
1 files changed, 47 insertions, 15 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
index f352e11..fe9c2d0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
@@ -18,7 +18,6 @@ package org.eclipse.ui.dialogs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -81,6 +80,8 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
private Object[] fExpandedElements;
+ private int fStyle = SWT.BORDER;
+
/**
* Constructs an instance of <code>ElementTreeSelectionDialog</code>.
*
@@ -93,15 +94,34 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
*/
public CheckedTreeSelectionDialog(Shell parent,
ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
- super(parent);
- fLabelProvider = labelProvider;
- fContentProvider = contentProvider;
- setResult(new ArrayList(0));
- setStatusLineAboveButtons(true);
- fContainerMode = false;
- fExpandedElements = null;
+ this(parent, labelProvider, contentProvider, SWT.BORDER);
}
+ /**
+ * Constructs an instance of <code>ElementTreeSelectionDialog</code>.
+ *
+ * @param parent
+ * The shell to parent from.
+ * @param labelProvider
+ * the label provider to render the entries
+ * @param contentProvider
+ * the content provider to evaluate the tree structure
+ * @param style
+ * the style of the tree
+ * @since 3.105
+ */
+ public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider,
+ ITreeContentProvider contentProvider, int style) {
+ super(parent);
+ fLabelProvider = labelProvider;
+ fContentProvider = contentProvider;
+ setResult(new ArrayList(0));
+ setStatusLineAboveButtons(true);
+ fContainerMode = false;
+ fExpandedElements = null;
+ fStyle = style;
+ }
+
/**
* If set, the checked /gray state of containers (inner nodes) is derived
* from the checked state of its leaf nodes.
@@ -146,11 +166,23 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
}
/**
- * Sets the comparator used by the tree viewer.
- *
- * @param comparator
- * @since 3.3
- */
+ * Set the style used for the creation of the Tree. Changing this will only
+ * have an effect up to the time the Tree is created.
+ *
+ * @param style
+ * the style of the tree
+ * @since 3.105
+ */
+ public void setStyle(int style) {
+ fStyle = style;
+ }
+
+ /**
+ * Sets the comparator used by the tree viewer.
+ *
+ * @param comparator
+ * @since 3.3
+ */
public void setComparator(ViewerComparator comparator){
fComparator = comparator;
}
@@ -312,9 +344,9 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
*/
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
if (fContainerMode) {
- fViewer = new ContainerCheckedTreeViewer(parent, SWT.BORDER);
+ fViewer = new ContainerCheckedTreeViewer(parent, fStyle);
} else {
- fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);
+ fViewer = new CheckboxTreeViewer(parent, fStyle);
}
fViewer.setContentProvider(fContentProvider);
fViewer.setLabelProvider(fLabelProvider);