summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets
diff options
context:
space:
mode:
authorJeff Brown <jbrown>2001-08-04 01:53:00 +0000
committerJeff Brown <jbrown>2001-08-04 01:53:00 +0000
commit582ff634d022629a0a943c10bfba912091789d3c (patch)
tree95740d287a860a722b8a68be74868543378db3eb /bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets
parentf194ae88fb5f8ee0fb7a6fd129741530a934a5fd (diff)
downloadeclipse.platform.swt-582ff634d022629a0a943c10bfba912091789d3c.tar.gz
eclipse.platform.swt-582ff634d022629a0a943c10bfba912091789d3c.tar.xz
eclipse.platform.swt-582ff634d022629a0a943c10bfba912091789d3c.zip
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java66
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java83
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java22
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java70
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java29
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java70
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java87
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java84
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java68
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java157
18 files changed, 686 insertions, 131 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
index 514b569550..3b630705cb 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
@@ -41,7 +41,7 @@ public /*final*/ class CoolItem extends Item {
/**
* Constructs a new instance of this class given its parent
- * (which must be a <code>CoolBar</code> and a style value
+ * (which must be a <code>CoolBar</code>) and a style value
* describing its behavior and appearance. The item is added
* to the end of the items maintained by its parent.
* <p>
@@ -76,7 +76,7 @@ public CoolItem (CoolBar parent, int style) {
}
/**
* Constructs a new instance of this class given its parent
- * (which must be a <code>CoolBar</code>, a style value
+ * (which must be a <code>CoolBar</code>), a style value
* describing its behavior and appearance, and the index
* at which to place it in the items maintained by its parent.
* <p>
@@ -328,6 +328,9 @@ int processPaint (int callData) {
*
* @param control the new control
*
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -335,8 +338,9 @@ int processPaint (int callData) {
*/
public void setControl (Control control) {
checkWidget();
- if (control != null && control.parent != parent) {
- error (SWT.ERROR_INVALID_PARENT);
+ if (control != null) {
+ if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+ if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
}
Control oldControl = this.control;
if (oldControl != null) oldControl.setVisible(false);
@@ -434,6 +438,7 @@ public void setPreferredSize (int width, int height) {
}
}
public void setPreferredSize (Point size) {
+ if (size == null) error(SWT.ERROR_NULL_ARGUMENT);
setPreferredSize(size.x, size.y);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java
index 21f108592d..e0c2ee06c0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java
@@ -27,23 +27,81 @@ import org.eclipse.swt.events.*;
public /*final*/ class MenuItem extends Item {
int accelerator;
Menu parent, menu;
+
/**
-* Creates a new instance of the widget.
-*/
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Menu</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
public MenuItem (Menu parent, int style) {
super (parent, checkStyle (style));
this.parent = parent;
createWidget (OS.XmLAST_POSITION);
}
+
/**
-* Creates a new instance of the widget.
-*/
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Menu</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
public MenuItem (Menu parent, int style, int index) {
super (parent, checkStyle (style));
this.parent = parent;
if (index == OS.XmLAST_POSITION) error (SWT.ERROR_INVALID_RANGE);
createWidget (index);
}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the arm events are generated for the control, by sending
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java
index 68b5d9ed33..c382dd368a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java
@@ -30,9 +30,63 @@ import org.eclipse.swt.widgets.*;
public /*final*/ class MessageBox extends Dialog {
int button;
String message = "";
+
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
public MessageBox (Shell parent) {
this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
public MessageBox (Shell parent, int style) {
super (parent, checkStyle (style));
}
@@ -58,9 +112,30 @@ int createHandle (int parentHandle, int [] argList) {
if ((style & SWT.ICON_WARNING) != 0) return OS.XmCreateWarningDialog (parentHandle, null, argList, argList.length / 2);
return OS.XmCreateMessageDialog (parentHandle, null, argList, argList.length / 2);
}
+
+/**
+ * Returns the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @return the message
+ */
public String getMessage () {
return message;
}
+
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return the ID of the button that was selected to dismiss the
+ * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
public int open () {
/* Create the dialog.*/
@@ -322,6 +397,14 @@ void setMessage (int dialogHandle) {
OS.XtSetValues (dialogHandle, argList, argList.length / 2);
OS.XmStringFree (xmStringPtr);
}
+
+/**
+ * Sets the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @param string the message
+ */
public void setMessage (String string) {
message = string;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java
index 8fef830353..b53259e74f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java
@@ -26,11 +26,37 @@ import org.eclipse.swt.graphics.*;
*/
public /*final*/ class ProgressBar extends Control {
+
/**
-* Creates a new instance of the widget.
-*/
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
public ProgressBar (Composite parent, int style) {
- /**
+ /*
* Feature in Motif. If you set the progress bar's value to 0,
* the thumb does not disappear. In order to make this happen,
* we hide the widget when the value is set to zero by changing
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
index fbeadd62b6..d26fa476fb 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java
@@ -30,6 +30,7 @@ public /*final*/ class Sash extends Control {
boolean dragging;
int startX, startY, lastX, lastY;
int cursor;
+
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -61,6 +62,7 @@ public /*final*/ class Sash extends Control {
public Sash (Composite parent, int style) {
super (parent, checkStyle (style));
}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the control is selected, by sending
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
index dd7c5e8c49..4e935cbc11 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java
@@ -58,6 +58,7 @@ public /*final*/ class Scale extends Control {
public Scale (Composite parent, int style) {
super (parent, checkStyle (style));
}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the receiver's value changes, by sending
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
index 87617d3343..010e596927 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
@@ -1024,7 +1024,6 @@ int getRedrawY(SelectableItem item) {
*/
public int getSelectionCount() {
checkWidget();
-
return getSelectionVector().size();
}
/**
@@ -1379,7 +1378,6 @@ void motif_setInsertMark(SelectableItem item, boolean after) {
*/
public void redraw () {
checkWidget();
-
if (drawCount == 0) {
super.redraw();
}
@@ -1390,7 +1388,6 @@ public void redraw () {
*/
public void redraw (int x, int y, int width, int height, boolean all) {
checkWidget();
-
if (drawCount == 0) {
super.redraw(x, y, width, height, all);
}
@@ -1402,7 +1399,6 @@ public void redraw (int x, int y, int width, int height, boolean all) {
*/
void redrawSelection(SelectableItem item) {
int redrawPosition = getVisibleRedrawY(item);
-
if (redrawPosition != -1) {
item.redrawSelection(redrawPosition);
}
@@ -1743,7 +1739,6 @@ void setCtrlSelection(boolean isCtrlSelection) {
*/
public void setFont(Font font) {
checkWidget();
-
super.setFont(font);
textHeight = -1;
}
@@ -1754,7 +1749,6 @@ public void setFont(Font font) {
*/
void setHorizontalOffset(int offset) {
int offsetChange = offset - horizontalOffset;
-
if (offsetChange != 0) {
scrollHorizontal(offsetChange);
horizontalOffset = offset;
@@ -1832,7 +1826,6 @@ void setLastSelection(SelectableItem selectedItem, boolean showItem) {
*/
public void setRedraw (boolean redraw) {
checkWidget();
-
if (redraw) {
if (--drawCount == 0) redraw();
} else {
@@ -1867,6 +1860,7 @@ void setSelectableSelection(SelectableItem selectionItems[]) {
keepSelected = new Vector(selectionItems.length);
for (int i = 0; i < selectionCount; i++) {
if (selectionItems[i] != null) {
+ if (selectionItems[i].isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
keepSelected.addElement(selectionItems[i]);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java
index d29cf93aef..d1285aca57 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java
@@ -46,6 +46,7 @@ public /*final*/ class TabFolder extends Composite {
static final int CLIENT_MARGIN_WIDTH = 2; // distance between widget border and client rect
static final int SELECTED_TAB_TOP_EXPANSION = 2; // amount we expand the selected tab on top
static final int SELECTED_TAB_HORIZONTAL_EXPANSION = 2; // amount we expand so it overlays to left and right
+
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -111,14 +112,10 @@ public TabFolder(Composite parent, int style) {
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget();
- TypedListener typedListener;
-
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection,typedListener);
+ addListener(SWT.DefaultSelection,typedListener);
}
static int checkStyle (int style) {
/*
@@ -485,7 +482,6 @@ int getImageHeight() {
*/
public TabItem getItem (int index) {
checkWidget();
-
if (!(0 <= index && index < getItemCount())) error(SWT.ERROR_INVALID_RANGE);
return items [index];
}
@@ -501,7 +497,6 @@ public TabItem getItem (int index) {
*/
public int getItemCount(){
checkWidget();
-
if (items == null)
return 0;
else return items.length;
@@ -524,7 +519,6 @@ public int getItemCount(){
*/
public TabItem [] getItems() {
checkWidget();
-
if (items == null) return new TabItem[0];
TabItem[] tabItems = new TabItem [items.length];
System.arraycopy(items, 0, tabItems, 0, items.length);
@@ -556,7 +550,6 @@ Rectangle getScrollButtonArea() {
*/
public TabItem [] getSelection() {
checkWidget();
-
if (selectedIndex == -1) return new TabItem [0];
return new TabItem [] {items[selectedIndex]};
}
@@ -573,7 +566,6 @@ public TabItem [] getSelection() {
*/
public int getSelectionIndex() {
checkWidget();
-
return selectedIndex;
}
/**
@@ -619,7 +611,6 @@ void handleEvents (Event event){
*/
public int indexOf(TabItem item) {
checkWidget();
-
if (item == null) {
error(SWT.ERROR_NULL_ARGUMENT);
}
@@ -882,7 +873,6 @@ void redrawTabs() {
*/
public void removeSelectionListener(SelectionListener listener) {
checkWidget();
-
if (listener == null) {
error(SWT.ERROR_NULL_ARGUMENT);
}
@@ -928,7 +918,6 @@ void scrollRight() {
}
public void setFont(Font font) {
checkWidget();
-
if (font != null && font.equals(getFont())) return;
super.setFont(font);
layoutItems();
@@ -987,7 +976,6 @@ public void setSelection(int index) {
*/
public void setSelection(TabItem selectedItems[]) {
checkWidget();
-
if (selectedItems == null) error(SWT.ERROR_NULL_ARGUMENT);
int index = -1;
if (selectedItems.length > 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java
index ed783e4c9e..724880aa45 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java
@@ -37,19 +37,75 @@ public /*final*/ class TabItem extends Item {
static final int DEFAULT_TEXT_WIDTH = 36; // preferred text width if there is no text.
// Used for preferred item width calculation
/**
- * Construct a TabItem with the specified parent and style.
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>TabFolder</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
public TabItem (TabFolder parent, int style) {
this(parent, style, parent.getItemCount());
}
+
/**
- * Construct a TabItem with the specified parent and style, inserted at
- * the specified index.
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>TabFolder</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
public TabItem (TabFolder parent, int style, int index) {
super (parent, style);
parent.createChild (this, index);
}
+
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
@@ -235,6 +291,9 @@ int preferredWidth(GC gc) {
* <p>
* @param control the new control (or null)
*
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -242,8 +301,9 @@ int preferredWidth(GC gc) {
*/
public void setControl (Control control) {
checkWidget();
- if (control != null && control.parent != parent) {
- error (SWT.ERROR_INVALID_PARENT);
+ if (control != null) {
+ if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+ if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
}
Control oldControl = this.control, newControl = control;
this.control = control;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java
index 0dff87eb78..84e6cfe3c0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java
@@ -58,6 +58,7 @@ public /*final*/ class Table extends SelectableItemWidget {
private TableColumn defaultColumn; // Default column that is created as soon as the table is created.
// Fix for 1FUSJY5
private int dotsWidth = -1; // width of the static String dots (see above)
+
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -90,6 +91,7 @@ public Table(Composite parent, int style) {
// use NO_MERGE_PAINTS to avoid flashing during column and widget resize redraw
super(parent, checkStyle(style| SWT.NO_MERGE_PAINTS));
}
+
/**
* Add 'column' to the receiver.
* @param column - new table column that should be added to
@@ -171,14 +173,10 @@ void addItem(TableItem item, int index) {
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget();
- TypedListener typedListener;
-
- if (listener == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
- typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection,typedListener);
+ addListener(SWT.DefaultSelection,typedListener);
}
static int checkStyle (int style) {
return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
@@ -2194,7 +2192,7 @@ void scrollVerticalRemovedItem(int index) {
* @param indices the array of indices for the items to select
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -2479,7 +2477,7 @@ void setResizeColumn(TableColumn column) {
* @param indices the indices of the items to select
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -2514,7 +2512,8 @@ public void setSelection(int [] indices) {
* @param items the array of items
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -2624,7 +2623,8 @@ void setTopIndexNoScroll(int index, boolean adjustScrollbar) {
* @param item the item to be shown
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -2635,9 +2635,8 @@ void setTopIndexNoScroll(int index, boolean adjustScrollbar) {
*/
public void showItem(TableItem item) {
checkWidget();
- if (item == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
showSelectableItem(item);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java
index 2ac334e74b..975c49c684 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java
@@ -32,6 +32,7 @@ public /*final*/ class TableColumn extends Item {
private Rectangle bounds = new Rectangle(0, 0, 0, 0);
private boolean isDefaultWidth = true;
private boolean resize = true;
+
/**
* Create a new TableColumn without adding it to the parent.
* Currently used to create fill columns and default columns.
@@ -43,22 +44,71 @@ TableColumn(Table parent) {
super(parent, SWT.NULL);
this.parent = parent;
}
+
/**
- * Create a new instance of TableColumn and append it to the existing
- * columns in 'parent'.
- * @param parent - Table widget the new instance will be a child of.
- * @param syle - style of the new TableColumn
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
public TableColumn(Table parent, int style) {
this(parent, style, checkNull(parent).getColumnCount());
}
+
/**
- * Create a new instance of TableColumn at position 'index' in the Table
- * identified by 'parent'.
- * @param parent - Table widget the new instance will be a child of.
- * @param index - position in the 'parent' at which the new instance will
- * be located relative to the other columns.
- * @param syle - style of the new TableColumn
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
public TableColumn(Table parent, int style, int index) {
super(parent, checkStyle (style), index);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java
index 297f4df153..bf8ae90dfb 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java
@@ -40,26 +40,77 @@ public /*final*/ class TableItem extends SelectableItem {
private int imageIndent = 0; // the factor by which the item image and check box, if any,
// are indented. The multiplier is the image width.
private int index; // index of the item in the parent widget
+
/**
- * Create a table item in the table widget 'parent'. Append the new
- * item to the existing items in 'parent'.
- * @param parent - table widget the new item is added to.
- * @param style - widget style. See Widget class for details
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
public TableItem(Table parent, int style) {
this(parent, style, checkNull(parent).getItemCount());
}
+
/**
- * Create a table item in the table widget 'parent'. Add the new
- * item at position 'index' to the existing items in 'parent'.
- * @param parent - table widget the new item is added to.
- * @param style - widget style. See Widget class for details
- * @param index - position the new item is inserted at in 'parent'
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
public TableItem(Table parent, int style, int index) {
super(parent, style);
parent.addItem(this, index);
}
+
/**
* Calculate the size of the rectangle drawn to indicate a selected
* item. This is also used to draw the selection focus rectangle.
@@ -683,6 +734,7 @@ void internalSetImage(int columnIndex, Image image) {
if (((Image) images.elementAt(columnIndex)) == null && image != null) {
imageWasNull = true;
}
+ if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
images.setElementAt(image, columnIndex);
reset(columnIndex); // new image may cause text to no longer fit in the column
notifyImageChanged(columnIndex, imageWasNull);
@@ -856,10 +908,11 @@ void reset(int index) {
/**
* Sets the image for multiple columns in the Table.
*
- * @param strings the array of new images
+ * @param images the array of new images
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -882,20 +935,20 @@ public void setImage(Image [] images) {
* Sets the receiver's image at a column.
*
* @param index the column index
- * @param string the new image
+ * @param image the new image
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
-public void setImage(int columnIndex, Image image) {
+public void setImage(int index, Image image) {
checkWidget();
if (getParent().indexOf(this) != -1) {
- internalSetImage(columnIndex, image);
+ internalSetImage(index, image);
}
}
public void setImage(Image image) {
@@ -969,13 +1022,13 @@ public void setText(String [] strings) {
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
-public void setText (int columnIndex, String string) {
+public void setText (int index, String string) {
checkWidget();
if (string == null) {
error(SWT.ERROR_NULL_ARGUMENT);
}
if (getParent().indexOf(this) != -1) {
- internalSetText(columnIndex, string);
+ internalSetText(index, string);
}
}
public void setText(String text) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
index 3d2cf70a3d..aff83aa4f4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java
@@ -24,7 +24,6 @@ import org.eclipse.swt.events.*;
* </p>
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
*/
-
public class Text extends Scrollable {
char echoCharacter;
boolean ignoreChange;
@@ -44,6 +43,7 @@ public class Text extends Scrollable {
LIMIT = 0x7FFFFFFF;
DELIMITER = "\n";
}
+
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -75,6 +75,7 @@ public class Text extends Scrollable {
public Text (Composite parent, int style) {
super (parent, checkStyle (style));
}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the receiver's text is modified, by sending
@@ -1021,7 +1022,6 @@ public void removeVerifyListener (VerifyListener listener) {
*/
public void selectAll () {
checkWidget();
-
/* Clear the highlight before setting the selection. */
int position = OS.XmTextGetLastPosition (handle);
// OS.XmTextSetHighlight (handle, 0, position, OS.XmHIGHLIGHT_NORMAL);
@@ -1180,7 +1180,6 @@ public void setRedraw (boolean redraw) {
*/
public void setSelection (int start) {
checkWidget();
-
/* Clear the selection and highlight before moving the i-beam. */
int xDisplay = OS.XtDisplay (handle);
if (xDisplay == 0) return;
@@ -1225,7 +1224,6 @@ public void setSelection (int start) {
*/
public void setSelection (int start, int end) {
checkWidget();
-
/* Clear the highlight before setting the selection. */
int position = OS.XmTextGetLastPosition (handle);
// OS.XmTextSetHighlight (handle, 0, position, OS.XmHIGHLIGHT_NORMAL);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java
index ad94426d6c..64134ff13d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java
@@ -246,7 +246,8 @@ public int getRowCount () {
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -256,6 +257,7 @@ public int getRowCount () {
public int indexOf (ToolItem item) {
checkWidget();
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
ToolItem [] items = getItems ();
for (int i=0; i<items.length; i++) {
if (items [i] == item) return i;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
index d1f5398673..af99680306 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java
@@ -33,23 +33,80 @@ public /*final*/ class ToolItem extends Item {
int mnemonicPos = -1;
/**
-* Creates a new instance of the widget.
-*/
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>ToolBar</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
public ToolItem (ToolBar parent, int style) {
super (parent, checkStyle (style));
this.parent = parent;
parent.createItem (this, parent.getItemCount ());
parent.relayout ();
}
+
/**
-* Creates a new instance of the widget.
-*/
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>ToolBar</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
public ToolItem (ToolBar parent, int style, int index) {
super (parent, checkStyle (style));
this.parent = parent;
parent.createItem (this, index);
parent.relayout ();
}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the control is selected, by sending
@@ -467,6 +524,9 @@ void setBounds (int x, int y, int width, int height) {
*
* @param control the new control
*
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -474,8 +534,9 @@ void setBounds (int x, int y, int width, int height) {
*/
public void setControl (Control control) {
checkWidget();
- if (control != null && control.parent != parent) {
- error (SWT.ERROR_INVALID_PARENT);
+ if (control != null) {
+ if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+ if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
}
if ((style & SWT.SEPARATOR) == 0) return;
this.control = control;
@@ -511,8 +572,11 @@ public void setEnabled (boolean enabled) {
* The disbled image is displayed when the receiver is disabled.
* </p>
*
- * @param image the hot image to display on the receiver (may be null)
+ * @param image the disabled image to display on the receiver (may be null)
*
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -520,6 +584,7 @@ public void setEnabled (boolean enabled) {
*/
public void setDisabledImage (Image image) {
checkWidget();
+ if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
if ((style & SWT.SEPARATOR) != 0) return;
disabledImage = image;
if (!getEnabled ()) redraw ();
@@ -533,6 +598,9 @@ public void setDisabledImage (Image image) {
*
* @param image the hot image to display on the receiver (may be null)
*
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -540,12 +608,14 @@ public void setDisabledImage (Image image) {
*/
public void setHotImage (Image image) {
checkWidget();
+ if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
if ((style & SWT.SEPARATOR) != 0) return;
hotImage = image;
if ((parent.style & SWT.FLAT) != 0) redraw ();
}
public void setImage (Image image) {
checkWidget();
+ if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
if ((style & SWT.SEPARATOR) != 0) return;
super.setImage (image);
Point size = computeSize ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java
index abb3b35637..811b202668 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java
@@ -28,17 +28,70 @@ public /*final*/ class Tracker extends Widget {
Display display;
boolean tracking, stippled;
Rectangle [] rectangles = new Rectangle [0];
+
/**
-* Creates a new instance of the widget.
-*/
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
public Tracker (Composite parent, int style) {
super (parent, style);
this.parent = parent;
display = parent.getDisplay ();
}
+
/**
-* Creates a new instance of the widget.
-*/
+ * Constructs a new instance of this class given the display
+ * to create it on and a style value describing its behavior
+ * and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p><p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the tracker on the currently active
+ * display if there is one. If there is no current display, the
+ * tracker is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the tracker on
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
public Tracker (Display display, int style) {
if (display == null) display = Display.getCurrent ();
if (display == null) display = Display.getDefault ();
@@ -48,6 +101,7 @@ public Tracker (Display display, int style) {
this.style = style;
this.display = display;
}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the control is moved or resized, by sending
@@ -82,6 +136,7 @@ public void addControlListener(ControlListener listener) {
* </ul>
*/
public void close () {
+ checkWidget();
tracking = false;
}
void drawRectangles () {
@@ -136,6 +191,7 @@ public Display getDisplay () {
* </ul>
*/
public Rectangle [] getRectangles () {
+ checkWidget();
return rectangles;
}
/**
@@ -149,6 +205,7 @@ public Rectangle [] getRectangles () {
* </ul>
*/
public boolean getStippled () {
+ checkWidget();
return stippled;
}
/**
@@ -160,6 +217,7 @@ public boolean getStippled () {
* </ul>
*/
public boolean open () {
+ checkWidget();
int xDisplay = display.xDisplay;
int color = OS.XWhitePixel (xDisplay, 0);
int xWindow = OS.XDefaultRootWindow (xDisplay);
@@ -246,6 +304,7 @@ public void removeControlListener (ControlListener listener) {
* </ul>
*/
public void setRectangles (Rectangle [] rectangles) {
+ checkWidget();
this.rectangles = rectangles;
}
/**
@@ -259,6 +318,7 @@ public void setRectangles (Rectangle [] rectangles) {
* </ul>
*/
public void setStippled (boolean stippled) {
+ checkWidget();
this.stippled = stippled;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java
index a47c8df2c2..0a9913d274 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java
@@ -1467,6 +1467,9 @@ public void setFont(Font font) {
* @param after true places the insert mark above 'item'. false places
* the insert mark below 'item'.
*
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -1474,6 +1477,7 @@ public void setFont(Font font) {
*/
public void setInsertMark(TreeItem item, boolean before){
checkWidget();
+ if (item != null && item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
motif_setInsertMark(item, !before);
}
/**
@@ -1484,7 +1488,8 @@ public void setInsertMark(TreeItem item, boolean before){
* @param items the array of items
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -1524,7 +1529,8 @@ void setTopIndex(int index, boolean adjustScrollbar) {
* @param item the item to be shown
*
* @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -1535,9 +1541,8 @@ void setTopIndex(int index, boolean adjustScrollbar) {
*/
public void showItem(TreeItem item) {
checkWidget();
- if (item == null) {
- error(SWT.ERROR_NULL_ARGUMENT);
- }
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
showSelectableItem(item);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java
index a3944c9f27..ced5db3429 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java
@@ -85,47 +85,148 @@ public /*final*/ class TreeItem extends AbstractTreeItem {
private Point itemExtent; // Size of the item (image + label)
private Point imageExtent; // original size of the item image
private int textYPosition = -1; // Centered y position of the item text
+
/**
- * Create a root item and add it to the tree widget identified
- * by 'parent'.
- * @param parent - Tree widget the receiver is added to
- * @param swtStyle - widget style. see Widget class for details
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
+ * and a style value describing its behavior and appearance.
+ * The item is added to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
-public TreeItem(Tree parent, int swtStyle) {
- this(parent, swtStyle, checkNull(parent).getItemCount());
+public TreeItem(Tree parent, int style) {
+ this(parent, style, checkNull(parent).getItemCount());
}
+
/**
- * Create a root item and add it to the tree widget identified
- * by 'parent'.
- * @param parent - Tree widget the receiver is added to.
- * @param swtStyle - widget style. see Widget class for details
- * @param position - position in 'parentItem' the receiver will
- * be inserted at
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
+ * a style value describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
-public TreeItem(Tree parent, int swtStyle, int position) {
- super(parent, swtStyle);
- parent.addItem(this, position);
+public TreeItem(Tree parent, int style, int index) {
+ super(parent, style);
+ parent.addItem(this, index);
}
+
/**
- * Create a root item with 'parentItem' as the parent item.
- * @param parentItem - the parent item of the receiver
- * @param swtStyle - widget style. see Widget class for details
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
+ * and a style value describing its behavior and appearance.
+ * The item is added to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
-public TreeItem(TreeItem parentItem, int swtStyle) {
- this(parentItem, swtStyle, checkNull(parentItem).getItemCount());
+public TreeItem(TreeItem parentItem, int style) {
+ this(parentItem, style, checkNull(parentItem).getItemCount());
}
+
/**
- * Create a root item with 'parentItem' as the parent item.
- * @param parentItem - the parent item of the receiver
- * @param swtStyle - widget style. see Widget class for details
- * @param position - position in 'parentItem' the receiver will
- * be inserted at
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
+ * a style value describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
*/
-public TreeItem(TreeItem parentItem, int swtStyle, int position) {
- super(checkNull(parentItem).getParent(), swtStyle);
+public TreeItem(TreeItem parentItem, int style, int index) {
+ super(checkNull(parentItem).getParent(), style);
setParentItem(parentItem);
- parentItem.add(this, position);
+ parentItem.add(this, index);
}
+
/**
* Calculate the number of expanded children.
* Recurse up in the tree to the root item.