use of org.eclipse.swt.graphics.DeviceData in project pentaho-kettle by pentaho.
the class Sleak method main.
public static void main(String[] args) {
DeviceData data = new DeviceData();
data.tracking = true;
Display display = new Display(data);
Sleak sleak = new Sleak();
Shell shell = new Shell(display);
shell.setText("S-Leak");
Point size = shell.getSize();
shell.setSize(size.x / 2, size.y / 2);
sleak.create(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
use of org.eclipse.swt.graphics.DeviceData in project netxms by netxms.
the class Sleak method refreshDifference.
void refreshDifference() {
final DeviceData info = display.getDeviceData();
if (!info.tracking) {
final MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
dialog.setText(shell.getText());
// $NON-NLS-1$
dialog.setMessage("Warning: Device is not tracking resource allocation");
dialog.open();
}
final Object[] newObjects = info.objects;
final Error[] newErrors = info.errors;
final Object[] diffObjects = new Object[newObjects.length];
final Error[] diffErrors = new Error[newErrors.length];
int count = 0;
for (int i = 0; i < newObjects.length; i++) {
int index = 0;
while (index < oldObjects.length) {
if (newObjects[i] == oldObjects[index]) {
break;
}
index++;
}
if (index == oldObjects.length) {
diffObjects[count] = newObjects[i];
diffErrors[count] = newErrors[i];
count++;
}
}
objects = new Object[count];
errors = new Error[count];
System.arraycopy(diffObjects, 0, objects, 0, count);
System.arraycopy(diffErrors, 0, errors, 0, count);
list.removeAll();
// $NON-NLS-1$
text.setText("");
canvas.redraw();
if (traceFileName != null) {
writeTraceFile(count);
}
for (final Object object : objects) {
list.add(objectName(object));
}
refreshLabel();
layout();
}
Aggregations