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 features/org.eclipse.pde.spies-feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.eclipse.pde.spies"
label="%featureName"
version="1.0.700.qualifier"
version="1.0.800.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.swt.tools.spies/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-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.tools.spies;singleton:=true
Bundle-Version: 3.109.600.qualifier
Bundle-Version: 3.109.700.qualifier
Bundle-ManifestVersion: 2
Export-Package: org.eclipse.swt.tools.internal,
org.eclipse.swt.tools.views
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Modify the main method below to launch your application.
* Run Sleak.
*/
@SuppressWarnings("restriction")

Check warning on line 35 in ui/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/internal/Sleak.java

View check run for this annotation

Jenkins - eclipse-pde / Compiler

Unnecessary Code

NORMAL: Unnecessary @SuppressWarnings("restriction")
public class Sleak {
List list;
Canvas canvas;
Expand Down Expand Up @@ -88,7 +88,9 @@
// shell2.open();

while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
if (!display.readAndDispatch ()) {
display.sleep ();
}
}
display.dispose ();
}
Expand All @@ -107,7 +109,7 @@
Composite right = new Composite(sash, 0);
right.setLayout(new GridLayout());

sash.setWeights(new int[] {40,60});
sash.setWeights(40, 60);

// Right side
canvas = new Canvas (right, SWT.BORDER);
Expand Down Expand Up @@ -243,7 +245,7 @@
}
}
}

objects.clear();
objects.addAll(created);

Expand Down Expand Up @@ -393,29 +395,39 @@
void paintCanvas (Event event) {
canvas.setCursor (null);
int index = list.getSelectionIndex ();
if (index == -1) return;
if (index == -1) {
return;
}
GC gc = event.gc;
Object object = objects.get(index).object;
draw(gc, object);
}

void draw(GC gc, Object object) {
if (object instanceof Cursor) {
if (((Cursor)object).isDisposed ()) return;
if (((Cursor)object).isDisposed ()) {
return;
}
canvas.setCursor ((Cursor) object);
return;
}
if (object instanceof Font) {
if (((Font)object).isDisposed ()) return;
if (((Font)object).isDisposed ()) {
return;
}
gc.setFont ((Font) object);
String string = "";
String lf = text.getLineDelimiter ();
for (FontData data : gc.getFont ().getFontData ()) {
String style = "NORMAL";
int bits = data.getStyle ();
if (bits != 0) {
if ((bits & SWT.BOLD) != 0) style = "BOLD ";
if ((bits & SWT.ITALIC) != 0) style += "ITALIC";
if ((bits & SWT.BOLD) != 0) {
style = "BOLD ";
}
if ((bits & SWT.ITALIC) != 0) {
style += "ITALIC";
}
}
string += data.getName () + " " + data.getHeight () + " " + style + lf;
}
Expand All @@ -427,35 +439,47 @@
// return;
// }
if (object instanceof Image) {
if (((Image)object).isDisposed ()) return;
if (((Image)object).isDisposed ()) {
return;
}
gc.drawImage ((Image) object, 0, 0);
return;
}
if (object instanceof Path) {
if (((Path)object).isDisposed ()) return;
if (((Path)object).isDisposed ()) {
return;
}
gc.drawPath ((Path) object);
return;
}
if (object instanceof Pattern) {
if (((Pattern)object).isDisposed ()) return;
if (((Pattern)object).isDisposed ()) {
return;
}
gc.setBackgroundPattern ((Pattern)object);
gc.fillRectangle (canvas.getClientArea ());
gc.setBackgroundPattern (null);
return;
}
if (object instanceof Region) {
if (((Region)object).isDisposed ()) return;
if (((Region)object).isDisposed ()) {
return;
}
String string = ((Region)object).getBounds().toString();
gc.drawString (string, 0, 0);
return;
}
if (object instanceof TextLayout) {
if (((TextLayout)object).isDisposed ()) return;
if (((TextLayout)object).isDisposed ()) {
return;
}
((TextLayout)object).draw (gc, 0, 0);
return;
}
if (object instanceof Transform) {
if (((Transform)object).isDisposed ()) return;
if (((Transform)object).isDisposed ()) {
return;
}
String string = ((Transform)object).toString();
gc.drawString (string, 0, 0);
return;
Expand All @@ -464,7 +488,9 @@

void refreshObject () {
int index = list.getSelectionIndex ();
if (index == -1) return;
if (index == -1) {
return;
}
if (stackTrace.getSelection ()) {
text.setText (objects.get(index).getStack());
setVisible(text, true);
Expand All @@ -484,7 +510,7 @@

private void filterNonDisposedWidgetTypes() {
java.util.List<Class<? extends Widget>> trackedTypes = Arrays.asList(
// Composite.class,
// Composite.class,
// Menu.class
);
nonDisposedWidgetTracker.setTrackedTypes(trackedTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public void createPartControl(Composite parent) {
timer = new Runnable() {
@Override
public void run() {
if (output == null || output.isDisposed() || !spyAction.isChecked()) return;
if (output == null || output.isDisposed() || !spyAction.isChecked()) {
return;
}
Display display = output.getDisplay();
Control control = display.getCursorControl();
if (control != lastControl) {
Expand All @@ -86,7 +88,9 @@ public void run() {
text.append("\nPeers:\n");
for (Control peer : parent.getChildren()) {
text.append("\t");
if (peer == control) text.append("*");
if (peer == control) {
text.append("*");
}
text.append(getName(peer)+"@"+getOSHandle(peer));
text.append(" Layout Data: "+getName(peer.getLayoutData()));
text.append(" Bounds: "+peer.getBounds());
Expand Down Expand Up @@ -134,7 +138,9 @@ public void run() {
}

String getName(Object object) {
if (object == null) return "null";
if (object == null) {
return "null";
}
String name = object.toString ();
if (fullyQualifiedAction.isChecked()) {
int index = name.indexOf(' ');
Expand All @@ -150,15 +156,19 @@ String getName(Object object) {
*/
@Override
public void setFocus() {
if (output != null & !output.isDisposed()) output.setFocus();
if (output != null & !output.isDisposed()) {
output.setFocus();
}
}

private String getOSHandle(Control control) {
if (field == null) {
for (String fieldName : new String[]{"handle", "view"}) {
try {
field = control.getClass().getField(fieldName);
if (field != null) break;
if (field != null) {
break;
}
} catch (Throwable e) {}
}
}
Expand Down Expand Up @@ -509,7 +519,9 @@ private String getStyle(Widget w) {
result += "DOUBLE_BUFFERED | ";
}
int lastOr = result.lastIndexOf("|");
if (lastOr == result.length() - 2 ) result = result.substring(0, result.length() - 2);
if (lastOr == result.length() - 2 ) {
result = result.substring(0, result.length() - 2);
}
return result;
}
}
Loading