From 33582f7509421f4da9ac1e39e59b5f34302896d7 Mon Sep 17 00:00:00 2001 From: incastrix Date: Wed, 23 Dec 2009 17:42:50 +0000 Subject: [PATCH 1/1] Refactory: remove unused classes, imports, fields and methods. --- .../dialogfields/CheckedListDialogField.java | 14 +- .../ui/wizards/dialogfields/ComboDialogField.java | 18 +- .../ui/wizards/dialogfields/LayoutUtil.java | 100 ++++++------ .../ui/wizards/dialogfields/ListDialogField.java | 104 +++++++------- .../SelectionButtonDialogFieldGroup.java | 12 +- .../dialogfields/StringButtonDialogField.java | 6 +- .../StringButtonStatusDialogField.java | 28 ++-- .../ui/wizards/dialogfields/StringDialogField.java | 16 +- .../wizards/dialogfields/TreeListDialogField.java | 162 ++++++++++---------- 9 files changed, 230 insertions(+), 230 deletions(-) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java index 64b47c8..df51493 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java @@ -55,10 +55,10 @@ public class CheckedListDialogField extends ListDialogField { * will then be handled internally. (enable state, button invocation * behaviour) */ - public void setCheckAllButtonIndex(int checkButtonIndex) { - Assert.isTrue(checkButtonIndex < fButtonLabels.length); - fCheckAllButtonIndex = checkButtonIndex; - } +// public void setCheckAllButtonIndex(int checkButtonIndex) { +// Assert.isTrue(checkButtonIndex < fButtonLabels.length); +// fCheckAllButtonIndex = checkButtonIndex; +// } /** * Sets the index of the 'uncheck' button in the button label array passed @@ -125,9 +125,9 @@ public class CheckedListDialogField extends ListDialogField { /** * Returns true if the element is checked. */ - public boolean isChecked(Object obj) { - return fCheckElements.contains(obj); - } +// public boolean isChecked(Object obj) { +// return fCheckElements.contains(obj); +// } /** * Sets the checked elements. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ComboDialogField.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ComboDialogField.java index 777e4bf..13f6572 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ComboDialogField.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ComboDialogField.java @@ -68,7 +68,7 @@ public class ComboDialogField extends DialogField { return 2; } - protected static GridData gridDataForCombo(int span) { + private static GridData gridDataForCombo(int span) { GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = false; @@ -220,13 +220,13 @@ public class ComboDialogField extends DialogField { /** * Sets the text without triggering a dialog-changed event. */ - public void setTextWithoutUpdate(String text) { - fText = text; - if (isOkToUse(fComboControl)) { - fComboControl.removeModifyListener(fModifyListener); - fComboControl.setText(text); - fComboControl.addModifyListener(fModifyListener); - } - } +// public void setTextWithoutUpdate(String text) { +// fText = text; +// if (isOkToUse(fComboControl)) { +// fComboControl.removeModifyListener(fModifyListener); +// fComboControl.setText(text); +// fComboControl.addModifyListener(fModifyListener); +// } +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/LayoutUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/LayoutUtil.java index baee413..cd39911 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/LayoutUtil.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/LayoutUtil.java @@ -10,10 +10,10 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.ui.wizards.dialogfields; -import org.eclipse.swt.SWT; +//import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; +//import org.eclipse.swt.layout.GridLayout; +//import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; public class LayoutUtil { @@ -36,10 +36,10 @@ public class LayoutUtil { * Defines if the label of all fields should be on top of the * fields */ - public static void doDefaultLayout(Composite parent, DialogField[] editors, - boolean labelOnTop) { - doDefaultLayout(parent, editors, labelOnTop, 0, 0, 0, 0); - } +// public static void doDefaultLayout(Composite parent, DialogField[] editors, +// boolean labelOnTop) { +// doDefaultLayout(parent, editors, labelOnTop, 0, 0, 0, 0); +// } /** * Creates a composite and fills in the given editors. @@ -52,10 +52,10 @@ public class LayoutUtil { * @param minHeight * The minimal height of the composite */ - public static void doDefaultLayout(Composite parent, DialogField[] editors, - boolean labelOnTop, int minWidth, int minHeight) { - doDefaultLayout(parent, editors, labelOnTop, minWidth, minHeight, 0, 0); - } +// public static void doDefaultLayout(Composite parent, DialogField[] editors, +// boolean labelOnTop, int minWidth, int minHeight) { +// doDefaultLayout(parent, editors, labelOnTop, minWidth, minHeight, 0, 0); +// } /** * Creates a composite and fills in the given editors. @@ -73,34 +73,34 @@ public class LayoutUtil { * The margin height to be used by the composite * @deprecated */ - public static void doDefaultLayout(Composite parent, DialogField[] editors, - boolean labelOnTop, int minWidth, int minHeight, int marginWidth, - int marginHeight) { - int nCulumns = getNumberOfColumns(editors); - Control[][] controls = new Control[editors.length][]; - for (int i = 0; i < editors.length; i++) { - controls[i] = editors[i].doFillIntoGrid(parent, nCulumns); - } - if (labelOnTop) { - nCulumns--; - modifyLabelSpans(controls, nCulumns); - } - GridLayout layout = new GridLayout(); - if (marginWidth != SWT.DEFAULT) { - layout.marginWidth = marginWidth; - } - if (marginHeight != SWT.DEFAULT) { - layout.marginHeight = marginHeight; - } - layout.numColumns = nCulumns; - parent.setLayout(layout); - } +// public static void doDefaultLayout(Composite parent, DialogField[] editors, +// boolean labelOnTop, int minWidth, int minHeight, int marginWidth, +// int marginHeight) { +// int nCulumns = getNumberOfColumns(editors); +// Control[][] controls = new Control[editors.length][]; +// for (int i = 0; i < editors.length; i++) { +// controls[i] = editors[i].doFillIntoGrid(parent, nCulumns); +// } +// if (labelOnTop) { +// nCulumns--; +// modifyLabelSpans(controls, nCulumns); +// } +// GridLayout layout = new GridLayout(); +// if (marginWidth != SWT.DEFAULT) { +// layout.marginWidth = marginWidth; +// } +// if (marginHeight != SWT.DEFAULT) { +// layout.marginHeight = marginHeight; +// } +// layout.numColumns = nCulumns; +// parent.setLayout(layout); +// } - private static void modifyLabelSpans(Control[][] controls, int nCulumns) { - for (int i = 0; i < controls.length; i++) { - setHorizontalSpan(controls[i][0], nCulumns); - } - } +// private static void modifyLabelSpans(Control[][] controls, int nCulumns) { +// for (int i = 0; i < controls.length; i++) { +// setHorizontalSpan(controls[i][0], nCulumns); +// } +// } /** * Sets the span of a control. Assumes that GridData is used. @@ -129,22 +129,22 @@ public class LayoutUtil { /** * Sets the heigthHint hint of a control. Assumes that GridData is used. */ - public static void setHeigthHint(Control control, int heigthHint) { - Object ld = control.getLayoutData(); - if (ld instanceof GridData) { - ((GridData) ld).heightHint = heigthHint; - } - } +// public static void setHeigthHint(Control control, int heigthHint) { +// Object ld = control.getLayoutData(); +// if (ld instanceof GridData) { +// ((GridData) ld).heightHint = heigthHint; +// } +// } /** * Sets the horizontal indent of a control. Assumes that GridData is used. */ - public static void setHorizontalIndent(Control control, int horizontalIndent) { - Object ld = control.getLayoutData(); - if (ld instanceof GridData) { - ((GridData) ld).horizontalIndent = horizontalIndent; - } - } +// public static void setHorizontalIndent(Control control, int horizontalIndent) { +// Object ld = control.getLayoutData(); +// if (ld instanceof GridData) { +// ((GridData) ld).horizontalIndent = horizontalIndent; +// } +// } /** * Sets the horizontal indent of a control. Assumes that GridData is used. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ListDialogField.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ListDialogField.java index 776f174..3c85696 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ListDialogField.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/ListDialogField.java @@ -111,7 +111,7 @@ public class ListDialogField extends DialogField { private int fDownButtonIndex; - private Label fLastSeparator; + //private Label fLastSeparator; private Control fTableControl; @@ -205,9 +205,9 @@ public class ListDialogField extends DialogField { * @param viewerSorter * The viewerSorter to set */ - public void setViewerSorter(ViewerSorter viewerSorter) { - fViewerSorter = viewerSorter; - } +// public void setViewerSorter(ViewerSorter viewerSorter) { +// fViewerSorter = viewerSorter; +// } public void setTableColumns(ColumnsDescription column) { fTableColumns = column; @@ -289,11 +289,11 @@ public class ListDialogField extends DialogField { * Sets the minimal width of the buttons. Must be called after widget * creation. */ - public void setButtonsMinWidth(int minWidth) { - if (fLastSeparator != null) { - ((GridData) fLastSeparator.getLayoutData()).widthHint = minWidth; - } - } +// public void setButtonsMinWidth(int minWidth) { +// if (fLastSeparator != null) { +// ((GridData) fLastSeparator.getLayoutData()).widthHint = minWidth; +// } +// } // ------ ui creation @@ -457,7 +457,7 @@ public class ListDialogField extends DialogField { } } - fLastSeparator = createSeparator(contents); + //fLastSeparator = createSeparator(contents); updateButtonState(); fButtonsControl = contents; @@ -593,9 +593,9 @@ public class ListDialogField extends DialogField { /** * Gets the index of an element in the list or -1 if element is not in list. */ - public int getIndexOfElement(Object elem) { - return fElements.indexOf(elem); - } +// public int getIndexOfElement(Object elem) { +// return fElements.indexOf(elem); +// } /** * Replace an element. @@ -636,26 +636,26 @@ public class ListDialogField extends DialogField { /** * Adds elements at the end of the list. */ - public void addElements(List elements) { - int nElements = elements.size(); - - if (nElements > 0) { - // filter duplicated - ArrayList elementsToAdd = new ArrayList(nElements); - - for (int i = 0; i < nElements; i++) { - Object elem = elements.get(i); - if (!fElements.contains(elem)) { - elementsToAdd.add(elem); - } - } - fElements.addAll(elementsToAdd); - if (fTable != null) { - fTable.add(elementsToAdd.toArray()); - } - dialogFieldChanged(); - } - } +// public void addElements(List elements) { +// int nElements = elements.size(); +// +// if (nElements > 0) { +// // filter duplicated +// ArrayList elementsToAdd = new ArrayList(nElements); +// +// for (int i = 0; i < nElements; i++) { +// Object elem = elements.get(i); +// if (!fElements.contains(elem)) { +// elementsToAdd.add(elem); +// } +// } +// fElements.addAll(elementsToAdd); +// if (fTable != null) { +// fTable.add(elementsToAdd.toArray()); +// } +// dialogFieldChanged(); +// } +// } /** * Adds an element at a position. @@ -675,29 +675,29 @@ public class ListDialogField extends DialogField { /** * Adds an element at a position. */ - public void removeAllElements() { - if (fElements.size() > 0) { - fElements.clear(); - if (fTable != null) { - fTable.refresh(); - } - dialogFieldChanged(); - } - } +// public void removeAllElements() { +// if (fElements.size() > 0) { +// fElements.clear(); +// if (fTable != null) { +// fTable.refresh(); +// } +// dialogFieldChanged(); +// } +// } /** * Removes an element from the list. */ - public void removeElement(Object element) throws IllegalArgumentException { - if (fElements.remove(element)) { - if (fTable != null) { - fTable.remove(element); - } - dialogFieldChanged(); - } else { - throw new IllegalArgumentException(); - } - } +// public void removeElement(Object element) throws IllegalArgumentException { +// if (fElements.remove(element)) { +// if (fTable != null) { +// fTable.remove(element); +// } +// dialogFieldChanged(); +// } else { +// throw new IllegalArgumentException(); +// } +// } /** * Removes elements from the list. diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/SelectionButtonDialogFieldGroup.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/SelectionButtonDialogFieldGroup.java index 3e6319b..d12e4fe 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/SelectionButtonDialogFieldGroup.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/SelectionButtonDialogFieldGroup.java @@ -191,12 +191,12 @@ public class SelectionButtonDialogFieldGroup extends DialogField { * Returns a button from the group or null if not yet * created. */ - public Button getSelectionButton(int index) { - if (index >= 0 && index < fButtons.length) { - return fButtons[index]; - } - return null; - } +// public Button getSelectionButton(int index) { +// if (index >= 0 && index < fButtons.length) { +// return fButtons[index]; +// } +// return null; +// } private void doWidgetSelected(SelectionEvent e) { Button button = (Button) e.widget; diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonDialogField.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonDialogField.java index aa06105..02c2044 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonDialogField.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonDialogField.java @@ -31,13 +31,13 @@ public class StringButtonDialogField extends StringDialogField { private String fBrowseButtonLabel; - private IStringButtonAdapter fStringButtonAdapter; + //private IStringButtonAdapter fStringButtonAdapter; private boolean fButtonEnabled; public StringButtonDialogField(IStringButtonAdapter adapter) { super(); - fStringButtonAdapter = adapter; + //fStringButtonAdapter = adapter; fBrowseButtonLabel = "!Browse...!"; //$NON-NLS-1$ fButtonEnabled = true; } @@ -55,7 +55,7 @@ public class StringButtonDialogField extends StringDialogField { * Programmatical pressing of the button */ public void changeControlPressed() { - fStringButtonAdapter.changeControlPressed(this); + //fStringButtonAdapter.changeControlPressed(this); } // ------- layout helpers diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonStatusDialogField.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonStatusDialogField.java index 87fd7ea..57a7a42 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonStatusDialogField.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringButtonStatusDialogField.java @@ -58,16 +58,16 @@ public class StringButtonStatusDialogField extends StringButtonDialogField { /** * Sets the status image. Caller is responsible to dispose image */ - public void setStatus(Image image) { - if (isOkToUse(fStatusLabelControl)) { - if (image == null) { - fStatusLabelControl.setImage(null); - } else { - fStatusLabelControl.setImage(image); - } - } - fStatus = image; - } +// public void setStatus(Image image) { +// if (isOkToUse(fStatusLabelControl)) { +// if (image == null) { +// fStatusLabelControl.setImage(null); +// } else { +// fStatusLabelControl.setImage(image); +// } +// } +// fStatus = image; +// } /** * Sets the staus string hint of the status label. The string is used to @@ -81,10 +81,10 @@ public class StringButtonStatusDialogField extends StringButtonDialogField { /** * Sets the width hint of the status label. */ - public void setStatusWidthHint(int widthHint) { - fWidthHint = widthHint; - fWidthHintString = null; - } +// public void setStatusWidthHint(int widthHint) { +// fWidthHint = widthHint; +// fWidthHintString = null; +// } // ------- layout helpers diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringDialogField.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringDialogField.java index e43b145..65471ca 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringDialogField.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/StringDialogField.java @@ -151,13 +151,13 @@ public class StringDialogField extends DialogField { /** * Sets the text without triggering a dialog-changed event. */ - public void setTextWithoutUpdate(String text) { - fText = text; - if (isOkToUse(fTextControl)) { - fTextControl.removeModifyListener(fModifyListener); - fTextControl.setText(text); - fTextControl.addModifyListener(fModifyListener); - } - } +// public void setTextWithoutUpdate(String text) { +// fText = text; +// if (isOkToUse(fTextControl)) { +// fTextControl.removeModifyListener(fModifyListener); +// fTextControl.setText(text); +// fTextControl.addModifyListener(fModifyListener); +// } +// } } diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/TreeListDialogField.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/TreeListDialogField.java index b5c2444..c447edc 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/TreeListDialogField.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/wizards/dialogfields/TreeListDialogField.java @@ -19,7 +19,7 @@ import net.sourceforge.phpdt.internal.ui.util.SWTUtil; //incastrix //import org.eclipse.jface.text.Assert; -import org.eclipse.core.runtime.Assert; +//import org.eclipse.core.runtime.Assert; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ILabelProvider; @@ -130,20 +130,20 @@ public class TreeListDialogField extends DialogField { * button will then behandled internally. (enable state, button invocation * behaviour) */ - public void setRemoveButtonIndex(int removeButtonIndex) { - Assert.isTrue(removeButtonIndex < fButtonLabels.length); - fRemoveButtonIndex = removeButtonIndex; - } +// public void setRemoveButtonIndex(int removeButtonIndex) { +// Assert.isTrue(removeButtonIndex < fButtonLabels.length); +// fRemoveButtonIndex = removeButtonIndex; +// } /** * Sets the index of the 'up' button in the button label array passed in the * constructor. The behaviour of the button marked as the 'up' button will * then behandled internally. (enable state, button invocation behaviour) */ - public void setUpButtonIndex(int upButtonIndex) { - Assert.isTrue(upButtonIndex < fButtonLabels.length); - fUpButtonIndex = upButtonIndex; - } +// public void setUpButtonIndex(int upButtonIndex) { +// Assert.isTrue(upButtonIndex < fButtonLabels.length); +// fUpButtonIndex = upButtonIndex; +// } /** * Sets the index of the 'down' button in the button label array passed in @@ -151,10 +151,10 @@ public class TreeListDialogField extends DialogField { * will then be handled internally. (enable state, button invocation * behaviour) */ - public void setDownButtonIndex(int downButtonIndex) { - Assert.isTrue(downButtonIndex < fButtonLabels.length); - fDownButtonIndex = downButtonIndex; - } +// public void setDownButtonIndex(int downButtonIndex) { +// Assert.isTrue(downButtonIndex < fButtonLabels.length); +// fDownButtonIndex = downButtonIndex; +// } /** * Sets the viewerSorter. @@ -162,9 +162,9 @@ public class TreeListDialogField extends DialogField { * @param viewerSorter * The viewerSorter to set */ - public void setViewerSorter(ViewerSorter viewerSorter) { - fViewerSorter = viewerSorter; - } +// public void setViewerSorter(ViewerSorter viewerSorter) { +// fViewerSorter = viewerSorter; +// } /** * Sets the viewerSorter. @@ -172,12 +172,12 @@ public class TreeListDialogField extends DialogField { * @param viewerSorter * The viewerSorter to set */ - public void setTreeExpansionLevel(int level) { - fTreeExpandLevel = level; - if (fTree != null) { - fTree.expandToLevel(level); - } - } +// public void setTreeExpansionLevel(int level) { +// fTreeExpandLevel = level; +// if (fTree != null) { +// fTree.expandToLevel(level); +// } +// } // ------ adapter communication @@ -544,36 +544,36 @@ public class TreeListDialogField extends DialogField { /** * Gets the index of an element in the list or -1 if element is not in list. */ - public int getIndexOfElement(Object elem) { - return fElements.indexOf(elem); - } +// public int getIndexOfElement(Object elem) { +// return fElements.indexOf(elem); +// } /** * Replace an element. */ - public void replaceElement(Object oldElement, Object newElement) - throws IllegalArgumentException { - int idx = fElements.indexOf(oldElement); - if (idx != -1) { - fElements.set(idx, newElement); - if (fTree != null) { - List selected = getSelectedElements(); - if (selected.remove(oldElement)) { - selected.add(newElement); - } - boolean isExpanded = fTree.getExpandedState(oldElement); - fTree.remove(oldElement); - fTree.add(fParentElement, newElement); - if (isExpanded) { - fTree.expandToLevel(newElement, fTreeExpandLevel); - } - selectElements(new StructuredSelection(selected)); - } - dialogFieldChanged(); - } else { - throw new IllegalArgumentException(); - } - } +// public void replaceElement(Object oldElement, Object newElement) +// throws IllegalArgumentException { +// int idx = fElements.indexOf(oldElement); +// if (idx != -1) { +// fElements.set(idx, newElement); +// if (fTree != null) { +// List selected = getSelectedElements(); +// if (selected.remove(oldElement)) { +// selected.add(newElement); +// } +// boolean isExpanded = fTree.getExpandedState(oldElement); +// fTree.remove(oldElement); +// fTree.add(fParentElement, newElement); +// if (isExpanded) { +// fTree.expandToLevel(newElement, fTreeExpandLevel); +// } +// selectElements(new StructuredSelection(selected)); +// } +// dialogFieldChanged(); +// } else { +// throw new IllegalArgumentException(); +// } +// } /** * Adds an element at the end of the tree list. @@ -593,29 +593,29 @@ public class TreeListDialogField extends DialogField { /** * Adds elements at the end of the tree list. */ - public void addElements(List elements) { - int nElements = elements.size(); - - if (nElements > 0) { - // filter duplicated - ArrayList elementsToAdd = new ArrayList(nElements); - - for (int i = 0; i < nElements; i++) { - Object elem = elements.get(i); - if (!fElements.contains(elem)) { - elementsToAdd.add(elem); - } - } - fElements.addAll(elementsToAdd); - if (fTree != null) { - fTree.add(fParentElement, elementsToAdd.toArray()); - for (int i = 0; i < elementsToAdd.size(); i++) { - fTree.expandToLevel(elementsToAdd.get(i), fTreeExpandLevel); - } - } - dialogFieldChanged(); - } - } +// public void addElements(List elements) { +// int nElements = elements.size(); +// +// if (nElements > 0) { +// // filter duplicated +// ArrayList elementsToAdd = new ArrayList(nElements); +// +// for (int i = 0; i < nElements; i++) { +// Object elem = elements.get(i); +// if (!fElements.contains(elem)) { +// elementsToAdd.add(elem); +// } +// } +// fElements.addAll(elementsToAdd); +// if (fTree != null) { +// fTree.add(fParentElement, elementsToAdd.toArray()); +// for (int i = 0; i < elementsToAdd.size(); i++) { +// fTree.expandToLevel(elementsToAdd.get(i), fTreeExpandLevel); +// } +// } +// dialogFieldChanged(); +// } +// } /** * Adds an element at a position. @@ -649,16 +649,16 @@ public class TreeListDialogField extends DialogField { /** * Removes an element from the list. */ - public void removeElement(Object element) throws IllegalArgumentException { - if (fElements.remove(element)) { - if (fTree != null) { - fTree.remove(element); - } - dialogFieldChanged(); - } else { - throw new IllegalArgumentException(); - } - } +// public void removeElement(Object element) throws IllegalArgumentException { +// if (fElements.remove(element)) { +// if (fTree != null) { +// fTree.remove(element); +// } +// dialogFieldChanged(); +// } else { +// throw new IllegalArgumentException(); +// } +// } /** * Removes elements from the list. -- 1.7.1