Ejemplo n.º 1
0
 protected void doFetch(ChangeDetail changeDetail, PatchSetDetail patchSetDetail) {
   GerritToGitMapping mapping = getRepository(changeDetail);
   if (mapping != null) {
     String refName = patchSetDetail.getPatchSet().getRefName();
     FetchGerritChangeWizard wizard =
         new FetchGerritChangeWizard(mapping.getRepository(), refName);
     WizardDialog wizardDialog = new WizardDialog(getShell(), wizard);
     wizardDialog.setHelpAvailable(false);
     wizardDialog.open();
   }
 }
 public int open() {
   dialog =
       new WizardDialog(editor.getSite().getShell(), this) {
         @Override
         protected Button createButton(
             Composite parent, int id, String label, boolean defaultButton) {
           if (id == IDialogConstants.FINISH_ID) {
             label = IDialogConstants.OK_LABEL;
           }
           return super.createButton(parent, id, label, defaultButton);
         }
       };
   dialog.setHelpAvailable(false);
   return dialog.open();
 }
Ejemplo n.º 3
0
  /**
   * 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();
  }
Ejemplo n.º 4
0
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final RepositoryTreeNode node = getSelectedNodes(event).get(0);

    if (node.getType() == RepositoryTreeNodeType.ADDITIONALREF) {
      Ref ref = (Ref) node.getObject();
      try {
        RevCommit baseCommit =
            new RevWalk(node.getRepository()).parseCommit(ref.getLeaf().getObjectId());
        WizardDialog dlg =
            new WizardDialog(
                getShell(event), new CreateBranchWizard(node.getRepository(), baseCommit.name()));
        dlg.setHelpAvailable(false);
        dlg.open();
      } catch (IOException e) {
        Activator.handleError(e.getMessage(), e, true);
      }
      return null;
    }
    String base = null;
    if (node.getObject() instanceof Ref) base = ((Ref) node.getObject()).getName();
    new WizardDialog(getShell(event), new CreateBranchWizard(node.getRepository(), base)).open();
    return null;
  }
Ejemplo n.º 5
0
  public static int openCloneRepositoryWizard(
      Shell shell, final TaskRepository repository, final Project project) {
    AbstractGitCloneWizard cloneWizard =
        new GitCloneWizard(
            new IRepositorySearchResult() {

              @Override
              public GitRepositoryInfo getGitRepositoryInfo() throws NoRepositoryInfoException {
                GitRepositoryInfo gitRepositoryInfo;
                try {
                  GerritConfiguration config =
                      GerritCorePlugin.getGerritClient(repository).getConfiguration();
                  gitRepositoryInfo =
                      new GitRepositoryInfo(GerritUtil.getSshCloneUri(repository, config, project));
                } catch (URISyntaxException e) {
                  throw new NoRepositoryInfoException(e.getMessage(), e);
                }
                return gitRepositoryInfo;
              }
            });
    WizardDialog dlg = new WizardDialog(shell, cloneWizard);
    dlg.setHelpAvailable(true);
    return dlg.open();
  }
Ejemplo n.º 6
0
  /** This methods performs the action */
  @Override
  public Object execute(ExecutionEvent event) {
    final AdfgvxWizard wizard = new AdfgvxWizard();
    final WizardDialog dialog = new WizardDialog(getActiveWorkbenchWindow().getShell(), wizard);
    dialog.setHelpAvailable(true);

    if (dialog.open() == Window.OK) {
      Job job =
          new Job(Messages.AdfgvxAlgorithmHandler_0) {
            @Override
            public IStatus run(final IProgressMonitor monitor) {
              try {
                String jobTitle = Messages.AdfgvxAlgorithmHandler_1;

                if (!wizard.encrypt()) {
                  jobTitle = Messages.AdfgvxAlgorithmHandler_2;
                }

                monitor.beginTask(jobTitle, 4);

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

                InputStream editorContent = getActiveEditorInputStream();
                // String editorContent = getActiveEditorContentAsString();
                char[] key = wizard.getSubstitutionKey().toCharArray();
                char[] key2 = wizard.getTranspositionKey().toCharArray();

                monitor.worked(1);

                AbstractAlphabet alphabet = wizard.getSelectedAlphabet();

                monitor.worked(2);

                final AbstractClassicAlgorithm algorithm = new AdfgvxAlgorithm();

                if (wizard.encrypt()) {
                  // explicit encrypt
                  algorithm.init(
                      AbstractAlgorithm.ENCRYPT_MODE,
                      editorContent,
                      alphabet,
                      key,
                      key2,
                      wizard.getTransformData());
                } else {
                  // implicit decrypt
                  algorithm.init(
                      AbstractAlgorithm.DECRYPT_MODE,
                      editorContent,
                      alphabet,
                      key,
                      key2,
                      wizard.getTransformData());
                }

                monitor.worked(3);

                if (!wizard.isNonAlphaFilter()) {
                  algorithm.setFilter(false);
                }

                monitor.worked(4);

                AdfgvxConfiguration config =
                    new AdfgvxConfiguration(
                        wizard.encrypt(),
                        wizard.getSelectedAlphabet(),
                        wizard.isNonAlphaFilter(),
                        wizard.getTransformData(),
                        wizard.getSubstitutionKeyAsEntered(),
                        wizard.getTranspositionKey());
                Observer editorOpenObserver =
                    ClassicAlgorithmConfiguration.createEditorOpenHandler(algorithm, config);
                AdfgvxAlgorithmHandler.super.finalizeRun(algorithm, editorOpenObserver);

              } catch (final Exception ex) {
                LogUtil.logError(AdfgvxPlugin.PLUGIN_ID, ex);
              } finally {
                monitor.done();
              }

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