Java 类com.intellij.util.ui.OptionsDialog 实例源码

项目:intellij-ce-playground    文件:CheckoutFileAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  if (myModifiedFiles != null) {
    if (!myModifiedFiles.isEmpty()) {
      if (!new ReplaceFileConfirmationDialog(context.getProject(), CvsBundle.getCheckoutOperationName()).requestConfirmation(myModifiedFiles)) {
        return CvsHandler.NULL;
      }

    }
  }

  myModifiedFiles = null;

  Project project = context.getProject();
  FilePath[] filesArray = context.getSelectedFilePaths();
  List<FilePath> files = Arrays.asList(filesArray);
  if (CvsVcs2.getInstance(project).getCheckoutOptions().getValue() || OptionsDialog.shiftIsPressed(context.getModifiers())) {
    CheckoutFileDialog checkoutFileDialog = new CheckoutFileDialog(project, files);
    if (!checkoutFileDialog.showAndGet()) {
      return CvsHandler.NULL;
    }
  }

  return CommandCvsHandler.createCheckoutFileHandler(filesArray, CvsConfiguration.getInstance(project),
                                                     VcsConfiguration.getInstance(project).getCheckoutOption());
}
项目:tools-idea    文件:CheckoutFileAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  if (myModifiedFiles != null) {
    if (!myModifiedFiles.isEmpty()) {
      if (!new ReplaceFileConfirmationDialog(context.getProject(), CvsBundle.getCheckoutOperationName()).requestConfirmation(myModifiedFiles)) {
        return CvsHandler.NULL;
      }

    }
  }

  myModifiedFiles = null;

  Project project = context.getProject();
  FilePath[] filesArray = context.getSelectedFilePaths();
  List<FilePath> files = Arrays.asList(filesArray);
  if (CvsVcs2.getInstance(project).getCheckoutOptions().getValue() || OptionsDialog.shiftIsPressed(context.getModifiers())) {
    CheckoutFileDialog checkoutFileDialog = new CheckoutFileDialog(project, files);
    checkoutFileDialog.show();
    if (!checkoutFileDialog.isOK()) return CvsHandler.NULL;
  }

  return CommandCvsHandler.createCheckoutFileHandler(filesArray, CvsConfiguration.getInstance(project),
                                                     VcsConfiguration.getInstance(project).getCheckoutOption());
}
项目:intellij-ce-playground    文件:EditAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  Project project = context.getProject();
  if (CvsVcs2.getInstance(project).getEditOptions().getValue()
      || OptionsDialog.shiftIsPressed(context.getModifiers())) {
    EditOptionsDialog editOptionsDialog = new EditOptionsDialog(project);
    if (!editOptionsDialog.showAndGet()) {
      return CvsHandler.NULL;
    }
  }

  return CommandCvsHandler.createEditHandler(context.getSelectedFiles(),
                                             CvsConfiguration.getInstance(project).RESERVED_EDIT);
}
项目:tools-idea    文件:LayoutCodeDialog.java   
@Override
protected JComponent createSouthPanel() {
  JComponent southPanel = super.createSouthPanel();
  myDoNotAskMeCheckBox = new JCheckBox(CommonBundle.message("dialog.options.do.not.show"));
  myDoNotAskMeCheckBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      updateState();
    }
  });
  return OptionsDialog.addDoNotShowCheckBox(southPanel, myDoNotAskMeCheckBox);
}
项目:tools-idea    文件:EditAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  Project project = context.getProject();
  if (CvsVcs2.getInstance(project).getEditOptions().getValue()
      || OptionsDialog.shiftIsPressed(context.getModifiers())) {
    EditOptionsDialog editOptionsDialog = new EditOptionsDialog(project);
    editOptionsDialog.show();
    if (!editOptionsDialog.isOK()) return CvsHandler.NULL;
  }

  return CommandCvsHandler.createEditHandler(context.getSelectedFiles(),
                                             CvsConfiguration.getInstance(project).RESERVED_EDIT);
}
项目:intellij-ce-playground    文件:AbstractCommonUpdateAction.java   
@Override
protected void actionPerformed(@NotNull final VcsContext context) {
  final Project project = context.getProject();

  boolean showUpdateOptions = myActionInfo.showOptions(project);

  LOG.debug(String.format("project: %s, show update options: %s", project, showUpdateOptions));

  if (project != null) {
    try {
      final FilePath[] filePaths = myScopeInfo.getRoots(context, myActionInfo);
      final FilePath[] roots = DescindingFilesFilter.filterDescindingFiles(filterRoots(filePaths, context), project);
      if (roots.length == 0) {
        LOG.debug("No roots found.");
        return;
      }

      final Map<AbstractVcs, Collection<FilePath>> vcsToVirtualFiles = createVcsToFilesMap(roots, project);

      for (AbstractVcs vcs : vcsToVirtualFiles.keySet()) {
        final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
        if ((updateEnvironment != null) && (! updateEnvironment.validateOptions(vcsToVirtualFiles.get(vcs)))) {
          // messages already shown
          LOG.debug("Options not valid for files: " + vcsToVirtualFiles);
          return;
        }
      }

      if (showUpdateOptions || OptionsDialog.shiftIsPressed(context.getModifiers())) {
        showOptionsDialog(vcsToVirtualFiles, project, context);
      }

      if (ApplicationManager.getApplication().isDispatchThread()) {
        ApplicationManager.getApplication().saveAll();
      }
      Task.Backgroundable task = new Updater(project, roots, vcsToVirtualFiles);
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        task.run(new EmptyProgressIndicator());
      }
      else {
        ProgressManager.getInstance().run(task);
      }
    }
    catch (ProcessCanceledException ignored) {
    }
  }
}
项目:intellij-ce-playground    文件:AbstractCommonUpdateAction.java   
@Override
 protected void update(VcsContext vcsContext, Presentation presentation) {
   Project project = vcsContext.getProject();

   if (project != null) {
     final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
     final boolean underVcs = vcsManager.hasActiveVcss();
     if (! underVcs) {
       presentation.setVisible(false);
       return;
     }

     String actionName = getCompleteActionName(vcsContext);
     if (myActionInfo.showOptions(project) || OptionsDialog.shiftIsPressed(vcsContext.getModifiers())) {
       actionName += "...";
     }

     presentation.setText(actionName);

     presentation.setVisible(true);
     presentation.setEnabled(true);

     if (supportingVcsesAreEmpty(vcsManager, myActionInfo)) {
       presentation.setVisible(myAlwaysVisible);
       presentation.setEnabled(false);
       return;
     }

     if (filterRootsBeforeAction()) {
       FilePath[] roots = filterRoots(myScopeInfo.getRoots(vcsContext, myActionInfo), vcsContext);
       if (roots.length == 0) {
         presentation.setVisible(myAlwaysVisible);
         presentation.setEnabled(false);
         return;
       }
     }

     if (presentation.isVisible() && presentation.isEnabled() &&
         vcsManager.isBackgroundVcsOperationRunning()) {
       presentation.setEnabled(false);
     }
   } else {
     presentation.setVisible(false);
     presentation.setEnabled(false);
   }
}
项目:intellij-ce-playground    文件:AddFileOrDirectoryAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  final Project project = context.getProject();
  final boolean showDialog = myOptions.isToBeShown(project) || OptionsDialog.shiftIsPressed(context.getModifiers());
  return getCvsHandler(project, context.getSelectedFiles(), showDialog, myOptions);
}
项目:intellij-ce-playground    文件:RemoveLocallyFileOrDirectoryAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  final Project project = context.getProject();
  final boolean showDialog = myOptions.isToBeShown(project) || OptionsDialog.shiftIsPressed(context.getModifiers());
  return getCvsHandler(project, getFilesToRemove(context), showDialog);
}
项目:tools-idea    文件:AbstractCommonUpdateAction.java   
protected void actionPerformed(final VcsContext context) {
  final Project project = context.getProject();

  boolean showUpdateOptions = myActionInfo.showOptions(project);

  LOG.debug(String.format("project: %s, show update options: %s", project, showUpdateOptions));

  if (project != null) {
    try {
      final FilePath[] filePaths = myScopeInfo.getRoots(context, myActionInfo);
      final FilePath[] roots = DescindingFilesFilter.filterDescindingFiles(filterRoots(filePaths, context), project);
      if (roots.length == 0) {
        LOG.debug("No roots found.");
        return;
      }

      final Map<AbstractVcs, Collection<FilePath>> vcsToVirtualFiles = createVcsToFilesMap(roots, project);

      for (AbstractVcs vcs : vcsToVirtualFiles.keySet()) {
        final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
        if ((updateEnvironment != null) && (! updateEnvironment.validateOptions(vcsToVirtualFiles.get(vcs)))) {
          // messages already shown
          LOG.debug("Options not valid for files: " + vcsToVirtualFiles);
          return;
        }
      }

      if (showUpdateOptions || OptionsDialog.shiftIsPressed(context.getModifiers())) {
        showOptionsDialog(vcsToVirtualFiles, project, context);
      }

      if (ApplicationManager.getApplication().isDispatchThread()) {
        ApplicationManager.getApplication().saveAll();
      }
      Task.Backgroundable task = new Updater(project, roots, vcsToVirtualFiles);
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        task.run(new EmptyProgressIndicator());
      }
      else {
        ProgressManager.getInstance().run(task);
      }
    }
    catch (ProcessCanceledException e1) {
      //ignore
    }
  }
}
项目:tools-idea    文件:AbstractCommonUpdateAction.java   
protected void update(VcsContext vcsContext, Presentation presentation) {
   Project project = vcsContext.getProject();

   if (project != null) {
     final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
     final boolean underVcs = vcsManager.hasActiveVcss();
     if (! underVcs) {
       presentation.setVisible(false);
       return;
     }

     String actionName = getCompleteActionName(vcsContext);
     if (myActionInfo.showOptions(project) || OptionsDialog.shiftIsPressed(vcsContext.getModifiers())) {
       actionName += "...";
     }

     presentation.setText(actionName);

     presentation.setVisible(true);
     presentation.setEnabled(true);

     if (supportingVcsesAreEmpty(vcsManager, myActionInfo)) {
       presentation.setVisible(myAlwaysVisible);
       presentation.setEnabled(false);
       return;
     }

     if (filterRootsBeforeAction()) {
       FilePath[] roots = filterRoots(myScopeInfo.getRoots(vcsContext, myActionInfo), vcsContext);
       if (roots.length == 0) {
         presentation.setVisible(myAlwaysVisible);
         presentation.setEnabled(false);
         return;
       }
     }

     if (presentation.isVisible() && presentation.isEnabled() &&
         vcsManager.isBackgroundVcsOperationRunning()) {
       presentation.setEnabled(false);
     }
   } else {
     presentation.setVisible(false);
     presentation.setEnabled(false);
   }
}
项目:tools-idea    文件:AddFileOrDirectoryAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  final Project project = context.getProject();
  final boolean showDialog = myOptions.isToBeShown(project) || OptionsDialog.shiftIsPressed(context.getModifiers());
  return getCvsHandler(project, context.getSelectedFiles(), showDialog, myOptions);
}
项目:tools-idea    文件:RemoveLocallyFileOrDirectoryAction.java   
protected CvsHandler getCvsHandler(CvsContext context) {
  final Project project = context.getProject();
  final boolean showDialog = myOptions.isToBeShown(project) || OptionsDialog.shiftIsPressed(context.getModifiers());
  return getCvsHandler(project, getFilesToRemove(context), showDialog);
}
项目:consulo    文件:AbstractCommonUpdateAction.java   
@Override
protected void actionPerformed(@Nonnull final VcsContext context) {
  final Project project = context.getProject();

  boolean showUpdateOptions = myActionInfo.showOptions(project);

  LOG.debug(String.format("project: %s, show update options: %s", project, showUpdateOptions));

  if (project != null) {
    try {
      final FilePath[] filePaths = myScopeInfo.getRoots(context, myActionInfo);
      final FilePath[] roots = DescindingFilesFilter.filterDescindingFiles(filterRoots(filePaths, context), project);
      if (roots.length == 0) {
        LOG.debug("No roots found.");
        return;
      }

      final Map<AbstractVcs, Collection<FilePath>> vcsToVirtualFiles = createVcsToFilesMap(roots, project);

      for (AbstractVcs vcs : vcsToVirtualFiles.keySet()) {
        final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
        if ((updateEnvironment != null) && (! updateEnvironment.validateOptions(vcsToVirtualFiles.get(vcs)))) {
          // messages already shown
          LOG.debug("Options not valid for files: " + vcsToVirtualFiles);
          return;
        }
      }

      if (showUpdateOptions || OptionsDialog.shiftIsPressed(context.getModifiers())) {
        showOptionsDialog(vcsToVirtualFiles, project, context);
      }

      if (ApplicationManager.getApplication().isDispatchThread()) {
        ApplicationManager.getApplication().saveAll();
      }
      Task.Backgroundable task = new Updater(project, roots, vcsToVirtualFiles);
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        task.run(new EmptyProgressIndicator());
      }
      else {
        ProgressManager.getInstance().run(task);
      }
    }
    catch (ProcessCanceledException ignored) {
    }
  }
}
项目:consulo    文件:AbstractCommonUpdateAction.java   
@Override
protected void update(@Nonnull VcsContext vcsContext, @Nonnull Presentation presentation) {
  Project project = vcsContext.getProject();

  if (project != null) {
    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
    final boolean underVcs = vcsManager.hasActiveVcss();
    if (! underVcs) {
      presentation.setVisible(false);
      return;
    }

    String actionName = getCompleteActionName(vcsContext);
    if (myActionInfo.showOptions(project) || OptionsDialog.shiftIsPressed(vcsContext.getModifiers())) {
      actionName += "...";
    }

    presentation.setText(actionName);

    presentation.setVisible(true);
    presentation.setEnabled(true);

    if (supportingVcsesAreEmpty(vcsManager, myActionInfo)) {
      presentation.setVisible(myAlwaysVisible);
      presentation.setEnabled(false);
      return;
    }

    if (filterRootsBeforeAction()) {
      FilePath[] roots = filterRoots(myScopeInfo.getRoots(vcsContext, myActionInfo), vcsContext);
      if (roots.length == 0) {
        presentation.setVisible(myAlwaysVisible);
        presentation.setEnabled(false);
        return;
      }
    }

    if (presentation.isVisible() && presentation.isEnabled() &&
        vcsManager.isBackgroundVcsOperationRunning()) {
      presentation.setEnabled(false);
    }
  } else {
    presentation.setVisible(false);
    presentation.setEnabled(false);
  }
}