public static void main (String [] args) { DeviceData data = new DeviceData(); data.tracking = true; Display display = new Display (data); Sleak sleak = new Sleak (); sleak.open (); // Launch your application here SwtAppleCommander ac = new SwtAppleCommander(); ac.launch(display); // End of AC code... while (!sleak.shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }
public static void main(String[] args) { DeviceData data = new DeviceData(); data.tracking = true; Display display = new Display(data); Sleak sleak = new Sleak(); sleak.open(); Example1.main(display, new String[0]); Example1.dispose(); Example1.main(display, new String[0]); Example1.dispose(); Example1.main(display, new String[0]); Example1.dispose(); Example1.main(display, new String[0]); sleak.loop(); }
void refreshDifference () { DeviceData info = display.getDeviceData (); if (!info.tracking) { MessageBox dialog = new MessageBox (shell, SWT.ICON_WARNING | SWT.OK); dialog.setText (shell.getText ()); dialog.setMessage ("Warning: Device is not tracking resource allocation"); //$NON-NLS-1$ dialog.open (); } Object [] newObjects = info.objects; Error [] newErrors = info.errors; Object [] diffObjects = new Object [newObjects.length]; 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 (); text.setText (""); //$NON-NLS-1$ canvas.redraw (); for (int i=0; i<objects.length; i++) { list.add (objectName (objects [i])); } refreshLabel (); layout (); }
public static void main(String[] args) throws Exception { 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(); // Launch your application here // e.g. // DocPageViewer.main(null); TrpMainWidget.show(display); // Shell shell = new Shell(display); // Button button1 = new Button(shell, SWT.PUSH); // button1.setBounds(10, 10, 100, 50); // button1.setText("Hello World"); // Image image = new Image(display, 20, 20); // Button button2 = new Button(shell, SWT.PUSH); // button2.setBounds(10, 70, 100, 50); // button2.setImage(image); // shell.open(); // while (!shell.isDisposed ()) { // if (!display.readAndDispatch ()) display.sleep (); // } // display.dispose (); }
public static void show() { ProgramInfo info = new ProgramInfo(); Display.setAppName(info.getName()); Display.setAppVersion(info.getVersion()); DeviceData data = new DeviceData(); data.tracking = shouldITrack(); logger.info("resource tracking = "+data.tracking); Display display = new Display(data); show(display); }
public static void main(String[] args) { DeviceData data = new DeviceData(); data.tracking = true; Display display = new Display(data); Shell shell = new Shell(display); shell.open(); // String fn = Display.getCurrent().getSystemFont().getFontData()[0].getName(); // System.out.println(fn); // if (true) // return; // run the event loop as long as the window is open while (!shell.isDisposed()) { // read the next OS event queue and transfer it to a SWT event if (!display.readAndDispatch()) { try { SWTUtil.testHandleLimit((int)1e6); } catch (Exception e) { e.printStackTrace(); } if (true) break; // if there are currently no other OS event to process // sleep until the next OS event is available display.sleep(); } } // disposes all associated windows and their components display.dispose(); System.out.println("--- DONE ---"); }
void refreshDifference() { DeviceData info = display.getDeviceData(); if (!info.tracking) { MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); dialog.setText(shell.getText()); dialog .setMessage("Warning: Device is not tracking resource allocation"); dialog.open(); } Object[] newObjects = info.objects; Error[] newErrors = info.errors; Object[] diffObjects = new Object[newObjects.length]; 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(); text.setText(""); canvas.redraw(); for (int i = 0; i < objects.length; i++) { list.add(objectName(objects[i])); } refreshLabel(); layout(); }
void refreshDifference() { DeviceData info = display.getDeviceData(); if (!info.tracking) { MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); dialog.setText(shell.getText()); dialog.setMessage("Warning: Device is not tracking resource allocation"); dialog.open(); } Object[] newObjects = info.objects; Error[] newErrors = info.errors; Object[] diffObjects = new Object[newObjects.length]; 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(); text.setText(""); canvas.redraw(); for (int i = 0; i < objects.length; i++) { list.add(objectName(objects[i])); } refreshLabel(); layout(); }
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(); // Launch your application here // e.g. // Shell shell = new Shell(display); // Button button1 = new Button(shell, SWT.PUSH); // button1.setBounds(10, 10, 100, 50); // button1.setText("Hello World"); // Image image = new Image(display, 20, 20); // Button button2 = new Button(shell, SWT.PUSH); // button2.setBounds(10, 70, 100, 50); // button2.setImage(image); // shell.open(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }
void refreshDifference () { Display display = canvas.getDisplay(); DeviceData info = display.getDeviceData (); if (!info.tracking) { Shell shell = canvas.getShell(); MessageBox dialog = new MessageBox (shell, SWT.ICON_WARNING | SWT.OK); dialog.setText (shell.getText ()); dialog.setMessage ("Warning: Device is not tracking resource allocation"); dialog.open (); } Object [] newObjects = info.objects; Error [] newErrors = info.errors; Object [] diffObjects = new Object [newObjects.length]; 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 (); text.setText (""); canvas.redraw (); for (int i=0; i<objects.length; i++) { list.add (objects [i].toString()); } refreshLabel (); layout (); }
public static void main(String[] args) { boolean showLeaks = false; if (args.length >= 1 && args[0].equalsIgnoreCase("--show-leaks")) showLeaks = true; DeviceData data = new DeviceData(); data.tracking = showLeaks; Display display = new Display(data); Dance dance = new Dance(); Shell shell = dance.open(display); Pattern pattern = new Pattern(); dance.setPattern(pattern); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if (showLeaks) { Sleak sleak = new Sleak(); sleak.open(); while (!sleak.shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } display.dispose(); }
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(); // Launch your application here // e.g. // Shell shell = new Shell(display); // Button button1 = new Button(shell, SWT.PUSH); // button1.setBounds(10, 10, 100, 50); // button1.setText("Hello World"); // Image image = new Image(display, 20, 20); // Button button2 = new Button(shell, SWT.PUSH); // button2.setBounds(10, 70, 100, 50); // button2.setImage(image); // shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } display.dispose(); }
@Before public void setup() throws Exception { if (Display.getCurrent() != null) Display.getCurrent().dispose(); DeviceData data = new DeviceData(); data.tracking = true; display = new Display(data); shell = new Shell(display); }
void refreshDifference () { DeviceData info = display.getDeviceData (); if (!info.tracking) { MessageBox dialog = new MessageBox (shell, SWT.ICON_WARNING | SWT.OK); dialog.setText (shell.getText ()); dialog.setMessage ("Warning: Device is not tracking resource allocation"); dialog.open (); } Object [] newObjects = info.objects; Error [] newErrors = info.errors; Object [] diffObjects = new Object [newObjects.length]; 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 (); text.setText (""); canvas.redraw (); for (int i=0; i<objects.length; i++) { list.add (objectName (objects [i])); } refreshLabel (); layout (); }
private static Display createDisplay(boolean debug) { Display display; if (debug) { DeviceData data = new DeviceData(); data.tracking = true; display = new Display(data); } else { display = new Display(); } return display; }
public static Map<String, Integer> getAllocatedResourceCounts(final Display display) { HashMap<String, Integer> results = new HashMap<String, Integer>(); DeviceData data = display.getDeviceData(); for (Object object : data.objects) { String name = object.getClass().getCanonicalName(); Integer count = results.get(name); if (count == null) { count = 0; } int c = count.intValue(); c++; results.put(name, c); } return results; }
void refreshDifference() { Display display = canvas.getDisplay(); DeviceData info = display.getDeviceData(); if (!info.tracking) { Shell shell = canvas.getShell(); MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); dialog.setText(shell.getText()); dialog.setMessage("Warning: Device is not tracking resource allocation"); dialog.open(); } Object[] newObjects = info.objects; Error[] newErrors = info.errors; Object[] diffObjects = new Object[newObjects.length]; 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(); text.setText(""); canvas.redraw(); for (int i = 0; i < objects.length; i++) { list.add(objects[i].toString()); } refreshLabel(); layout(); }
@Override public Object start(IApplicationContext context) throws Exception { // // Comment out check until the missing // if (!checkWorkspaceLock(new Shell(PlatformUI.createDisplay(), SWT.ON_TOP))) { // Platform.endSplash(); // return IApplication.EXIT_OK; // } String productName = "Ensemble"; if (Platform.getProduct() != null) productName = Platform.getProduct().getName(); Display.setAppName(productName); Authenticator login = AuthenticationUtil.getAuthenticator(); boolean isAuthenticated = false; if (login != null) { // may need these credentials later credentials = login.getCredentials(); isAuthenticated = login.isAuthenticated(); } else { // Setup the authenticator that gets us through the password check on the website java.net.Authenticator.setDefault(new java.net.Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { Properties properties = CommonPlugin.getDefault().getEnsembleProperties(); String user = properties.getProperty(APACHE_SERVER_USER_PROPERTY, ""); String pass = properties.getProperty(APACHE_SERVER_PASS_PROPERTY, ""); return new PasswordAuthentication(user, pass.toCharArray()); } }); isAuthenticated = true; } Display display = null; String sleakEnabled = EnsembleProperties.getProperty("sleak.enabled"); if (sleakEnabled != null && Boolean.valueOf(sleakEnabled)){ DeviceData data = new DeviceData(); data.tracking = true; display = new Display(data); Sleak sleak = new Sleak(); sleak.open(); } else { display = Display.getDefault(); } PlatformUI.createDisplay(); try { if (isAuthenticated) { WorkbenchAdvisor workbenchAdvisor; try { workbenchAdvisor = MissionExtender.construct(EnsembleWorkbenchAdvisor.class); } catch (ConstructionException e) { trace.warn("couldn't instantiate mission-specific EnsembleWorkbenchAdvisor"); workbenchAdvisor = new EnsembleWorkbenchAdvisor() { @Override public String getInitialWindowPerspectiveId() { return null; } }; } DynamicExtensionUtils.removeIgnoredExtensions(); int returnCode = PlatformUI.createAndRunWorkbench(display, workbenchAdvisor); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } // authentication failed context.applicationRunning(); return IApplication.EXIT_OK; } finally { display.dispose(); } }
static DeviceData checkNull(PrinterData data) { return data; }
/** * This is the main procedure for Spoon. * * @param a * Arguments are available in the "Get System Info" step. */ public static void main(String[] a) throws KettleException { try { // Bootstrap Kettle // // We start Sleak if the VM argument RUN_SLEAK was provided Display display = null; if (System.getProperties().containsKey("SLEAK")) { DeviceData data = new DeviceData(); data.tracking = true; display = new Display(data); Sleak sleak = new Sleak(); sleak.open(); } else { display = new Display(); } // The core plugin types don't know about UI classes. Add them in now // before the PluginRegistry inits. splash = new Splash(display); registerUIPluginObjectTypes(); KettleEnvironment.init(); List<String> args = new ArrayList<String>(java.util.Arrays.asList(a)); CommandLineOption[] commandLineOptions = getCommandLineArgs(args); initLogging(commandLineOptions); PropsUI.init(display, Props.TYPE_PROPERTIES_SPOON); CentralLogStore.init( PropsUI.getInstance().getMaxNrLinesInLog(), PropsUI.getInstance().getMaxLogLineTimeoutMinutes()); // remember... staticSpoon = new Spoon(display); staticSpoon.init(null); SpoonFactory.setSpoonInstance(staticSpoon); staticSpoon.setDestroy(true); GUIFactory.setThreadDialogs(new ThreadGuiResources()); // listeners // try { staticSpoon.lifecycleSupport.onStart(staticSpoon); } catch (LifecycleException e) { // if severe, we have to quit MessageBox box = new MessageBox(staticSpoon.shell, (e.isSevere() ? SWT.ICON_ERROR : SWT.ICON_WARNING) | SWT.OK); box.setMessage(e.getMessage()); box.open(); } staticSpoon.setArguments(args.toArray(new String[args.size()])); staticSpoon.start(commandLineOptions); } catch (Throwable t) { // avoid calls to Messages i18n method getString() in this block // We do this to (hopefully) also catch Out of Memory Exceptions // t.printStackTrace(); if (staticSpoon != null) { log.logError("Fatal error : " + Const.NVL(t.toString(), Const.NVL(t.getMessage(), "Unknown error"))); //$NON-NLS-1$ //$NON-NLS-2$ log.logError(Const.getStackTracker(t)); } } // Kill all remaining things in this VM! System.exit(0); }
void refreshDifference() { DeviceData info = display.getDeviceData(); if (!info.tracking) { MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); dialog.setText(shell.getText()); dialog.setMessage( "Warning: Device is not tracking resource allocation"); dialog.open(); } Object[] newObjects = info.objects; Error[] newErrors = info.errors; Object[] diffObjects = new Object[newObjects.length]; 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(); text.setText(""); canvas.redraw(); for (int i = 0; i < objects.length; i++) { list.add(objectName(objects[i])); } refreshLabel(); layout(); }
void refreshDifference() { Display display = canvas.getDisplay(); DeviceData info = display.getDeviceData(); if ( !info.tracking ) { Shell shell = canvas.getShell(); MessageBox dialog = new MessageBox( shell, SWT.ICON_WARNING | SWT.OK ); dialog.setText( shell.getText() ); dialog.setMessage( "Warning: Device is not tracking resource allocation" ); dialog.open(); } Object[] newObjects = info.objects; Error[] newErrors = info.errors; Object[] diffObjects = new Object[newObjects.length]; 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(); text.setText( "" ); canvas.redraw(); for ( int i = 0; i < objects.length; i++ ) { list.add( objects[i].toString() ); } refreshLabel(); layout(); }
@Before public void setUp() throws Exception { DeviceData data = new DeviceData(); data.tracking = true; display = new Display(data); }
/** * Creates the device in the operating system. If the device does not have a * handle, this method may do nothing depending on the device. * <p> * This method is called before <code>init</code>. * </p> * * @param data * the DeviceData which describes the receiver * * @see #init */ protected void create(DeviceData data) { // checkSubclass(); // checkDisplay(thread = Thread.currentThread(), false); // createDisplay(data); // register(this); // if (Default == null) // Default = this; }
/** * Creates the printer handle. This method is called internally by the * instance creation mechanism of the <code>Device</code> class. * * @param deviceData * the device data */ protected void create(DeviceData deviceData) { }
/** * Constructs a new instance of this class using the parameter. * * @param data * the device data */ public Display(DeviceData data) { super(data); }