本文整理匯總了Java中org.eclipse.ui.internal.ide.ChooseWorkspaceDialog類的典型用法代碼示例。如果您正苦於以下問題:Java ChooseWorkspaceDialog類的具體用法?Java ChooseWorkspaceDialog怎麽用?Java ChooseWorkspaceDialog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ChooseWorkspaceDialog類屬於org.eclipse.ui.internal.ide包,在下文中一共展示了ChooseWorkspaceDialog類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog; //導入依賴的package包/類
@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();
}
}
示例2: start
import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog; //導入依賴的package包/類
@SuppressWarnings("deprecation")
public Object start(IApplicationContext appContext) throws Exception
{
Display display = createDisplay();
// processor must be created before we start event loop
DelayedEventsProcessor processor = new DelayedEventsProcessor(display);
try
{
// look and see if there's a splash shell we can parent off of
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(Dialog.getDefaultImages());
}
Object instanceLocationCheck =
checkInstanceLocation(shell, appContext.getArguments());
if (instanceLocationCheck != null)
{
WorkbenchPlugin.unsetSplashShell(display);
Platform.endSplash();
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()
int returnCode =
PlatformUI.createAndRunWorkbench(display, new IDEWorkbenchAdvisor(
processor));
// 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();
}
Location instanceLoc = Platform.getInstanceLocation();
if (instanceLoc != null)
{
instanceLoc.release();
}
}
}
示例3: promptForWorkspace
import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog; //導入依賴的package包/類
/**
* Open a workspace selection dialog on the argument shell, populating the argument data with the
* user's selection. Perform first level validation on the selection by comparing the version
* information. This method does not examine the runtime state (e.g., is the workspace already
* locked?).
*
* @param shell
* @param launchData
* @param force
* setting to true makes the dialog open regardless of the showDialog value
* @return An URL storing the selected workspace or null if the user has canceled the launch
* operation.
*/
private URL promptForWorkspace(Shell shell, ChooseWorkspaceData launchData,
boolean force)
{
URL url = null;
do
{
// okay to use the shell now - this is the splash shell
new ChooseWorkspaceDialog(shell, launchData, false, true).prompt(force);
String instancePath = launchData.getSelection();
if (instancePath == null)
{
return null;
}
// the dialog is not forced on the first iteration, but is on every
// subsequent one -- if there was an error then the user needs to be
// allowed to fix it
force = true;
// 70576: don't accept empty input
if (instancePath.length() <= 0)
{
MessageDialog.openError(shell,
IDEWorkbenchMessages.IDEApplication_workspaceEmptyTitle,
IDEWorkbenchMessages.IDEApplication_workspaceEmptyMessage);
continue;
}
// create the workspace if it does not already exist
File workspace = new File(instancePath);
if (!workspace.exists())
{
workspace.mkdir();
}
try
{
// Don't use File.toURL() since it adds a leading slash that Platform does not
// handle properly. See bug 54081 for more details.
String path =
workspace.getAbsolutePath().replace(File.separatorChar, '/');
url = new URL("file", null, path); //$NON-NLS-1$
}
catch (MalformedURLException e)
{
MessageDialog.openError(shell,
IDEWorkbenchMessages.IDEApplication_workspaceInvalidTitle,
IDEWorkbenchMessages.IDEApplication_workspaceInvalidMessage);
continue;
}
}
while (!checkValidWorkspace(shell, url));
return url;
}