* 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
/**
* 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.
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;
/**
* 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);
+// }
+// }
}
*******************************************************************************/
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 {
* 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.
* @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.
* 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.
/**
* 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.
private int fDownButtonIndex;
- private Label fLastSeparator;
+ //private Label fLastSeparator;
private Control fTableControl;
* @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;
* 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
}
}
- fLastSeparator = createSeparator(contents);
+ //fLastSeparator = createSeparator(contents);
updateButtonState();
fButtonsControl = contents;
/**
* 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.
/**
* 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.
/**
* 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.
* Returns a button from the group or <code>null</code> 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;
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;
}
* Programmatical pressing of the button
*/
public void changeControlPressed() {
- fStringButtonAdapter.changeControlPressed(this);
+ //fStringButtonAdapter.changeControlPressed(this);
}
// ------- layout helpers
/**
* 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
/**
* 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
/**
* 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);
+// }
+// }
}
//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;
* 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
* 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.
* @param viewerSorter
* The viewerSorter to set
*/
- public void setViewerSorter(ViewerSorter viewerSorter) {
- fViewerSorter = viewerSorter;
- }
+// public void setViewerSorter(ViewerSorter viewerSorter) {
+// fViewerSorter = viewerSorter;
+// }
/**
* Sets the viewerSorter.
* @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
/**
* 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.
/**
* 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.
/**
* 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.