Java Code Examples for org.eclipse.swt.widgets.Display#setAppName()

The following examples show how to use org.eclipse.swt.widgets.Display#setAppName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OsHelper.java    From hop with Apache License 2.0 5 votes vote down vote up
public static boolean setAppName() {

    if ( isMac() ) {
      // Sets the app name in main menu (so it works even when launching
      // from shell script)
      String appName = "Data Integration";
      Display.setAppName( appName );
    }

    return true;
  }
 
Example 2
Source File: Application.java    From gradle-and-eclipse-rcp with Apache License 2.0 5 votes vote down vote up
@Override
public Object start(IApplicationContext context) throws Exception {
	Display.setAppName("RCP Demo");
	Shells.builder(SWT.SHELL_TRIM, AppGui::new)
			.setTitle("RCP Demo")
			.setSize(SwtMisc.scaleByFontHeight(40, 30))
			.openOnDisplayBlocking();
	return IApplication.EXIT_OK;
}
 
Example 3
Source File: OsHelper.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static boolean setAppName() {

    if ( isMac() ) {
      // Sets the app name in main menu (so it works even when launching
      // from shell script)
      String appName = "Data Integration";
      Display.setAppName( appName );
    }

    return true;
  }
 
Example 4
Source File: SWTApplication.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static Display createDisplay(String name) {
	Display.setAppName(name);
	
	return new Display();
}
 
Example 5
Source File: Application.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Object start(final IApplicationContext context) throws Exception {

	Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
		if ( e instanceof OutOfMemoryError ) {
			final boolean close = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Out of memory",
				"GAMA is out of memory and will likely crash. Do you want to close now ?");
			if ( close ) {
				this.stop();
			}
			e.printStackTrace();
		}

	});
	Display.setAppName("Gama Platform");
	Display.setAppVersion("1.8.1");
	// DEBUG.OUT(System.getProperties());
	createProcessor();
	final Object check = checkWorkspace();
	if ( EXIT_OK.equals(check) ) { return EXIT_OK; }
	// if ( check == EXIT_RESTART ) {
	// ClearWorkspace(true);
	// No need to restart : the value will be checked later
	// return EXIT_RESTART;
	// }
	Display display = null;
	try {
		display = Display.getDefault();
		checkWorkbenchXMI();
		// final String splash = getProperty("org.eclipse.equinox.launcher.splash.location");
		// if ( splash != null ) {
		// setProperty("org.eclipse.equinox.launcher.splash.location", splash.replace("bmp", "png"));
		// }
		final int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if ( returnCode == PlatformUI.RETURN_RESTART ) { return IApplication.EXIT_RESTART; }
		return IApplication.EXIT_OK;
	} finally {
		if ( display != null ) {
			display.dispose();
		}
		final Location instanceLoc = Platform.getInstanceLocation();
		if ( instanceLoc != null ) {
			instanceLoc.release();
		}
	}

}
 
Example 6
Source File: MainSWT.java    From Flashtool with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Open the window.
 */
public void open() {
	if (GlobalConfig.getProperty("gitauto")==null) GlobalConfig.setProperty("gitauto", "true");
	Display.setAppName("Flashtool");
	Display display = Display.getDefault();
	GlobalConfig.setProperty("clientheight", Integer.toString(display.getClientArea().height));
	GlobalConfig.setProperty("clientwidth", Integer.toString(display.getClientArea().width));
	GlobalConfig.setProperty("ydpi", Integer.toString(display.getDPI().y));
	GlobalConfig.setProperty("xdpi", Integer.toString(display.getDPI().x));
	createContents();
	guimode=true;
	shlSonyericsson.open();
	shlSonyericsson.layout();
	boolean folderexists = (new File(OS.getWorkDir()+File.separator+"firmwares").exists() || new File(OS.getWorkDir()+File.separator+"custom"+File.separator+"mydevices").exists());
	if (folderexists) {
		HomeSelector hs = new HomeSelector(shlSonyericsson,SWT.PRIMARY_MODAL | SWT.SHEET);
		String result = (String)hs.open(false);
		GlobalConfig.setProperty("user.flashtool", result);
		forceMove(OS.getWorkDir()+File.separator+"firmwares",OS.getFolderFirmwares());
		forceMove(OS.getWorkDir()+File.separator+"custom"+File.separator+"mydevices",OS.getFolderRegisteredDevices());
		new File(OS.getWorkDir()+File.separator+"firmwares").delete();
		new File(OS.getWorkDir()+File.separator+"custom"+File.separator+"mydevices").delete();
	}
	if (GlobalConfig.getProperty("gitauto").equals("true")) {
		WaitForDevicesSync sync = new WaitForDevicesSync(shlSonyericsson,SWT.PRIMARY_MODAL | SWT.SHEET);
		sync.open();
	}
	WidgetTask.setEnabled(mntmAdvanced,GlobalConfig.getProperty("devfeatures").equals("yes"));
	StatusListener phoneStatus = new StatusListener() {
		public void statusChanged(StatusEvent e) {
			if (!e.isDriverOk()) {
				logger.error("Drivers need to be installed for connected device.");
				logger.error("You can find them in the drivers folder of Flashtool.");
			}
			else {
				if (e.getNew().equals("adb_unauthorized")) {
					logger.info("Unauthorized device connected with USB debugging on");
					logger.info("Check the device to accept the authorization");
				}
				if (e.getNew().equals("adb")) {
					logger.info("Device connected with USB debugging on");
					logger.debug("Device connected, continuing with identification");
					doIdent();
				}
				if (e.getNew().equals("none")) {
					logger.info("Device disconnected");
					doDisableIdent();
				}
				if (e.getNew().equals("flash")) {
					logger.info("Device connected in flash mode");
					doDisableIdent();
				}
				if (e.getNew().equals("flash_obsolete")) {
					logger.error("Device connected in flash mode but driver is too old");
					doDisableIdent();
				}
				if (e.getNew().equals("fastboot")) {
					logger.info("Device connected in fastboot mode");
					doDisableIdent();
				}
				if (e.getNew().equals("normal")) {
					logger.info("Device connected with USB debugging off");
					logger.info("For 2011 devices line, be sure you are not in MTP mode");
					doDisableIdent();
				}
			}
		}
	};
	killAdbandFastboot();
	Devices.load();
	logger.info("Starting phone detection");
	DeviceChangedListener.starts(phoneStatus);
	//phoneWatchdog = new AdbPhoneThread();
	//phoneWatchdog.start();
	//phoneWatchdog.addStatusListener(phoneStatus);
	while (!shlSonyericsson.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}