org.eclipse.ui.PlatformUI#RETURN_RESTART源码实例Demo

下面列出了org.eclipse.ui.PlatformUI#RETURN_RESTART 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: neoscada   文件: Application.java
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
    final Display display = PlatformUI.createDisplay ();
    try
    {
        final int returnCode = PlatformUI.createAndRunWorkbench ( display, new ApplicationWorkbenchAdvisor () );
        if ( returnCode == PlatformUI.RETURN_RESTART )
        {
            return IApplication.EXIT_RESTART;
        }
        else
        {
            return IApplication.EXIT_OK;
        }
    }
    finally
    {
        display.dispose ();
    }

}
 
源代码2 项目: olca-app   文件: RcpApplication.java
@Override
public Object start(final IApplicationContext context) throws Exception {
	Object result = null;
	Display display = PlatformUI.createDisplay();
	try {
		final int returnCode = PlatformUI.createAndRunWorkbench(display,
				new RcpWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			result = IApplication.EXIT_RESTART;
		} else {
			result = IApplication.EXIT_OK;
		}
	} finally {
		display.dispose();
	}
	return result;
}
 
源代码3 项目: orion.server   文件: Application.java
public Object start(IApplicationContext context) {

		Display display = PlatformUI.createDisplay();

		display.asyncExec(new Runnable() {
			public void run() {
				launchOrionApplication();
				new OSGiConsoleFactory().openConsole();
			}
		});
		try {
			int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
			if (returnCode == PlatformUI.RETURN_RESTART) {
				return IApplication.EXIT_RESTART;
			}
			return IApplication.EXIT_OK;
		} finally {
			display.dispose();
		}
	}
 
源代码4 项目: translationstudio8   文件: Application.java
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		PreferenceUtil.initProductEdition();

		deleteErrorMemoryInfo();

		initSystemLan();
		PreferenceUtil.checkCleanValue();
		int returnCode = PlatformUI.createAndRunWorkbench(display,
				new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
源代码5 项目: tmxeditor8   文件: Application.java
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		PreferenceUtil.initProductEdition();
		if (!PreferenceUtil.checkEdition()) {
			MessageDialog.openInformation(display.getActiveShell(), Messages.getString("dialog.AboutDialog.msgTitle"),
					Messages.getString("dialog.AboutDialog.msg"));
			return IApplication.EXIT_OK;
		}
		initSystemLan();
		SystemResourceUtil.beforeload();
		PreferenceUtil.checkCleanValue();
		deleteErrorMemoryFile();
		int returnCode = PlatformUI.createAndRunWorkbench(display,
				new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
源代码6 项目: birt   文件: DesignerApplication.java
/**
 * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
 */
public Object run( Object args ) throws Exception
{
	Display display = PlatformUI.createDisplay( );
	TrayDialog.setDialogHelpAvailable( true );
	try
	{
		int code = PlatformUI.createAndRunWorkbench( display,
				new DesignerWorkbenchAdvisor( ) );
		// exit the application with an appropriate return code
		return code == PlatformUI.RETURN_RESTART ? EXIT_RESTART : EXIT_OK;
	}
	finally
	{
		if ( display != null )
			display.dispose( );
	}
}
 
源代码7 项目: MergeProcessor   文件: Application.java
/**
 * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
 */
@Override
public Object start(IApplicationContext context) throws Exception {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART)
			return IApplication.EXIT_RESTART;
		else
			return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}

}
 
源代码8 项目: nebula   文件: ExamplesApplication.java
@Override
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
源代码9 项目: neoscada   文件: Application.java
public Object start(IApplicationContext context) throws Exception {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART)
			return IApplication.EXIT_RESTART;
		else
			return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
	
}
 
源代码10 项目: depan   文件: Application.java
@Override
public Object start(IApplicationContext context) throws Exception {
  Display display = PlatformUI.createDisplay();

  try {
    int returnCode = PlatformUI.createAndRunWorkbench(
        display, new ApplicationWorkbenchAdvisor());
    if (returnCode == PlatformUI.RETURN_RESTART) {
      return IApplication.EXIT_RESTART;
    }
    return IApplication.EXIT_OK;
  } finally {
    display.dispose();
  }
}
 
源代码11 项目: slr-toolkit   文件: Application.java
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
源代码12 项目: translationstudio8   文件: Application.java
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
源代码13 项目: codeexamples-eclipse   文件: Application.java
@Override
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
源代码14 项目: tmxeditor8   文件: Application.java
public Object start(IApplicationContext context) throws Exception {
	OpenDocumentEventProcessor openDocProcessor = new OpenDocumentEventProcessor();

	Display display = PlatformUI.createDisplay();
	display.addListener(SWT.OpenDocument, openDocProcessor);

	try {
		IProduct product = Platform.getProduct();
		String id = product.getId();
		String hsVersion = "";
		if (id.equals("net.heartsome.cat.te.tmx_editor_product")) {
			hsVersion = "F";
		}
		System.getProperties().put("TSVersion", "88");
		System.getProperties().put("TSEdition", hsVersion);

		String versionDate = System.getProperty("date", "");
		String version = System.getProperty("version", "");
		System.getProperties().put("TSVersionDate", version + "." + versionDate);
		checkCleanValue();

		int returnCode = PlatformUI.createAndRunWorkbench(display,
				new ApplicationWorkbenchAdvisor(openDocProcessor));
		if (returnCode == PlatformUI.RETURN_RESTART)
			return IApplication.EXIT_RESTART;
		else
			return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}

}
 
源代码15 项目: tmxeditor8   文件: Application.java
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
源代码16 项目: jbt   文件: Application.java
public Object start(IApplicationContext context) throws Exception {
	Display display = PlatformUI.createDisplay();

	/*
	 * Before doing anything at all, standard nodes must be loaded. If they
	 * cannot be loaded, the application will not start.
	 */
	try {
		NodesLoader.loadStandardNodes();
		ApplicationIcons.loadIcons();
	} catch (Exception e) {
		StandardDialogs
				.exceptionDialog(
						"Could not start application",
						"There were errors while loading the set of standard nodes",
						e);
		return IApplication.EXIT_OK;
	}

	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display,
				new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART)
			return IApplication.EXIT_RESTART;
		else
			return IApplication.EXIT_OK;
	} finally {
		/* Dispose loaded icons. */
		ApplicationIcons.disposeIcons();
		display.dispose();
	}

}
 
源代码17 项目: bonita-studio   文件: BonitaStudioApplication.java
protected Object createAndRunWorkbench(final Display display) {
    try {
        final int returnCode = PlatformUI.createAndRunWorkbench(display, createWorkbenchAdvisor());
        if (returnCode == PlatformUI.RETURN_RESTART) {
            return IApplication.EXIT_RESTART;
        }
        return IApplication.EXIT_OK;
    } finally {
        display.dispose();
    }
}
 
源代码18 项目: n4js   文件: N4JSApplication.java
@Override
public Object start(final IApplicationContext appContext) throws Exception {
	final Display display = createDisplay();

	try {

		// look and see if there's a splash shell we can parent off of
		final Shell shell = WorkbenchPlugin.getSplashShell(display);
		if (shell != null) {
			// should should set the icon and message for this shell to be the
			// same as the chooser dialog - this will be the guy that lives in
			// the task bar and without these calls you'd have the default icon
			// with no message.
			shell.setText(ChooseWorkspaceDialog.getWindowTitle());
			shell.setImages(Window.getDefaultImages());
		}

		final Object instanceLocationCheck = checkInstanceLocation(shell, appContext.getArguments());
		if (instanceLocationCheck != null) {
			WorkbenchPlugin.unsetSplashShell(display);
			appContext.applicationRunning();
			return instanceLocationCheck;
		}

		// create the workbench with this advisor and run it until it exits
		// N.B. createWorkbench remembers the advisor, and also registers
		// the workbench globally so that all UI plug-ins can find it using
		// PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench()
		final int returnCode = createAndRunWorkbench(display, new N4JSApplicationWorkbenchAdvisor());

		// the workbench doesn't support relaunch yet (bug 61809) so
		// for now restart is used, and exit data properties are checked
		// here to substitute in the relaunch return code if needed
		if (returnCode != PlatformUI.RETURN_RESTART) {
			return EXIT_OK;
		}

		// if the exit code property has been set to the relaunch code, then
		// return that code now, otherwise this is a normal restart
		return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH
				: EXIT_RESTART;
	} finally {
		if (display != null) {
			display.dispose();
		}
		final Location instanceLoc = Platform.getInstanceLocation();
		if (instanceLoc != null)
			instanceLoc.release();
	}
}
 
源代码19 项目: tracecompass   文件: Application.java
@Override
public Object start(IApplicationContext context) throws Exception {
    Display display = PlatformUI.createDisplay();
    try {
        // fetch the Location that we will be modifying
        fInstanceLoc = Platform.getInstanceLocation();

        // -data @noDefault in <applName>.ini allows us to set the workspace here.
        // If the user wants to change the location then he has to change
        // @noDefault to a specific location or remove -data @noDefault for
        // default location
        if (!fInstanceLoc.allowsDefault() && !fInstanceLoc.isSet()) {
            File workspaceRoot = new File(TracingRcpPlugin.getWorkspaceRoot());

            if (!workspaceRoot.exists()) {
                MessageDialog.openError(display.getActiveShell(),
                        Messages.Application_WorkspaceCreationError,
                        MessageFormat.format(Messages.Application_WorkspaceRootNotExistError, new Object[] { TracingRcpPlugin.getWorkspaceRoot() }));
                return IApplication.EXIT_OK;
            }

            if (!workspaceRoot.canWrite()) {
                MessageDialog.openError(display.getActiveShell(),
                        Messages.Application_WorkspaceCreationError,
                        MessageFormat.format(Messages.Application_WorkspaceRootPermissionError, new Object[] { TracingRcpPlugin.getWorkspaceRoot() }));
                return IApplication.EXIT_OK;
            }

            String workspace = TracingRcpPlugin.getWorkspaceRoot() + File.separator + TracingRcpPlugin.WORKSPACE_NAME;
            // set location to workspace
            fInstanceLoc.set(new URL("file", null, workspace), false); //$NON-NLS-1$
        }

        /*
         * Execute the early command line options.
         */
        try {
            CliCommandLine cmdLine = CliParserManager.getInstance().parse(Platform.getCommandLineArgs());
            TracingRcpPlugin.getDefault().setCommandLine(cmdLine);
            if (cmdLine != null && CliParserManager.applicationStartup(cmdLine)) {
                return IApplication.EXIT_OK;
            }
        } catch (CliParserException e) {
            TracingRcpPlugin.getDefault().logError("Error parsing command line arguments", e); //$NON-NLS-1$
            return IApplication.EXIT_OK;
        }

        if (!fInstanceLoc.lock()) {
            MessageDialog.openError(display.getActiveShell(),
                    Messages.Application_WorkspaceCreationError,
                    MessageFormat.format(Messages.Application_WorkspaceInUseError, new Object[] { fInstanceLoc.getURL().getPath() }));
            return IApplication.EXIT_OK;
        }

        int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
        if (returnCode == PlatformUI.RETURN_RESTART) {
            return IApplication.EXIT_RESTART;
        }
        return IApplication.EXIT_OK;
    } finally {
        display.dispose();
    }
}
 
源代码20 项目: gama   文件: Application.java
@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();
		}
	}

}