Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.SWTStandaloneExampleSet.name
Bundle-SymbolicName: org.eclipse.swt.examples; singleton:=true
Bundle-Version: 3.109.0.qualifier
Bundle-Version: 3.109.100.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -210,11 +210,11 @@ void disposeExampleWidgets () {
/* store the state of the Browser if applicable */
if (browser != null) {
String url = browser.getUrl();
if (url.length() > 0 && !url.equals("about:blank")) { //$NON-NLS-1$
if (!url.isEmpty() && !url.equals("about:blank")) { //$NON-NLS-1$
lastUrl = url;
} else {
String text = browser.getText();
if (text.length() > 0) {
if (!text.isEmpty()) {
lastText = text;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -448,7 +448,7 @@ void setSingleTabs () {
*/
void setImages () {
boolean setImage = imageButton.getSelection ();
CTabItem items[] = tabFolder1.getItems ();
CTabItem[] items = tabFolder1.getItems ();
for (CTabItem item : items) {
if (setImage) {
item.setImage (instance.images[ControlExample.ciClosedFolder]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -35,7 +35,7 @@
import org.eclipse.swt.widgets.Widget;

class CanvasTab extends Tab {
static final int colors [] = {
static final int[] colors = {
SWT.COLOR_RED,
SWT.COLOR_GREEN,
SWT.COLOR_BLUE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public void widgetSelected(SelectionEvent event) {
menu.addMenuListener(menuHiddenAdapter(e -> visible = false));
for (int i = 0; i < 9; ++i) {
final String text = ControlExample.getResourceString("DropDownData_" + i);
if (text.length() != 0) {
if (!text.isEmpty()) {
MenuItem menuItem = new MenuItem(menu, SWT.NONE);
menuItem.setText(text);
/*
Expand Down Expand Up @@ -469,7 +469,7 @@ public void widgetSelected(SelectionEvent event) {
menuItem.setMenu(m);
for (int k = 0; k < 9; ++k) {
text = ControlExample.getResourceString("DropDownData_" + k);
if (text.length() != 0) {
if (!text.isEmpty()) {
MenuItem mi = new MenuItem(m, SWT.NONE);
mi.setText(text);
/* Application code to perform the action for the submenu item would go here. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2014 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -90,9 +90,7 @@ void createColorAndFontGroup () {
TableItem item = new TableItem(colorAndFontTable, SWT.None);
item.setText(ControlExample.getResourceString ("Link_Foreground_Color"));

shell.addDisposeListener(event -> {
linkForegroundColor = null;
});
shell.addDisposeListener(event -> linkForegroundColor = null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2022 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -52,7 +52,7 @@ class ShellTab extends Tab {
*/
void closeAllShells() {
for (int i = 0; i<shellCount; i++) {
if (shells [i] != null & !shells [i].isDisposed ()) {
if (shells [i] != null && !shells [i].isDisposed ()) {
shells [i].dispose();
shells [i] = null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -579,7 +579,7 @@ void createEditEventDialog(Shell parent, int x, int y, final int index) {
doitCombo.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
doitCombo.addSelectionListener(widgetSelectedAdapter(e -> {
String newValue = doitCombo.getText();
if (newValue.length() == 0) {
if (newValue.isEmpty()) {
setFieldsMask &= ~DOIT;
} else {
setFieldsEvent.type = eventType;
Expand All @@ -600,7 +600,7 @@ void createEditEventDialog(Shell parent, int x, int y, final int index) {
detailCombo.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
detailCombo.addSelectionListener(widgetSelectedAdapter(e -> {
String newValue = detailCombo.getText();
if (newValue.length() == 0) {
if (newValue.isEmpty()) {
setFieldsMask &= ~DETAIL;
} else {
setFieldsEvent.type = eventType;
Expand All @@ -622,7 +622,7 @@ void createEditEventDialog(Shell parent, int x, int y, final int index) {
textText.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
textText.addModifyListener(e -> {
String newValue = textText.getText();
if (newValue.length() == 0) {
if (newValue.isEmpty()) {
setFieldsMask &= ~TEXT;
} else {
setFieldsEvent.type = eventType;
Expand Down Expand Up @@ -1097,20 +1097,20 @@ void setValue() {
} else if (typeName.equals("java.lang.String")) {
parameter = new Object[] {value};
} else if (typeName.equals("org.eclipse.swt.graphics.Point")) {
String xy[] = split(value, ',');
String[] xy = split(value, ',');
parameter = new Object[] {new Point(Integer.parseInt(xy[0]),Integer.parseInt(xy[1]))};
} else if (typeName.equals("org.eclipse.swt.graphics.Rectangle")) {
String xywh[] = split(value, ',');
String[] xywh = split(value, ',');
parameter = new Object[] {new Rectangle(Integer.parseInt(xywh[0]),Integer.parseInt(xywh[1]),Integer.parseInt(xywh[2]),Integer.parseInt(xywh[3]))};
} else if (typeName.equals("[I")) {
String strings[] = split(value, ',');
String[] strings = split(value, ',');
int[] ints = new int[strings.length];
for (int j = 0; j < strings.length; j++) {
ints[j] = Integer.parseInt(strings[j]);
}
parameter = new Object[] {ints};
} else if (typeName.equals("[C")) {
String strings[] = split(value, ',');
String[] strings = split(value, ',');
char[] chars = new char[strings.length];
for (int j = 0; j < strings.length; j++) {
chars[j] = strings[j].charAt(0);
Expand Down Expand Up @@ -1333,7 +1333,7 @@ public void drawOn(GC gc, int iwidth, int iheight) {
gc.fillRectangle(0, 0, iwidth - 1, iheight - 1);
gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
gc.drawRectangle(0, 0, iwidth - 1, iheight- 1);
FontData data[] = font.getFontData();
FontData[] data = font.getFontData();
int style = data[0].getStyle();
switch (style) {
case SWT.NORMAL:
Expand Down Expand Up @@ -1418,11 +1418,11 @@ int getDefaultStyle () {
Widget [] widgets = getExampleWidgets ();
Control [] controls = new Control [0];
for (Widget widget : widgets) {
if (widget instanceof Control) {
if (widget instanceof Control control) {
Control[] newControls = new Control[controls.length + 1];
System.arraycopy(controls, 0, newControls, 0, controls.length);
controls = newControls;
controls[controls.length - 1] = (Control)widget;
controls[controls.length - 1] = control;
}
}
return controls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,6 @@ void createStyleGroup() {
borderButton.setText ("SWT.BORDER");
}

@Override
void disposeExampleWidgets () {
super.disposeExampleWidgets ();
}

/**
* Gets the "Example" widget children's items, if any.
*
Expand Down Expand Up @@ -355,7 +350,7 @@ public void widgetSelected(SelectionEvent event) {
menu = new Menu(shell, style | SWT.POP_UP);
for (int i = 0; i < 9; ++i) {
final String text = ControlExample.getResourceString("DropDownData_" + i);
if (text.length() != 0) {
if (!text.isEmpty()) {
MenuItem menuItem = new MenuItem(menu, SWT.NONE);
menuItem.setText(text);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ private void makeTreeEditable(Tree tree) {
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal = true;

tree.addListener(SWT.MouseDoubleClick, event -> {
treeDoubleClickListener(tree, editor, event);
});
tree.addListener(SWT.MouseDoubleClick, event -> treeDoubleClickListener(tree, editor, event));
}

private void treeDoubleClickListener(Tree tree, final TreeEditor editor, Event event) {
Expand Down Expand Up @@ -371,7 +369,7 @@ void createExampleWidgets () {
setItemText(subitem, i, ControlExample.getResourceString("Node_" + (i + 1) + "_1"));
}
}
TreeItem treeRoots[] = tree1.getItems ();
TreeItem[] treeRoots = tree1.getItems ();
TreeItem item = new TreeItem (treeRoots[1], SWT.NONE);
setItemText(item, 1, ControlExample.getResourceString("Node_2_2"));
item = new TreeItem (item, SWT.NONE);
Expand Down
Loading