Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-05-18 17:05:03 +0000
committerPaul Pazderski2019-06-14 22:34:53 +0000
commit7051049221c9d3b99ff179f167fa09a6e02138ee (patch)
tree21704e08b4c470f16f4fece637154f86fce96cc8 /examples
parenta1b9b9e1accf9dfece07675d7919a6f4e6561891 (diff)
downloadeclipse.platform.swt-7051049221c9d3b99ff179f167fa09a6e02138ee.tar.gz
eclipse.platform.swt-7051049221c9d3b99ff179f167fa09a6e02138ee.tar.xz
eclipse.platform.swt-7051049221c9d3b99ff179f167fa09a6e02138ee.zip
Bug 547304 - [cleanup] Fix wrong space/tab indentation
This change fixes space or mixed tab/space indentations in all Java files. This also includes two or three space indentations and even fix most stray single spaces in indentations. The change includes only whitespace formatting and no code changes. Change-Id: Ib7b260691acee06845cc580dd8cb859de0da8bf1
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java16
-rw-r--r--examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OLEExample.java14
-rw-r--r--examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java6
-rw-r--r--examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java12
-rw-r--r--examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithAccessibleNamesExample.java24
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ColorTab.java62
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java8
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java8
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java18
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java12
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java10
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CardsTab.java68
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CustomAlphaTab.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/FontBounceTab.java74
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java20
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicAntialiasTab.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/IntroTab.java38
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathClippingTab.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/RegionClippingTab.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/StarPolyTab.java22
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java8
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java44
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSession.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/TextTool.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java22
-rw-r--r--examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java2
-rw-r--r--examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LWJGLExample.java38
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java80
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java114
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java50
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java12
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java96
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java40
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java94
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java18
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet228.java4
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java38
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java10
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet274.java106
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.java14
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet304.java96
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet333.java6
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet334.java2
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet336.java2
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet359.java18
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet363.java130
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet366.java4
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java52
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java52
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java10
63 files changed, 820 insertions, 820 deletions
diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java
index 579af02866..8d98dce347 100644
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java
+++ b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java
@@ -79,12 +79,12 @@ public class LauncherPlugin extends AbstractUIPlugin {
plugin = this;
}
- @Override
+ @Override
public void start(BundleContext context) throws Exception {
- super.start(context);
- resourceBundle = Platform.getResourceBundle(getBundle());
- }
-
+ super.start(context);
+ resourceBundle = Platform.getResourceBundle(getBundle());
+ }
+
/**
* Clean up
*/
@@ -173,9 +173,9 @@ public class LauncherPlugin extends AbstractUIPlugin {
}
/**
- * Constructs a list of available programs from registered extensions.
- *
- * @return an ItemTreeNode representing the root of a tree of items (the root is not to be displayed)
+ * Constructs a list of available programs from registered extensions.
+ *
+ * @return an ItemTreeNode representing the root of a tree of items (the root is not to be displayed)
*/
public static ItemTreeNode getLaunchItemTree() {
ItemTreeNode categoryTree =
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OLEExample.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OLEExample.java
index 409c43d3a5..0e7ea33c97 100644
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OLEExample.java
+++ b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OLEExample.java
@@ -182,18 +182,18 @@ public class OLEExample {
try {
clientSite = createSite(oleFrame, "PDF.PdfCtrl.5");
clientSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
- OleAutomation pdf = new OleAutomation (clientSite);
- int loadFile[] = pdf.getIDsOfNames (new String [] {"LoadFile"});
- if (loadFile != null) {
- Variant result = pdf.invoke(loadFile[0], new Variant[] {new Variant(fileName)});
+ OleAutomation pdf = new OleAutomation (clientSite);
+ int loadFile[] = pdf.getIDsOfNames (new String [] {"LoadFile"});
+ if (loadFile != null) {
+ Variant result = pdf.invoke(loadFile[0], new Variant[] {new Variant(fileName)});
if (result == null)
disposeClient();
else
result.dispose();
- } else {
+ } else {
disposeClient();
- }
- pdf.dispose();
+ }
+ pdf.dispose();
} catch (SWTException error2) {
disposeClient();
}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
index afe7d9c6d4..da0828d52f 100644
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
+++ b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
@@ -336,10 +336,10 @@ public class OleBrowserView extends ViewPart {
switch (commandID) {
case OleWebBrowser.CSC_NAVIGATEBACK:
- webCommandBackward.setEnabled(commandEnabled);
- break;
+ webCommandBackward.setEnabled(commandEnabled);
+ break;
case OleWebBrowser.CSC_NAVIGATEFORWARD:
- webCommandForward.setEnabled(commandEnabled);
+ webCommandForward.setEnabled(commandEnabled);
break;
}
});
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
index a3cb1897c8..52f20cd99b 100644
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
+++ b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
@@ -49,7 +49,7 @@ public class OlePlugin extends AbstractUIPlugin {
"icons/search_nav.gif" };
static Image images[];
static Font browserFont;
-
+
/**
* Constructs an OLE plugin.
*/
@@ -58,12 +58,12 @@ public class OlePlugin extends AbstractUIPlugin {
plugin = this;
}
- @Override
+ @Override
public void start(BundleContext context) throws Exception {
- super.start(context);
- resourceBundle = Platform.getResourceBundle(getBundle());
- }
-
+ super.start(context);
+ resourceBundle = Platform.getResourceBundle(getBundle());
+ }
+
/**
* Clean up
*/
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
index a70797716c..52931b9d48 100644
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
+++ b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
@@ -75,8 +75,8 @@ class OleWebBrowser {
* OleWebBrowser webBrowser = new OleWebBrowser(oleControlSite, oleAutomation);<br>
* </code>
*
- * @param oleAutomation the OleAutomation object for this control.
- * @param oleControlSite the OleControlSite object for this control.
+ * @param oleAutomation the OleAutomation object for this control.
+ * @param oleControlSite the OleControlSite object for this control.
*/
public OleWebBrowser(OleAutomation oleAutomation) {
this.oleAutomation = oleAutomation;
@@ -98,7 +98,7 @@ class OleWebBrowser {
* this is of course the fastest way, but you increase coupling
* to the control.
*/
-
+
/**
* Returns the current web page title.
*
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java
index 1b5f23322e..56b64d1145 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java
@@ -889,9 +889,9 @@ public Control[] getChildren () {
/* remove the Header from the returned set of children */
int index = 0;
for (Control control : controls) {
- if (control != header) {
- result [index++] = control;
- }
+ if (control != header) {
+ result [index++] = control;
+ }
}
return result;
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java
index 2f76f9a612..07af3a09c7 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java
@@ -852,7 +852,7 @@ Accessible getAccessible(final Accessible accessibleTable) {
}
@Override
public void getRowHeaders(AccessibleTableCellEvent e) {
- /* CTable does not support row headers. */
+ /* CTable does not support row headers. */
}
@Override
public void getRowIndex(AccessibleTableCellEvent e) {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java
index a2e43502aa..9d492249a5 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java
@@ -508,7 +508,7 @@ Accessible getAccessible(final Accessible accessibleTable, final int columnIndex
}
@Override
public void getRowHeaders(AccessibleTableCellEvent e) {
- /* CTable does not support row headers. */
+ /* CTable does not support row headers. */
}
@Override
public void getRowIndex(AccessibleTableCellEvent e) {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithAccessibleNamesExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithAccessibleNamesExample.java
index ac1e79463f..56e3f9113c 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithAccessibleNamesExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithAccessibleNamesExample.java
@@ -372,12 +372,12 @@ public class ControlsWithAccessibleNamesExample {
item.setToolTipText("ToolItem ToolTip" + i + j);
if (item.getWidth() > toolItemWidth) toolItemWidth = item.getWidth();
}
- coolItem.setControl(coolItemToolBar);
- Point size = coolItemToolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point coolSize = coolItem.computeSize (size.x, size.y);
- coolItem.setMinimumSize(toolItemWidth, coolSize.y);
- coolItem.setPreferredSize(coolSize);
- coolItem.setSize(coolSize);
+ coolItem.setControl(coolItemToolBar);
+ Point size = coolItemToolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point coolSize = coolItem.computeSize (size.x, size.y);
+ coolItem.setMinimumSize(toolItemWidth, coolSize.y);
+ coolItem.setPreferredSize(coolSize);
+ coolItem.setSize(coolSize);
}
overrideCoolBar = new CoolBar(shell, SWT.FLAT);
@@ -391,12 +391,12 @@ public class ControlsWithAccessibleNamesExample {
item.setToolTipText("ToolItem ToolTip" + i + j);
if (item.getWidth() > toolItemWidth) toolItemWidth = item.getWidth();
}
- coolItem.setControl(coolItemToolBar);
- Point size = coolItemToolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point coolSize = coolItem.computeSize (size.x, size.y);
- coolItem.setMinimumSize(toolItemWidth, coolSize.y);
- coolItem.setPreferredSize(coolSize);
- coolItem.setSize(coolSize);
+ coolItem.setControl(coolItemToolBar);
+ Point size = coolItemToolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point coolSize = coolItem.computeSize (size.x, size.y);
+ coolItem.setMinimumSize(toolItemWidth, coolSize.y);
+ coolItem.setPreferredSize(coolSize);
+ coolItem.setSize(coolSize);
}
overrideCoolBar.setData("name", "CoolBar");
overrideCoolBar.setData("child", "CoolBar Item");
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ColorTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ColorTab.java
index 187f5aa47d..0fa1c6ad30 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ColorTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ColorTab.java
@@ -38,9 +38,9 @@ class ColorTab extends Tab {
HashMap <Integer, String> hmap = new HashMap <> ();
static final int namedColorEnd = 8;
static String [] columnTitles = {ControlExample.getResourceString("ColorTitle_0"),
- ControlExample.getResourceString("ColorTitle_1"),
- ControlExample.getResourceString("ColorTitle_2"),
- ControlExample.getResourceString("ColorTitle_3")};
+ ControlExample.getResourceString("ColorTitle_1"),
+ ControlExample.getResourceString("ColorTitle_2"),
+ ControlExample.getResourceString("ColorTitle_3")};
/* Size widgets added to the "Size" group */
Button packColumnsButton;
@@ -54,34 +54,34 @@ class ColorTab extends Tab {
}
void addTableElements () {
- hmap.put(SWT.COLOR_WHITE, "COLOR_WHITE");
- hmap.put(SWT.COLOR_BLACK, "COLOR_BLACK");
- hmap.put(SWT.COLOR_RED, "COLOR_RED");
- hmap.put(SWT.COLOR_DARK_RED, "COLOR_DARK_RED");
- hmap.put(SWT.COLOR_GREEN, "COLOR_GREEN");
- hmap.put(SWT.COLOR_DARK_GREEN, "COLOR_DARK_GREEN");
- hmap.put(SWT.COLOR_YELLOW, "COLOR_YELLOW");
- hmap.put(SWT.COLOR_DARK_YELLOW, "COLOR_DARK_YELLOW");
- hmap.put(SWT.COLOR_WIDGET_DARK_SHADOW, "COLOR_WIDGET_DARK_SHADOW");
- hmap.put(SWT.COLOR_WIDGET_NORMAL_SHADOW, "COLOR_WIDGET_NORMAL_SHADOW");
- hmap.put(SWT.COLOR_WIDGET_LIGHT_SHADOW, "COLOR_WIDGET_LIGHT_SHADOW");
- hmap.put(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW, "COLOR_WIDGET_HIGHLIGHT_SHADOW");
- hmap.put(SWT.COLOR_WIDGET_FOREGROUND, "COLOR_WIDGET_FOREGROUND");
- hmap.put(SWT.COLOR_WIDGET_BACKGROUND, "COLOR_WIDGET_BACKGROUND");
- hmap.put(SWT.COLOR_WIDGET_BORDER, "COLOR_WIDGET_BORDER");
- hmap.put(SWT.COLOR_LIST_FOREGROUND, "COLOR_LIST_FOREGROUND");
- hmap.put(SWT.COLOR_LIST_BACKGROUND, "COLOR_LIST_BACKGROUND");
- hmap.put(SWT.COLOR_LIST_SELECTION, "COLOR_LIST_SELECTION");
- hmap.put(SWT.COLOR_LIST_SELECTION_TEXT, "COLOR_LIST_SELECTION_TEXT");
- hmap.put(SWT.COLOR_INFO_FOREGROUND, "COLOR_INFO_FOREGROUND");
- hmap.put(SWT.COLOR_INFO_BACKGROUND, "COLOR_INFO_BACKGROUND");
- hmap.put(SWT.COLOR_TITLE_FOREGROUND, "COLOR_TITLE_FOREGROUND");
- hmap.put(SWT.COLOR_TITLE_BACKGROUND, "COLOR_TITLE_BACKGROUND");
- hmap.put(SWT.COLOR_TITLE_BACKGROUND_GRADIENT, "COLOR_TITLE_BACKGROUND_GRADIENT");
- hmap.put(SWT.COLOR_TITLE_INACTIVE_FOREGROUND, "COLOR_TITLE_INACTIVE_FOREGROUND");
- hmap.put(SWT.COLOR_TITLE_INACTIVE_BACKGROUND, "COLOR_TITLE_INACTIVE_BACKGROUND");
- hmap.put(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT, "COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT");
- hmap.put(SWT.COLOR_LINK_FOREGROUND, "COLOR_LINK_FOREGROUND");
+ hmap.put(SWT.COLOR_WHITE, "COLOR_WHITE");
+ hmap.put(SWT.COLOR_BLACK, "COLOR_BLACK");
+ hmap.put(SWT.COLOR_RED, "COLOR_RED");
+ hmap.put(SWT.COLOR_DARK_RED, "COLOR_DARK_RED");
+ hmap.put(SWT.COLOR_GREEN, "COLOR_GREEN");
+ hmap.put(SWT.COLOR_DARK_GREEN, "COLOR_DARK_GREEN");
+ hmap.put(SWT.COLOR_YELLOW, "COLOR_YELLOW");
+ hmap.put(SWT.COLOR_DARK_YELLOW, "COLOR_DARK_YELLOW");
+ hmap.put(SWT.COLOR_WIDGET_DARK_SHADOW, "COLOR_WIDGET_DARK_SHADOW");
+ hmap.put(SWT.COLOR_WIDGET_NORMAL_SHADOW, "COLOR_WIDGET_NORMAL_SHADOW");
+ hmap.put(SWT.COLOR_WIDGET_LIGHT_SHADOW, "COLOR_WIDGET_LIGHT_SHADOW");
+ hmap.put(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW, "COLOR_WIDGET_HIGHLIGHT_SHADOW");
+ hmap.put(SWT.COLOR_WIDGET_FOREGROUND, "COLOR_WIDGET_FOREGROUND");
+ hmap.put(SWT.COLOR_WIDGET_BACKGROUND, "COLOR_WIDGET_BACKGROUND");
+ hmap.put(SWT.COLOR_WIDGET_BORDER, "COLOR_WIDGET_BORDER");
+ hmap.put(SWT.COLOR_LIST_FOREGROUND, "COLOR_LIST_FOREGROUND");
+ hmap.put(SWT.COLOR_LIST_BACKGROUND, "COLOR_LIST_BACKGROUND");
+ hmap.put(SWT.COLOR_LIST_SELECTION, "COLOR_LIST_SELECTION");
+ hmap.put(SWT.COLOR_LIST_SELECTION_TEXT, "COLOR_LIST_SELECTION_TEXT");
+ hmap.put(SWT.COLOR_INFO_FOREGROUND, "COLOR_INFO_FOREGROUND");
+ hmap.put(SWT.COLOR_INFO_BACKGROUND, "COLOR_INFO_BACKGROUND");
+ hmap.put(SWT.COLOR_TITLE_FOREGROUND, "COLOR_TITLE_FOREGROUND");
+ hmap.put(SWT.COLOR_TITLE_BACKGROUND, "COLOR_TITLE_BACKGROUND");
+ hmap.put(SWT.COLOR_TITLE_BACKGROUND_GRADIENT, "COLOR_TITLE_BACKGROUND_GRADIENT");
+ hmap.put(SWT.COLOR_TITLE_INACTIVE_FOREGROUND, "COLOR_TITLE_INACTIVE_FOREGROUND");
+ hmap.put(SWT.COLOR_TITLE_INACTIVE_BACKGROUND, "COLOR_TITLE_INACTIVE_BACKGROUND");
+ hmap.put(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT, "COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT");
+ hmap.put(SWT.COLOR_LINK_FOREGROUND, "COLOR_LINK_FOREGROUND");
}
/**
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
index a200a54f58..9d7ae24bd9 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
@@ -67,9 +67,9 @@ public class ControlExample {
tabs = createTabs();
for (Tab tab : tabs) {
TabItem item = new TabItem (tabFolder, SWT.NONE);
- item.setText (tab.getTabText ());
- item.setControl (tab.createTabFolderPage (tabFolder));
- item.setData (tab);
+ item.setText (tab.getTabText ());
+ item.setControl (tab.createTabFolderPage (tabFolder));
+ item.setData (tab);
}
/* Workaround: if the tab folder is wider than the screen,
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
index b6c008a295..d9642c8008 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
@@ -448,9 +448,9 @@ class CoolBarTab extends Tab {
pt = toolBar.toDisplay(new Point(toolBounds.x, toolBounds.y));
toolBounds.x = pt.x;
toolBounds.y = pt.y;
- Rectangle intersection = itemBounds.intersection (toolBounds);
- if (!intersection.equals (toolBounds)) break;
- i++;
+ Rectangle intersection = itemBounds.intersection (toolBounds);
+ if (!intersection.equals (toolBounds)) break;
+ i++;
}
/* Create a pop-up menu with items for each of the hidden buttons. */
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
index 0c0fa3f036..702c092a9f 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
@@ -1280,10 +1280,10 @@ abstract class Tab {
}
if (menu == null && popupMenuButton.getSelection()) {
menu = new Menu(shell, SWT.POP_UP | (control.getStyle() & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT)));
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText("Sample popup menu item");
- specialPopupMenuItems(menu, event);
- control.setMenu(menu);
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Sample popup menu item");
+ specialPopupMenuItems(menu, event);
+ control.setMenu(menu);
samplePopup = true;
}
});
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
index 040721f61a..061c0bf250 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
@@ -739,10 +739,10 @@ class TableTab extends ScrollableTab {
@Override
protected void specialPopupMenuItems(Menu menu, Event event) {
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText("getItem(Point) on mouse coordinates");
- menuMouseCoords = table1.toControl(new Point(event.x, event.y));
- item.addSelectionListener(widgetSelectedAdapter(e -> {
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("getItem(Point) on mouse coordinates");
+ menuMouseCoords = table1.toControl(new Point(event.x, event.y));
+ item.addSelectionListener(widgetSelectedAdapter(e -> {
eventConsole.append ("getItem(Point(" + menuMouseCoords + ")) returned: " + table1.getItem(menuMouseCoords));
eventConsole.append ("\n");
}));
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
index 6536521f66..f8046568fa 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
@@ -66,9 +66,9 @@ class TreeTab extends ScrollableTab {
Font itemFont, cellFont;
static String [] columnTitles = {ControlExample.getResourceString("TableTitle_0"),
- ControlExample.getResourceString("TableTitle_1"),
- ControlExample.getResourceString("TableTitle_2"),
- ControlExample.getResourceString("TableTitle_3")};
+ ControlExample.getResourceString("TableTitle_1"),
+ ControlExample.getResourceString("TableTitle_2"),
+ ControlExample.getResourceString("TableTitle_3")};
static String[][] tableData = {
{ ControlExample.getResourceString("TableLine0_0"),
@@ -535,7 +535,7 @@ class TreeTab extends ScrollableTab {
}
/* Set the header background color item's image to match the header background color. */
Color color = headerBackgroundColor;
- if (color == null) color = tree1.getHeaderBackground();
+ if (color == null) color = tree1.getHeaderBackground();
TableItem item = colorAndFontTable.getItem(HEADER_BACKGROUND_COLOR);
Image oldImage1 = item.getImage();
if (oldImage1 != null) oldImage1.dispose();
@@ -840,11 +840,11 @@ class TreeTab extends ScrollableTab {
@Override
protected void specialPopupMenuItems(Menu menu, Event event) {
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText("getItem(Point) on mouse coordinates");
- final Tree t = (Tree) event.widget;
- menuMouseCoords = t.toControl(new Point(event.x, event.y));
- item.addSelectionListener(widgetSelectedAdapter(e -> {
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("getItem(Point) on mouse coordinates");
+ final Tree t = (Tree) event.widget;
+ menuMouseCoords = t.toControl(new Point(event.x, event.y));
+ item.addSelectionListener(widgetSelectedAdapter(e -> {
eventConsole.append ("getItem(Point(" + menuMouseCoords + ")) returned: " + t.getItem(menuMouseCoords));
eventConsole.append ("\n");
}));
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java
index 49abdeb549..d69916d205 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java
@@ -773,10 +773,10 @@ private void createDropTarget() {
printEvent(event);
String[] strings = null;
if (TextTransfer.getInstance().isSupportedType(event.currentDataType) ||
- RTFTransfer.getInstance().isSupportedType(event.currentDataType) ||
- HTMLTransfer.getInstance().isSupportedType(event.currentDataType) ||
- URLTransfer.getInstance().isSupportedType(event.currentDataType)) {
- strings = new String[] {(String)event.data};
+ RTFTransfer.getInstance().isSupportedType(event.currentDataType) ||
+ HTMLTransfer.getInstance().isSupportedType(event.currentDataType) ||
+ URLTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ strings = new String[] {(String)event.data};
}
if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
strings = (String[])event.data;
@@ -787,8 +787,8 @@ private void createDropTarget() {
}
if (strings.length == 1 && (dropControlType == TABLE ||
- dropControlType == TREE ||
- dropControlType == LIST)) {
+ dropControlType == TREE ||
+ dropControlType == LIST)) {
// convert string separated by "\n" into an array of strings
String string = strings[0];
int count = 0;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
index 4a9a92f609..ef212e122f 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
@@ -73,7 +73,7 @@ import org.eclipse.swt.widgets.TreeItem;
* File Viewer example
*/
public class FileViewer {
- private static ResourceBundle resourceBundle = ResourceBundle.getBundle("examples_fileviewer");
+ private static ResourceBundle resourceBundle = ResourceBundle.getBundle("examples_fileviewer");
private final static String DRIVE_A = "a:" + File.separator;
private final static String DRIVE_B = "b:" + File.separator;
@@ -1428,11 +1428,11 @@ public class FileViewer {
for (int i = end; i > start; --i) {
for (int j = end; j > start; --j) {
if (compareFiles(files[j - 1], files[j]) > 0) {
- final File temp = files[j];
- files[j] = files[j-1];
- files[j-1] = temp;
+ final File temp = files[j];
+ files[j] = files[j-1];
+ files[j-1] = temp;
}
- }
+ }
}
return;
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CardsTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CardsTab.java
index 2d75192637..82501ae2e9 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CardsTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CardsTab.java
@@ -91,40 +91,40 @@ public void next(int width, int height) {
scaleWidth = (float) ((movClubY/height)*0.35 + 0.15);
movClubY = 2*height/5 * (float)Math.sin(0.01*movClubX - 90) + 2*height/5;
- movDiamondY = 2*height/5 * (float)Math.cos(0.01*movDiamondX) + 2*height/5;
-
- if (movClubX + clubWidth*scaleWidth > width) {
- movClubX = width - clubWidth*scaleWidth;
- inc_club = -inc_club;
- }
- if (movClubX < 0) {
- movClubX = 0;
- inc_club = -inc_club;
- }
- if (movDiamondX + diamondWidth*scaleWidth > width) {
- movDiamondX = width - diamondWidth*scaleWidth;
- inc_diamond = -inc_diamond;
- }
- if (movDiamondX < 0) {
- movDiamondX = 0;
- inc_diamond = -inc_diamond;
- }
- if (movHeart + heartWidth*heartScale > width) {
- movHeart = width - heartWidth*heartScale;
- inc_hearts = -inc_hearts;
- }
- if (movHeart < 0) {
- movHeart = 0;
- inc_hearts = -inc_hearts;
- }
- if (movSpade + spadeHeight*spadeScale > height) {
- movSpade = height - spadeHeight*spadeScale;
- inc_spade = -inc_spade;
- }
- if (movSpade < 0) {
- movSpade = 0;
- inc_spade = -inc_spade;
- }
+ movDiamondY = 2*height/5 * (float)Math.cos(0.01*movDiamondX) + 2*height/5;
+
+ if (movClubX + clubWidth*scaleWidth > width) {
+ movClubX = width - clubWidth*scaleWidth;
+ inc_club = -inc_club;
+ }
+ if (movClubX < 0) {
+ movClubX = 0;
+ inc_club = -inc_club;
+ }
+ if (movDiamondX + diamondWidth*scaleWidth > width) {
+ movDiamondX = width - diamondWidth*scaleWidth;
+ inc_diamond = -inc_diamond;
+ }
+ if (movDiamondX < 0) {
+ movDiamondX = 0;
+ inc_diamond = -inc_diamond;
+ }
+ if (movHeart + heartWidth*heartScale > width) {
+ movHeart = width - heartWidth*heartScale;
+ inc_hearts = -inc_hearts;
+ }
+ if (movHeart < 0) {
+ movHeart = 0;
+ inc_hearts = -inc_hearts;
+ }
+ if (movSpade + spadeHeight*spadeScale > height) {
+ movSpade = height - spadeHeight*spadeScale;
+ inc_spade = -inc_spade;
+ }
+ if (movSpade < 0) {
+ movSpade = 0;
+ inc_spade = -inc_spade;
+ }
}
@Override
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CustomAlphaTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CustomAlphaTab.java
index 92fc6f634c..f81fd723ac 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CustomAlphaTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CustomAlphaTab.java
@@ -166,6 +166,6 @@ public void paint(GC gc, int width, int height) {
gc.fillPath(path);
path.dispose();
- if (pattern != null) pattern.dispose();
+ if (pattern != null) pattern.dispose();
}
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/FontBounceTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/FontBounceTab.java
index c55c286d7b..27ba6c8c9e 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/FontBounceTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/FontBounceTab.java
@@ -59,49 +59,49 @@ public String getDescription() {
@Override
public void next(int width, int height) {
x += incX;
- y += incY;
+ y += incY;
float random = (float)Math.random();
// collision with right side of screen
- if (x + textWidth > width) {
- x = width - textWidth;
- incX = random * -width / 16 - 1;
- fontFace = 0;
- fontSize = 125;
- fillColor = SWT.COLOR_DARK_BLUE;
- foreGrdColor = SWT.COLOR_YELLOW;
- fontStyle = SWT.ITALIC;
- }
+ if (x + textWidth > width) {
+ x = width - textWidth;
+ incX = random * -width / 16 - 1;
+ fontFace = 0;
+ fontSize = 125;
+ fillColor = SWT.COLOR_DARK_BLUE;
+ foreGrdColor = SWT.COLOR_YELLOW;
+ fontStyle = SWT.ITALIC;
+ }
// collision with left side of screen
- if (x < 0) {
- x = 0;
- incX = random * width / 16 + 1;
- fontFace = 1;
- fontSize = 80;
- fillColor = SWT.COLOR_DARK_MAGENTA;
- foreGrdColor = SWT.COLOR_CYAN;
- fontStyle = SWT.NONE;
- }
+ if (x < 0) {
+ x = 0;
+ incX = random * width / 16 + 1;
+ fontFace = 1;
+ fontSize = 80;
+ fillColor = SWT.COLOR_DARK_MAGENTA;
+ foreGrdColor = SWT.COLOR_CYAN;
+ fontStyle = SWT.NONE;
+ }
// collision with bottom side of screen
- if (y + textHeight > height) {
- y = (height - textHeight)- 2;
- incY = random * -height / 16 - 1;
- fontFace = 2;
- fontSize = 100;
- fillColor = SWT.COLOR_YELLOW;
- foreGrdColor = SWT.COLOR_BLACK;
- fontStyle = SWT.BOLD;
- }
+ if (y + textHeight > height) {
+ y = (height - textHeight)- 2;
+ incY = random * -height / 16 - 1;
+ fontFace = 2;
+ fontSize = 100;
+ fillColor = SWT.COLOR_YELLOW;
+ foreGrdColor = SWT.COLOR_BLACK;
+ fontStyle = SWT.BOLD;
+ }
// collision with top side of screen
- if (y < 0) {
- y = 0;
- incY = random * height / 16 + 1;
- fontFace = 3;
- fontSize = 120;
- fillColor = SWT.COLOR_GREEN;
- foreGrdColor = SWT.COLOR_GRAY;
- fontStyle = SWT.NONE;
- }
+ if (y < 0) {
+ y = 0;
+ incY = random * height / 16 + 1;
+ fontFace = 3;
+ fontSize = 120;
+ fillColor = SWT.COLOR_GREEN;
+ foreGrdColor = SWT.COLOR_GRAY;
+ fontStyle = SWT.NONE;
+ }
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java
index a1c6d45a35..ea18fde7c7 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java
@@ -74,13 +74,13 @@ public class GradientDialog extends Dialog {
dialog.setText(GraphicsExample.getResourceString("Gradient")); //$NON-NLS-1$
GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginHeight = 10;
- gridLayout.marginWidth = 10;
- dialog.setLayout(gridLayout);
+ gridLayout.numColumns = 2;
+ gridLayout.marginHeight = 10;
+ gridLayout.marginWidth = 10;
+ dialog.setLayout(gridLayout);
- // create the controls in the dialog
- createDialogControls(dialog);
+ // create the controls in the dialog
+ createDialogControls(dialog);
dialog.addListener(SWT.Close, event -> {
for (int i = 0; i < resources.size(); i++) {
@@ -169,7 +169,7 @@ public class GradientDialog extends Dialog {
// position composite
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- colorButtonComp.setLayoutData(gridData);
+ colorButtonComp.setLayoutData(gridData);
ColorMenu colorMenu = new ColorMenu();
@@ -228,10 +228,10 @@ public class GradientDialog extends Dialog {
// position composite
gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
- gridData.horizontalSpan = 2;
- okCancelComp.setLayoutData(gridData);
+ gridData.horizontalSpan = 2;
+ okCancelComp.setLayoutData(gridData);
- // OK button
+ // OK button
okButton = new Button (okCancelComp, SWT.PUSH);
okButton.setText("&OK");
okButton.addListener(SWT.Selection, event -> {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicAntialiasTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicAntialiasTab.java
index 7f08715970..4432dd71a0 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicAntialiasTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicAntialiasTab.java
@@ -98,7 +98,7 @@ public void createControlPanel(Composite parent) {
comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
- // initialize the background to the 5th item in the menu (blue)
+ // initialize the background to the 5th item in the menu (blue)
ovalColorGB = (GraphicsBackground)menu.getItem(4).getData();
// color button
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/IntroTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/IntroTab.java
index f061cccfb4..121b69ff7c 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/IntroTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/IntroTab.java
@@ -24,7 +24,7 @@ public class IntroTab extends AnimatedGraphicsTab {
Image image;
Random random = new Random();
float x, y;
- float incX = 10.0f;
+ float incX = 10.0f;
float incY = 5.0f;
int textWidth, textHeight;
String text = GraphicsExample.getResourceString("SWT");
@@ -58,25 +58,25 @@ public String getDescription() {
@Override
public void next(int width, int height) {
- x += incX;
- y += incY;
+ x += incX;
+ y += incY;
float random = (float)Math.random();
- if (x + textWidth > width) {
- x = width - textWidth;
- incX = random * -width / 16 - 1;
- }
- if (x < 0) {
- x = 0;
- incX = random * width / 16 + 1;
- }
- if (y + textHeight > height) {
- y = (height - textHeight)- 2;
- incY = random * -height / 16 - 1;
- }
- if (y < 0) {
- y = 0;
- incY = random * height / 16 + 1;
- }
+ if (x + textWidth > width) {
+ x = width - textWidth;
+ incX = random * -width / 16 - 1;
+ }
+ if (x < 0) {
+ x = 0;
+ incX = random * width / 16 + 1;
+ }
+ if (y + textHeight > height) {
+ y = (height - textHeight)- 2;
+ incY = random * -height / 16 - 1;
+ }
+ if (y < 0) {
+ y = 0;
+ incY = random * height / 16 + 1;
+ }
}
@Override
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathClippingTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathClippingTab.java
index b66aa2dc10..60962f8b46 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathClippingTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathClippingTab.java
@@ -249,7 +249,7 @@ public void paint(GC gc, int width, int height) {
pattern = new Pattern(device, background.getBgImage());
gc.setBackgroundPattern(pattern);
}
- gc.fillRectangle(0, 0, width, height);
- if (pattern != null) pattern.dispose();
+ gc.fillRectangle(0, 0, width, height);
+ if (pattern != null) pattern.dispose();
}
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/RegionClippingTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/RegionClippingTab.java
index b0d99a181f..c75ac01916 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/RegionClippingTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/RegionClippingTab.java
@@ -206,10 +206,10 @@ public void paint(GC gc, int width, int height) {
gc.fillPolygon(polygon1);
gc.setBackground(colorGB2.getBgColor1());
- gc.fillPolygon(polygon2);
+ gc.fillPolygon(polygon2);
}
region1.dispose();
region2.dispose();
- }
+ }
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/StarPolyTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/StarPolyTab.java
index 9dc68324bc..c5b71711aa 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/StarPolyTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/StarPolyTab.java
@@ -57,18 +57,18 @@ public String getDescription() {
@Override
public void paint(GC gc, int width, int height) {
- int centerX = width / 2;
- int centerY = height / 2;
- int pos = 0;
- for (int i = 0; i < POINTS; ++i) {
- double r = Math.PI*2 * pos/POINTS;
- radial[i*2] = (int)((1+Math.cos(r))*centerX);
- radial[i*2+1] = (int)((1+Math.sin(r))*centerY);
- pos = (pos + POINTS/2) % POINTS;
- }
+ int centerX = width / 2;
+ int centerY = height / 2;
+ int pos = 0;
+ for (int i = 0; i < POINTS; ++i) {
+ double r = Math.PI*2 * pos/POINTS;
+ radial[i*2] = (int)((1+Math.cos(r))*centerX);
+ radial[i*2+1] = (int)((1+Math.sin(r))*centerY);
+ pos = (pos + POINTS/2) % POINTS;
+ }
gc.setFillRule(fillRuleCb.getSelectionIndex() != 0 ? SWT.FILL_WINDING : SWT.FILL_EVEN_ODD);
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_YELLOW));
- gc.fillPolygon(radial);
- gc.drawPolygon(radial);
+ gc.fillPolygon(radial);
+ gc.drawPolygon(radial);
}
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
index 43355157c5..39b4c08b44 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
@@ -1451,8 +1451,8 @@ public class ImageAnalyzer {
animateLoop();
} catch (final SWTException e) {
display.syncExec(() -> showErrorDialog(createMsg(bundle.getString("Creating_image"),
- Integer.valueOf(imageDataIndex+1)),
- currentName, e));
+ Integer.valueOf(imageDataIndex+1)),
+ currentName, e));
}
// Post animation widget reset.
@@ -1696,7 +1696,7 @@ public class ImageAnalyzer {
string = createMsg(bundle.getString("Size_value"),
new Object[] {Integer.valueOf(imageData.width),
- Integer.valueOf(imageData.height)});
+ Integer.valueOf(imageData.height)});
sizeLabel.setText(string);
string = createMsg(bundle.getString("Depth_value"),
@@ -1723,7 +1723,7 @@ public class ImageAnalyzer {
string = createMsg(bundle.getString("Disposal_value"),
new Object[] {Integer.valueOf(imageData.disposalMethod),
- disposalString(imageData.disposalMethod)});
+ disposalString(imageData.disposalMethod)});
disposalMethodLabel.setText(string);
int delay = imageData.delayTime * 10;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
index 1a4e63ce82..cf982f3540 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
@@ -377,7 +377,7 @@ public class JavaScanner {
protected void unread(int c) {
if (c != EOF)
- fPos--;
+ fPos--;
}
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
index 24c143e9cc..80d6ede38f 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
@@ -277,7 +277,7 @@ class GridLayoutTab extends Tab {
*/
@Override
void createControlWidgets () {
- /* Controls the columns in the GridLayout */
+ /* Controls the columns in the GridLayout */
Group columnGroup = new Group (controlGroup, SWT.NONE);
columnGroup.setText (LayoutExample.getResourceString ("Columns"));
columnGroup.setLayout(new GridLayout(2, false));
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java
index ca83839952..e76927ef80 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java
@@ -47,8 +47,8 @@ public class LayoutExample {
};
for (Tab tab : tabs) {
TabItem item = new TabItem (tabFolder, SWT.NONE);
- item.setText (tab.getTabText ());
- item.setControl (tab.createTabFolderPage (tabFolder));
+ item.setText (tab.getTabText ());
+ item.setControl (tab.createTabFolderPage (tabFolder));
}
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java
index 9f7bd57a66..1f765541be 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java
@@ -92,14 +92,14 @@ class StackLayoutTab extends Tab {
*/
@Override
void createControlWidgets() {
- /* Controls the topControl in the StackLayout */
+ /* Controls the topControl in the StackLayout */
Group columnGroup = new Group (controlGroup, SWT.NONE);
columnGroup.setText ("topControl");//(LayoutExample.getResourceString ("Top_Control"));
columnGroup.setLayout(new GridLayout(3, false));
columnGroup.setLayoutData(new GridData (SWT.FILL, SWT.FILL, false, false));
backButton = new Button(columnGroup, SWT.PUSH);
- backButton.setText("<<");
- backButton.setEnabled(false);
+ backButton.setText("<<");
+ backButton.setEnabled(false);
backButton.setLayoutData(new GridData (SWT.END, SWT.CENTER, false, false));
backButton.addSelectionListener(SelectionListener.widgetSelectedAdapter( e ->setTopControl (currentLayer - 1)));
topControl = new Label (columnGroup, SWT.BORDER);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java
index 45b4890f0d..a18048ca0f 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java
@@ -305,11 +305,11 @@ abstract class Tab {
combo.addTraverseListener(e -> {
if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_RETURN) {
comboReset = true;
- resetEditors ();
- }
- if (e.detail == SWT.TRAVERSE_ESCAPE) {
- disposeEditors ();
- }
+ resetEditors ();
+ }
+ if (e.detail == SWT.TRAVERSE_ESCAPE) {
+ disposeEditors ();
+ }
});
}
@@ -429,11 +429,11 @@ abstract class Tab {
text.addTraverseListener(e -> {
if (e.detail == SWT.TRAVERSE_TAB_NEXT) {
- resetEditors (true);
- }
- if (e.detail == SWT.TRAVERSE_ESCAPE) {
- disposeEditors ();
- }
+ resetEditors (true);
+ }
+ if (e.detail == SWT.TRAVERSE_ESCAPE) {
+ disposeEditors ();
+ }
});
}
@@ -642,28 +642,28 @@ abstract class Tab {
} else if (control.equals ("Composite")) {
Composite composite = new Composite (layoutComposite, SWT.BORDER);
children [i] = composite;
- } else if (control.equals ("CoolBar")) {
- CoolBar coolBar = new CoolBar (layoutComposite, SWT.NONE);
- ToolBar toolBar = new ToolBar (coolBar, SWT.BORDER);
+ } else if (control.equals ("CoolBar")) {
+ CoolBar coolBar = new CoolBar (layoutComposite, SWT.NONE);
+ ToolBar toolBar = new ToolBar (coolBar, SWT.BORDER);
ToolItem item = new ToolItem (toolBar, 0);
item.setText (LayoutExample.getResourceString ("Item",new String [] {"1"}));
item = new ToolItem (toolBar, 0);
item.setText (LayoutExample.getResourceString ("Item",new String [] {"2"}));
- CoolItem coolItem1 = new CoolItem (coolBar, 0);
- coolItem1.setControl (toolBar);
+ CoolItem coolItem1 = new CoolItem (coolBar, 0);
+ coolItem1.setControl (toolBar);
toolBar = new ToolBar (coolBar, SWT.BORDER);
item = new ToolItem (toolBar, 0);
item.setText (LayoutExample.getResourceString ("Item",new String [] {"3"}));
item = new ToolItem (toolBar, 0);
item.setText (LayoutExample.getResourceString ("Item",new String [] {"4"}));
- CoolItem coolItem2 = new CoolItem (coolBar, 0);
- coolItem2.setControl (toolBar);
- Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- coolItem1.setSize(coolItem1.computeSize (size.x, size.y));
- coolItem2.setSize(coolItem2.computeSize (size.x, size.y));
- coolBar.setSize(coolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ CoolItem coolItem2 = new CoolItem (coolBar, 0);
+ coolItem2.setControl (toolBar);
+ Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ coolItem1.setSize(coolItem1.computeSize (size.x, size.y));
+ coolItem2.setSize(coolItem2.computeSize (size.x, size.y));
+ coolBar.setSize(coolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
children [i] = coolBar;
- } else if (control.equals ("Group")) {
+ } else if (control.equals ("Group")) {
Group group = new Group (layoutComposite, SWT.NONE);
group.setText (controlName);
children [i] = group;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
index 1a9c8a296b..b3225e70dc 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
@@ -76,7 +76,7 @@ public abstract class ContinuousPaintSession extends BasicPaintSession {
/**
* Deactivates the tool.
- */
+ */
@Override
public void endSession() {
abortRetrigger();
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java
index 199d3c9a23..de93ba76e8 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java
@@ -59,7 +59,7 @@ public abstract class DragPaintSession extends BasicPaintSession {
/**
* Deactivates the tool.
- */
+ */
@Override
public void endSession() {
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSession.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSession.java
index 50ba9498f7..bcfda6669e 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSession.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSession.java
@@ -38,9 +38,9 @@ public interface PaintSession extends MouseListener, MouseMoveListener {
/**
* Deactivates the session.
- *
+ *
* Note: When overriding this method, call super.endSession() at method exit.
- */
+ */
public abstract void endSession();
/**
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
index 18278779f6..15bdc3e2e2 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
@@ -63,7 +63,7 @@ public abstract class SegmentedPaintSession extends BasicPaintSession {
/**
* Deactivates the tool.
- */
+ */
@Override
public void endSession() {
getPaintSurface().clearRubberbandSelection();
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/TextTool.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/TextTool.java
index 1a510e0d60..45e2e0ab7a 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/TextTool.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/TextTool.java
@@ -76,7 +76,7 @@ public class TextTool extends BasicPaintSession implements PaintTool {
/**
* Deactivates the tool.
- */
+ */
@Override
public void endSession() {
getPaintSurface().clearRubberbandSelection();
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
index cf00d895c4..2177b48b88 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
@@ -244,14 +244,14 @@ public class TextEditor {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterNames(new String [] {getResourceString("Text_Documents")}); //$NON-NLS-1$
dialog.setFilterExtensions (new String [] {"*.txt"}); //$NON-NLS-1$
- String name = dialog.open();
- if (name == null) return;
- fileName = name;
- try (FileInputStream file = new FileInputStream(name);){
- styledText.setText(openFile(file));
- } catch (IOException e) {
- showError(getResourceString("Error"), e.getMessage()); //$NON-NLS-1$
- }
+ String name = dialog.open();
+ if (name == null) return;
+ fileName = name;
+ try (FileInputStream file = new FileInputStream(name);){
+ styledText.setText(openFile(file));
+ } catch (IOException e) {
+ showError(getResourceString("Error"), e.getMessage()); //$NON-NLS-1$
+ }
}));
final MenuItem saveItem = new MenuItem(fileMenu, SWT.PUSH);
@@ -1251,10 +1251,10 @@ public class TextEditor {
void saveFile() {
if (fileName != null) {
try (FileWriter file = new FileWriter(fileName);) {
- file.write(styledText.getText());
+ file.write(styledText.getText());
} catch (IOException e) {
- showError(getResourceString("Error"), e.getMessage());
- }
+ showError(getResourceString("Error"), e.getMessage());
+ }
}
}
diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java
index cc5a4cb7e3..051c5eedc6 100644
--- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java
+++ b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java
@@ -121,7 +121,7 @@ class FogTab extends OpenGLTab {
/**
* Creates a cube at 0,0 in the viewport.
*/
- void createCube() {
+ void createCube() {
GL.glNewList(cubeListIndexBase, GL.GL_COMPILE);
GL.glBegin(GL.GL_QUADS);
// front
diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LWJGLExample.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LWJGLExample.java
index 0a966dc119..d2b0c7c68f 100644
--- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LWJGLExample.java
+++ b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LWJGLExample.java
@@ -67,25 +67,25 @@ public class LWJGLExample {
canvas.setCurrent();
try {
- GLContext.useContext(canvas);
- } catch(LWJGLException e) { e.printStackTrace(); }
-
- canvas.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- Rectangle bounds = canvas.getBounds();
- float fAspect = (float) bounds.width / (float) bounds.height;
+ GLContext.useContext(canvas);
+ } catch(LWJGLException e) { e.printStackTrace(); }
+
+ canvas.addListener(SWT.Resize, new Listener() {
+ public void handleEvent(Event event) {
+ Rectangle bounds = canvas.getBounds();
+ float fAspect = (float) bounds.width / (float) bounds.height;
canvas.setCurrent();
try {
GLContext.useContext(canvas);
- } catch(LWJGLException e) { e.printStackTrace(); }
- GL11.glViewport(0, 0, bounds.width, bounds.height);
- GL11.glMatrixMode(GL11.GL_PROJECTION);
- GL11.glLoadIdentity();
- GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glLoadIdentity();
- }
- });
+ } catch(LWJGLException e) { e.printStackTrace(); }
+ GL11.glViewport(0, 0, bounds.width, bounds.height);
+ GL11.glMatrixMode(GL11.GL_PROJECTION);
+ GL11.glLoadIdentity();
+ GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glLoadIdentity();
+ }
+ });
GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glColor3f(1.0f, 0.0f, 0.0f);
@@ -98,14 +98,14 @@ public class LWJGLExample {
shell.setSize(640, 480);
shell.open();
- display.asyncExec(new Runnable() {
- int rot = 0;
+ display.asyncExec(new Runnable() {
+ int rot = 0;
public void run() {
if (!canvas.isDisposed()) {
canvas.setCurrent();
try {
GLContext.useContext(canvas);
- } catch(LWJGLException e) { e.printStackTrace(); }
+ } catch(LWJGLException e) { e.printStackTrace(); }
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glClearColor(.3f, .5f, .8f, 1.0f);
GL11.glLoadIdentity();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java
index ff5aec2417..c06f5eae8e 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java
@@ -30,49 +30,49 @@ public class Snippet150 {
static int itemCount;
static CoolItem createItem(CoolBar coolBar, int count) {
- ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT);
- for (int i = 0; i < count; i++) {
- ToolItem item = new ToolItem(toolBar, SWT.PUSH);
- item.setText(itemCount++ +"");
- }
- toolBar.pack();
- Point size = toolBar.getSize();
- CoolItem item = new CoolItem(coolBar, SWT.NONE);
- item.setControl(toolBar);
- Point preferred = item.computeSize(size.x, size.y);
- item.setPreferredSize(preferred);
- return item;
+ ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT);
+ for (int i = 0; i < count; i++) {
+ ToolItem item = new ToolItem(toolBar, SWT.PUSH);
+ item.setText(itemCount++ +"");
+ }
+ toolBar.pack();
+ Point size = toolBar.getSize();
+ CoolItem item = new CoolItem(coolBar, SWT.NONE);
+ item.setControl(toolBar);
+ Point preferred = item.computeSize(size.x, size.y);
+ item.setPreferredSize(preferred);
+ return item;
}
public static void main(String[] args) {
- Display display = new Display();
- final Shell shell = new Shell(display);
+ Display display = new Display();
+ final Shell shell = new Shell(display);
shell.setText("Snippet 150");
- CoolBar coolBar = new CoolBar(shell, SWT.NONE);
- createItem(coolBar, 3);
- createItem(coolBar, 2);
- createItem(coolBar, 3);
- createItem(coolBar, 4);
- int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL;
- Text text = new Text(shell, style);
- FormLayout layout = new FormLayout();
- shell.setLayout(layout);
- FormData coolData = new FormData();
- coolData.left = new FormAttachment(0);
- coolData.right = new FormAttachment(100);
- coolData.top = new FormAttachment(0);
- coolBar.setLayoutData(coolData);
- coolBar.addListener(SWT.Resize, event -> shell.layout());
- FormData textData = new FormData();
- textData.left = new FormAttachment(0);
- textData.right = new FormAttachment(100);
- textData.top = new FormAttachment(coolBar);
- textData.bottom = new FormAttachment(100);
- text.setLayoutData(textData);
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
+ CoolBar coolBar = new CoolBar(shell, SWT.NONE);
+ createItem(coolBar, 3);
+ createItem(coolBar, 2);
+ createItem(coolBar, 3);
+ createItem(coolBar, 4);
+ int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL;
+ Text text = new Text(shell, style);
+ FormLayout layout = new FormLayout();
+ shell.setLayout(layout);
+ FormData coolData = new FormData();
+ coolData.left = new FormAttachment(0);
+ coolData.right = new FormAttachment(100);
+ coolData.top = new FormAttachment(0);
+ coolBar.setLayoutData(coolData);
+ coolBar.addListener(SWT.Resize, event -> shell.layout());
+ FormData textData = new FormData();
+ textData.left = new FormAttachment(0);
+ textData.right = new FormAttachment(100);
+ textData.top = new FormAttachment(coolBar);
+ textData.bottom = new FormAttachment(100);
+ text.setLayoutData(textData);
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java
index 35b647c3af..8f4dac46cb 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java
@@ -29,67 +29,67 @@ import org.eclipse.swt.widgets.*;
public class Snippet152 {
public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
+ Display display = new Display();
+ Shell shell = new Shell(display);
shell.setText("Snippet 152");
- FormLayout layout = new FormLayout();
- shell.setLayout(layout);
- final Label label = new Label(shell, SWT.BORDER);
- Listener armListener = event -> {
- MenuItem item = (MenuItem) event.widget;
- label.setText(item.getText());
- label.update();
+ FormLayout layout = new FormLayout();
+ shell.setLayout(layout);
+ final Label label = new Label(shell, SWT.BORDER);
+ Listener armListener = event -> {
+ MenuItem item = (MenuItem) event.widget;
+ label.setText(item.getText());
+ label.update();
};
- Listener showListener = event -> {
- Menu menu = (Menu) event.widget;
- MenuItem item = menu.getParentItem();
- if (item != null) {
- label.setText(item.getText());
- label.update();
- }
+ Listener showListener = event -> {
+ Menu menu = (Menu) event.widget;
+ MenuItem item = menu.getParentItem();
+ if (item != null) {
+ label.setText(item.getText());
+ label.update();
+ }
};
- Listener hideListener = event -> {
- label.setText("");
- label.update();
+ Listener hideListener = event -> {
+ label.setText("");
+ label.update();
};
- FormData labelData = new FormData();
- labelData.left = new FormAttachment(0);
- labelData.right = new FormAttachment(100);
- labelData.bottom = new FormAttachment(100);
- label.setLayoutData(labelData);
- Menu menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
- MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
- fileItem.setText("File");
- fileItem.addListener(SWT.Arm, armListener);
- MenuItem editItem = new MenuItem(menuBar, SWT.CASCADE);
- editItem.setText("Edit");
- editItem.addListener(SWT.Arm, armListener);
- Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
- fileMenu.addListener(SWT.Hide, hideListener);
- fileMenu.addListener(SWT.Show, showListener);
- fileItem.setMenu(fileMenu);
- String[] fileStrings = { "New", "Close", "Exit" };
- for (int i = 0; i < fileStrings.length; i++) {
- MenuItem item = new MenuItem(fileMenu, SWT.PUSH);
- item.setText(fileStrings[i]);
- item.addListener(SWT.Arm, armListener);
- }
- Menu editMenu = new Menu(shell, SWT.DROP_DOWN);
- editMenu.addListener(SWT.Hide, hideListener);
- editMenu.addListener(SWT.Show, showListener);
- String[] editStrings = { "Cut", "Copy", "Paste" };
- editItem.setMenu(editMenu);
- for (int i = 0; i < editStrings.length; i++) {
- MenuItem item = new MenuItem(editMenu, SWT.PUSH);
- item.setText(editStrings[i]);
- item.addListener(SWT.Arm, armListener);
- }
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
+ FormData labelData = new FormData();
+ labelData.left = new FormAttachment(0);
+ labelData.right = new FormAttachment(100);
+ labelData.bottom = new FormAttachment(100);
+ label.setLayoutData(labelData);
+ Menu menuBar = new Menu(shell, SWT.BAR);
+ shell.setMenuBar(menuBar);
+ MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
+ fileItem.setText("File");
+ fileItem.addListener(SWT.Arm, armListener);
+ MenuItem editItem = new MenuItem(menuBar, SWT.CASCADE);
+ editItem.setText("Edit");
+ editItem.addListener(SWT.Arm, armListener);
+ Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
+ fileMenu.addListener(SWT.Hide, hideListener);
+ fileMenu.addListener(SWT.Show, showListener);
+ fileItem.setMenu(fileMenu);
+ String[] fileStrings = { "New", "Close", "Exit" };
+ for (int i = 0; i < fileStrings.length; i++) {
+ MenuItem item = new MenuItem(fileMenu, SWT.PUSH);
+ item.setText(fileStrings[i]);
+ item.addListener(SWT.Arm, armListener);
+ }
+ Menu editMenu = new Menu(shell, SWT.DROP_DOWN);
+ editMenu.addListener(SWT.Hide, hideListener);
+ editMenu.addListener(SWT.Show, showListener);
+ String[] editStrings = { "Cut", "Copy", "Paste" };
+ editItem.setMenu(editMenu);
+ for (int i = 0; i < editStrings.length; i++) {
+ MenuItem item = new MenuItem(editMenu, SWT.PUSH);
+ item.setText(editStrings[i]);
+ item.addListener(SWT.Arm, armListener);
+ }
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java
index 8e7f0a090f..af9c59720a 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java
@@ -27,33 +27,33 @@ public class Snippet153 {
static String statusText = "";
public static void main(String[] args) {
- final Display display = new Display();
- Shell shell = new Shell(display);
+ final Display display = new Display();
+ Shell shell = new Shell(display);
shell.setText("Snippet 153");
- shell.setBounds(10, 10, 200, 200);
- final ToolBar bar = new ToolBar(shell, SWT.BORDER);
- bar.setBounds(10, 10, 150, 50);
- final Label statusLine = new Label(shell, SWT.BORDER);
- statusLine.setBounds(10, 90, 150, 30);
- new ToolItem(bar, SWT.NONE).setText("item 1");
- new ToolItem(bar, SWT.NONE).setText("item 2");
- new ToolItem(bar, SWT.NONE).setText("item 3");
- bar.addMouseMoveListener(e -> {
- ToolItem item = bar.getItem(new Point(e.x, e.y));
- String name = "";
- if (item != null) {
- name = item.getText();
- }
- if (!statusText.equals(name)) {
- statusLine.setText(name);
- statusText = name;
- }
+ shell.setBounds(10, 10, 200, 200);
+ final ToolBar bar = new ToolBar(shell, SWT.BORDER);
+ bar.setBounds(10, 10, 150, 50);
+ final Label statusLine = new Label(shell, SWT.BORDER);
+ statusLine.setBounds(10, 90, 150, 30);
+ new ToolItem(bar, SWT.NONE).setText("item 1");
+ new ToolItem(bar, SWT.NONE).setText("item 2");
+ new ToolItem(bar, SWT.NONE).setText("item 3");
+ bar.addMouseMoveListener(e -> {
+ ToolItem item = bar.getItem(new Point(e.x, e.y));
+ String name = "";
+ if (item != null) {
+ name = item.getText();
+ }
+ if (!statusText.equals(name)) {
+ statusLine.setText(name);
+ statusText = name;
+ }
});
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java
index 7292affd9a..e1c48f8f0c 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java
@@ -23,7 +23,7 @@ package org.eclipse.swt.snippets;
*/
import java.applet.*;
-
+
public class Snippet157 extends Applet {
org.eclipse.swt.widgets.Display display;
@@ -63,15 +63,15 @@ public void init () {
}
@Override
public void stop (){
- if (display != null && !display.isDisposed ()){
- display.syncExec(() -> {
+ if (display != null && !display.isDisposed ()){
+ display.syncExec(() -> {
if (swtParent != null && !swtParent.isDisposed ()) swtParent.dispose ();
swtParent = null;
display.dispose ();
display = null;
});
- remove (awtParent);
- awtParent = null;
- }
+ remove (awtParent);
+ awtParent = null;
+ }
}
} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java
index 9f526b0fbd..9777d7f4bb 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java
@@ -45,66 +45,66 @@ import org.eclipse.swt.widgets.*;
public class Snippet174 {
public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
- shell.setText("OpenGL in SWT");
- shell.setLayout(new FillLayout());
- GLData data = new GLData();
- data.doubleBuffer = true;
- final GLCanvas canvas = new GLCanvas(shell, SWT.NO_BACKGROUND, data);
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setText("OpenGL in SWT");
+ shell.setLayout(new FillLayout());
+ GLData data = new GLData();
+ data.doubleBuffer = true;
+ final GLCanvas canvas = new GLCanvas(shell, SWT.NO_BACKGROUND, data);
canvas.addControlListener(ControlListener.controlResizedAdapter(e -> {
resize(canvas);
}));
- init(canvas);
- new Runnable() {
- @Override
+ init(canvas);
+ new Runnable() {
+ @Override
public void run() {
- if (canvas.isDisposed()) return;
- render();
- canvas.swapBuffers();
- canvas.getDisplay().timerExec(50, this);
- }
- }.run();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
+ if (canvas.isDisposed()) return;
+ render();
+ canvas.swapBuffers();
+ canvas.getDisplay().timerExec(50, this);
+ }
+ }.run();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
}
static void init(GLCanvas canvas) {
- canvas.setCurrent();
- resize(canvas);
- GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- GL.glColor3f(0.0f, 0.0f, 0.0f);
- GL.glClearDepth(1.0f);
- GL.glEnable(GL.GL_DEPTH_TEST);
- GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
+ canvas.setCurrent();
+ resize(canvas);
+ GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ GL.glColor3f(0.0f, 0.0f, 0.0f);
+ GL.glClearDepth(1.0f);
+ GL.glEnable(GL.GL_DEPTH_TEST);
+ GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
}
static void render() {
- GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- GL.glLoadIdentity();
- GL.glTranslatef(0.0f, 0.0f, -6.0f);
- GL.glBegin(GL.GL_QUADS);
- GL.glVertex3f(-1.0f, 1.0f, 0.0f);
- GL.glVertex3f(1.0f, 1.0f, 0.0f);
- GL.glVertex3f(1.0f, -1.0f, 0.0f);
- GL.glVertex3f(-1.0f, -1.0f, 0.0f);
- GL.glEnd();
+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ GL.glLoadIdentity();
+ GL.glTranslatef(0.0f, 0.0f, -6.0f);
+ GL.glBegin(GL.GL_QUADS);
+ GL.glVertex3f(-1.0f, 1.0f, 0.0f);
+ GL.glVertex3f(1.0f, 1.0f, 0.0f);
+ GL.glVertex3f(1.0f, -1.0f, 0.0f);
+ GL.glVertex3f(-1.0f, -1.0f, 0.0f);
+ GL.glEnd();
}
static void resize(GLCanvas canvas) {
- canvas.setCurrent();
- Rectangle rect = canvas.getClientArea();
- int width = rect.width;
- int height = Math.max(rect.height, 1);
- GL.glViewport(0, 0, width, height);
- GL.glMatrixMode(GL.GL_PROJECTION);
- GL.glLoadIdentity();
- float aspect = (float) width / (float) height;
- GLU.gluPerspective(45.0f, aspect, 0.5f, 400.0f);
- GL.glMatrixMode(GL.GL_MODELVIEW);
- GL.glLoadIdentity();
+ canvas.setCurrent();
+ Rectangle rect = canvas.getClientArea();
+ int width = rect.width;
+ int height = Math.max(rect.height, 1);
+ GL.glViewport(0, 0, width, height);
+ GL.glMatrixMode(GL.GL_PROJECTION);
+ GL.glLoadIdentity();
+ float aspect = (float) width / (float) height;
+ GLU.gluPerspective(45.0f, aspect, 0.5f, 400.0f);
+ GL.glMatrixMode(GL.GL_MODELVIEW);
+ GL.glLoadIdentity();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java
index 7253cb7c56..c9af85c36a 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java
@@ -133,30 +133,30 @@ static String readSafeArray(Variant variantByRef) {
// Read a safearray that contains data of
// type VT_UI1 (unsigned shorts) which contains
// a text stream.
- long /*int*/ pPostData = variantByRef.getByRef();
- short[] vt_type = new short[1];
- OS.MoveMemory(vt_type, pPostData, 2);
- String result = null;
- if (vt_type[0] == (short)(OLE.VT_BYREF | OLE.VT_VARIANT)) {
- int[] pVariant = new int[1];
- OS.MoveMemory(pVariant, pPostData + 8, 4);
- vt_type = new short[1];
- OS.MoveMemory(vt_type, pVariant[0], 2);
- if (vt_type[0] == (short)(OLE.VT_ARRAY | OLE.VT_UI1)) {
- long /*int*/ [] pSafearray = new long /*int*/[1];
- OS.MoveMemory(pSafearray, pVariant[0] + 8, OS.PTR_SIZEOF);
- SAFEARRAY safeArray = new SAFEARRAY();
- OS.MoveMemory(safeArray, pSafearray[0], SAFEARRAY.sizeof);
- for (int i = 0; i < safeArray.cDims; i++) {
- int cchWideChar = OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, safeArray.pvData, -1, null, 0);
+ long /*int*/ pPostData = variantByRef.getByRef();
+ short[] vt_type = new short[1];
+ OS.MoveMemory(vt_type, pPostData, 2);
+ String result = null;
+ if (vt_type[0] == (short)(OLE.VT_BYREF | OLE.VT_VARIANT)) {
+ int[] pVariant = new int[1];
+ OS.MoveMemory(pVariant, pPostData + 8, 4);
+ vt_type = new short[1];
+ OS.MoveMemory(vt_type, pVariant[0], 2);
+ if (vt_type[0] == (short)(OLE.VT_ARRAY | OLE.VT_UI1)) {
+ long /*int*/ [] pSafearray = new long /*int*/[1];
+ OS.MoveMemory(pSafearray, pVariant[0] + 8, OS.PTR_SIZEOF);
+ SAFEARRAY safeArray = new SAFEARRAY();
+ OS.MoveMemory(safeArray, pSafearray[0], SAFEARRAY.sizeof);
+ for (int i = 0; i < safeArray.cDims; i++) {
+ int cchWideChar = OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, safeArray.pvData, -1, null, 0);
if (cchWideChar == 0) return null;
char[] lpWideCharStr = new char [cchWideChar - 1];
OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, safeArray.pvData, -1, lpWideCharStr, lpWideCharStr.length);
result = new String(lpWideCharStr);
- }
- }
- }
- return result;
+ }
+ }
+ }
+ return result;
}
static Variant writeSafeArray (String string) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java
index 3b76456d49..300d8ffee4 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java
@@ -31,55 +31,55 @@ import org.eclipse.swt.widgets.*;
public class Snippet2 {
public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new Shell (display);
+ Display display = new Display ();
+ Shell shell = new Shell (display);
shell.setText("Snippet 2");
- shell.setLayout(new FillLayout());
- final Table table = new Table(shell, SWT.BORDER);
- table.setHeaderVisible(true);
- final TableColumn column1 = new TableColumn(table, SWT.NONE);
- column1.setText("Column 1");
- final TableColumn column2 = new TableColumn(table, SWT.NONE);
- column2.setText("Column 2");
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(new String[] {"a", "3"});
- item = new TableItem(table, SWT.NONE);
- item.setText(new String[] {"b", "2"});
- item = new TableItem(table, SWT.NONE);
- item.setText(new String[] {"c", "1"});
- column1.setWidth(100);
- column2.setWidth(100);
- Listener sortListener = e -> {
- TableItem[] items = table.getItems();
- Collator collator = Collator.getInstance(Locale.getDefault());
- TableColumn column = (TableColumn)e.widget;
- int index = column == column1 ? 0 : 1;
- for (int i = 1; i < items.length; i++) {
- String value1 = items[i].getText(index);
- for (int j = 0; j < i; j++){
- String value2 = items[j].getText(index);
- if (collator.compare(value1, value2) < 0) {
- String[] values = {items[i].getText(0), items[i].getText(1)};
- items[i].dispose();
- TableItem item1 = new TableItem(table, SWT.NONE, j);
- item1.setText(values);
- items = table.getItems();
- break;
- }
- }
- }
- table.setSortColumn(column);
+ shell.setLayout(new FillLayout());
+ final Table table = new Table(shell, SWT.BORDER);
+ table.setHeaderVisible(true);
+ final TableColumn column1 = new TableColumn(table, SWT.NONE);
+ column1.setText("Column 1");
+ final TableColumn column2 = new TableColumn(table, SWT.NONE);
+ column2.setText("Column 2");
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(new String[] {"a", "3"});
+ item = new TableItem(table, SWT.NONE);
+ item.setText(new String[] {"b", "2"});
+ item = new TableItem(table, SWT.NONE);
+ item.setText(new String[] {"c", "1"});
+ column1.setWidth(100);
+ column2.setWidth(100);
+ Listener sortListener = e -> {
+ TableItem[] items = table.getItems();
+ Collator collator = Collator.getInstance(Locale.getDefault());
+ TableColumn column = (TableColumn)e.widget;
+ int index = column == column1 ? 0 : 1;
+ for (int i = 1; i < items.length; i++) {
+ String value1 = items[i].getText(index);
+ for (int j = 0; j < i; j++){
+ String value2 = items[j].getText(index);
+ if (collator.compare(value1, value2) < 0) {
+ String[] values = {items[i].getText(0), items[i].getText(1)};
+ items[i].dispose();
+ TableItem item1 = new TableItem(table, SWT.NONE, j);
+ item1.setText(values);
+ items = table.getItems();
+ break;
+ }
+ }
+ }
+ table.setSortColumn(column);
};
- column1.addListener(SWT.Selection, sortListener);
- column2.addListener(SWT.Selection, sortListener);
- table.setSortColumn(column1);
- table.setSortDirection(SWT.UP);
- shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300);
- shell.open();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
+ column1.addListener(SWT.Selection, sortListener);
+ column2.addListener(SWT.Selection, sortListener);
+ table.setSortColumn(column1);
+ table.setSortDirection(SWT.UP);
+ shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300);
+ shell.open();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java
index 8a0c277d0c..777a584b53 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java
@@ -30,17 +30,17 @@ import org.eclipse.swt.widgets.*;
public class Snippet210 {
static String string1 = "A drag source is the provider of data in a Drag and Drop data transfer as well as "+
- "the originator of the Drag and Drop operation. The data provided by the drag source "+
- "may be transferred to another location in the same widget, to a different widget "+
- "within the same application, or to a different application altogether. For example, "+
- "you can drag text from your application and drop it on an email application, or you "+
- "could drag an item in a tree and drop it below a different node in the same tree.";
+ "the originator of the Drag and Drop operation. The data provided by the drag source "+
+ "may be transferred to another location in the same widget, to a different widget "+
+ "within the same application, or to a different application altogether. For example, "+
+ "you can drag text from your application and drop it on an email application, or you "+
+ "could drag an item in a tree and drop it below a different node in the same tree.";
static String string2 = "A drop target receives data in a Drag and Drop operation. The data received by "+
- "the drop target may have come from the same widget, from a different widget within "+
- "the same application, or from a different application altogether. For example, you "+
- "can drag text from an email application and drop it on your application, or you could "+
- "drag an item in a tree and drop it below a different node in the same tree.";
+ "the drop target may have come from the same widget, from a different widget within "+
+ "the same application, or from a different application altogether. For example, you "+
+ "can drag text from an email application and drop it on your application, or you could "+
+ "drag an item in a tree and drop it below a different node in the same tree.";
public static void main (String [] args) {
final Display display = new Display ();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet228.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet228.java
index 30ced9a4fd..afa9d91ffa 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet228.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet228.java
@@ -48,8 +48,8 @@ public static void main(String [] args) {
column2.setWidth(200);
String[] labels = new String[]{"Resolved", "New", "Won't Fix", "Invalid"};
for (int i=0; i<labels.length; i++) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(labels[i]);
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(labels[i]);
}
/*
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java
index 7f48a275c3..83bd297598 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java
@@ -26,28 +26,28 @@ import org.eclipse.swt.widgets.*;
public class Snippet244 {
static String SEARCH_STRING = "box";
- public static void main(String[] args) {
- final Display display = new Display();
- Shell shell = new Shell(display);
- shell.setText("Snippet 244");
- shell.setLayout(new FillLayout());
- final StyledText text = new StyledText(shell, SWT.NONE);
- StyleRange style = new StyleRange();
- style.borderColor = display.getSystemColor(SWT.COLOR_RED);
- style.borderStyle = SWT.BORDER_SOLID;
- StyleRange[] styles = {style};
- String contents = "This demonstrates drawing a box\naround every occurrence of the word\nbox in the StyledText";
- text.setText(contents);
+ public static void main(String[] args) {
+ final Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setText("Snippet 244");
+ shell.setLayout(new FillLayout());
+ final StyledText text = new StyledText(shell, SWT.NONE);
+ StyleRange style = new StyleRange();
+ style.borderColor = display.getSystemColor(SWT.COLOR_RED);
+ style.borderStyle = SWT.BORDER_SOLID;
+ StyleRange[] styles = {style};
+ String contents = "This demonstrates drawing a box\naround every occurrence of the word\nbox in the StyledText";
+ text.setText(contents);
int index = contents.indexOf(SEARCH_STRING);
while (index != -1) {
text.setStyleRanges(0, 0, new int[] {index, SEARCH_STRING.length()}, styles);
index = contents.indexOf(SEARCH_STRING, index + 1);
}
- shell.pack();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
- }
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
+ }
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java
index d4ea9e1a8a..e0a019c4f9 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java
@@ -31,11 +31,11 @@ import org.eclipse.swt.widgets.*;
public class Snippet257 {
static String string1 = "A drag source is the provider of data in a Drag and Drop data transfer as well as "+
- "the originator of the Drag and Drop operation. The data provided by the drag source "+
- "may be transferred to another location in the same widget, to a different widget "+
- "within the same application, or to a different application altogether. For example, "+
- "you can drag text from your application and drop it on an email application, or you "+
- "could drag an item in a tree and drop it below a different node in the same tree.";
+ "the originator of the Drag and Drop operation. The data provided by the drag source "+
+ "may be transferred to another location in the same widget, to a different widget "+
+ "within the same application, or to a different application altogether. For example, "+
+ "you can drag text from your application and drop it on an email application, or you "+
+ "could drag an item in a tree and drop it below a different node in the same tree.";
static String DRAG_START_DATA = "DRAG_START_DATA";
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet274.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet274.java
index 30ba24f3fc..3287361d27 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet274.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet274.java
@@ -28,68 +28,68 @@ import org.eclipse.swt.widgets.*;
public class Snippet274 {
static void checkPath(TreeItem item, boolean checked, boolean grayed) {
- if (item == null) return;
- if (grayed) {
- checked = true;
- } else {
- int index = 0;
- TreeItem[] items = item.getItems();
- while (index < items.length) {
- TreeItem child = items[index];
- if (child.getGrayed() || checked != child.getChecked()) {
- checked = grayed = true;
- break;
- }
- index++;
- }
- }
- item.setChecked(checked);
- item.setGrayed(grayed);
- checkPath(item.getParentItem(), checked, grayed);
+ if (item == null) return;
+ if (grayed) {
+ checked = true;
+ } else {
+ int index = 0;
+ TreeItem[] items = item.getItems();
+ while (index < items.length) {
+ TreeItem child = items[index];
+ if (child.getGrayed() || checked != child.getChecked()) {
+ checked = grayed = true;
+ break;
+ }
+ index++;
+ }
+ }
+ item.setChecked(checked);
+ item.setGrayed(grayed);
+ checkPath(item.getParentItem(), checked, grayed);
}
static void checkItems(TreeItem item, boolean checked) {
- item.setGrayed(false);
- item.setChecked(checked);
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- checkItems(items[i], checked);
- }
+ item.setGrayed(false);
+ item.setChecked(checked);
+ TreeItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ checkItems(items[i], checked);
+ }
}
public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
+ Display display = new Display();
+ Shell shell = new Shell(display);
shell.setText("Snippet 274");
- Tree tree = new Tree(shell, SWT.BORDER | SWT.CHECK);
- tree.addListener(SWT.Selection, event -> {
- if (event.detail == SWT.CHECK) {
- TreeItem item = (TreeItem) event.item;
- boolean checked = item.getChecked();
- checkItems(item, checked);
- checkPath(item.getParentItem(), checked, false);
- }
+ Tree tree = new Tree(shell, SWT.BORDER | SWT.CHECK);
+ tree.addListener(SWT.Selection, event -> {
+ if (event.detail == SWT.CHECK) {
+ TreeItem item = (TreeItem) event.item;
+ boolean checked = item.getChecked();
+ checkItems(item, checked);
+ checkPath(item.getParentItem(), checked, false);
+ }
});
- for (int i = 0; i < 4; i++) {
- TreeItem itemI = new TreeItem(tree, SWT.NONE);
- itemI.setText("Item " + i);
- for (int j = 0; j < 4; j++) {
- TreeItem itemJ = new TreeItem(itemI, SWT.NONE);
- itemJ.setText("Item " + i + " " + j);
- for (int k = 0; k < 4; k++) {
- TreeItem itemK = new TreeItem(itemJ, SWT.NONE);
- itemK.setText("Item " + i + " " + j + " " + k);
- }
- }
- }
+ for (int i = 0; i < 4; i++) {
+ TreeItem itemI = new TreeItem(tree, SWT.NONE);
+ itemI.setText("Item " + i);
+ for (int j = 0; j < 4; j++) {
+ TreeItem itemJ = new TreeItem(itemI, SWT.NONE);
+ itemJ.setText("Item " + i + " " + j);
+ for (int k = 0; k < 4; k++) {
+ TreeItem itemK = new TreeItem(itemJ, SWT.NONE);
+ itemK.setText("Item " + i + " " + j + " " + k);
+ }
+ }
+ }
Rectangle clientArea = shell.getClientArea();
- tree.setBounds(clientArea.x, clientArea.y, 200, 200);
- shell.pack();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
+ tree.setBounds(clientArea.x, clientArea.y, 200, 200);
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.java
index 78d352bd4f..014eaaecba 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.java
@@ -36,14 +36,14 @@ public class Snippet282 {
shell.setLayout(new GridLayout());
shell.setText("Clipboard ImageTransfer");
- final Button imageButton = new Button(shell, SWT.NONE );
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.minimumHeight = 400;
- gd.minimumWidth = 600;
- imageButton.setLayoutData(gd);
+ final Button imageButton = new Button(shell, SWT.NONE );
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.minimumHeight = 400;
+ gd.minimumWidth = 600;
+ imageButton.setLayoutData(gd);
- final Text imageText = new Text(shell, SWT.BORDER);
- imageText.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+ final Text imageText = new Text(shell, SWT.BORDER);
+ imageText.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
Composite buttons = new Composite(shell, SWT.NONE);
buttons.setLayout(new GridLayout(4, true));
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet304.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet304.java
index 77713048d7..ed9ccc9568 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet304.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet304.java
@@ -26,62 +26,62 @@ import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class Snippet304 {
- static Display display = null;
+ static Display display = null;
- public static void main(String[] args) {
- display = new Display();
- Shell shell = new Shell(display);
- shell.setText("Snippet 304");
+ public static void main(String[] args) {
+ display = new Display();
+ Shell shell = new Shell(display);
+ shell.setText("Snippet 304");
- shell.setLayout(new GridLayout());
- Text text = new Text(shell, SWT.MULTI | SWT.BORDER);
- text.setText("< cursor was there\na\nmulti\nline\ntext\nnow it's here >");
+ shell.setLayout(new GridLayout());
+ Text text = new Text(shell, SWT.MULTI | SWT.BORDER);
+ text.setText("< cursor was there\na\nmulti\nline\ntext\nnow it's here >");
- text.addKeyListener(new KeyListener() {
- @Override
+ text.addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
- System.out.println("KeyDown " + e);
- }
- @Override
+ System.out.println("KeyDown " + e);
+ }
+ @Override
public void keyReleased(KeyEvent e) {
- System.out.println("KeyUp " + e);
- }
- });
+ System.out.println("KeyUp " + e);
+ }
+ });
- shell.pack();
- shell.open();
+ shell.pack();
+ shell.open();
- /*
- * Simulate the (platform specific) key sequence
- * to move the I-beam to the end of a text control.
- */
- new Thread(){
- @Override
+ /*
+ * Simulate the (platform specific) key sequence
+ * to move the I-beam to the end of a text control.
+ */
+ new Thread(){
+ @Override
public void run(){
- int key = SWT.END;
- String platform = SWT.getPlatform();
- if (platform.equals("cocoa") ) {
- key = SWT.ARROW_DOWN;
- }
- postEvent(SWT.MOD1, SWT.KeyDown);
- postEvent(key, SWT.KeyDown);
- postEvent(key, SWT.KeyUp);
- postEvent(SWT.MOD1, SWT.KeyUp);
- }
- }.start();
+ int key = SWT.END;
+ String platform = SWT.getPlatform();
+ if (platform.equals("cocoa") ) {
+ key = SWT.ARROW_DOWN;
+ }
+ postEvent(SWT.MOD1, SWT.KeyDown);
+ postEvent(key, SWT.KeyDown);
+ postEvent(key, SWT.KeyUp);
+ postEvent(SWT.MOD1, SWT.KeyUp);
+ }
+ }.start();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
- display.dispose();
- }
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
- public static void postEvent(int keyCode, int type) {
- Event event = new Event();
- event.type = type;
- event.keyCode = keyCode;
- display.post(event);
- }
+ public static void postEvent(int keyCode, int type) {
+ Event event = new Event();
+ event.type = type;
+ event.keyCode = keyCode;
+ display.post(event);
+ }
} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet333.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet333.java
index 95897df322..40006ba62a 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet333.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet333.java
@@ -104,9 +104,9 @@ public class Snippet333 {
}
protected static void setBackground(Display display, Control control) {
- Random randomGenerator = new Random();
- int nextColor = randomGenerator.nextInt(100) + randomGenerator.nextInt(100);
- control.setBackground(display.getSystemColor(colors[nextColor % colors.length]));
+ Random randomGenerator = new Random();
+ int nextColor = randomGenerator.nextInt(100) + randomGenerator.nextInt(100);
+ control.setBackground(display.getSystemColor(colors[nextColor % colors.length]));
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet334.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet334.java
index dc23b0dbf9..da1adae455 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet334.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet334.java
@@ -156,7 +156,7 @@ public static void main(String[] arg) {
if (index != -1) index++;
}
e.count = e.count < 0 ? Math.max(e.count, -lineCount) : Math.min(e.count, lineCount);
- index = 0;
+ index = 0;
int lastIndex = 0;
String[] lines = new String[lineCount];
for (int i = 0; i < lines.length; i++) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet336.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet336.java
index 5bf180c552..0797b0acaa 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet336.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet336.java
@@ -147,7 +147,7 @@ public static void main(String[] args) {
button.setText(images[i]);
button.addListener(SWT.Selection, listener3);
}
- shell.pack();
+ shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet359.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet359.java
index 32025fdeae..4d80707b19 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet359.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet359.java
@@ -32,9 +32,9 @@ public class Snippet359 {
combo.addKeyListener(new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.CR) {
- combo.add(combo.getText());
- }
+ if (e.keyCode == SWT.CR) {
+ combo.add(combo.getText());
+ }
}
@Override
public void keyPressed(KeyEvent e) {
@@ -42,11 +42,11 @@ public class Snippet359 {
System.out.println("caret location: " + combo.getCaretLocation());
}
});
- shell.pack();
- shell.open ();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
+ shell.pack();
+ shell.open ();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet363.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet363.java
index ed14dc4436..23431a48cf 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet363.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet363.java
@@ -28,86 +28,86 @@ import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class Snippet363 {
- static final String errorMessage = "Error: Number expected.";
- static Label icon;
- static Image errorIcon;
- static Text liveLabel;
+ static final String errorMessage = "Error: Number expected.";
+ static Label icon;
+ static Image errorIcon;
+ static Text liveLabel;
public static void main(String [] args) {
- Display display = new Display();
- errorIcon = display.getSystemImage(SWT.ICON_ERROR);
- Shell shell = new Shell(display);
+ Display display = new Display();
+ errorIcon = display.getSystemImage(SWT.ICON_ERROR);
+ Shell shell = new Shell(display);
shell.setText("Snippet 363");
- shell.setLayout(new GridLayout(2, false));
- shell.setText("LiveRegion Test");
+ shell.setLayout(new GridLayout(2, false));
+ shell.setText("LiveRegion Test");
- icon = new Label(shell, SWT.NONE);
- icon.setLayoutData(new GridData(32, 32));
+ icon = new Label(shell, SWT.NONE);
+ icon.setLayoutData(new GridData(32, 32));
- liveLabel = new Text(shell, SWT.READ_ONLY);
- GC gc = new GC(liveLabel);
- Point pt = gc.textExtent(errorMessage);
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
- data.minimumWidth = (int) (pt.x + gc.getFontMetrics().getAverageCharacterWidth() * 2);
- gc.dispose();
- liveLabel.setLayoutData(data);
- liveLabel.setText("");
- liveLabel.getAccessible().addAccessibleAttributeListener(new AccessibleAttributeAdapter() {
- @Override
+ liveLabel = new Text(shell, SWT.READ_ONLY);
+ GC gc = new GC(liveLabel);
+ Point pt = gc.textExtent(errorMessage);
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.minimumWidth = (int) (pt.x + gc.getFontMetrics().getAverageCharacterWidth() * 2);
+ gc.dispose();
+ liveLabel.setLayoutData(data);
+ liveLabel.setText("");
+ liveLabel.getAccessible().addAccessibleAttributeListener(new AccessibleAttributeAdapter() {
+ @Override
public void getAttributes(AccessibleAttributeEvent e) {
- e.attributes = new String[] {
- "container-live", "polite",
- "live", "polite",
- "container-live-role", "status",
- };
- }
- });
+ e.attributes = new String[] {
+ "container-live", "polite",
+ "live", "polite",
+ "container-live-role", "status",
+ };
+ }
+ });
- final Label textFieldLabel = new Label(shell, SWT.NONE);
- textFieldLabel.setText("Type a number:");
- textFieldLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ final Label textFieldLabel = new Label(shell, SWT.NONE);
+ textFieldLabel.setText("Type a number:");
+ textFieldLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
- final Text textField = new Text(shell, SWT.SINGLE | SWT.BORDER);
- textField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ final Text textField = new Text(shell, SWT.SINGLE | SWT.BORDER);
+ textField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
- final Button okButton = new Button(shell, SWT.PUSH);
- okButton.setText("OK");
- okButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false, 2, 1));
- okButton.setEnabled(false);
+ final Button okButton = new Button(shell, SWT.PUSH);
+ okButton.setText("OK");
+ okButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false, 2, 1));
+ okButton.setEnabled(false);
- textField.addModifyListener(e -> {
- boolean isNumber = false;
- String textValue = textField.getText();
- try {
- Integer.parseInt(textValue);
- isNumber = true;
- setMessageText(false, "Thank-you");
- } catch (NumberFormatException ex) {
- if (textValue.isEmpty()) {
- setMessageText(false, "");
- } else {
- setMessageText(true, "Error: Number expected.");
- }
- }
- okButton.setEnabled(isNumber);
+ textField.addModifyListener(e -> {
+ boolean isNumber = false;
+ String textValue = textField.getText();
+ try {
+ Integer.parseInt(textValue);
+ isNumber = true;
+ setMessageText(false, "Thank-you");
+ } catch (NumberFormatException ex) {
+ if (textValue.isEmpty()) {
+ setMessageText(false, "");
+ } else {
+ setMessageText(true, "Error: Number expected.");
+ }
+ }
+ okButton.setEnabled(isNumber);
});
- textField.setFocus();
- shell.pack();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
+ textField.setFocus();
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
}
static void setMessageText(boolean error, String newMessage) {
- String oldMessage = liveLabel.getText();
- icon.setImage(error ? errorIcon : null);
- liveLabel.setText(newMessage);
- liveLabel.getAccessible().sendEvent(ACC.EVENT_ATTRIBUTE_CHANGED, null);
- liveLabel.getAccessible().sendEvent(ACC.EVENT_TEXT_CHANGED, new Object[] {ACC.TEXT_DELETE, 0, oldMessage.length(), oldMessage});
- liveLabel.getAccessible().sendEvent(ACC.EVENT_TEXT_CHANGED, new Object[] {ACC.TEXT_INSERT, 0, newMessage.length(), newMessage});
+ String oldMessage = liveLabel.getText();
+ icon.setImage(error ? errorIcon : null);
+ liveLabel.setText(newMessage);
+ liveLabel.getAccessible().sendEvent(ACC.EVENT_ATTRIBUTE_CHANGED, null);
+ liveLabel.getAccessible().sendEvent(ACC.EVENT_TEXT_CHANGED, new Object[] {ACC.TEXT_DELETE, 0, oldMessage.length(), oldMessage});
+ liveLabel.getAccessible().sendEvent(ACC.EVENT_TEXT_CHANGED, new Object[] {ACC.TEXT_INSERT, 0, newMessage.length(), newMessage});
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet366.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet366.java
index becfd5c631..a4e0934a5d 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet366.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet366.java
@@ -26,8 +26,8 @@ import org.eclipse.swt.widgets.*;
* http://www.eclipse.org/swt/snippets/
*/
public class Snippet366 {
- static Display display;
- static Shell shell;
+ static Display display;
+ static Shell shell;
public static void main (String [] args) {
display = new Display();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java
index 7bfa3bd333..675028db06 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java
@@ -28,36 +28,36 @@ public class Snippet5 {
public static void main (String [] args)
{
- Display display = new Display ();
- Shell shell = new Shell (display);
+ Display display = new Display ();
+ Shell shell = new Shell (display);
shell.setText("Snippet 5");
- shell.setLayout(new FillLayout());
+ shell.setLayout(new FillLayout());
- // this button is always 400 x 400. Scrollbars appear if the window is resized to be
- // too small to show part of the button
- ScrolledComposite c1 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- Button b1 = new Button(c1, SWT.PUSH);
- b1.setText("fixed size button");
- b1.setSize(400, 400);
- c1.setContent(b1);
+ // this button is always 400 x 400. Scrollbars appear if the window is resized to be
+ // too small to show part of the button
+ ScrolledComposite c1 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ Button b1 = new Button(c1, SWT.PUSH);
+ b1.setText("fixed size button");
+ b1.setSize(400, 400);
+ c1.setContent(b1);
- // this button has a minimum size of 400 x 400. If the window is resized to be big
- // enough to show more than 400 x 400, the button will grow in size. If the window
- // is made too small to show 400 x 400, scrollbars will appear.
- ScrolledComposite c2 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- Button b2 = new Button(c2, SWT.PUSH);
- b2.setText("expanding button");
- c2.setContent(b2);
- c2.setExpandHorizontal(true);
- c2.setExpandVertical(true);
- c2.setMinSize(400, 400);
+ // this button has a minimum size of 400 x 400. If the window is resized to be big
+ // enough to show more than 400 x 400, the button will grow in size. If the window
+ // is made too small to show 400 x 400, scrollbars will appear.
+ ScrolledComposite c2 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ Button b2 = new Button(c2, SWT.PUSH);
+ b2.setText("expanding button");
+ c2.setContent(b2);
+ c2.setExpandHorizontal(true);
+ c2.setExpandVertical(true);
+ c2.setMinSize(400, 400);
- shell.setSize(600, 300);
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
+ shell.setSize(600, 300);
+ shell.open ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java
index 8bd72bad0a..96e13d8de4 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java
@@ -28,36 +28,36 @@ import org.eclipse.swt.widgets.*;
public class Snippet6 {
public static void main (String [] args) {
- Display display = new Display ();
- final Shell shell = new Shell (display);
+ Display display = new Display ();
+ final Shell shell = new Shell (display);
shell.setText("Snippet 6");
- shell.setLayout(new GridLayout());
- final Composite c = new Composite(shell, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- c.setLayout(layout);
- for (int i = 0; i < 10; i++) {
- Button b = new Button(c, SWT.PUSH);
- b.setText("Button "+i);
- }
+ shell.setLayout(new GridLayout());
+ final Composite c = new Composite(shell, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ c.setLayout(layout);
+ for (int i = 0; i < 10; i++) {
+ Button b = new Button(c, SWT.PUSH);
+ b.setText("Button "+i);
+ }
- Button b = new Button(shell, SWT.PUSH);
- b.setText("add a new button at row 2 column 1");
- final int[] index = new int[1];
- b.addListener(SWT.Selection, e -> {
- Button s = new Button(c, SWT.PUSH);
- s.setText("Special "+index[0]);
- index[0]++;
- Control[] children = c.getChildren();
- s.moveAbove(children[3]);
- shell.layout(new Control[] {s});
+ Button b = new Button(shell, SWT.PUSH);
+ b.setText("add a new button at row 2 column 1");
+ final int[] index = new int[1];
+ b.addListener(SWT.Selection, e -> {
+ Button s = new Button(c, SWT.PUSH);
+ s.setText("Special "+index[0]);
+ index[0]++;
+ Control[] children = c.getChildren();
+ s.moveAbove(children[3]);
+ shell.layout(new Control[] {s});
});
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
+ shell.open ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java
index 5286557c8a..8f177d9008 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java
@@ -76,17 +76,17 @@ private static void printTypeInfo(OleAutomation auto) {
if ( j < data.args.length - 1) argList += ", ";
}
System.out.println(getInvokeKind(data.invokeKind)+" (id = "+data.id+") : "
- +"\n\tSignature : "+getTypeName(data.returnType)+" "+data.name+"("+argList+")"
- +"\n\tDescription : "+data.documentation
- +"\n\tHelp File : "+data.helpFile+"\n");
+ +"\n\tSignature : "+getTypeName(data.returnType)+" "+data.name+"("+argList+")"
+ +"\n\tDescription : "+data.documentation
+ +"\n\tHelp File : "+data.helpFile+"\n");
}
if (typeattr.cVars > 0) System.out.println("\n\nVariables :\n");
for (int i = 0; i < typeattr.cVars; i++) {
OlePropertyDescription data = auto.getPropertyDescription(i);
System.out.println("PROPERTY (id = "+data.id+") :"
- +"\n\tName : "+data.name
- +"\n\tType : "+getTypeName(data.type)+"\n");
+ +"\n\tName : "+data.name
+ +"\n\tType : "+getTypeName(data.type)+"\n");
}
}
}

Back to the top