org.eclipse.ui.actions.NewProjectAction Java Examples

The following examples show how to use org.eclipse.ui.actions.NewProjectAction. 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: AbstractOpenWizardAction.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the new project dialog if the workspace is empty. This method is
 * called on {@link #run()}.
 * 
 * @param shell the shell to use
 * @return returns <code>true</code> when a project has been created, or
 *         <code>false</code> when the new project has been canceled.
 */
protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell shell) {
  IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
  if (workspaceRoot.getProjects().length == 0) {
    String title = NewWizardMessages.AbstractOpenWizardAction_noproject_title;
    String message = NewWizardMessages.AbstractOpenWizardAction_noproject_message;
    if (MessageDialog.openQuestion(shell, title, message)) {
      new NewProjectAction().run();
      return workspaceRoot.getProjects().length != 0;
    }
    return false;
  }
  return true;
}
 
Example #2
Source File: AbstractOpenWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the new project dialog if the workspace is empty. This method is called on {@link #run()}.
 * @param shell the shell to use
 * @return returns <code>true</code> when a project has been created, or <code>false</code> when the
 * new project has been canceled.
 */
protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell shell) {
	IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
	if (workspaceRoot.getProjects().length == 0) {
		String title= NewWizardMessages.AbstractOpenWizardAction_noproject_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_noproject_message;
		if (MessageDialog.openQuestion(shell, title, message)) {
			new NewProjectAction().run();
			return workspaceRoot.getProjects().length != 0;
		}
		return false;
	}
	return true;
}
 
Example #3
Source File: OpenTypeAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the new project dialog if the workspace is empty.
 * @param parent the parent shell
 * @return returns <code>true</code> when a project has been created, or <code>false</code> when the
 * new project has been canceled.
 */
protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell parent) {
	IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
	if (workspaceRoot.getProjects().length == 0) {
		String title= JavaUIMessages.OpenTypeAction_dialogTitle;
		String message= JavaUIMessages.OpenTypeAction_createProjectFirst;
		if (MessageDialog.openQuestion(parent, title, message)) {
			new NewProjectAction().run();
			return workspaceRoot.getProjects().length != 0;
		}
		return false;
	}
	return true;
}
 
Example #4
Source File: WizardUtils.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Runs the {@link NewProjectAction} in the SWT thread in order to create a new project wizard.
 */
public static void openNewProjectWizard() {
  SWTUtils.runSafeSWTSync(
      log,
      new Runnable() {
        @Override
        public void run() {
          IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
          NewProjectAction newProjectAction = new NewProjectAction(window);
          newProjectAction.run();
        }
      });
}