Exemplo n.º 1
0
 public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
   try {
     EditorComponent component =
         ((EditorComponent)
             ((Editor) MapSequence.fromMap(_params).get("editor")).getCurrentEditorComponent());
     if (component == null) {
       return;
     }
     Set<String> enabledHints = component.getEnabledHints();
     ConceptEditorHintSettings settings = new ConceptEditorHintSettings();
     settings.putAll(
         ConceptEditorHintSettingsComponent.getInstance(
                 ((Project) MapSequence.fromMap(_params).get("project")))
             .getSettings());
     for (String lang : settings.getLanguagesNames()) {
       for (ConceptEditorHint hint : SetSequence.fromSet(settings.getHints(lang))) {
         settings.put(lang, hint, false);
       }
     }
     settings.updateSettings(enabledHints);
     final ConceptEditorHintPreferencesPage page = new ConceptEditorHintPreferencesPage(settings);
     DialogWrapper dialog =
         new HintsDialog(
             ((Project) MapSequence.fromMap(_params).get("project")), page, settings, component);
     dialog.show();
   } catch (Throwable t) {
     if (LOG.isEnabledFor(Priority.ERROR)) {
       LOG.error("User's action execute method failed. Action:" + "PushEditorHints", t);
     }
   }
 }
  private static void showDialog(ApplicationImpl app) {
    DialogWrapper dialog =
        new DialogWrapper(null) {
          {
            setTitle("Some Modal Dialog");
            init();
          }

          @Nullable
          @Override
          protected JComponent createCenterPanel() {
            return new JTextField("Waiting for the progress...");
          }
        };
    EdtExecutorService.getScheduledExecutorInstance()
        .schedule(
            () -> {
              app.runWriteActionWithProgress(
                  "Progress in modal dialog",
                  null,
                  dialog.getRootPane(),
                  TestWriteActionUnderProgress::runDeterminateProgress);
              dialog.close(0);
            },
            2500,
            TimeUnit.MILLISECONDS);
    app.invokeLater(
        () -> {
          dialog.setSize(100, 100);
          dialog.setLocation(100, 100);
        },
        ModalityState.any());
    dialog.show();
  }
  private void showDialog() {
    if (myDialog == null) {
      // System.out.println("showDialog()");
      myDialog =
          new DialogWrapper(myProject, false) {
            {
              getWindow().setBounds(0, 0, 1, 1);
              setResizable(false);
            }

            @Override
            protected boolean isProgressDialog() {
              return true;
            }

            @Override
            protected JComponent createCenterPanel() {
              return null;
            }
          };
      myDialog.setModal(true);
      myDialog.setUndecorated(true);
      myDialog.show();
    }
  }
Exemplo n.º 4
0
 @Override
 public void show() {
   final BorderDrawer drawer = new BorderDrawer();
   drawer.start();
   super.show();
   drawer.setDone();
 }
Exemplo n.º 5
0
  public void show(@NotNull Issue issue) {
    this.issue = issue;
    currentForm = (create) ? createMainForm : updateTabbedPane;
    currentForm.updateUI(issue.getReview(), issue, true);

    cardLayout.show(centerPanel, currentForm.getClass().getName());

    super.show();
  }
Exemplo n.º 6
0
  public void show() {
    DialogWrapper dialog =
        new DialogWrapper(true) {
          {
            setTitle("Registry");
            setModal(true);
            init();
            revaliateActions();
          }

          protected JComponent createCenterPanel() {
            return myContent;
          }

          @Override
          protected void dispose() {
            super.dispose();
            RegistryUi.this.dispose();
          }

          @Override
          protected String getDimensionServiceKey() {
            return "Registry";
          }

          @Override
          public JComponent getPreferredFocusedComponent() {
            return myTable;
          }

          @Override
          protected Action[] createActions() {
            return new Action[] {
              myRestoreDefaultsAction,
              new AbstractAction("Close") {
                public void actionPerformed(ActionEvent e) {
                  processClose();
                  doOKAction();
                }
              }
            };
          }

          @Override
          public void doCancelAction() {
            final TableCellEditor cellEditor = myTable.getCellEditor();
            if (cellEditor != null) {
              cellEditor.stopCellEditing();
            }
            processClose();
            super.doCancelAction();
          }
        };

    dialog.show();
  }
  private static void invoke(
      final PsiMethod method, final Project project, @Nullable final Editor editor) {
    if (!CommonRefactoringUtil.checkReadOnlyStatus(project, method)) return;

    PsiMethod newMethod =
        SuperMethodWarningUtil.checkSuperMethod(method, RefactoringBundle.message("to.refactor"));
    if (newMethod == null) return;

    if (!newMethod.equals(method)) {
      invoke(newMethod, project, editor);
      return;
    }

    if (!CommonRefactoringUtil.checkReadOnlyStatus(project, method)) return;

    final PsiClass containingClass = method.getContainingClass();
    final PsiReferenceExpression refExpr =
        editor != null ? TargetElementUtil.findReferenceExpression(editor) : null;
    final DialogWrapper dialog =
        new JavaChangeSignatureDialog(
            project, method, containingClass != null && !containingClass.isInterface(), refExpr);
    dialog.show();
  }
  protected void handleErrorsOnSave(@NotNull Map<Document, IOException> failures) {
    for (IOException exception : failures.values()) {
      LOG.warn(exception);
    }

    final String text =
        StringUtil.join(
            failures.values(),
            new Function<IOException, String>() {
              @Override
              public String fun(IOException e) {
                return e.getMessage();
              }
            },
            "\n");

    final DialogWrapper dialog =
        new DialogWrapper(null) {
          {
            init();
            setTitle(UIBundle.message("cannot.save.files.dialog.title"));
          }

          @Override
          protected void createDefaultActions() {
            super.createDefaultActions();
            myOKAction.putValue(
                Action.NAME,
                UIBundle.message(
                    myOnClose
                        ? "cannot.save.files.dialog.ignore.changes"
                        : "cannot.save.files.dialog.revert.changes"));
            myOKAction.putValue(DEFAULT_ACTION, null);

            if (!myOnClose) {
              myCancelAction.putValue(Action.NAME, CommonBundle.getCloseButtonText());
            }
          }

          @Override
          protected JComponent createCenterPanel() {
            final JPanel panel = new JPanel(new BorderLayout(0, 5));

            panel.add(
                new JLabel(UIBundle.message("cannot.save.files.dialog.message")),
                BorderLayout.NORTH);

            final JTextPane area = new JTextPane();
            area.setText(text);
            area.setEditable(false);
            area.setMinimumSize(new Dimension(area.getMinimumSize().width, 50));
            panel.add(
                new JBScrollPane(
                    area,
                    ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER),
                BorderLayout.CENTER);

            return panel;
          }
        };

    dialog.show();

    if (dialog.isOK()) {
      for (Document document : failures.keySet()) {
        reloadFromDisk(document);
      }
    }
  }
Exemplo n.º 9
0
 @Override
 public void show() {
   super.show();
   myColorPicker.fireClosed(getExitCode() == DialogWrapper.OK_EXIT_CODE ? getColor() : null);
 }