Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
286,400 | Builder (@Nls @NotNull String fragmentText, @NotNull SimpleTextAttributes attributes) { if (!fragmentText.isEmpty()) { if (myLastFragmentAttributes == null && !myFragments.isEmpty()) { int size = myFragments.size(); Fragment lastFragment = myFragments.get(size - 1); if (attributes.equals(lastFragment.fragmentAttributes())) { myLastFragmentTextBuilder.append(lastFragment.fragmentText()); myFragments.remove(size - 1); } } if (!attributes.equals(myLastFragmentAttributes)) { flushLastFragment(); } myLastFragmentAttributes = attributes; myLastFragmentTextBuilder.append(fragmentText); } return this; } | append |
286,401 | void () { if (myLastFragmentAttributes != null) { myFragments.add(new ColoredTextFragmentImpl(myLastFragmentTextBuilder.toString(), myLastFragmentAttributes)); myLastFragmentTextBuilder.setLength(0); myLastFragmentAttributes = null; } } | flushLastFragment |
286,402 | ColoredText () { flushLastFragment(); int size = myFragments.size(); if (size == 0) { return ColoredTextImpl.EMPTY; } else if (size == 1) { return new ColoredTextImpl(myFragments.get(0)); } else { return new ColoredTextImpl(myFragments); } } | build |
286,403 | Component (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { myCellState.collectState(table, isSelected, hasFocus, row, column); if (value == null) { myCellState.updateRenderer(myPanel); return myPanel; } myCellState.updateRenderer(this); if (value instanceof String) { setSelected(Boolean.parseBoolean((String)value)); } else { setSelected(((Boolean)value).booleanValue()); } setEnabled(table.isCellEditable(row, column)); return this; } | getTableCellRendererComponent |
286,404 | Icon () { return getScaled(0); } | getMainIcon |
286,405 | Icon () { return getScaled(1); } | getOverlayIcon |
286,406 | Icon (int layer) { Icon icon = getIcon(layer); assert icon != null; float scale = getScale(); return scale == 1f ? icon : IconUtil.scale(icon, null, scale); } | getScaled |
286,407 | void (Component c, Graphics g, int x, int y) { Shape dontPaintHere = getOverlayShape(0, 0); if (dontPaintHere == null) { super.paintIcon(c, g, x, y); return; } BufferedImage img = UIUtil.createImage(((Graphics2D)g).getDeviceConfiguration(), getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB, PaintUtil.RoundingMode.CEIL); Graphics2D g2 = img.createGraphics(); getMainIcon().paintIcon(c, g2, 0, 0); GraphicsConfig config = new GraphicsConfig(g2); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR)); g2.fill(dontPaintHere); config.restore(); UIUtil.drawImage(g,img, x, y, null); getOverlayIcon().paintIcon(c, g, x, y); } | paintIcon |
286,408 | IconWrapperWithToolTipComposite (@NotNull IconReplacer replacer) { return new IconWrapperWithToolTipComposite(replacer.replaceIcon(myIcon)); } | replaceBy |
286,409 | void (Component c, Graphics g, int x, int y) { myIcon.paintIcon(c, g, x, y); } | paintIcon |
286,410 | int () { return myIcon.getIconWidth(); } | getIconWidth |
286,411 | int () { return myIcon.getIconHeight(); } | getIconHeight |
286,412 | Icon () { return new IconWrapperWithToolTipComposite(myIcon); } | copy |
286,413 | Icon () { return myIcon; } | retrieveIcon |
286,414 | int () { return myIcon.hashCode(); } | hashCode |
286,415 | boolean (Object object) { return object == this || object instanceof IconWrapperWithToolTipComposite && Objects.equals(((IconWrapperWithToolTipComposite)object).myIcon, this.myIcon); } | equals |
286,416 | String () { return "IconWrapperWithTooltipComposite:" + myIcon.toString(); } | toString |
286,417 | String (@Nullable PsiElement element) { if (element == null) return null; return DumbService.getInstance(element.getProject()).computeWithAlternativeResolveEnabled(() -> QualifiedNameProviderUtil.getQualifiedName(element)); } | getQualifiedNameFromProviders |
286,418 | String (@Nullable final PsiElement element, @Nullable Editor editor) { String result = getQualifiedNameFromProviders(element); if (result != null) return result; if (editor != null) { //IDEA-70346 PsiReference reference = TargetElementUtilBase.findReference(editor, editor.getCaretModel().getOffset()); if (reference != null) { result = getQualifiedNameFromProviders(reference.resolve()); if (result != null) return result; } } if (element instanceof PsiFile) { return FileUtil.toSystemIndependentName(getFileFqn((PsiFile)element)); } if (element instanceof PsiDirectory) { return FileUtil.toSystemIndependentName(getVirtualFileFqn(((PsiDirectory)element).getVirtualFile(), element.getProject())); } return null; } | elementToFqn |
286,419 | String (@NotNull VirtualFile virtualFile, @NotNull Project project) { for (VirtualFileQualifiedNameProvider provider : VirtualFileQualifiedNameProvider.EP_NAME.getExtensionList()) { String qualifiedName = provider.getQualifiedName(project, virtualFile); if (qualifiedName != null) { return qualifiedName; } } VirtualFile baseDirectory = BaseProjectDirectories.getInstance(project).getBaseDirectoryFor(virtualFile); if (baseDirectory != null) { String relativePath = VfsUtilCore.getRelativePath(virtualFile, baseDirectory); if (relativePath != null) { return relativePath; } } RootType rootType = RootType.forFile(virtualFile); if (rootType != null) { VirtualFile scratchRootVirtualFile = VfsUtil.findFileByIoFile(new File(ScratchFileService.getInstance().getRootPath(rootType)), false); if (scratchRootVirtualFile != null) { String scratchRelativePath = VfsUtilCore.getRelativePath(virtualFile, scratchRootVirtualFile); if (scratchRelativePath != null) { return scratchRelativePath; } } } return virtualFile.getPath(); } | getVirtualFileFqn |
286,420 | PsiElement (@NotNull PsiElement element) { for (QualifiedNameProvider provider : QualifiedNameProvider.EP_NAME.getExtensionList()) { PsiElement adjustedElement = provider.adjustElementToCopy(element); if (adjustedElement != null) return adjustedElement; } return null; } | adjustElementToCopy |
286,421 | String (@NotNull PsiElement element) { for (QualifiedNameProvider provider : QualifiedNameProvider.EP_NAME.getExtensionList()) { String qualifiedName = provider.getQualifiedName(element); if (qualifiedName != null) return qualifiedName; } return null; } | getQualifiedName |
286,422 | PsiElement (@NotNull String qualifiedName, @NotNull Project project) { for (QualifiedNameProvider provider : QualifiedNameProvider.EP_NAME.getExtensionList()) { PsiElement element = provider.qualifiedNameToElement(qualifiedName, project); if (element != null) return element; } return null; } | qualifiedNameToElement |
286,423 | RefactoringSupportProvider (@NotNull PsiElement element) { List<RefactoringSupportProvider> providers = INSTANCE.allForLanguage(element.getLanguage()); for (RefactoringSupportProvider provider : providers) { if (provider.isAvailable(element)) { return provider; } } return null; } | forContext |
286,424 | boolean (@NotNull PsiElement context) { return true; } | isAvailable |
286,425 | boolean (@NotNull PsiElement element) { return false; } | isSafeDeleteAvailable |
286,426 | RefactoringActionHandler () { return null; } | getIntroduceVariableHandler |
286,427 | RefactoringActionHandler (PsiElement element) { return getIntroduceVariableHandler(); } | getIntroduceVariableHandler |
286,428 | RefactoringActionHandler () { return null; } | getExtractMethodHandler |
286,429 | RefactoringActionHandler () { return null; } | getIntroduceConstantHandler |
286,430 | RefactoringActionHandler () { return null; } | getIntroduceFieldHandler |
286,431 | RefactoringActionHandler () { return null; } | getIntroduceParameterHandler |
286,432 | RefactoringActionHandler () { return null; } | getIntroduceFunctionalParameterHandler |
286,433 | RefactoringActionHandler () { return null; } | getIntroduceFunctionalVariableHandler |
286,434 | RefactoringActionHandler () { return null; } | getPullUpHandler |
286,435 | RefactoringActionHandler () { return null; } | getPushDownHandler |
286,436 | RefactoringActionHandler () { return null; } | getExtractInterfaceHandler |
286,437 | RefactoringActionHandler () { return null; } | getExtractModuleHandler |
286,438 | RefactoringActionHandler () { return null; } | getExtractSuperClassHandler |
286,439 | ChangeSignatureHandler () { return null; } | getChangeSignatureHandler |
286,440 | boolean (@NotNull PsiElement element, PsiElement context) { return false; } | isInplaceRenameAvailable |
286,441 | boolean (@NotNull PsiElement element, PsiElement context) { return false; } | isInplaceIntroduceAvailable |
286,442 | RefactoringActionHandler () { return null; } | getExtractClassHandler |
286,443 | boolean (@NotNull PsiElement element, @Nullable PsiElement context) { return false; } | isMemberInplaceRenameAvailable |
286,444 | boolean () { return false; } | isOnlyOneReferenceToInline |
286,445 | boolean (PsiElement element) { return canInlineElement(element); } | isEnabledOnElement |
286,446 | boolean (PsiElement element, @Nullable Editor editor) { return isEnabledOnElement(element); } | isEnabledOnElement |
286,447 | boolean (PsiElement element, Editor editor) { return canInlineElement(element); } | canInlineElementInEditor |
286,448 | String (PsiElement element) { return null; } | getActionName |
286,449 | List<InlineHandler> (Language language) { return INSTANCE.allForLanguage(language); } | getInlineHandlers |
286,450 | HighlightManager (@NotNull Project project) { return project.getService(HighlightManager.class); } | getInstance |
286,451 | RenameRefactoringDialog (Project project, PsiElement element, PsiElement context, Editor editor) { return null; } | createRenameRefactoringDialog |
286,452 | int (boolean isMultipleFiles, @DialogTitle String title, Project project) { return FindManager.PromptResult.SKIP; } | showReplacePromptDialog |
286,453 | void (@NotNull Project project, @NotNull @StatusBarText String message) { } | setStatusBarInfo |
286,454 | ConflictsDialogBase (@NotNull Project project, @NotNull MultiMap<PsiElement, @DialogMessage String> conflicts, @Nullable Runnable doRefactoringRunnable, boolean alwaysShowOkButton, boolean canShowConflictsInView) { return null; } | createConflictsDialog |
286,455 | void (PsiElement element, FindUsagesOptions options) { } | startFindUsages |
286,456 | void (PsiElement file, PsiElement target, @NotNull Editor editor, boolean clearHighlights) { } | highlightUsageReferences |
286,457 | boolean (@DialogTitle String title, @DialogMessage String message, @NonNls String helpTopic, @NonNls String iconId, boolean showCancelButton, Project project) { return false; } | showRefactoringMessageDialog |
286,458 | RefactoringUiService () { return ApplicationManager.getApplication().getService(RefactoringUiService.class); } | getInstance |
286,459 | void (PsiElement @NotNull [] elements) {} | refreshElements |
286,460 | boolean (@NotNull Ref<UsageInfo[]> refUsages) { prepareSuccessful(); return true; } | preprocessUsages |
286,461 | boolean (UsageInfo @NotNull [] usages) { return myIsPreviewUsages; } | isPreviewUsages |
286,462 | boolean () { return myIsPreviewUsages; } | isPreviewUsages |
286,463 | Set<UnloadedModuleDescription> (UsageViewDescriptor descriptor) { if (ModuleManager.getInstance(myProject).getUnloadedModuleDescriptions().isEmpty()) { //optimization return Collections.emptySet(); } Set<UnloadedModuleDescription> unloadedModulesInUseScope = new LinkedHashSet<>(); for (PsiElement element : descriptor.getElements()) { SearchScope useScope = element.getUseScope(); if (useScope instanceof GlobalSearchScope) { unloadedModulesInUseScope.addAll(((GlobalSearchScope)useScope).getUnloadedModulesBelongingToScope()); } } return unloadedModulesInUseScope; } | computeUnloadedModulesFromUseScope |
286,464 | void (boolean isPreviewUsages) { myIsPreviewUsages = isPreviewUsages; } | setPreviewUsages |
286,465 | void (Runnable prepareSuccessfulSwingThreadCallback) { myPrepareSuccessfulSwingThreadCallback = prepareSuccessfulSwingThreadCallback; } | setPrepareSuccessfulSwingThreadCallback |
286,466 | RefactoringTransaction () { return myTransaction; } | getTransaction |
286,467 | void () { if (!PsiDocumentManager.getInstance(myProject).commitAllDocumentsUnderProgress()) { return; } final Ref<UsageInfo[]> refUsages = new Ref<>(); final Ref<Language> refErrorLanguage = new Ref<>(); final Ref<Boolean> refProcessCanceled = new Ref<>(); final Ref<Boolean> anyException = new Ref<>(); final Ref<Boolean> indexNotReadyException = new Ref<>(); DumbService.getInstance(myProject).completeJustSubmittedTasks(); final Runnable findUsagesRunnable = () -> { try { refUsages.set(ReadAction.compute(this::findUsages)); } catch (UnknownReferenceTypeException e) { refErrorLanguage.set(e.getElementLanguage()); } catch (ProcessCanceledException e) { refProcessCanceled.set(Boolean.TRUE); } catch (IndexNotReadyException e) { indexNotReadyException.set(Boolean.TRUE); } catch (Throwable e) { anyException.set(Boolean.TRUE); LOG.error(e); } }; long findUsagesStart = System.currentTimeMillis(); boolean isProgressFinished = ProgressManager.getInstance() .runProcessWithProgressSynchronously(findUsagesRunnable, RefactoringBundle.message("progress.text"), true, myProject); long findUsagesDuration = System.currentTimeMillis() - findUsagesStart; RefactoringUsageCollector.USAGES_SEARCHED.log(this.getClass(), !isProgressFinished, findUsagesDuration); if (!isProgressFinished) { return; } if (!refErrorLanguage.isNull()) { MessagesService.getInstance().showErrorDialog(myProject, RefactoringBundle.message("unsupported.refs.found", refErrorLanguage.get().getDisplayName()), RefactoringBundle.message("error.title")); return; } if (!indexNotReadyException.isNull() || DumbService.isDumb(myProject)) { DumbService.getInstance(myProject).showDumbModeNotificationForFunctionality(RefactoringBundle.message("refactoring.dumb.mode.notification"), DumbModeBlockedFunctionality.Refactoring); return; } if (!refProcessCanceled.isNull()) { MessagesService.getInstance().showErrorDialog(myProject, RefactoringBundle.message("refactoring.index.corruption.notifiction"), RefactoringBundle.message("error.title")); return; } if (!anyException.isNull()) { //do not proceed if find usages fails return; } assert !refUsages.isNull(): "Null usages from processor " + this; if (!preprocessUsages(refUsages)) return; final UsageInfo[] usages = refUsages.get(); assert usages != null; UsageViewDescriptor descriptor = createUsageViewDescriptor(usages); boolean isPreview = isPreviewUsages(usages) || !computeUnloadedModulesFromUseScope(descriptor).isEmpty(); if (!isPreview) { isPreview = !ensureElementsWritable(usages, descriptor) || UsageViewUtil.hasReadOnlyUsages(usages); if (isPreview) { RefactoringUiService.getInstance().setStatusBarInfo(myProject, RefactoringBundle.message("readonly.occurences.found")); } } long executeStart = System.currentTimeMillis(); if (isPreview) { for (UsageInfo usage : usages) { LOG.assertTrue(usage != null, getClass()); } previewRefactoring(usages); } else { execute(usages); } long executeDuration = System.currentTimeMillis() - executeStart; RefactoringUsageCollector.EXECUTED.log(this.getClass(), executeDuration); } | doRun |
286,468 | void (UsageInfo @NotNull [] usages) { if (ApplicationManager.getApplication().isUnitTestMode()) { if (!PREVIEW_IN_TESTS) throw new RuntimeException("Unexpected preview in tests: " + StringUtil.join(usages, UsageInfo::toString, ", ")); ensureElementsWritable(usages, createUsageViewDescriptor(usages)); execute(usages); return; } final UsageViewDescriptor viewDescriptor = createUsageViewDescriptor(usages); final PsiElement[] elements = viewDescriptor.getElements(); final PsiElement2UsageTargetAdapter[] targets = PsiElement2UsageTargetAdapter.convert(elements); Factory<UsageSearcher> factory = () -> new UsageInfoSearcherAdapter() { @Override public void generate(@NotNull final Processor<? super Usage> processor) { ApplicationManager.getApplication().runReadAction(() -> { for (int i = 0; i < elements.length; i++) { elements[i] = targets[i].getElement(); } refreshElements(elements); }); processUsages(processor, myProject); } @Override protected UsageInfo @NotNull [] findUsages() { return BaseRefactoringProcessor.this.findUsages(); } }; showUsageView(viewDescriptor, factory, usages); } | previewRefactoring |
286,469 | void (@NotNull final Processor<? super Usage> processor) { ApplicationManager.getApplication().runReadAction(() -> { for (int i = 0; i < elements.length; i++) { elements[i] = targets[i].getElement(); } refreshElements(elements); }); processUsages(processor, myProject); } | generate |
286,470 | boolean () { return false; } | skipNonCodeUsages |
286,471 | boolean (UsageInfo @NotNull [] usages, @NotNull UsageViewDescriptor descriptor) { // protect against poorly implemented equality Set<PsiElement> elements = new ReferenceOpenHashSet<>(); for (UsageInfo usage : usages) { assert usage != null: "Found null element in usages array"; if (skipNonCodeUsages() && usage.isNonCodeUsage()) { continue; } PsiElement element = usage.getElement(); if (element != null) { elements.add(element); } } elements.addAll(getElementsToWrite(descriptor)); return ensureFilesWritable(myProject, elements); } | ensureElementsWritable |
286,472 | boolean (@NotNull Project project, @NotNull Collection<? extends PsiElement> elements) { PsiElement[] psiElements = PsiUtilCore.toPsiElementArray(elements); return CommonRefactoringUtil.checkReadOnlyStatus(project, psiElements); } | ensureFilesWritable |
286,473 | void (final UsageInfo @NotNull [] usages) { execute(usages); } | executeEx |
286,474 | void (final UsageInfo @NotNull [] usages) { CommandProcessor.getInstance().executeCommand(myProject, () -> { Collection<UsageInfo> usageInfos = new LinkedHashSet<>(Arrays.asList(usages)); doRefactoring(usageInfos); if (isGlobalUndoAction()) CommandProcessor.getInstance().markCurrentCommandAsGlobal(myProject); SuggestedRefactoringProvider.getInstance(myProject).reset(); }, getCommandName(), null, getUndoConfirmationPolicy()); } | execute |
286,475 | boolean () { return CommonDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext()) == null; } | isGlobalUndoAction |
286,476 | UndoConfirmationPolicy () { return UndoConfirmationPolicy.DEFAULT; } | getUndoConfirmationPolicy |
286,477 | UsageViewPresentation (@NotNull UsageViewDescriptor descriptor, Usage @NotNull [] usages) { UsageViewPresentation presentation = new UsageViewPresentation(); presentation.setTabText(RefactoringBundle.message("usageView.tabText")); presentation.setTargetsNodeText(descriptor.getProcessedElementsHeader()); presentation.setShowReadOnlyStatusAsRed(true); presentation.setShowCancelButton(true); presentation.setUsagesString(RefactoringBundle.message("usageView.usagesText")); int codeUsageCount = 0; int nonCodeUsageCount = 0; int dynamicUsagesCount = 0; Set<PsiFile> codeFiles = new HashSet<>(); Set<PsiFile> nonCodeFiles = new HashSet<>(); Set<PsiFile> dynamicUsagesCodeFiles = new HashSet<>(); for (Usage usage : usages) { if (usage instanceof PsiElementUsage elementUsage) { final PsiElement element = elementUsage.getElement(); if (element == null) continue; final PsiFile containingFile = element.getContainingFile(); if (usage instanceof UsageInfo2UsageAdapter && ((UsageInfo2UsageAdapter)usage).getUsageInfo().isDynamicUsage()) { dynamicUsagesCount++; dynamicUsagesCodeFiles.add(containingFile); } else if (elementUsage.isNonCodeUsage()) { nonCodeUsageCount++; nonCodeFiles.add(containingFile); } else { codeUsageCount++; codeFiles.add(containingFile); } } } codeFiles.remove(null); nonCodeFiles.remove(null); dynamicUsagesCodeFiles.remove(null); presentation.setCodeUsagesString(UsageViewBundle.message( "usage.view.results.node.prefix", UsageViewBundle.message("usage.view.results.node.code"), descriptor.getCodeReferencesText(codeUsageCount, codeFiles.size()) )); presentation.setNonCodeUsagesString(UsageViewBundle.message( "usage.view.results.node.prefix", UsageViewBundle.message("usage.view.results.node.non.code"), descriptor.getCodeReferencesText(nonCodeUsageCount, nonCodeFiles.size()) )); presentation.setDynamicUsagesString(UsageViewBundle.message( "usage.view.results.node.prefix", UsageViewBundle.message("usage.view.results.node.dynamic"), descriptor.getCodeReferencesText(dynamicUsagesCount, dynamicUsagesCodeFiles.size()) )); return presentation; } | createPresentation |
286,478 | boolean (@NotNull Project project, @NotNull MultiMap<PsiElement, @DialogMessage String> conflicts) { if (conflicts.isEmpty()) return true; if (ApplicationManager.getApplication().isUnitTestMode()) { if (BaseRefactoringProcessor.ConflictsInTestsException.isTestIgnore()) return true; throw new BaseRefactoringProcessor.ConflictsInTestsException(conflicts.values()); } ConflictsDialogBase conflictsDialog = RefactoringUiService.getInstance().createConflictsDialog(project, conflicts, null, true, true); return conflictsDialog.showAndGet(); } | processConflicts |
286,479 | void (@NotNull UsageViewDescriptor viewDescriptor, @NotNull Factory<? extends UsageSearcher> factory, UsageInfo @NotNull [] usageInfos) { UsageViewManager viewManager = UsageViewManager.getInstance(myProject); final PsiElement[] initialElements = viewDescriptor.getElements(); final UsageTarget[] targets = PsiElement2UsageTargetAdapter.convert(initialElements); final Ref<Usage[]> convertUsagesRef = new Ref<>(); if (!ProgressManager.getInstance().runProcessWithProgressSynchronously( () -> ApplicationManager.getApplication().runReadAction( () -> convertUsagesRef.set(UsageInfo2UsageAdapter.convert(usageInfos))), RefactoringBundle.message("refactoring.preprocess.usages.progress"), true, myProject)) return; if (convertUsagesRef.isNull()) return; final Usage[] usages = convertUsagesRef.get(); final UsageViewPresentation presentation = createPresentation(viewDescriptor, usages); if (myUsageView == null) { myUsageView = viewManager.showUsages(targets, usages, presentation, factory); customizeUsagesView(viewDescriptor, myUsageView); } else { myUsageView.removeUsagesBulk(myUsageView.getUsages()); ((UsageViewEx)myUsageView).appendUsagesInBulk(Arrays.asList(usages)); } Set<UnloadedModuleDescription> unloadedModules = computeUnloadedModulesFromUseScope(viewDescriptor); if (!unloadedModules.isEmpty()) { myUsageView.appendUsage(new UnknownUsagesInUnloadedModules(unloadedModules)); } } | showUsageView |
286,480 | void (@NotNull final UsageViewDescriptor viewDescriptor, @NotNull final UsageView usageView) { Runnable refactoringRunnable = () -> { Set<UsageInfo> usagesToRefactor = UsageViewUtil.getNotExcludedUsageInfos(usageView); final UsageInfo[] infos = usagesToRefactor.toArray(UsageInfo.EMPTY_ARRAY); if (ensureElementsWritable(infos, viewDescriptor)) { execute(infos); } }; String canNotMakeString = RefactoringBundle.message("usageView.need.reRun"); addDoRefactoringAction(usageView, refactoringRunnable, canNotMakeString); usageView.setRerunAction(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { run(); } }); } | customizeUsagesView |
286,481 | void (ActionEvent e) { run(); } | actionPerformed |
286,482 | void (@NotNull UsageView usageView, @NotNull Runnable refactoringRunnable, @NotNull String canNotMakeString) { usageView.addPerformOperationAction(refactoringRunnable, getCommandName(), canNotMakeString, RefactoringBundle.message("usageView.doAction"), false); } | addDoRefactoringAction |
286,483 | void (@NotNull final Collection<UsageInfo> usageInfoSet) { for (Iterator<UsageInfo> iterator = usageInfoSet.iterator(); iterator.hasNext();) { UsageInfo usageInfo = iterator.next(); final PsiElement element = usageInfo.getElement(); if (element == null || !isToBeChanged(usageInfo)) { iterator.remove(); } } String commandName = getCommandName(); LocalHistoryAction action = LocalHistory.getInstance().startAction(commandName); final UsageInfo[] writableUsageInfos = usageInfoSet.toArray(UsageInfo.EMPTY_ARRAY); final String refactoringId = getRefactoringId(); try { if (refactoringId != null) { RefactoringEventData data = getBeforeData(); if (data != null) { data.addUsages(Arrays.asList(writableUsageInfos)); } myProject.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted(refactoringId, data); } PsiDocumentManager.getInstance(myProject).commitAllDocuments(); RefactoringListenerManagerImpl listenerManager = (RefactoringListenerManagerImpl)RefactoringListenerManager.getInstance(myProject); myTransaction = listenerManager.startTransaction(); final Map<RefactoringHelper, Object> preparedData = new LinkedHashMap<>(); final Runnable prepareHelpersRunnable = () -> { RefactoringEventData data = ReadAction.compute(() -> getBeforeData()); PsiElement primaryElement = data != null ? data.getUserData(RefactoringEventData.PSI_ELEMENT_KEY) : null; for (final RefactoringHelper helper : RefactoringHelper.EP_NAME.getExtensionList()) { Object operation = ReadAction.compute(() -> primaryElement != null ? helper.prepareOperation(writableUsageInfos, primaryElement) : helper.prepareOperation(writableUsageInfos)); preparedData.put(helper, operation); } }; ProgressManager.getInstance().runProcessWithProgressSynchronously(prepareHelpersRunnable, RefactoringBundle.message("refactoring.prepare.progress"), false, myProject); if (refactoringId != null) { UndoManager.getInstance(myProject).undoableActionPerformed(new UndoRefactoringAction(myProject, refactoringId)); } ApplicationEx app = ApplicationManagerEx.getApplicationEx(); if (Registry.is("run.refactorings.under.progress")) { app.runWriteActionWithNonCancellableProgressInDispatchThread(commandName, myProject, null, indicator -> performRefactoring(writableUsageInfos)); } else { app.runWriteAction(() -> performRefactoring(writableUsageInfos)); } DumbService.getInstance(myProject).completeJustSubmittedTasks(); for(Map.Entry<RefactoringHelper, Object> e: preparedData.entrySet()) { //noinspection unchecked e.getKey().performOperation(myProject, e.getValue()); } myTransaction.commit(); if (Registry.is("run.refactorings.under.progress")) { app.runWriteActionWithNonCancellableProgressInDispatchThread(commandName, myProject, null, indicator -> performPsiSpoilingRefactoring()); } else { app.runWriteAction(this::performPsiSpoilingRefactoring); } } finally { if (refactoringId != null) { myProject.getMessageBus() .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone(refactoringId, getAfterData(writableUsageInfos)); } action.finish(); myUsageView = null; } int count = writableUsageInfos.length; if (count > 0) { RefactoringUiService.getInstance().setStatusBarInfo(myProject, RefactoringBundle.message("statusBar.refactoring.result", count)); } else { if (!isPreviewUsages(writableUsageInfos)) { RefactoringUiService.getInstance().setStatusBarInfo(myProject, RefactoringBundle.message("statusBar.noUsages")); } } } | doRefactoring |
286,484 | boolean (@NotNull UsageInfo usageInfo) { return usageInfo.isWritable(); } | isToBeChanged |
286,485 | void () { } | performPsiSpoilingRefactoring |
286,486 | void () { if (myPrepareSuccessfulSwingThreadCallback != null) { // make sure that dialog is closed in swing thread try { ApplicationManager.getApplication().invokeAndWait(myPrepareSuccessfulSwingThreadCallback); } catch (RuntimeException e) { LOG.error(e); } } } | prepareSuccessful |
286,487 | void () { Runnable baseRunnable = () -> { try (var ignored = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { doRun(); } }; Runnable runnable = shouldDisableAccessChecks() ? () -> NonProjectFileWritingAccessProvider.disableChecksDuring(baseRunnable) : baseRunnable; if (ApplicationManager.getApplication().isUnitTestMode()) { ApplicationManager.getApplication().assertWriteIntentLockAcquired(); runnable.run(); return; } if (ApplicationManager.getApplication().isWriteAccessAllowed()) { LOG.error("Refactorings should not be started inside write action\n because they start progress inside and any read action from the progress task would cause the deadlock", new Exception()); DumbService.getInstance(myProject).smartInvokeLater(runnable); } else { runnable.run(); } } | run |
286,488 | boolean () { return false; } | shouldDisableAccessChecks |
286,489 | boolean () { return myTestIgnore; } | isTestIgnore |
286,490 | Collection<String> () { List<String> result = new ArrayList<>(messages); for (int i = 0; i < messages.size(); i++) { result.set(i, result.get(i).replaceAll("<[^>]+>", "")); } return result; } | getMessages |
286,491 | String () { List<String> result = ContainerUtil.sorted(messages); return StringUtil.join(result, "\n"); } | getMessage |
286,492 | boolean (@NotNull MultiMap<PsiElement, @DialogMessage String> conflicts, UsageInfo @Nullable [] usages) { if (!conflicts.isEmpty() && ApplicationManager.getApplication().isUnitTestMode()) { if (!ConflictsInTestsException.isTestIgnore()) throw new ConflictsInTestsException(conflicts.values()); return true; } if (myPrepareSuccessfulSwingThreadCallback != null && !conflicts.isEmpty()) { final String refactoringId = getRefactoringId(); if (refactoringId != null) { RefactoringEventData conflictUsages = new RefactoringEventData(); conflictUsages.putUserData(RefactoringEventData.CONFLICTS_KEY, conflicts.values()); myProject.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC) .conflictsDetected(refactoringId, conflictUsages); } final ConflictsDialogBase conflictsDialog = prepareConflictsDialog(conflicts, usages); if (!conflictsDialog.showAndGet()) { if (conflictsDialog.isShowConflicts()) prepareSuccessful(); return false; } } prepareSuccessful(); return true; } | showConflicts |
286,493 | ConflictsDialogBase (@NotNull MultiMap<PsiElement, @DialogMessage String> conflicts, UsageInfo @Nullable [] usages) { final ConflictsDialogBase conflictsDialog = createConflictsDialog(conflicts, usages); conflictsDialog.setCommandName(getCommandName()); return conflictsDialog; } | prepareConflictsDialog |
286,494 | RefactoringEventData () { return null; } | getBeforeData |
286,495 | RefactoringEventData (UsageInfo @NotNull [] usages) { return null; } | getAfterData |
286,496 | String () { return null; } | getRefactoringId |
286,497 | ConflictsDialogBase (@NotNull MultiMap<PsiElement, @DialogMessage String> conflicts, UsageInfo @Nullable [] usages) { return RefactoringUiService.getInstance().createConflictsDialog(myProject, conflicts, usages == null ? null : () -> execute(usages), false, true); } | createConflictsDialog |
286,498 | void () { myProject.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).undoRefactoring(myRefactoringId); } | undo |
286,499 | void () { myProject.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).redoRefactoring(myRefactoringId); } | redo |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.