/*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
   * .ExecutionEvent)
   */
  public Object execute(ExecutionEvent event) throws ExecutionException {

    LoadModelInstanceWizard wizard;
    WizardDialog dialog;

    ISelection currentSelection;
    IStructuredSelection currentStructuredSelection;

    /* Get the current selection. */
    IWorkbenchWindow window =
        ModelBusUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
    currentSelection = window.getSelectionService().getSelection();

    if (currentSelection instanceof IStructuredSelection) {
      currentStructuredSelection = (IStructuredSelection) currentSelection;
    } else {
      currentStructuredSelection = null;
    }

    /* Initialize and start the depending code gen wizard. */
    wizard = new LoadModelInstanceWizard();
    wizard.init(window.getWorkbench(), currentStructuredSelection);

    /* Instantiates the wizard container with the wizard and opens it. */
    dialog = new WizardDialog(window.getShell(), wizard);
    dialog.create();
    dialog.open();

    return null;
  }
  /** {@inheritDoc} */
  public Object execute(ExecutionEvent event) throws ExecutionException {
    Display current = Display.getCurrent();
    if (current == null) {
      current = Display.getDefault();
    }
    Shell shell = current.getActiveShell();
    if (shell != null) {

      CustomizePropertyViewWizard wizard = new CustomizePropertyViewWizard();
      WizardDialog wd =
          new WizardDialog(shell, wizard) {

            /** {@inheritDoc} */
            @Override
            protected void configureShell(Shell newShell) {
              super.configureShell(newShell);
              newShell.setText("Customize Property View");
            }
          };
      wd.create();
      // wd.getShell().setSize(640, 600);
      wd.open();
    } else {
      Activator.log.error("impossible to find a shell to open the message dialog", null);
    }

    return null;
  }
  @Deprecated
  public void promptToAddQuery(TaskRepository taskRepository) {
    IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
    if (!preferenceStore.getBoolean(PREF_ADD_QUERY)) {
      Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
      MessageDialogWithToggle messageDialog =
          MessageDialogWithToggle.openYesNoQuestion(
              shell,
              Messages.AddRepositoryAction_Add_new_query,
              Messages.AddRepositoryAction_Add_a_query_to_the_Task_List,
              Messages.AddRepositoryAction_Do_not_show_again,
              false,
              preferenceStore,
              PREF_ADD_QUERY);
      preferenceStore.setValue(PREF_ADD_QUERY, messageDialog.getToggleState());
      if (messageDialog.getReturnCode() == IDialogConstants.YES_ID) {
        AbstractRepositoryConnectorUi connectorUi =
            TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
        IWizard queryWizard = connectorUi.getQueryWizard(taskRepository, null);
        if (queryWizard instanceof Wizard) {
          ((Wizard) queryWizard).setForcePreviousAndNextButtons(true);
        }

        WizardDialog queryDialog = new WizardDialog(shell, queryWizard);
        queryDialog.create();
        queryDialog.setBlockOnOpen(true);
        queryDialog.open();
      }
    }
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.action.Action#run()
   */
  public void run() {
    Shell shell = getShell();
    if (!doCreateProjectFirstOnEmptyWorkspace(shell)) {
      return;
    }
    try {
      INewWizard wizard = createWizard();
      wizard.init(PlatformUI.getWorkbench(), getSelection());

      WizardDialog dialog = new WizardDialog(shell, wizard);
      if (shell != null) {
        PixelConverter converter = new PixelConverter(shell);
        dialog.setMinimumPageSize(
            converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
      }
      dialog.create();
      int res = dialog.open();
      if (res == Window.OK && wizard instanceof NewElementWizard) {
        fCreatedElement = ((NewElementWizard) wizard).getCreatedElement();
      }

      notifyResult(res == Window.OK);
    } catch (CoreException e) {
      String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title;
      String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message;
      ExceptionHandler.handle(e, shell, title, message);
    }
  }
 public void run(IAction action) {
   final TransformToGenModelWizard wiz = new TransformToGenModelWizard();
   wiz.setWindowTitle(action.getText());
   wiz.init(PlatformUI.getWorkbench(), sselection);
   WizardDialog wd = new WizardDialog(getShell(), wiz);
   wd.create();
   Rectangle mb = getShell().getMonitor().getClientArea();
   Point dpi = getShell().getDisplay().getDPI();
   if (Platform.OS_MACOSX.equals(Platform.getOS())) {
     dpi =
         new Point(110, 110); // OSX DPI is always 72; 110 is a common value for modern LCD screens
   }
   int width = dpi.x * WIZARD_WIDTH_INCH;
   int height = dpi.y * WIZARD_HEIGHT_INCH;
   int x = mb.x + (mb.width - width) / 2;
   if (x < mb.x) {
     x = mb.x;
   }
   int y = mb.y + (mb.height - height) / 2;
   if (y < mb.y) {
     y = mb.y;
   }
   wd.getShell().setLocation(x, y);
   wd.getShell().setSize(width, height);
   wd.open();
 }
Example #6
0
  /** Tests the wizard when the uninstall is preresolved. This is the normal SDK workflow. */
  public void testUninstallWizardResolved() {
    ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
    iusInvolved.add(top1);
    iusInvolved.add(top2);
    UninstallOperation op = getProvisioningUI().getUninstallOperation(iusInvolved, null);
    op.resolveModal(getMonitor());
    UninstallWizard wizard = new UninstallWizard(getProvisioningUI(), op, iusInvolved, null);
    WizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
    dialog.setBlockOnOpen(false);
    dialog.create();
    dialog.open();
    ProfileModificationJob longOp = null;

    try {
      SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
      // We should have a good plan
      assertTrue(page1.isPageComplete());
      ResolutionResultsWizardPage page2 = (ResolutionResultsWizardPage) wizard.getNextPage(page1);
      dialog.showPage(page2);
      assertTrue(page2.isPageComplete());

      // if another operation is scheduled for this profile, we should not be allowed to proceed
      longOp = getLongTestOperation();
      getProvisioningUI().schedule(longOp, StatusManager.LOG);
      assertTrue(page1.isPageComplete());
      // causes recalculation of plan and status
      wizard.recomputePlan(dialog);
      // can't move to next page while op is running
      assertFalse(page1.isPageComplete());
      longOp.cancel();
    } finally {
      dialog.getShell().close();
      if (longOp != null) longOp.cancel();
    }
  }
 private void handleNewIntro() {
   boolean needNewProduct = false;
   if (!productDefined()) {
     needNewProduct = true;
     MessageDialog mdiag =
         new MessageDialog(
             PDEPlugin.getActiveWorkbenchShell(),
             PDEUIMessages.IntroSection_undefinedProductId,
             null,
             PDEUIMessages.IntroSection_undefinedProductIdMessage,
             MessageDialog.QUESTION,
             new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
             0);
     if (mdiag.open() != Window.OK) return;
   }
   ProductIntroWizard wizard = new ProductIntroWizard(getProduct(), needNewProduct);
   WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
   dialog.create();
   if (dialog.open() == Window.OK) {
     String id = wizard.getIntroId();
     fIntroCombo.add(id, 0);
     fIntroCombo.setText(id);
     getIntroInfo().setId(id);
     addDependenciesAndPlugins();
   }
 }
Example #8
0
 public Object execute(ExecutionEvent event) throws ExecutionException {
   // TODO copied from ProxiesViewControlsComposite, does the same as clicking the Button
   WizardDialog wizardDialog =
       new WizardDialog(Display.getCurrent().getActiveShell(), new AddProxyWizard());
   wizardDialog.create();
   wizardDialog.open();
   return null;
 }
 @Override
 public void run() {
   TakeCompilerWizard wizard = new TakeCompilerWizard();
   wizard.getWp().setTitle(getToolTip());
   Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
   WizardDialog dialog = new WizardDialog(shell, wizard);
   dialog.create();
   dialog.open();
 }
 private void handleNewPlugin() {
   NewPluginProjectWizard wizard = new NewPluginProjectWizard();
   wizard.init(PDEPlugin.getActiveWorkbenchWindow().getWorkbench(), null);
   WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
   dialog.create();
   SWTUtil.setDialogSize(dialog, 400, 500);
   if (dialog.open() == Window.OK) {
     addPlugin(wizard.getPluginId(), wizard.getPluginVersion());
   }
 }
  public void run() {

    if (table == null) return;

    LoadDataWizard wiz = new LoadDataWizard(table);
    WizardDialog dialog =
        new WizardDialog(org.eclipse.swt.widgets.Display.getCurrent().getActiveShell(), wiz);
    dialog.create();
    dialog.open();
  }
 // public for unit test
 public WizardDialog MSG_SM_CommunicationClassOperationFormalize(IStructuredSelection selection) {
   CommunicationClassOperationFormalizeOnMSG_SMWizard wizard =
       new CommunicationClassOperationFormalizeOnMSG_SMWizard();
   wizard.init(CorePlugin.getDefault().getWorkbench(), selection, null);
   // Instantiates the wizard container with the wizard and opens it
   WizardDialog dialog = new WizardDialog(m_part.getSite().getShell(), wizard);
   dialog.create();
   ImageDescriptor descr = CorePlugin.getImageDescriptor("green-bp.gif");
   dialog.getShell().setImage(descr.createImage());
   return dialog;
 }
 // public for unit test
 public WizardDialog SQ_CP_SpecializedPackageClassFormalize(IStructuredSelection selection) {
   SpecializedPackageClassFormalizeOnSQ_CPWizard wizard =
       new SpecializedPackageClassFormalizeOnSQ_CPWizard();
   wizard.init(CorePlugin.getDefault().getWorkbench(), selection, null);
   // Instantiates the wizard container with the wizard and opens it
   WizardDialog dialog = new WizardDialog(m_part.getSite().getShell(), wizard);
   dialog.create();
   ImageDescriptor descr = CorePlugin.getImageDescriptor("green-bp.gif");
   dialog.getShell().setImage(descr.createImage());
   return dialog;
 }
  @Override
  public void redo() {
    CreateBPAssignmentWizard wizard = new CreateBPAssignmentWizard(this);

    wizard.setObj(this.leftSide);

    WizardDialog wizardDialog =
        new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
    wizardDialog.create();
    wizardDialog.open();
    super.redo();
  }
 /**
  * Runs the wizard in a dialog.
  *
  * @generated
  */
 public static void runWizard(Shell shell, Wizard wizard, String settingsKey) {
   IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin.getInstance().getDialogSettings();
   IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
   if (wizardDialogSettings == null) {
     wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
   }
   wizard.setDialogSettings(wizardDialogSettings);
   WizardDialog dialog = new WizardDialog(shell, wizard);
   dialog.create();
   dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
   dialog.open();
 }
Example #16
0
 /**
  * The <code>CreateFileAction</code> implementation of this <code>IAction</code> method opens a
  * <code>BasicNewFileResourceWizard</code> in a wizard dialog under the shell passed to the
  * constructor.
  */
 public void run() {
   BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard();
   wizard.init(PlatformUI.getWorkbench(), getStructuredSelection());
   wizard.setNeedsProgressMonitor(true);
   WizardDialog dialog = new WizardDialog(shellProvider.getShell(), wizard);
   dialog.create();
   dialog.getShell().setText(IDEWorkbenchMessages.CreateFileAction_title);
   PlatformUI.getWorkbench()
       .getHelpSystem()
       .setHelp(dialog.getShell(), IIDEHelpContextIds.NEW_FILE_WIZARD);
   dialog.open();
 }
Example #17
0
  /**
   * Called when decrypting an XML resource inside an opened editor or via a view. The output XML
   * can not be pretty printed since this would break an existing XML signature in the document.
   *
   * @param wizard The Decryption Wizard
   * @throws Exception to indicate any exceptional condition
   */
  private void decryptData(final NewDecryptionWizard wizard) throws Exception {
    final CreateDecryption decryption = new CreateDecryption();

    WizardDialog dialog = new WizardDialog(getActiveWorkbenchWindow().getShell(), wizard);
    dialog.create();
    dialog.open();

    if (dialog.getReturnCode() == Window.OK && wizard.getModel() != null) {
      Job job =
          new Job(Messages.NewDecryptionCommand_0) {
            public IStatus run(final IProgressMonitor monitor) {
              try {
                monitor.beginTask(Messages.NewDecryptionCommand_2, 6);

                Document doc = decryption.decrypt(wizard.getModel(), monitor);

                if (monitor.isCanceled()) {
                  return Status.CANCEL_STATUS;
                }

                if (doc != null) {
                  IEditorInput output =
                      AbstractEditorService.createOutputFile(
                          "decrypted",
                          IConstants.XML_FILE_TYPE_EXTENSION,
                          Utils.docToInputStram(doc));

                  performOpenEditor(output, IOperationsConstants.ID_TEXT_EDITOR);
                }
              } catch (final Exception ex) {
                getActiveWorkbenchWindow()
                    .getShell()
                    .getDisplay()
                    .asyncExec(
                        new Runnable() {
                          public void run() {
                            LogUtil.logError(
                                XSTUIPlugin.getId(), Messages.NewDecryptionCommand_1, ex, true);
                          }
                        });
              } finally {
                monitor.done();
              }

              return Status.OK_STATUS;
            }
          };
      job.setUser(true);
      job.schedule();
    }

    wizard.dispose();
  }
 @Override
 public void run(IAction action) {
   IWorkbench workbench = PlatformUI.getWorkbench();
   // Instantiates and initializes the wizard
   VCTImportWizard wizard = new VCTImportWizard();
   wizard.init(workbench, (org.eclipse.jface.viewers.IStructuredSelection) select);
   // Instantiates the wizard container with the wizard and opens it
   Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
   WizardDialog dialog = new WizardDialog(shell, wizard);
   dialog.create();
   dialog.open();
 }
  private IWizardPage[] openNewElementWizard(
      IWorkbenchWizard wizard, Shell shell, Object selection) {
    wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection));

    WizardDialog dialog = new WizardDialog(shell, wizard);
    PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(
        converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
    dialog.create();
    dialog.open();
    IWizardPage[] pages = wizard.getPages();
    return pages;
  }
  protected void generate() {

    PersistenceUnit persistenceUnit =
        this.getPersistenceUnits().iterator().next(); // Take the first persistenceUnit
    String puName = persistenceUnit.getName();

    EclipseLinkGenerateDDLWizard wizard = this.buildGenerateDDLWizard(this.project, puName);
    WizardDialog wizardDialog = new WizardDialog(this.getCurrentShell(), wizard);
    wizardDialog.create();
    if (wizard.getPageCount() > 0) {
      wizardDialog.open();
    }
  }
  public TaskRepository showWizard(Shell shell, String connectorKind) {
    NewRepositoryWizard repositoryWizard = new NewRepositoryWizard(connectorKind);
    repositoryWizard.setShowNewQueryPromptOnFinish(getPromptToAddQuery());

    WizardDialog dialog = new TaskRepositoryWizardDialog(shell, repositoryWizard);
    dialog.create();
    dialog.setBlockOnOpen(true);
    dialog.open();

    if (dialog.getReturnCode() == Window.OK) {
      return repositoryWizard.getTaskRepository();
    }
    return null;
  }
 @Override
 public void run(String[] params, ICheatSheetManager manager) {
   Hashtable<String, String> defValues = new Hashtable<>();
   if (params.length > 0) defValues.put(NewSiteProjectWizard.DEF_PROJECT_NAME, params[0]);
   NewSiteProjectWizard wizard = new NewSiteProjectWizard();
   wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
   wizard.init(defValues);
   WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
   dialog.create();
   SWTUtil.setDialogSize(dialog, 500, 500);
   dialog.getShell().setText(wizard.getWindowTitle());
   int result = dialog.open();
   notifyResult(result == Window.OK);
 }
Example #23
0
 /** Creates a new domain with the given name, for the given system. */
 public static void createNewModel(String domainName, SystemModel_c sys) {
   NewDomainWizard ndw = new NewDomainWizard();
   Selection.getInstance().clear();
   Selection.getInstance().addToSelection(sys);
   ndw.init(null, Selection.getInstance().getStructuredSelection());
   ndw.addPages();
   WizardDialog dialog =
       new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ndw);
   dialog.create();
   WizardNewDomainCreationPage wndcp = (WizardNewDomainCreationPage) ndw.getStartingPage();
   wndcp.setDomainNameFieldValue(domainName);
   wndcp.setUseTemplate(false);
   ndw.setContainer(null);
   ndw.performFinish();
 }
Example #24
0
 /**
  * Create the new-plan wizard and open the dialog
  *
  * @param action ignored
  */
 @Override
 public void run(IAction action) {
   // switch to the planning perspective
   IWorkbench workbench = PlatformUI.getWorkbench();
   try {
     NewPlanWizard planWizard = MissionExtender.construct(NewPlanWizard.class);
     planWizard.init(workbench, null);
     Shell parent = workbench.getActiveWorkbenchWindow().getShell();
     WizardDialog dialog = new WizardDialog(parent, planWizard);
     dialog.create();
     dialog.open();
   } catch (ConstructionException e) {
     LogUtil.error("Error constructing the NewPlanWizard: " + e, e);
   }
 }
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

    ImportKeystoreWizard createKeystoreWizard = new ImportKeystoreWizard();

    WizardDialog dialog = new WizardDialog(shell, createKeystoreWizard);

    // open the wizard to import keystores
    // the result doesn't need to be handled as it is self-contained
    dialog.create();
    dialog.open();

    return null;
  }
 /**
  * Runs the wizard in a dialog.
  *
  * @generated
  */
 public static void runWizard(Shell shell, Wizard wizard, String settingsKey) {
   IDialogSettings pluginDialogSettings =
       edu.toronto.cs.se.modelepedia.statemachine_mavo.diagram.part
           .StateMachine_MAVODiagramEditorPlugin.getInstance()
           .getDialogSettings();
   IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
   if (wizardDialogSettings == null) {
     wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
   }
   wizard.setDialogSettings(wizardDialogSettings);
   WizardDialog dialog = new WizardDialog(shell, wizard);
   dialog.create();
   dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
   dialog.open();
 }
  @Override
  public void run() {
    Connection connection = UIUtils.getFirstElement(getSelection(), Connection.class);
    if (connection == null) {
      return;
    }

    // do not show the dialog if the user was not connected or did not provide valid credentials.
    if (!connection.connect()) {
      return;
    }
    WizardDialog dialog =
        new WizardDialog(Display.getCurrent().getActiveShell(), createDomainWizard(connection));
    dialog.create();
    dialog.open();
  }
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    //		IWorkbench workbench = PlatformUI.getWorkbench();
    //		IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();

    // Instantiates and initializes the wizard
    SubmitFSDLRequestWizard wizard = new SubmitFSDLRequestWizard(checkInfrastructureReq());

    // wizard.init( workbench.getActiveWorkbenchWindow(), (IStructuredSelection)selection);
    // Instantiates the wizard container with the wizard and opens it
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.create();
    dialog.open();
    return null;
  }
  /**
   * Must be called in the UI thread.
   *
   * @param sel will define what appears initially in the project/source folder/name.
   */
  public static void startWizard(
      AbstractPythonWizard wizard, String title, IStructuredSelection sel) {
    IWorkbenchPart part =
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();

    wizard.init(part.getSite().getWorkbenchWindow().getWorkbench(), sel);
    wizard.setWindowTitle(title);

    Shell shell = part.getSite().getShell();
    if (shell == null) {
      shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    }
    WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.setPageSize(350, 500);
    dialog.setHelpAvailable(false);
    dialog.create();
    dialog.open();
  }
  protected void createNewODProject() {
    final IWizardDescriptor descriptor =
        WizardFinder.findNewWizardDescriptor(
            "org.gemoc.xdsmlframework.extensions.sirius.wizards.NewGemocSiriusProjectWizard");
    // Then if we have a wizard, open it.
    if (descriptor != null) {
      NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
      ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceListener);
      try {
        IWorkbenchWizard wizard;
        wizard = descriptor.createWizard();
        ((NewGemocSiriusProjectWizard) wizard)
            .setInitialProjectName(XDSMLProjectHelper.baseProjectName(gemocLanguageIProject));

        IWorkbench workbench = PlatformUI.getWorkbench();
        wizard.init(workbench, null);
        WizardDialog wd = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
        wd.create();
        wd.setTitle(wizard.getWindowTitle());

        int res = wd.open();
        if (res == WizardDialog.OK) {
          ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener);
          createdProject = workspaceListener.getLastCreatedProject();
          // update the project configuration model
          if (createdProject != null) {
            SiriusEditorProject editorProject =
                Xdsml_baseFactoryImpl.eINSTANCE.createSiriusEditorProject();
            editorProject.setProjectName(createdProject.getName());
            addOrUpdateProjectToConf(editorProject);
          } else {
            Activator.error("not able to detect which project was created by wizard", null);
          }
        }
      } catch (CoreException e) {
        Activator.error(e.getMessage(), e);
      } finally {
        ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener);
      }
    } else {
      Activator.error(
          "wizard with id=org.eclipse.sirius.ui.specificationproject.wizard not found", null);
    }
  }