protected void doOKAction() { final LogicalPosition currentPosition = myEditor.getCaretModel().getLogicalPosition(); int lineNumber = getLineNumber(currentPosition.line + 1); if (isInternal() && myOffsetField.getText().length() > 0) { try { final int offset = Integer.parseInt(myOffsetField.getText()); if (offset < myEditor.getDocument().getTextLength()) { myEditor.getCaretModel().removeSecondaryCarets(); myEditor.getCaretModel().moveToOffset(offset); myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER); myEditor.getSelectionModel().removeSelection(); IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true); super.doOKAction(); } return; } catch (NumberFormatException e) { return; } } if (lineNumber < 0) return; int columnNumber = getColumnNumber(currentPosition.column); myEditor.getCaretModel().removeSecondaryCarets(); myEditor .getCaretModel() .moveToLogicalPosition( new LogicalPosition(Math.max(0, lineNumber - 1), Math.max(0, columnNumber - 1))); myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER); myEditor.getSelectionModel().removeSelection(); IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true); super.doOKAction(); }
@Override protected void doOKAction() { apply((SeverityBasedTextAttributes) myOptionsList.getSelectedValue()); final Collection<SeverityBasedTextAttributes> infoTypes = new HashSet<SeverityBasedTextAttributes>( SeverityUtil.getRegisteredHighlightingInfoTypes(mySeverityRegistrar)); final ListModel listModel = myOptionsList.getModel(); final List<HighlightSeverity> order = new ArrayList<HighlightSeverity>(); for (int i = listModel.getSize() - 1; i >= 0; i--) { final SeverityBasedTextAttributes info = (SeverityBasedTextAttributes) listModel.getElementAt(i); order.add(info.getSeverity()); if (!mySeverityRegistrar.isDefaultSeverity(info.getSeverity())) { infoTypes.remove(info); final Color stripeColor = info.getAttributes().getErrorStripeColor(); mySeverityRegistrar.registerSeverity( info, stripeColor != null ? stripeColor : LightColors.YELLOW); } } for (SeverityBasedTextAttributes info : infoTypes) { mySeverityRegistrar.unregisterSeverity(info.getSeverity()); } mySeverityRegistrar.setOrder(order); super.doOKAction(); }
@Override protected void doOKAction() { VirtualFile root = getGitRoot(); GitLineHandler h = handler(); final AtomicBoolean conflict = new AtomicBoolean(); h.addLineListener( new GitLineHandlerAdapter() { public void onLineAvailable(String line, Key outputType) { if (line.contains("Merge conflict")) { conflict.set(true); } } }); int rc = GitHandlerUtil.doSynchronously( h, GitBundle.getString("unstash.unstashing"), h.printableCommandLine(), false); root.refresh(true, true); if (conflict.get()) { boolean conflictsResolved = new UnstashConflictResolver(myProject, root, getSelectedStash()).merge(); LOG.info("loadRoot " + root + ", conflictsResolved: " + conflictsResolved); } else if (rc != 0) { GitUIUtil.showOperationErrors(myProject, h.errors(), h.printableCommandLine()); } super.doOKAction(); }
@Override protected void doOKAction() { myColorPicker.appendRecentColor(); myColorPicker.saveRecentColors(); super.doOKAction(); }
@Override protected final void doOKAction() { if (!validateAndApply()) { return; } super.doOKAction(); }
@Override protected void doOKAction() { try { apply(); } catch (ConfigurationException ignored) { } super.doOKAction(); }
@Override protected void doOKAction() { List<VirtualFile> extractedVirtualFiles = extractAdapterFiles(); if (extractedVirtualFiles != null) { installCodeAssistance(extractedVirtualFiles); } super.doOKAction(); }
protected void doOKAction() { if (!myValidator.isOK(this)) return; myNameSuggestionsManager.nameSelected(); myTypeSelectorManager.typeSelected(getSelectedType()); if (myCbFinal.isEnabled()) { JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_FINALS = myCbFinal.isSelected(); } super.doOKAction(); }
@Override protected void doOKAction() { super.doOKAction(); myLastRunOptions.saveOptimizeImportsState(isOptimizeImports()); myLastRunOptions.saveRearrangeCodeState(isRearrangeCode()); if (myEnableOnlyVCSChangedTextCb) { myLastRunOptions.saveProcessVcsChangedTextState( getTextRangeType() == TextRangeType.VCS_CHANGED_TEXT); } }
@Override protected void doOKAction() { final String errorString = myComponent.canCreateAllFilesForAllLocales(); if (errorString != null) { Messages.showErrorDialog(getContentPanel(), errorString); } else { final List<PsiFile> createFiles = myComponent.createPropertiesFiles(); myCreatedFiles = createFiles.toArray(new PsiElement[createFiles.size()]); super.doOKAction(); } }
@Override protected void doOKAction() { mySelectedClass = calcSelectedClass(); if (mySelectedClass == null) return; if (!myClassFilter.isAccepted(mySelectedClass)) { Messages.showErrorDialog( myTabbedPane.getComponent(), SymbolPresentationUtil.getSymbolPresentableText(mySelectedClass) + " is not acceptable"); return; } super.doOKAction(); }
@Override protected void doOKAction() { AuthDataHolder authData = myLoginPanel.getAuthData(); final boolean success = EduStepicConnector.login(authData.email, authData.password); if (!success) { setErrorText("Login failed"); } else { StudySettings.getInstance().setLogin(authData.email); StudySettings.getInstance().setPassword(authData.password); super.doOKAction(); } }
@Override protected void doOKAction() { try { myProjectJdk = myConfigurable.getSelectedJdk(); // before dispose myConfigurable.apply(); super.doOKAction(); } catch (ConfigurationException e) { Messages.showMessageDialog( getContentPane(), e.getMessage(), ProjectBundle.message("sdk.configure.save.settings.error"), Messages.getErrorIcon()); } }
@Override protected void doOKAction() { final LibraryCompositionSettings librarySettings = myComponent.getLibraryCompositionSettings(); if (librarySettings != null) { final ModifiableRootModel modifiableModel = myModifiableModelsProvider.getModuleModifiableModel(myModule); if (!askAndRemoveDuplicatedLibraryEntry( modifiableModel, librarySettings.getLibraryDescription())) { if (myConfigurable.isOnlyLibraryAdded()) { myModifiableModelsProvider.disposeModuleModifiableModel(modifiableModel); return; } return; } // Fix new WriteAction() { @Override protected void run(final Result result) { myModifiableModelsProvider.commitModuleModifiableModel(modifiableModel); } }.execute(); final boolean downloaded = librarySettings.downloadFiles(getRootPane()); if (!downloaded) { int answer = Messages.showYesNoDialog( getRootPane(), ProjectBundle.message("warning.message.some.required.libraries.wasn.t.downloaded"), CommonBundle.getWarningTitle(), Messages.getWarningIcon()); if (answer != 0) { return; } } } new WriteAction() { @Override protected void run(final Result result) { final ModifiableRootModel rootModel = myModifiableModelsProvider.getModuleModifiableModel(myModule); if (librarySettings != null) { librarySettings.addLibraries( rootModel, new ArrayList<Library>(), myModel.getLibrariesContainer()); } myConfigurable.addSupport(myModule, rootModel, myModifiableModelsProvider); myModifiableModelsProvider.commitModuleModifiableModel(rootModel); } }.execute(); super.doOKAction(); }
@Override public void doOKAction() { saveSettings(); super.doOKAction(); final GrParametersOwner toReplaceIn = myInfo.getToReplaceIn(); final GrExpression expr = GroovyIntroduceParameterUtil.findExpr(myInfo); final GrVariable var = GroovyIntroduceParameterUtil.findVar(myInfo); final StringPartInfo stringPart = findStringPart(); if (myTypeComboBox.isClosureSelected() || expr == null && var == null && stringPart == null) { GrIntroduceParameterSettings settings = new ExtractClosureHelperImpl( myInfo, getEnteredName(), myDeclareFinalCheckBox.isSelected(), getParametersToRemove(), myDelegateViaOverloadingMethodCheckBox.isSelected(), getReplaceFieldsWithGetter(), myForceReturnCheckBox.isSelected(), false, myTypeComboBox.getSelectedType() == null); if (toReplaceIn instanceof GrMethod) { invokeRefactoring(new ExtractClosureFromMethodProcessor(settings)); } else { invokeRefactoring(new ExtractClosureFromClosureProcessor(settings)); } } else { GrIntroduceParameterSettings settings = new GrIntroduceExpressionSettingsImpl( myInfo, getEnteredName(), myDeclareFinalCheckBox.isSelected(), getParametersToRemove(), myDelegateViaOverloadingMethodCheckBox.isSelected(), getReplaceFieldsWithGetter(), expr, var, myTypeComboBox.getSelectedType(), var != null, true, myForceReturnCheckBox.isSelected()); if (toReplaceIn instanceof GrMethod) { invokeRefactoring(new GrIntroduceParameterProcessor(settings)); } else { invokeRefactoring(new GrIntroduceClosureParameterProcessor(settings)); } } }
@Override protected void doOKAction() { String answerPlaceholderText = myPanel.getAnswerPlaceholderText(); myAnswerPlaceholder.setTaskText(StringUtil.notNullize(answerPlaceholderText)); myAnswerPlaceholder.setLength(StringUtil.notNullize(answerPlaceholderText).length()); final List<String> hints = myPanel.getHints(); if (hints.size() == 1 && hints.get(0).isEmpty()) { myAnswerPlaceholder.setHints(Collections.emptyList()); } else { myAnswerPlaceholder.setHints(hints); } super.doOKAction(); }
protected void doOKAction() { lastRunStatus = doRun.isSelected(); final CppSupportLoader loader = CppSupportLoader.getInstance(project); loader.setIncludeProjectSettings(includeProjectCompileParametersCheckBox.isSelected()); String s = compileProperties.getText(); int index = s.lastIndexOf(CompileHandler.MARKER); if (index != -1) s = s.substring(0, index).trim(); loader.setAdditionalCompileParameters(s.length() > 0 ? s : null); lastOptions = getCompiler(); super.doOKAction(); }
@Override protected void doOKAction() { final String login = myGithubLoginPanel.getLogin(); final String password = myGithubLoginPanel.getPassword(); if (GithubUtil.checkCredentials(myProject, login, password)) { final GithubSettings settings = GithubSettings.getInstance(); settings.setLogin(login); settings.setPassword(password); super.doOKAction(); } else { setErrorText("Cannot login with given credentials"); } }
@Override public void doOKAction() { myEditor.flushModifications(); if (myEditor.canApply()) { myEditor.apply(); if (!updateStatus()) return; } saveCurrentConfigurable(); ApplicationManager.getApplication().saveAll(); super.doOKAction(); }
@Override protected void doOKAction() { valueChanged(null); if (myContentPanel.getSelectedComponent() == myColorPickerPanel && myResourceNameVisibility != ResourceNameVisibility.HIDE) { String colorName = myResourceNameField.getText(); if (myOverwriteResource) { ThemeEditorUtils.changeColor(myModule, colorName, myResultResourceName); } else { ThemeEditorUtils.createColor(myModule, colorName, myResultResourceName); } myResultResourceName = SdkConstants.COLOR_RESOURCE_PREFIX + colorName; } super.doOKAction(); }
@Override protected void doOKAction() { super.doOKAction(); // Saving checkboxes state PropertiesComponent.getInstance() .setValue( LayoutCodeConstants.OPTIMIZE_IMPORTS_KEY, Boolean.toString(myCbOptimizeImports.isSelected())); PropertiesComponent.getInstance() .setValue( LayoutCodeConstants.REARRANGE_ENTRIES_KEY, Boolean.toString(myCbArrangeEntries.isSelected())); PropertiesComponent.getInstance() .setValue( LayoutCodeConstants.PROCESS_CHANGED_TEXT_KEY, Boolean.toString(myCbOnlyVcsChangedRegions.isSelected())); }
@Override protected void doOKAction() { super.doOKAction(); if (myCurrentProject != null) { int exitCode = Messages.showDialog( IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.open.project"), new String[] { IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe") }, 1, Messages.getQuestionIcon()); if (exitCode == 1) { ProjectUtil.closeAndDispose(myCurrentProject); } } final ProjectOptions myOptions = new ProjectOptions(); myOptions.setProjectName(myProjectName.getText()); myOptions.setProjectPath(myProjectPath.getPath()); myOptions.setCreateNewLanguage(false); myOptions.setCreateNewSolution(false); myOptions.setStorageScheme(myProjectFormatPanel.isDefault()); // invoke later is for plugins to be ready ApplicationManager.getApplication() .invokeLater( new Runnable() { @Override public void run() { try { ProjectFactory factory = new ProjectFactory(myCurrentProject, myOptions); Project project = factory.createProject(); myCurrentTemplateItem .getTemplateFiller() .fillProjectWithModules(project.getComponent(MPSProject.class)); factory.activate(); } catch (ProjectNotCreatedException e) { Messages.showErrorDialog(getContentPane(), e.getMessage()); } } }); }
protected void doOKAction() { if (myNode != null) { if (!doSetIcon(myNode, myTextField.getText(), getContentPane())) { return; } final Object userObject = myNode.getUserObject(); if (userObject instanceof Pair) { String actionId = (String) ((Pair) userObject).first; final AnAction action = ActionManager.getInstance().getAction(actionId); final Icon icon = (Icon) ((Pair) userObject).second; action.getTemplatePresentation().setIcon(icon); action.setDefaultIcon(icon == null); editToolbarIcon(actionId, myNode); } myActionsTree.repaint(); } setCustomizationSchemaForCurrentProjects(); super.doOKAction(); }
protected void doOKAction() { final String path = FileUtil.toSystemIndependentName(myDestDirectoryField.getText()); final Project project = myDirectory.getProject(); PsiDirectory directory = ApplicationManager.getApplication() .runWriteAction( new Computable<PsiDirectory>() { public PsiDirectory compute() { try { return DirectoryUtil.mkdirs(PsiManager.getInstance(project), path); } catch (IncorrectOperationException e) { LOG.error(e); return null; } } }); if (directory == null) { Messages.showErrorDialog( project, RefactoringBundle.message("cannot.find.or.create.destination.directory"), RefactoringBundle.message("cannot.move")); return; } super.doOKAction(); final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory); if (aPackage == null) { Messages.showErrorDialog( project, RefactoringBundle.message("destination.directory.does.not.correspond.to.any.package"), RefactoringBundle.message("cannot.move")); return; } final JavaRefactoringSettings refactoringSettings = JavaRefactoringSettings.getInstance(); final boolean searchInComments = isSearchInComments(); final boolean searchForTextOccurences = isSearchInNonJavaFiles(); refactoringSettings.MOVE_SEARCH_IN_COMMENTS = searchInComments; refactoringSettings.MOVE_SEARCH_FOR_TEXT = searchForTextOccurences; performRefactoring(project, directory, aPackage, searchInComments, searchForTextOccurences); }
@Override protected void doOKAction() { boolean retVal; try { String name = txtName.getText().trim(); String thumb = txtThumb.getText().trim(); retVal = validateNameAndThumbprint(name, thumb); if (retVal) { waRole.addCertificate(name, thumb.toUpperCase()); certNameAdded = name; } } catch (Exception ex) { PluginUtil.displayErrorDialogAndLog( message("rolsErr"), message("adRolErrMsgBox1") + message("adRolErrMsgBox2"), ex); retVal = false; } if (retVal) { super.doOKAction(); } }
@Override protected void doOKAction() { if (!(check())) { return; } super.doOKAction(); NewModuleUtil.runModuleCreation( myProject, new _FunctionTypes._void_P0_E0() { public void invoke() { myResult = NewModuleUtil.createSolution( mySolutionSettings.getSolutionName(), mySolutionSettings.getSolutionLocation(), (MPSProject) myProject); ((StandaloneMPSProject) myProject).setFolderFor(myResult, myVirtualFolder); } }); }
@Override protected void doOKAction() { final String resourceName = getResourceName(); final String fileName = getFileName(); final List<String> dirNames = getDirNames(); final Module module = getModule(); if (resourceName.length() == 0) { Messages.showErrorDialog( myPanel, "Resource name is not specified", CommonBundle.getErrorTitle()); } else if (!AndroidResourceUtil.isCorrectAndroidResourceName(resourceName)) { Messages.showErrorDialog( myPanel, resourceName + " is not correct resource name", CommonBundle.getErrorTitle()); } else if (fileName.length() == 0) { Messages.showErrorDialog(myPanel, "File name is not specified", CommonBundle.getErrorTitle()); } else if (dirNames.size() == 0) { Messages.showErrorDialog( myPanel, "Directories are not selected", CommonBundle.getErrorTitle()); } else if (module == null) { Messages.showErrorDialog(myPanel, "Module is not specified", CommonBundle.getErrorTitle()); } else { super.doOKAction(); } }
protected void doOKAction() { if (!isOKActionEnabled()) { return; } if (isTextFieldActive()) { final String text = myPathTextField.getTextFieldText(); final LookupFile file = myPathTextField.getFile(); if (text == null || file == null || !file.exists()) { setErrorText("Specified path cannot be found"); return; } } final List<VirtualFile> selectedFiles = Arrays.asList(getSelectedFilesInt()); final VirtualFile[] files = VfsUtilCore.toVirtualFileArray( FileChooserUtil.getChosenFiles(myChooserDescriptor, selectedFiles)); if (files.length == 0) { myChosenFiles = VirtualFile.EMPTY_ARRAY; close(CANCEL_EXIT_CODE); return; } try { myChooserDescriptor.validateSelectedFiles(files); } catch (Exception e) { Messages.showErrorDialog(getContentPane(), e.getMessage(), getTitle()); return; } myChosenFiles = files; storeSelection(files[files.length - 1]); super.doOKAction(); }
@Override protected void doOKAction() { TaskManagerImpl taskManager = (TaskManagerImpl) TaskManager.getManager(myProject); taskManager.getState().markAsInProgress = isMarkAsInProgress(); if (taskManager.isVcsEnabled()) { taskManager.getState().createChangelist = myCreateChangelist.isSelected(); } TaskRepository repository = myTask.getRepository(); if (isMarkAsInProgress() && repository != null) { try { repository.setTaskState(myTask, TaskState.IN_PROGRESS); } catch (Exception ex) { Messages.showErrorDialog(myProject, "Could not set state for " + myTask.getId(), "Error"); LOG.warn(ex); } } taskManager.activateTask(myTask, isClearContext(), isCreateChangelist()); if (myTask.getType() == TaskType.EXCEPTION && AnalyzeTaskStacktraceAction.hasTexts(myTask)) { AnalyzeTaskStacktraceAction.analyzeStacktrace(myTask, myProject); } super.doOKAction(); }
protected void doOKAction() { final ActionManager actionManager = ActionManager.getInstance(); TreeUtil.traverseDepth( (TreeNode) myTree.getModel().getRoot(), new TreeUtil.Traverse() { public boolean accept(Object node) { if (node instanceof DefaultMutableTreeNode) { final DefaultMutableTreeNode mutableNode = (DefaultMutableTreeNode) node; final Object userObject = mutableNode.getUserObject(); if (userObject instanceof Pair) { String actionId = (String) ((Pair) userObject).first; final AnAction action = actionManager.getAction(actionId); Icon icon = (Icon) ((Pair) userObject).second; action.getTemplatePresentation().setIcon(icon); action.setDefaultIcon(icon == null); editToolbarIcon(actionId, mutableNode); } } return true; } }); super.doOKAction(); setCustomizationSchemaForCurrentProjects(); }