CodeServer: support Python inline variable and inline method refactorings

Also decouple BaseRefacgoringProcessor from UI and split usageView into api and impl parts

GitOrigin-RevId: c4c6d9011726d93f0ee6ab4677f7a105c28ec108
This commit is contained in:
Dmitry Trofimov
2022-02-08 09:59:00 +01:00
committed by intellij-monorepo-bot
parent e1001bb07d
commit f35438983c
179 changed files with 586 additions and 427 deletions

1
.idea/modules.xml generated
View File

@@ -810,6 +810,7 @@
<module fileurl="file://$PROJECT_DIR$/uast/uast-tests/intellij.platform.uast.tests.iml" filepath="$PROJECT_DIR$/uast/uast-tests/intellij.platform.uast.tests.iml" />
<module fileurl="file://$PROJECT_DIR$/updater/intellij.platform.updater.iml" filepath="$PROJECT_DIR$/updater/intellij.platform.updater.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/usageView/intellij.platform.usageView.iml" filepath="$PROJECT_DIR$/platform/usageView/intellij.platform.usageView.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/usageView-impl/intellij.platform.usageView.impl.iml" filepath="$PROJECT_DIR$/platform/usageView-impl/intellij.platform.usageView.impl.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/util/intellij.platform.util.iml" filepath="$PROJECT_DIR$/platform/util/intellij.platform.util.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/util/base/intellij.platform.util.base.iml" filepath="$PROJECT_DIR$/platform/util/base/intellij.platform.util.base.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/util-class-loader/intellij.platform.util.classLoader.iml" filepath="$PROJECT_DIR$/platform/util-class-loader/intellij.platform.util.classLoader.iml" />

View File

@@ -10,6 +10,7 @@ import com.intellij.openapi.util.Ref;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.util.*;
import com.intellij.refactoring.ConflictsDialogBase;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.rename.RenameUtil;
import com.intellij.refactoring.ui.ConflictsDialog;
@@ -157,7 +158,7 @@ public class ChangeSignatureProcessor extends ChangeSignatureProcessorBase {
throw new ConflictsInTestsException(conflictDescriptions.values());
}
if (myPrepareSuccessfulSwingThreadCallback != null) {
ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
ConflictsDialogBase dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
if (!dialog.showAndGet()) {
if (dialog.isShowConflicts()) prepareSuccessful();
return false;
@@ -276,4 +277,4 @@ public class ChangeSignatureProcessor extends ChangeSignatureProcessorBase {
}
return substitutor;
}
}
}

View File

@@ -21,8 +21,8 @@ import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.util.*;
import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.refactoring.ConflictsDialogBase;
import com.intellij.refactoring.inheritanceToDelegation.usageInfo.*;
import com.intellij.refactoring.ui.ConflictsDialog;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.refactoring.util.ConflictsUtil;
import com.intellij.refactoring.util.RefactoringUIUtil;
@@ -191,7 +191,7 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor {
analyzeConflicts(usagesIn, conflicts);
if (!conflicts.isEmpty()) {
ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, usagesIn);
ConflictsDialogBase conflictsDialog = prepareConflictsDialog(conflicts, usagesIn);
if (!conflictsDialog.showAndGet()) {
if (conflictsDialog.isShowConflicts()) prepareSuccessful();
return false;
@@ -1215,4 +1215,4 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor {
}
}
}
}
}

View File

@@ -16,8 +16,8 @@ import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.refactoring.ConflictsDialogBase;
import com.intellij.refactoring.listeners.RefactoringEventData;
import com.intellij.refactoring.ui.ConflictsDialog;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.refactoring.util.ConflictsUtil;
import com.intellij.refactoring.util.RefactoringUIUtil;
@@ -88,7 +88,7 @@ public abstract class MakeMethodOrClassStaticProcessor<T extends PsiTypeParamete
if (myPrepareSuccessfulSwingThreadCallback != null) {
MultiMap<PsiElement, String> conflicts = getConflictDescriptions(usagesIn);
if (conflicts.size() > 0) {
ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, refUsages.get());
ConflictsDialogBase conflictsDialog = prepareConflictsDialog(conflicts, refUsages.get());
if (!conflictsDialog.showAndGet()) {
if (conflictsDialog.isShowConflicts()) prepareSuccessful();
return false;
@@ -327,4 +327,4 @@ public abstract class MakeMethodOrClassStaticProcessor<T extends PsiTypeParamete
protected abstract void changeInternalUsage(InternalUsageInfo usage, PsiElementFactory factory) throws IncorrectOperationException;
protected abstract void changeExternalUsage(UsageInfo usage, PsiElementFactory factory) throws IncorrectOperationException;
}
}

View File

@@ -177,6 +177,12 @@ public final class TargetElementUtilBase {
return ref.resolve();
}
@Nullable
public static PsiReference findReferenceWithoutExpectedCaret(@NotNull Editor editor) {
int offset = editor.getCaretModel().getOffset();
return findReference(editor, offset);
}
@Nullable
public static PsiReference findReference(@NotNull Editor editor, int offset) {
Project project = editor.getProject();
@@ -296,4 +302,4 @@ public final class TargetElementUtilBase {
}
return result;
}
}
}

View File

@@ -121,6 +121,7 @@ final class PlatformModules {
"intellij.platform.feedback",
"intellij.platform.warmup",
"intellij.platform.buildScripts.downloader",
"intellij.platform.usageView.impl",
)
private static final String UTIL_JAR = "util.jar"
@@ -345,4 +346,4 @@ final class PlatformModules {
return null
}
}
}
}

View File

@@ -20,5 +20,6 @@
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.editor" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.jps.model.impl" />
</component>
</module>

View File

@@ -1,25 +1,10 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.fileTemplates;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.vfs.CharsetToolkit;
import org.apache.velocity.runtime.parser.ParseException;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -111,5 +96,5 @@ public interface FileTemplate extends Cloneable {
@NotNull
FileTemplate clone();
String @NotNull [] getUnsetAttributes(@NotNull Properties properties, @NotNull Project project) throws ParseException;
String @NotNull [] getUnsetAttributes(@NotNull Properties properties, @NotNull Project project) throws FileTemplateParseException;
}

View File

@@ -0,0 +1,8 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.fileTemplates;
public class FileTemplateParseException extends Exception {
public FileTemplateParseException(Throwable cause) {
super(cause);
}
}

View File

@@ -1,7 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.fileTemplates;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.IdeCoreBundle;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.options.Scheme;
import com.intellij.openapi.project.Project;
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
* @author Dmitry Avdeev
*/
public abstract class FileTemplatesScheme implements Scheme {
public final static FileTemplatesScheme DEFAULT = new FileTemplatesScheme(IdeBundle.message("default.scheme")) {
public final static FileTemplatesScheme DEFAULT = new FileTemplatesScheme(IdeCoreBundle.message("default.scheme")) {
@NotNull
@Override
public String getTemplatesDir() {
@@ -46,4 +46,4 @@ public abstract class FileTemplatesScheme implements Scheme {
@NotNull
public abstract Project getProject();
}
}

View File

@@ -0,0 +1,5 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileTypes.impl;
public interface AbstractFileTypeBase {
}

View File

@@ -163,3 +163,5 @@ progress.downloading.0.files.text=Downloading {0} {0, choice, 1#file|2#files}...
dialog.directory.for.downloaded.files.title=Download Directory
dialog.directory.for.downloaded.files.description=Downloaded files will be copied to selected directory
error.file.download.failed=Failed to download ''{0}'':\n{1}
default.scheme=Default

View File

@@ -52,8 +52,9 @@ public class IdeUiService {
}
@NotNull
public DataContext createUiDataContext(Component component) {
return null;
return DataContext.EMPTY_CONTEXT;
}
public Component getComponentFromRecentMouseEvent() {
@@ -146,4 +147,4 @@ public class IdeUiService {
public boolean showErrorDialog(String title, String message) {
return false;
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.util.scopeChooser
import com.intellij.openapi.application.ApplicationManager
@@ -53,8 +53,8 @@ abstract class ScopeIdMapper {
@JvmStatic
val standardNames = setOf(ALL_PLACES_SCOPE_ID, PROJECT_AND_LIBRARIES_SCOPE_ID, PROJECT_FILES_SCOPE_ID, PROJECT_PRODUCTION_FILES_SCOPE_ID,
PROJECT_TEST_FILES_SCOPE_ID, SCRATCHES_AND_CONSOLES_SCOPE_ID, RECENTLY_VIEWED_FILES_SCOPE_ID, RECENTLY_CHANGED_FILES_SCOPE_ID,
RECENTLY_CHANGED_FILES_SCOPE_ID, OPEN_FILES_SCOPE_ID, CURRENT_FILE_SCOPE_ID)
PROJECT_TEST_FILES_SCOPE_ID, SCRATCHES_AND_CONSOLES_SCOPE_ID, RECENTLY_VIEWED_FILES_SCOPE_ID, RECENTLY_CHANGED_FILES_SCOPE_ID,
RECENTLY_CHANGED_FILES_SCOPE_ID, OPEN_FILES_SCOPE_ID, CURRENT_FILE_SCOPE_ID)
}
@Nls

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.usageView;

View File

@@ -23,5 +23,6 @@
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.editor" />
<orderEntry type="module" module-name="intellij.platform.analysis" />
<orderEntry type="module" module-name="intellij.platform.usageView" />
</component>
</module>

View File

@@ -16,6 +16,7 @@
<orderEntry type="library" name="commons-collections" level="project" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" exported="" />
<orderEntry type="module" module-name="intellij.platform.usageView" exported="" />
<orderEntry type="module" module-name="intellij.platform.usageView.impl" exported="" />
<orderEntry type="library" name="cli-parser" level="project" />
<orderEntry type="module" module-name="intellij.platform.indexing" />
<orderEntry type="module" module-name="intellij.platform.indexing.impl" exported="" />

View File

@@ -15,10 +15,10 @@ import com.intellij.openapi.fileEditor.FileEditor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import com.intellij.usageView.UsageViewBundle
import com.intellij.usageView.UsageViewUtil
import com.intellij.usages.ConfigurableUsageTarget
import com.intellij.usages.UsageTarget
import com.intellij.usages.UsageView
import com.intellij.usages.impl.UsageViewImpl
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls
import javax.swing.Icon
@@ -65,7 +65,7 @@ class SearchTarget2UsageTarget<O>(
// ----- actions -----
override fun getShortcut(): KeyboardShortcut? = UsageViewImpl.getShowUsagesWithSettingsShortcut()
override fun getShortcut(): KeyboardShortcut? = UsageViewUtil.getShowUsagesWithSettingsShortcut()
override fun getLongDescriptiveName(): @Nls String {
val target = myPointer.dereference() ?: return UsageViewBundle.message("node.invalid")
@@ -100,4 +100,4 @@ class SearchTarget2UsageTarget<O>(
}
return null
}
}
}

View File

@@ -660,7 +660,7 @@ public class ShowUsagesAction extends AnAction implements PopupAction, HintManag
private static InplaceButton createSettingsButton(@NotNull Project project,
@NotNull Runnable cancelAction,
@NotNull Runnable showDialogAndFindUsagesRunnable) {
KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
KeyboardShortcut shortcut = UsageViewUtil.getShowUsagesWithSettingsShortcut();
String tooltip = shortcut == null
? FindBundle.message("show.usages.settings.tooltip")
: FindBundle.message("show.usages.settings.tooltip.shortcut", KeymapUtil.getShortcutText(shortcut));
@@ -723,7 +723,7 @@ public class ShowUsagesAction extends AnAction implements PopupAction, HintManag
Disposable contentDisposable = Disposer.newDisposable();
AtomicReference<AbstractPopup> popupRef = new AtomicReference<>();
KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
KeyboardShortcut shortcut = UsageViewUtil.getShowUsagesWithSettingsShortcut();
if (shortcut != null) {
new DumbAwareAction() {
@Override
@@ -1364,7 +1364,7 @@ public class ShowUsagesAction extends AnAction implements PopupAction, HintManag
return new ActionButton(this, presentation, place, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE) {
@Override
protected @Nullable String getShortcutText() {
KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
KeyboardShortcut shortcut = UsageViewUtil.getShowUsagesWithSettingsShortcut();
return shortcut != null ? KeymapUtil.getShortcutText(shortcut) : null;
}
};
@@ -1440,4 +1440,4 @@ public class ShowUsagesAction extends AnAction implements PopupAction, HintManag
public static void setPopupDelayTimeout(int timeout) {
ourPopupDelayTimeout = timeout;
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.find.findUsages;
import com.intellij.codeInsight.hint.HintManager;
@@ -215,7 +215,7 @@ public final class FindUsagesManager {
startFindUsages(findUsagesOptions, handler, scopeFile, editor);
}
void startFindUsages(@NotNull PsiElement psiElement, @NotNull FindUsagesOptions findUsagesOptions) {
public void startFindUsages(@NotNull PsiElement psiElement, @NotNull FindUsagesOptions findUsagesOptions) {
ApplicationManager.getApplication().assertIsDispatchThread();
FindUsagesHandler handler = getFindUsagesHandler(psiElement, false);
if (handler == null) return;
@@ -674,4 +674,4 @@ public final class FindUsagesManager {
}
return GlobalSearchScope.allScope(project);
}
}
}

View File

@@ -16,6 +16,7 @@
package com.intellij.ide.fileTemplates.impl;
import com.intellij.ide.fileTemplates.FileTemplate;
import com.intellij.ide.fileTemplates.FileTemplateParseException;
import com.intellij.ide.fileTemplates.FileTemplateUtil;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
@@ -102,10 +103,15 @@ public abstract class FileTemplateBase implements FileTemplate {
}
@Override
public final String @NotNull [] getUnsetAttributes(@NotNull Properties properties, @NotNull Project project) throws ParseException {
public final String @NotNull [] getUnsetAttributes(@NotNull Properties properties, @NotNull Project project) throws
FileTemplateParseException {
try {
Set<String> attributes = new OrderedSet<>(Arrays.asList(FileTemplateUtil.calculateAttributes(getText(), properties, false, project)));
attributes.addAll(Arrays.asList(FileTemplateUtil.calculateAttributes(getFileName(), properties, false, project)));
return ArrayUtil.toStringArray(attributes);
} catch (ParseException e) {
throw new FileTemplateParseException(e);
}
}
@NotNull
@@ -179,4 +185,4 @@ public abstract class FileTemplateBase implements FileTemplate {
public static boolean isChild(@NotNull FileTemplate template) {
return template.getName().contains(TEMPLATE_CHILDREN_SUFFIX);
}
}
}

View File

@@ -7,6 +7,7 @@ import com.intellij.ide.IdeBundle;
import com.intellij.ide.actions.CreateFileAction;
import com.intellij.ide.fileTemplates.FileTemplate;
import com.intellij.ide.fileTemplates.FileTemplateManager;
import com.intellij.ide.fileTemplates.FileTemplateParseException;
import com.intellij.ide.fileTemplates.FileTemplateUtil;
import com.intellij.ide.fileTemplates.actions.AttributesDefaults;
import com.intellij.openapi.application.ApplicationManager;
@@ -76,7 +77,7 @@ public class CreateFromTemplateDialog extends DialogWrapper {
try {
unsetAttributes = myTemplate.getUnsetAttributes(myDefaultProperties, project);
}
catch (ParseException e) {
catch (FileTemplateParseException e) {
showErrorDialog(e);
}
@@ -190,4 +191,4 @@ public class CreateFromTemplateDialog extends DialogWrapper {
public JComponent getPreferredFocusedComponent(){
return IdeFocusTraversalPolicy.getPreferredFocusedComponent(myAttrComponent);
}
}
}

View File

@@ -0,0 +1,37 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring;
import com.intellij.codeInsight.actions.VcsFacade;
import com.intellij.model.ModelPatch;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogBuilder;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.wm.impl.status.StatusBarUtil;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.ui.ConflictsDialog;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class BaseRefactoringProcessorUi {
public void displayPreview(Project project, ModelPatch patch) throws ProcessCanceledException {
JComponent preview = VcsFacade.getInstance().createPatchPreviewComponent(project, patch);
if (preview != null) {
DialogBuilder builder = new DialogBuilder(project).title(RefactoringBundle.message("usageView.tabText")).centerPanel(preview);
if (builder.show() != DialogWrapper.OK_EXIT_CODE) {
throw new ProcessCanceledException();
}
}
}
public ConflictsDialog createConflictsDialog(@NotNull Project project,
@NotNull MultiMap<PsiElement, String> conflicts,
@Nullable Runnable doRefactoringRunnable,
boolean alwaysShowOkButton,
boolean canShowConflictsInView) {
return new ConflictsDialog(project, conflicts, doRefactoringRunnable, alwaysShowOkButton, canShowConflictsInView);
}
}

View File

@@ -1,13 +1,38 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring;
import com.intellij.codeInsight.highlighting.HighlightUsagesHandler;
import com.intellij.find.FindManager;
import com.intellij.find.findUsages.FindUsagesHandlerBase;
import com.intellij.find.findUsages.FindUsagesManager;
import com.intellij.find.findUsages.FindUsagesOptions;
import com.intellij.find.impl.FindManagerImpl;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.model.ModelPatch;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.wm.impl.status.StatusBarUtil;
import com.intellij.psi.PsiCompiledFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiReference;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.refactoring.rename.RenameDialog;
import com.intellij.refactoring.rename.RenameRefactoringDialog;
import com.intellij.refactoring.util.RefactoringMessageDialog;
import com.intellij.ui.ReplacePromptDialog;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
public class RefactoringUiServiceImpl extends RefactoringUiService {
@@ -25,4 +50,65 @@ public class RefactoringUiServiceImpl extends RefactoringUiService {
promptDialog.show();
return promptDialog.getExitCode();
}
}
@Override
public void setStatusBarInfo(@NotNull Project project, @NotNull @NlsContexts.StatusBarText String message) {
StatusBarUtil.setStatusBarInfo(project, message);
}
@Override
public void displayPreview(Project project, ModelPatch patch) throws ProcessCanceledException {
new BaseRefactoringProcessorUi().displayPreview(project, patch);
}
@Override
public ConflictsDialogBase createConflictsDialog(@NotNull Project project,
@NotNull MultiMap<PsiElement, String> conflicts,
@Nullable Runnable doRefactoringRunnable,
boolean alwaysShowOkButton, boolean canShowConflictsInView) {
return new BaseRefactoringProcessorUi().createConflictsDialog(project, conflicts, doRefactoringRunnable, alwaysShowOkButton, canShowConflictsInView);
}
@Override
public void startFindUsages(PsiElement element, FindUsagesOptions options) {
((FindManagerImpl)FindManager.getInstance(element.getProject())).getFindUsagesManager().startFindUsages(element, options);
}
@Override
public void highlightUsageReferences(PsiElement file,
PsiElement target,
@NotNull Editor editor, boolean clearHighlights) {
if (file instanceof PsiCompiledFile) {
file = ((PsiCompiledFile)file).getDecompiledPsiFile();
}
Project project = target.getProject();
final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
final FindUsagesHandlerBase handler = findUsagesManager.getFindUsagesHandler(target, true);
// in case of injected file, use host file to highlight all occurrences of the target in each injected file
PsiFile context = InjectedLanguageManager.getInstance(project).getTopLevelFile(file);
SearchScope searchScope = new LocalSearchScope(context);
Collection<PsiReference> refs = handler == null
? ReferencesSearch.search(target, searchScope, false).findAll()
: handler.findReferencesToHighlight(target, searchScope);
new HighlightUsagesHandler.DoHighlightRunnable(new ArrayList<>(refs), project, target,
editor, context, clearHighlights).run();
}
@Override
public void findUsages(@NotNull Project project, @NotNull PsiElement psiElement, @Nullable PsiFile scopeFile, FileEditor editor, boolean showDialog, @Nullable("null means default (stored in options)") SearchScope searchScope) {
FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
findUsagesManager.findUsages(psiElement, scopeFile, editor, showDialog, searchScope);
}
@Override
public boolean showRefactoringMessageDialog(@NlsContexts.DialogTitle String title, @NlsContexts.DialogMessage String message,
@NonNls String helpTopic, @NonNls String iconId, boolean showCancelButton, Project project) {
final RefactoringMessageDialog dialog =
new RefactoringMessageDialog(title, message, helpTopic, iconId, showCancelButton, project);
return dialog.showAndGet();
}
}

View File

@@ -28,6 +28,7 @@ import com.intellij.psi.*;
import com.intellij.psi.impl.light.LightElement;
import com.intellij.psi.search.*;
import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.refactoring.ConflictsDialogBase;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.copy.CopyFilesOrDirectoriesHandler;
import com.intellij.refactoring.listeners.RefactoringElementListener;
@@ -158,7 +159,7 @@ public class RenameProcessor extends BaseRefactoringProcessor {
if (!ConflictsInTestsException.isTestIgnore()) throw new ConflictsInTestsException(conflicts.values());
return true;
}
ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, refUsages.get());
ConflictsDialogBase conflictsDialog = prepareConflictsDialog(conflicts, refUsages.get());
if (!conflictsDialog.showAndGet()) {
if (conflictsDialog.isShowConflicts()) prepareSuccessful();
return false;
@@ -617,4 +618,4 @@ public class RenameProcessor extends BaseRefactoringProcessor {
return RenameScopeType.Unknown;
}
}
}

View File

@@ -11,6 +11,7 @@ import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.util.text.HtmlBuilder;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.ConflictsDialogBase;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.SimpleTextAttributes;
@@ -30,7 +31,7 @@ import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.regex.Pattern;
public class ConflictsDialog extends DialogWrapper{
public class ConflictsDialog extends DialogWrapper implements ConflictsDialogBase {
private static final int SHOW_CONFLICTS_EXIT_CODE = 4;
private static final int MAX_CONFLICTS_SHOWN = 20;
@NonNls private static final String EXPAND_LINK = "expand";
@@ -101,6 +102,7 @@ public class ConflictsDialog extends DialogWrapper{
return new Action[]{okAction, new MyShowConflictsInUsageViewAction(), new CancelAction()};
}
@Override
public boolean isShowConflicts() {
return getExitCode() == SHOW_CONFLICTS_EXIT_CODE;
}
@@ -144,6 +146,7 @@ public class ConflictsDialog extends DialogWrapper{
return panel;
}
@Override
public void setCommandName(@NlsContexts.Command String commandName) {
myCommandName = commandName;
}
@@ -301,4 +304,4 @@ public class ConflictsDialog extends DialogWrapper{
public void highlightInEditor() {}
}
}
}
}

View File

@@ -2310,7 +2310,6 @@ dialog.message.unknown.error=Unknown error
http.velocity={0}<hr> <font face="verdana" size="-1">\
<a href=''http://velocity.apache.org/engine/devel/user-guide.html#Velocity_Template_Language_VTL:_An_Introduction''>\nApache Velocity</a> \
template language is used</font>
default.scheme=Default
project.scheme=Project
dialog.message.conversions.will.be.performed=<html>The following conversions will be performed:<br>{0}</html>
label.text.put.stacktrace.here=Put a stacktrace here:
@@ -2713,4 +2712,4 @@ notification.group.required.plugins=Required plugins not loaded
notification.group.language.plugin=Recommended language plugin available
notification.group.load.error=Could not load settings
notification.group.power.save.mode=Power save mode enabled
notification.group.cache.recovery=Cache recovery step performed
notification.group.cache.recovery=Cache recovery step performed

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileTypes.impl;
import com.intellij.ide.highlighter.FileTypeRegistrar;
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Set;
public class AbstractFileType extends UserFileType<AbstractFileType> implements ExternalizableFileType, ExternalizableScheme,
CustomSyntaxTableFileType, PlainTextLikeFileType {
CustomSyntaxTableFileType, PlainTextLikeFileType, AbstractFileTypeBase {
private static final String SEMICOLON = ";";
@NotNull
private SyntaxTable mySyntaxTable;
@@ -370,4 +370,4 @@ public class AbstractFileType extends UserFileType<AbstractFileType> implements
public String toString() {
return "AbstractFileType "+(getName().isEmpty() ? "" : getName()+"; ") +mySyntaxTable;
}
}
}

View File

@@ -287,7 +287,6 @@
<extensionPoint name="hectorComponentProvider" interface="com.intellij.openapi.editor.HectorComponentPanelsProvider" area="IDEA_PROJECT" dynamic="true"/>
<extensionPoint name="findInProjectExtension" interface="com.intellij.find.impl.FindInProjectExtension" dynamic="true" />
<extensionPoint name="findInProjectSearchEngine" interface="com.intellij.find.FindInProjectSearchEngine" dynamic="true"/>
<extensionPoint name="psi.referenceProvider" beanClass="com.intellij.psi.PsiReferenceProviderBean">
<with attribute="providerClass" implements="com.intellij.psi.PsiReferenceProvider"/>
@@ -394,9 +393,6 @@
<extensionPoint name="modelScopeItemPresenter" interface="com.intellij.analysis.dialog.ModelScopeItemPresenter" />
<extensionPoint name="qualifiedNameProvider" interface="com.intellij.ide.actions.QualifiedNameProvider" dynamic="true"/>
<extensionPoint name="virtualFileQualifiedNameProvider" interface="com.intellij.ide.actions.VirtualFileQualifiedNameProvider" dynamic="true"/>
<extensionPoint name="usageFilteringRuleProvider" interface="com.intellij.usages.rules.UsageFilteringRuleProvider" dynamic="true"/>
<extensionPoint name="importFilteringRule" interface="com.intellij.usages.rules.ImportFilteringRule" dynamic="true"/>
<extensionPoint name="usageGroupingRuleProvider" interface="com.intellij.usages.rules.UsageGroupingRuleProvider" dynamic="true"/>
@@ -472,7 +468,6 @@
<extensionPoint name="testFinder" interface="com.intellij.testIntegration.TestFinder" dynamic="true"/>
<extensionPoint name="testSrcLocator" interface="com.intellij.testIntegration.TestLocationProvider" dynamic="true"/>
<extensionPoint name="testSourcesFilter" interface="com.intellij.openapi.roots.TestSourcesFilter" dynamic="true"/>
<extensionPoint name="testCreator" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.testIntegration.TestCreator"/>
</extensionPoint>
@@ -634,4 +629,4 @@
<extensionPoint name="lang.psiDocumentation" dynamic="true"
interface="com.intellij.lang.documentation.psi.PsiDocumentationTargetFactory"/>
</extensionPoints>
</idea-plugin>
</idea-plugin>

View File

@@ -355,9 +355,6 @@
<projectService serviceInterface="com.intellij.ide.util.gotoByName.ChooseByNameFactory"
serviceImplementation="com.intellij.ide.util.gotoByName.ChooseByNameFactoryImpl"/>
<projectService serviceInterface="com.intellij.refactoring.listeners.RefactoringListenerManager"
serviceImplementation="com.intellij.refactoring.listeners.impl.RefactoringListenerManagerImpl"/>
<projectService serviceImplementation="com.intellij.codeEditor.printing.ExportToHTMLSettings"/>
<projectService serviceImplementation="com.intellij.diagnostic.logging.LogConsolePreferences"/>
@@ -1049,7 +1046,6 @@
<copyPastePostProcessor implementation="com.intellij.codeInsight.editorActions.CopyPasteFoldingProcessor"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.internal.statistic.service.fus.collectors.TooltipActionsLogger"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.refactoring.rename.RenameUsagesCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.refactoring.rename.RenameInplacePopupUsagesCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.refactoring.move.MoveUsagesCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.refactoring.actions.RefactoringUsageCollector"/>
@@ -1514,4 +1510,4 @@
<listener class="com.intellij.codeInsight.daemon.impl.EssentialHighlightingRestarter"
topic="com.intellij.ide.SaveAndSyncHandlerListener" />
</projectListeners>
</idea-plugin>
</idea-plugin>

View File

@@ -31,6 +31,7 @@
</xi:include>
<xi:include href="/META-INF/PlatformExtensionPoints.xml"/>
<xi:include href="/META-INF/Refactoring.xml"/>
<xi:include href="/META-INF/LangExtensionPoints.xml"/>
<xi:include href="/META-INF/PlatformExtensions.xml"/>
@@ -154,4 +155,4 @@
<xi:include href="/META-INF/ExternalSystem.xml">
<xi:fallback/>
</xi:include>
</idea-plugin>
</idea-plugin>

View File

@@ -15,10 +15,6 @@
<with attribute="implementationClass" implements="com.intellij.refactoring.memberPushDown.PushDownDelegate"/>
</extensionPoint>
<extensionPoint name="refactoring.moveDirectoryWithClassesHelper" interface="com.intellij.refactoring.move.moveClassesOrPackages.MoveDirectoryWithClassesHelper" dynamic="true"/>
<extensionPoint name="refactoring.helper" interface="com.intellij.refactoring.RefactoringHelper" dynamic="true"/>
<extensionPoint name="refactoring.inlineHandler" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.lang.refactoring.InlineHandler"/>
</extensionPoint>
<extensionPoint name="refactoring.safeDeleteProcessor" interface="com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate" dynamic="true"/>
<extensionPoint name="refactoring.extractIncludeHandler" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.refactoring.RefactoringActionHandler"/>
@@ -32,8 +28,6 @@
<extensionPoint name="renameFileActionProvider" interface="com.intellij.refactoring.actions.RenameFileActionProvider" dynamic="true"/>
<extensionPoint name="inlineActionHandler" interface="com.intellij.lang.refactoring.InlineActionHandler" dynamic="true"/>
<extensionPoint name="changeSignatureDetector" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.refactoring.changeSignature.inplace.LanguageChangeSignatureDetector"/>
</extensionPoint>
@@ -42,4 +36,4 @@
<with attribute="implementationClass" implements="com.intellij.refactoring.suggested.SuggestedRefactoringSupport"/>
</extensionPoint>
</extensionPoints>
</idea-plugin>
</idea-plugin>

View File

@@ -26,5 +26,7 @@
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.ide.core.impl" />
<orderEntry type="module" module-name="intellij.platform.codeStyle" />
<orderEntry type="module" module-name="intellij.platform.usageView" />
<orderEntry type="module" module-name="intellij.platform.lvcs" />
</component>
</module>

View File

@@ -0,0 +1,7 @@
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<projectService serviceInterface="com.intellij.refactoring.listeners.RefactoringListenerManager"
serviceImplementation="com.intellij.refactoring.listeners.impl.RefactoringListenerManagerImpl"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.refactoring.rename.RenameUsagesCollector"/>
</extensions>
</idea-plugin>

View File

@@ -16,6 +16,11 @@
<extensionPoint name="nameSuggestionProvider" interface="com.intellij.refactoring.rename.NameSuggestionProvider" dynamic="true"/>
<extensionPoint name="vetoRenameCondition" interface="com.intellij.openapi.util.Condition" dynamic="true"/>
<extensionPoint name="renamerFactory" dynamic="true" interface="com.intellij.refactoring.rename.RenamerFactory"/>
<extensionPoint name="refactoring.helper" interface="com.intellij.refactoring.RefactoringHelper" dynamic="true"/>
<extensionPoint name="inlineActionHandler" interface="com.intellij.lang.refactoring.InlineActionHandler" dynamic="true"/>
<extensionPoint name="refactoring.inlineHandler" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.lang.refactoring.InlineHandler"/>
</extensionPoint>
<extensionPoint name="rename.inplace.resolveSnapshotProvider" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.refactoring.rename.ResolveSnapshotProvider"/>
@@ -24,5 +29,12 @@
<extensionPoint name="renameInputValidator" interface="com.intellij.refactoring.rename.RenameInputValidator" dynamic="true"/>
<extensionPoint name="refactoring.elementListenerProvider" interface="com.intellij.refactoring.listeners.RefactoringElementListenerProvider" area="IDEA_PROJECT" dynamic="true"/>
<extensionPoint name="findInProjectSearchEngine" interface="com.intellij.find.FindInProjectSearchEngine" dynamic="true"/>
<extensionPoint name="qualifiedNameProvider" interface="com.intellij.ide.actions.QualifiedNameProvider" dynamic="true"/>
<extensionPoint name="virtualFileQualifiedNameProvider" interface="com.intellij.ide.actions.VirtualFileQualifiedNameProvider" dynamic="true"/>
<extensionPoint name="testSourcesFilter" interface="com.intellij.openapi.roots.TestSourcesFilter" dynamic="true"/>
</extensionPoints>
</idea-plugin>
</idea-plugin>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.highlighting;
import com.intellij.openapi.editor.Editor;
@@ -191,4 +191,4 @@ public abstract class HighlightManager {
@Nullable Collection<? super RangeHighlighter> outHighlighters,
@Nullable Color scrollMarkColor);
//</editor-fold>
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.highlighting;
import com.intellij.lang.annotation.AnnotationBuilder;
@@ -32,4 +32,4 @@ public interface PsiHighlightedReference extends PsiSymbolReference {
default @NotNull AnnotationBuilder highlightReference(@NotNull AnnotationBuilder annotationBuilder) {
return annotationBuilder;
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.find;
import com.intellij.openapi.extensions.ExtensionPointName;
@@ -46,4 +46,4 @@ public interface FindInProjectSearchEngine {
*/
boolean isCovered(@NotNull VirtualFile file);
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.find;
@@ -26,4 +26,4 @@ public interface FindInProjectSettings {
@NotNull
List<@NlsSafe String> getRecentDirectories();
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.find;
import com.intellij.navigation.NavigationItem;
@@ -272,4 +272,4 @@ public abstract class FindManager {
int ALL_FILES = 5;
int SKIP_ALL_IN_THIS_FILE = 6;
}
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
/*
* @author max

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.find;
import com.intellij.openapi.util.TextRange;
@@ -33,4 +19,4 @@ public abstract class FindResult extends TextRange {
* @return true if a string was found by the operation, false otherwise.
*/
public abstract boolean isStringFound();
}
}

View File

@@ -1,14 +1,11 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.find.findUsages;
import com.intellij.codeInsight.highlighting.HighlightUsagesHandler;
import com.intellij.find.FindBundle;
import com.intellij.find.FindManager;
import com.intellij.find.impl.FindManagerImpl;
import com.intellij.ide.presentation.VirtualFilePresentation;
import com.intellij.lang.findUsages.DescriptiveNameUtil;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.NavigationItem;
import com.intellij.navigation.PsiElementNavigationItem;
@@ -20,28 +17,27 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import com.intellij.psi.*;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.SmartPointerManager;
import com.intellij.psi.SmartPsiElementPointer;
import com.intellij.psi.meta.PsiMetaData;
import com.intellij.psi.meta.PsiMetaOwner;
import com.intellij.psi.meta.PsiPresentableMetaData;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.refactoring.RefactoringUiService;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewBundle;
import com.intellij.usageView.UsageViewUtil;
import com.intellij.usages.ConfigurableUsageTarget;
import com.intellij.usages.PsiElementUsageTarget;
import com.intellij.usages.UsageView;
import com.intellij.usages.impl.UsageViewImpl;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Collection;
public class PsiElement2UsageTargetAdapter
implements PsiElementUsageTarget, DataProvider, PsiElementNavigationItem, ItemPresentation, ConfigurableUsageTarget {
@@ -71,6 +67,7 @@ public class PsiElement2UsageTargetAdapter
/**
* Consider to use {@link PsiElement2UsageTargetAdapter(PsiElement, FindUsagesOptions, boolean)} to avoid
* calling {@link #update()} that could lead to freeze. {@link #update()} should be called on bg thread.
*
* @param element
*/
@ApiStatus.ScheduledForRemoval(inVersion = "2022.1")
@@ -82,6 +79,7 @@ public class PsiElement2UsageTargetAdapter
/**
* Consider to use {@link PsiElement2UsageTargetAdapter(PsiElement, boolean)} to avoid
* calling {@link #update()} that could lead to freeze. {@link #update()} should be called on bg thread.
*
* @param element
*/
@ApiStatus.ScheduledForRemoval(inVersion = "2022.2")
@@ -136,7 +134,7 @@ public class PsiElement2UsageTargetAdapter
public void findUsages() {
PsiElement element = getElement();
if (element != null) {
((FindManagerImpl)FindManager.getInstance(element.getProject())).getFindUsagesManager().startFindUsages(element, myOptions);
RefactoringUiService.getInstance().startFindUsages(element, myOptions);
}
}
@@ -155,23 +153,7 @@ public class PsiElement2UsageTargetAdapter
public void highlightUsages(@NotNull PsiFile file, @NotNull Editor editor, boolean clearHighlights) {
PsiElement target = getElement();
if (file instanceof PsiCompiledFile) {
file = ((PsiCompiledFile)file).getDecompiledPsiFile();
}
Project project = target.getProject();
final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
final FindUsagesHandlerBase handler = findUsagesManager.getFindUsagesHandler(target, true);
// in case of injected file, use host file to highlight all occurrences of the target in each injected file
PsiFile context = InjectedLanguageManager.getInstance(project).getTopLevelFile(file);
SearchScope searchScope = new LocalSearchScope(context);
Collection<PsiReference> refs = handler == null
? ReferencesSearch.search(target, searchScope, false).findAll()
: handler.findReferencesToHighlight(target, searchScope);
new HighlightUsagesHandler.DoHighlightRunnable(new ArrayList<>(refs), project, target,
editor, context, clearHighlights).run();
RefactoringUiService.getInstance().highlightUsageReferences(file, target, editor, clearHighlights);
}
@Override
@@ -239,7 +221,7 @@ public class PsiElement2UsageTargetAdapter
@Override
public KeyboardShortcut getShortcut() {
return UsageViewImpl.getShowUsagesWithSettingsShortcut();
return UsageViewUtil.getShowUsagesWithSettingsShortcut();
}
@Override
@@ -259,8 +241,7 @@ public class PsiElement2UsageTargetAdapter
public void showSettings() {
PsiElement element = getElement();
if (element != null) {
FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(myPointer.getProject())).getFindUsagesManager();
findUsagesManager.findUsages(element, null, null, true, null);
RefactoringUiService.getInstance().findUsages(myPointer.getProject(), element, null, null, true, null);
}
}
@@ -317,4 +298,4 @@ public class PsiElement2UsageTargetAdapter
public Project getProject() {
return myPointer.getProject();
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.actions;
@@ -36,4 +36,4 @@ public final class QualifiedNameProviderUtil {
}
return null;
}
}
}

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring;
import com.intellij.codeInsight.actions.VcsFacade;
import com.intellij.find.findUsages.PsiElement2UsageTargetAdapter;
import com.intellij.history.LocalHistory;
import com.intellij.history.LocalHistoryAction;
@@ -29,16 +28,13 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogBuilder;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.messages.MessagesService;
import com.intellij.openapi.util.Factory;
import com.intellij.openapi.util.NlsContexts.Command;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.impl.status.StatusBarUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -51,7 +47,6 @@ import com.intellij.refactoring.listeners.RefactoringListenerManager;
import com.intellij.refactoring.listeners.impl.RefactoringListenerManagerImpl;
import com.intellij.refactoring.listeners.impl.RefactoringTransaction;
import com.intellij.refactoring.suggested.SuggestedRefactoringProvider;
import com.intellij.refactoring.ui.ConflictsDialog;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewBundle;
@@ -59,8 +54,7 @@ import com.intellij.usageView.UsageViewDescriptor;
import com.intellij.usageView.UsageViewUtil;
import com.intellij.usages.*;
import com.intellij.usages.impl.UnknownUsagesInUnloadedModules;
import com.intellij.usages.impl.UsageViewImpl;
import com.intellij.usages.impl.UsageViewStatisticsCollector;
import com.intellij.usages.impl.UsageViewEx;
import com.intellij.usages.rules.PsiElementUsage;
import com.intellij.util.Processor;
import com.intellij.util.SlowOperations;
@@ -221,7 +215,7 @@ public abstract class BaseRefactoringProcessor implements Runnable {
}
if (!refErrorLanguage.isNull()) {
Messages.showErrorDialog(myProject, RefactoringBundle.message("unsupported.refs.found", refErrorLanguage.get().getDisplayName()), RefactoringBundle.message("error.title"));
MessagesService.getInstance().showErrorDialog(myProject, RefactoringBundle.message("unsupported.refs.found", refErrorLanguage.get().getDisplayName()), RefactoringBundle.message("error.title"));
return;
}
if (!indexNotReadyException.isNull() || DumbService.isDumb(myProject)) {
@@ -229,7 +223,7 @@ public abstract class BaseRefactoringProcessor implements Runnable {
return;
}
if (!refProcessCanceled.isNull()) {
Messages.showErrorDialog(myProject, RefactoringBundle.message("refactoring.index.corruption.notifiction"), RefactoringBundle.message("error.title"));
MessagesService.getInstance().showErrorDialog(myProject, RefactoringBundle.message("refactoring.index.corruption.notifiction"), RefactoringBundle.message("error.title"));
return;
}
@@ -246,7 +240,7 @@ public abstract class BaseRefactoringProcessor implements Runnable {
if (!isPreview) {
isPreview = !ensureElementsWritable(usages, descriptor) || UsageViewUtil.hasReadOnlyUsages(usages);
if (isPreview) {
StatusBarUtil.setStatusBarInfo(myProject, RefactoringBundle.message("readonly.occurences.found"));
RefactoringUiService.getInstance().setStatusBarInfo(myProject, RefactoringBundle.message("readonly.occurences.found"));
}
}
if (isPreview) {
@@ -424,7 +418,7 @@ public abstract class BaseRefactoringProcessor implements Runnable {
throw new BaseRefactoringProcessor.ConflictsInTestsException(conflicts.values());
}
ConflictsDialog conflictsDialog = new ConflictsDialog(project, conflicts);
ConflictsDialogBase conflictsDialog = RefactoringUiService.getInstance().createConflictsDialog(project, conflicts, null, true, true);
return conflictsDialog.showAndGet();
}
@@ -451,7 +445,7 @@ public abstract class BaseRefactoringProcessor implements Runnable {
customizeUsagesView(viewDescriptor, myUsageView);
} else {
myUsageView.removeUsagesBulk(myUsageView.getUsages());
((UsageViewImpl)myUsageView).appendUsagesInBulk(Arrays.asList(usages));
((UsageViewEx)myUsageView).appendUsagesInBulk(Arrays.asList(usages));
}
Set<UnloadedModuleDescription> unloadedModules = computeUnloadedModulesFromUseScope(viewDescriptor);
if (!unloadedModules.isEmpty()) {
@@ -551,11 +545,11 @@ public abstract class BaseRefactoringProcessor implements Runnable {
int count = writableUsageInfos.length;
if (count > 0) {
StatusBarUtil.setStatusBarInfo(myProject, RefactoringBundle.message("statusBar.refactoring.result", count));
RefactoringUiService.getInstance().setStatusBarInfo(myProject, RefactoringBundle.message("statusBar.refactoring.result", count));
}
else {
if (!isPreviewUsages(writableUsageInfos)) {
StatusBarUtil.setStatusBarInfo(myProject, RefactoringBundle.message("statusBar.noUsages"));
RefactoringUiService.getInstance().setStatusBarInfo(myProject, RefactoringBundle.message("statusBar.noUsages"));
}
}
}
@@ -594,21 +588,11 @@ public abstract class BaseRefactoringProcessor implements Runnable {
computable, getCommandName(), true, myProject);
if (!ApplicationManager.getApplication().isUnitTestMode() && isPreviewUsages()) {
displayPreview(patch);
RefactoringUiService.getInstance().displayPreview(myProject, patch);
}
WriteAction.run(() -> patch.applyBranchChanges());
}
private void displayPreview(ModelPatch patch) throws ProcessCanceledException {
JComponent preview = VcsFacade.getInstance().createPatchPreviewComponent(myProject, patch);
if (preview != null) {
DialogBuilder builder = new DialogBuilder(myProject).title(RefactoringBundle.message("usageView.tabText")).centerPanel(preview);
if (builder.show() != DialogWrapper.OK_EXIT_CODE) {
throw new ProcessCanceledException();
}
}
}
protected boolean isToBeChanged(@NotNull UsageInfo usageInfo) {
return usageInfo.isWritable();
}
@@ -714,7 +698,7 @@ public abstract class BaseRefactoringProcessor implements Runnable {
myProject.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC)
.conflictsDetected(refactoringId, conflictUsages);
}
final ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, usages);
final ConflictsDialogBase conflictsDialog = prepareConflictsDialog(conflicts, usages);
if (!conflictsDialog.showAndGet()) {
if (conflictsDialog.isShowConflicts()) prepareSuccessful();
return false;
@@ -726,8 +710,8 @@ public abstract class BaseRefactoringProcessor implements Runnable {
}
@NotNull
protected ConflictsDialog prepareConflictsDialog(@NotNull MultiMap<PsiElement, String> conflicts, final UsageInfo @Nullable [] usages) {
final ConflictsDialog conflictsDialog = createConflictsDialog(conflicts, usages);
protected ConflictsDialogBase prepareConflictsDialog(@NotNull MultiMap<PsiElement, String> conflicts, final UsageInfo @Nullable [] usages) {
final ConflictsDialogBase conflictsDialog = createConflictsDialog(conflicts, usages);
conflictsDialog.setCommandName(getCommandName());
return conflictsDialog;
}
@@ -749,8 +733,8 @@ public abstract class BaseRefactoringProcessor implements Runnable {
}
@NotNull
protected ConflictsDialog createConflictsDialog(@NotNull MultiMap<PsiElement, String> conflicts, final UsageInfo @Nullable [] usages) {
return new ConflictsDialog(myProject, conflicts, usages == null ? null : () -> execute(usages), false, true);
protected ConflictsDialogBase createConflictsDialog(@NotNull MultiMap<PsiElement, String> conflicts, final UsageInfo @Nullable [] usages) {
return RefactoringUiService.getInstance().createConflictsDialog(myProject, conflicts, usages == null ? null : () -> execute(usages), false, true);
}
@NotNull
@@ -789,4 +773,4 @@ public abstract class BaseRefactoringProcessor implements Runnable {
public void redo() {
}
}
}
}

View File

@@ -0,0 +1,10 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring;
public interface ConflictsDialogBase {
void setCommandName(String name);
boolean showAndGet();
boolean isShowConflicts();
}

View File

@@ -2,13 +2,23 @@
package com.intellij.refactoring;
import com.intellij.find.FindManager;
import com.intellij.find.findUsages.FindUsagesOptions;
import com.intellij.model.ModelPatch;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.SearchScope;
import com.intellij.refactoring.rename.RenameRefactoringDialog;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ApiStatus.Experimental
public class RefactoringUiService {
@@ -24,7 +34,40 @@ public class RefactoringUiService {
return FindManager.PromptResult.SKIP;
}
public void setStatusBarInfo(@NotNull Project project, @NotNull @NlsContexts.StatusBarText String message) {
}
public void displayPreview(Project project, ModelPatch patch) throws ProcessCanceledException {
}
public ConflictsDialogBase createConflictsDialog(@NotNull Project project,
@NotNull MultiMap<PsiElement, String> conflicts,
@Nullable Runnable doRefactoringRunnable,
boolean alwaysShowOkButton,
boolean canShowConflictsInView) {
return null;
}
public void startFindUsages(PsiElement element, FindUsagesOptions options) {
}
public void highlightUsageReferences(PsiElement file,
PsiElement target,
@NotNull Editor editor, boolean clearHighlights) {
}
public void findUsages(@NotNull Project project, @NotNull PsiElement psiElement, @Nullable PsiFile scopeFile, FileEditor editor, boolean showDialog, @Nullable("null means default (stored in options)") SearchScope searchScope) {
}
public boolean showRefactoringMessageDialog(@NlsContexts.DialogTitle String title, @NlsContexts.DialogMessage String message,
@NonNls String helpTopic, @NonNls String iconId, boolean showCancelButton, Project project) {
return false;
}
public static RefactoringUiService getInstance() {
return ApplicationManager.getApplication().getService(RefactoringUiService.class);
}
}
}

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.extractMethod;
import org.jetbrains.annotations.NotNull;
public interface ExtractMethodDecorator<T> {
String createMethodSignature(@NotNull ExtractMethodSettings<T> settings);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.extractMethod;
import com.intellij.refactoring.util.AbstractVariableData;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.extractMethod;
import com.intellij.openapi.util.NlsContexts;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.extractMethod;
import com.intellij.codeInsight.PsiEquivalenceUtil;
@@ -210,4 +196,4 @@ public class SimpleDuplicatesFinder {
myReplacement = replacement;
}
}
}

View File

@@ -1,11 +1,10 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.listeners.impl;
import com.intellij.openapi.project.Project;
import com.intellij.refactoring.listeners.RefactoringElementListenerProvider;
import com.intellij.refactoring.listeners.RefactoringListenerManager;
import com.intellij.refactoring.listeners.impl.impl.RefactoringTransactionImpl;
import com.intellij.util.containers.ContainerUtil;
import java.util.ArrayList;
@@ -38,4 +37,4 @@ public class RefactoringListenerManagerImpl extends RefactoringListenerManager {
Collections.addAll(providers, RefactoringElementListenerProvider.EP_NAME.getExtensions(myProject));
return new RefactoringTransactionImpl(myProject, providers);
}
}
}

View File

@@ -1,6 +1,6 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.listeners.impl.impl;
package com.intellij.refactoring.listeners.impl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.DumbService;
@@ -11,7 +11,6 @@ import com.intellij.psi.SmartPsiElementPointer;
import com.intellij.refactoring.listeners.RefactoringElementListener;
import com.intellij.refactoring.listeners.RefactoringElementListenerProvider;
import com.intellij.refactoring.listeners.UndoRefactoringElementListener;
import com.intellij.refactoring.listeners.impl.RefactoringTransaction;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -137,4 +136,4 @@ public class RefactoringTransactionImpl implements RefactoringTransaction {
myRunnables.clear();
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
@@ -42,4 +42,4 @@ public interface NameSuggestionProvider {
}
return resultInfo;
}
}
}

View File

@@ -1,22 +1,8 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
public abstract class PreferrableNameSuggestionProvider implements NameSuggestionProvider {
public boolean shouldCheckOthers() {
return true;
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
import com.intellij.openapi.actionSystem.DataContext;
@@ -25,4 +25,4 @@ public interface RenameHandler extends RefactoringActionHandler {
default boolean isRenaming(@NotNull DataContext dataContext) {
return isAvailableOnDataContext(dataContext);
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
import com.intellij.openapi.extensions.ExtensionPointName;
@@ -27,4 +27,4 @@ public interface RenameInputValidator {
* otherwise default message "'[newName]' is not a valid identifier" will be shown.
*/
boolean isInputValid(@NotNull final String newName, @NotNull final PsiElement element, @NotNull final ProcessingContext context);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
import com.intellij.openapi.project.Project;
@@ -22,4 +22,4 @@ public interface RenameInputValidatorEx extends RenameInputValidator {
*/
@Nullable
@DialogMessage String getErrorMessage(@NotNull String newName, @NotNull Project project);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
import com.intellij.openapi.project.Project;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename
import com.intellij.internal.statistic.eventLog.EventLogGroup

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
@@ -422,4 +422,4 @@ public final class RenameUtil {
public static String getUsageViewType(@NotNull PsiElement element) {
return ElementDescriptionUtil.getElementDescription(element, UsageViewTypeLocation.INSTANCE);
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
import org.jetbrains.annotations.ApiStatus;
@@ -19,4 +19,4 @@ public interface Renamer {
* May show dialogs.
*/
void performRename();
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename;
import com.intellij.openapi.actionSystem.DataContext;
@@ -23,4 +23,4 @@ public interface RenamerFactory {
* This can happen if there are several targets to rename.
*/
@NotNull Collection<? extends @NotNull Renamer> createRenamers(@NotNull DataContext dataContext);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename.naming;
import com.intellij.openapi.extensions.ExtensionPointName;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.rename.naming;
import com.intellij.openapi.diagnostic.Logger;
@@ -285,4 +285,4 @@ public final class NameSuggester {
return null;
}
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.suggested
import com.intellij.openapi.project.Project

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.statistics" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.ide.core" />
<orderEntry type="module" module-name="intellij.platform.ide.core.impl" />
<orderEntry type="module" module-name="intellij.platform.editor" />
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="intellij.platform.indexing" />
<orderEntry type="module" module-name="intellij.platform.util.ui" />
<orderEntry type="module" module-name="intellij.platform.analysis" />
<orderEntry type="module" module-name="intellij.platform.core.impl" />
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.usageView" />
<orderEntry type="module" module-name="intellij.platform.lang" />
<orderEntry type="module" module-name="intellij.platform.concurrency" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
</component>
</module>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.usages.impl;
import com.intellij.icons.AllIcons;
@@ -15,13 +15,13 @@ class PreviewUsageAction extends RuleAction {
@Override
protected boolean getOptionValue(@NotNull AnActionEvent e) {
UsageViewImpl impl = getUsageViewImpl(e);
UsageViewImpl impl = RuleAction.getUsageViewImpl(e);
return impl != null && impl.isPreviewUsages();
}
@Override
protected void setOptionValue(@NotNull AnActionEvent e, boolean value) {
UsageViewImpl usageViewImpl = getUsageViewImpl(e);
UsageViewImpl usageViewImpl = RuleAction.getUsageViewImpl(e);
if (usageViewImpl != null) usageViewImpl.setPreviewUsages(value);
}
}
}

Some files were not shown because too many files have changed in this diff Show More