Ejemplo n.º 1
0
  /** User clicks Finish */
  @Override
  public boolean performFinish() {
    try {
      // Create file object
      IFile file = doCreateNew(new NullProgressMonitor());
      if (file == null) {
        // that's ok, as it just didn't create a file (but maybe a folder)...
        return true;
      }

      // Scroll to file in package explorer
      BasicNewResourceWizard.selectAndReveal(file, workbench.getActiveWorkbenchWindow());

      // Open editor on new file.
      IWorkbenchWindow dw = workbench.getActiveWorkbenchWindow();
      try {
        if (dw != null) {
          IWorkbenchPage page = dw.getActivePage();
          if (page != null) {
            IEditorPart openEditor = IDE.openEditor(page, file, true);
            afterEditorCreated(openEditor);
          }
        }
      } catch (PartInitException e) {
        Log.log(e);
        return false;
      }
    } catch (Exception e) {
      Log.log(e);
      return false;
    }
    return true;
  }
Ejemplo n.º 2
0
 /** @see org.eclipse.jface.wizard.IWizard#addPages() */
 public void addPages() {
   super.addPages();
   mainPage = new Page(); // $NON-NLS-1$
   mainPage.setTitle("New Clojure " + kind(false));
   mainPage.setDescription("Create new top-level Clojure " + kind(true));
   addPage(mainPage);
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.wizard.Wizard#addPages()
   */
  @Override
  public void addPages() {
    super.addPages();
    mainPage = new NewConfigFileCreationWizardPage(getSelection(), this);
    addPage(mainPage);

    optionsPage = new NewConfigFileOptionsWizardPage();
    addPage(optionsPage);
  }
  /** Do the work after everything is specified. */
  @Override
  public boolean performFinish() {
    modelFile = newFileCreationPage.createNewFile();
    if (modelFile == null) {
      return false;
    }

    BasicNewResourceWizard.selectAndReveal(modelFile, workbench.getActiveWorkbenchWindow());

    return true;
  }
Ejemplo n.º 5
0
  /**
   * Add pages to the wizard.<br>
   * By default, we don't add the reference page to the base Web Project (subclasses may override).
   *
   * @see org.eclipse.jface.wizard.Wizard#addPages()
   */
  @Override
  public void addPages() {
    super.addPages();

    TemplateType[] templateTypes = getProjectTemplateTypes();
    validateProjectTemplate(templateTypes);

    LinkedHashMap<String, IStepIndicatorWizardPage> stepPages =
        new LinkedHashMap<String, IStepIndicatorWizardPage>();

    // Add the template selection page
    List<IProjectTemplate> templates =
        ProjectsPlugin.getDefault().getTemplatesManager().getTemplates(templateTypes);
    if (hasNonDefaultTemplates(templates) && selectedTemplate == null) {
      addPage(
          templatesPage =
              new ProjectTemplateSelectionPage(TEMPLATE_SELECTION_PAGE_NAME, templates));
      stepPages.put(templatesPage.getStepName(), templatesPage);
    }

    // Add the main page where we set up the project name/location
    addPage(mainPage = createMainPage());
    if (mainPage instanceof IStepIndicatorWizardPage) {
      stepPages.put(
          ((IStepIndicatorWizardPage) mainPage).getStepName(), (IStepIndicatorWizardPage) mainPage);
    }

    // Add contributed pages
    ProjectWizardContributionManager projectWizardContributionManager =
        ProjectsPlugin.getDefault().getProjectWizardContributionManager();
    IWizardPage[] extraPages =
        projectWizardContributionManager.createPages(data, getProjectNatures());
    if (!ArrayUtil.isEmpty(extraPages)) {
      for (IWizardPage page : extraPages) {
        addPage(page);
        if (page instanceof IStepIndicatorWizardPage) {
          stepPages.put(
              ((IStepIndicatorWizardPage) page).getStepName(), (IStepIndicatorWizardPage) page);
        }
      }
    }

    // Set up the steps
    stepNames = stepPages.keySet().toArray(new String[stepPages.size()]);
    if (stepNames.length > 1) {
      for (IStepIndicatorWizardPage page : stepPages.values()) {
        page.initStepIndicator(stepNames);
      }
    }

    // Finalize pages using contributors
    projectWizardContributionManager.finalizeWizardPages(getPages(), getProjectNatures());
  }
  @Override
  public void addPages() {
    super.addPages();

    mainPage =
        new WizardNewProjectCreationPage("basicNewProjectPage") // $NON-NLS-1$
        {

          @Override
          public void createControl(Composite parent) {
            super.createControl(parent);
            validatePage();
          }

          @Override
          protected boolean validatePage() {
            boolean valid = super.validatePage();
            if (!valid) {
              return false;
            }

            // Check if there's already a directory/files at the destination
            IPath location = getLocationPath();
            if (useDefaults()) {
              // needs to append the project name since getLocationPath() returns the workspace path
              // in this case
              location = location.append(getProjectName());
            }

            File file = location.toFile();
            if (file.exists()) {
              setMessage(Messages.NewSampleProjectWizard_LocationExistsMessage, WARNING);
              return true;
            }

            setErrorMessage(null);
            setMessage(null);
            return true;
          }
        };
    mainPage.setTitle(Messages.NewSampleProjectWizard_ProjectPage_Title);
    mainPage.setDescription(Messages.NewSampleProjectWizard_ProjectPage_Description);
    addPage(mainPage);

    String name = sample.getName();
    if (name != null) {
      mainPage.setInitialProjectName(name);
    }
  }
Ejemplo n.º 7
0
  public boolean performFinish() {
    try {

      wizardPage.createType(null);
      IResource resource = wizardPage.getModifiedResource();
      BasicNewResourceWizard.selectAndReveal(resource, workbench.getActiveWorkbenchWindow());
      openResource((IFile) resource);
      BasicNewProjectResourceWizard.updatePerspective(config);

    } catch (Exception e) {
      Activator.logException(e);
      MessageDialog.openError(
          getShell(), "Error", "Error creating GWT Module. See log file for more details.");
    }
    return true;
  }
Ejemplo n.º 8
0
  @Override
  protected void execute(final IProgressMonitor monitor)
      throws CoreException, InvocationTargetException, InterruptedException {
    SubMonitor subMonitor =
        SubMonitor.convert(monitor, getCreateModelProjectMessage(), getMonitorTicks());

    IProject project = createDslProject(subMonitor.newChild(1));
    createDslUiProject(subMonitor.newChild(1));

    if (getXtextProjectInfo().isCreateTestProject()) {
      createTestProject(subMonitor.newChild(1));
    }
    if (getXtextProjectInfo().isCreateFeatureProject()) {
      createFeatureProject(subMonitor.newChild(1));
    }

    IFile dslGrammarFile =
        project.getFile(getModelFolderName() + "/" + getXtextProjectInfo().getGrammarFilePath());
    BasicNewResourceWizard.selectAndReveal(
        dslGrammarFile, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
    setResult(dslGrammarFile);
  }
  public boolean performFinish() {
    boolean result = true;
    mainPage.commit();

    context.setServletVersion("2.4"); // $NON-NLS-1$
    if (!context.isServletVersionConsistentToWebXML()) {
      context.setServletVersion("2.3"); // $NON-NLS-1$
    }

    IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(createOperation());
    try {
      getContainer().run(false, true, op);
    } catch (InvocationTargetException e) {
      WebUiPlugin.getPluginLog().logError(e);
    } catch (InterruptedException e) {
      WebUiPlugin.getPluginLog().logError(e);
    }
    updatePerspective();
    BasicNewResourceWizard.selectAndReveal(
        context.getProjectHandle(),
        ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow());
    return result;
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.ui.wizards.newresource.BasicNewResourceWizard#init(org
  * .eclipse.ui.IWorkbench,
  * org.eclipse.jface.viewers.IStructuredSelection)
  */
 @Override
 public void init(final IWorkbench workbench, final IStructuredSelection currentSelection) {
   super.init(workbench, currentSelection);
   setNeedsProgressMonitor(true);
   setWindowTitle(WIZARD_TITLE);
 }
Ejemplo n.º 11
0
 protected void selectAndReveal(IResource newResource) {
   BasicNewResourceWizard.selectAndReveal(newResource, workbench.getActiveWorkbenchWindow());
 }
Ejemplo n.º 12
0
 protected void initializeDefaultPageImageDescriptor() {
   super.initializeDefaultPageImageDescriptor();
 }
Ejemplo n.º 13
0
 /**
  * Selects and reveals the newly added resource in all parts of the active workbench window's
  * active page.
  *
  * @see ISetSelectionTarget
  */
 public static void selectAndReveal(IResource newResource) {
   BasicNewResourceWizard.selectAndReveal(
       newResource, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
 }
Ejemplo n.º 14
0
  @Override
  public void init(final IWorkbench workbench, final IStructuredSelection currentSelection) {

    super.init(workbench, currentSelection);
    setWindowTitle(Messages.getString("NewDocumentWizard.title")); // $NON-NLS-1$
  }
 @Override
 public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
   super.init(workbench, currentSelection);
   setNeedsProgressMonitor(true);
   setWindowTitle(Messages.NewSampleProjectWizard_Title);
 }
Ejemplo n.º 16
0
 public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
   super.init(workbench, currentSelection);
   setWindowTitle("New Clojure  " + kind(false));
   setNeedsProgressMonitor(false);
 }
Ejemplo n.º 17
0
 /*
  * (non-Javadoc)
  * @see org.eclipse.ui.wizards.newresource.BasicNewResourceWizard#init(org.eclipse.ui.IWorkbench,
  * org.eclipse.jface.viewers.IStructuredSelection)
  */
 @Override
 public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
   super.init(workbench, currentSelection);
   setNeedsProgressMonitor(true);
 }
 private void openFile(IProgressMonitor monitor, IFile fileToOpen) {
   monitor.setTaskName("Opening file for editing...");
   BasicNewResourceWizard.selectAndReveal(
       fileToOpen, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
   EclipseHelper.openFileToEdit(getShell(), fileToOpen);
 }