类org.eclipse.ui.actions.NewProjectAction源码实例Demo

下面列出了怎么用org.eclipse.ui.actions.NewProjectAction的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * 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;
}
 
/**
 * 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;
}
 
/**
 * 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;
}
 
源代码4 项目: saros   文件: WizardUtils.java
/**
 * 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();
        }
      });
}
 
 类所在包
 同包方法