本文整理汇总了Java中com.intellij.refactoring.rename.RenameUtil.removeConflictUsages方法的典型用法代码示例。如果您正苦于以下问题:Java RenameUtil.removeConflictUsages方法的具体用法?Java RenameUtil.removeConflictUsages怎么用?Java RenameUtil.removeConflictUsages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.refactoring.rename.RenameUtil
的用法示例。
在下文中一共展示了RenameUtil.removeConflictUsages方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findConflicts
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
public MultiMap<PsiElement, String> findConflicts(Ref<UsageInfo[]> refUsages) {
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
addMethodConflicts(conflictDescriptions);
UsageInfo[] usagesIn = refUsages.get();
RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
RenameUtil.removeConflictUsages(usagesSet);
if (myChangeInfo.isVisibilityChanged()) {
try {
addInaccessibilityDescriptions(usagesSet, conflictDescriptions);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
return conflictDescriptions;
}
示例2: preprocessUsages
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
for (ChangeSignatureUsageProcessor processor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
if (!processor.setupDefaultValues(myChangeInfo, refUsages, myProject)) return false;
}
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
for (ChangeSignatureUsageProcessor usageProcessor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
final MultiMap<PsiElement, String> conflicts = usageProcessor.findConflicts(myChangeInfo, refUsages);
for (PsiElement key : conflicts.keySet()) {
Collection<String> collection = conflictDescriptions.get(key);
if (collection.size() == 0) collection = new HashSet<String>();
collection.addAll(conflicts.get(key));
conflictDescriptions.put(key, collection);
}
}
final UsageInfo[] usagesIn = refUsages.get();
RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
RenameUtil.removeConflictUsages(usagesSet);
if (!conflictDescriptions.isEmpty()) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new ConflictsInTestsException(conflictDescriptions.values());
}
if (myPrepareSuccessfulSwingThreadCallback != null) {
ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
if (!dialog.showAndGet()) {
if (dialog.isShowConflicts()) prepareSuccessful();
return false;
}
}
}
if (myChangeInfo.isReturnTypeChanged()) {
askToRemoveCovariantOverriders(usagesSet);
}
refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
prepareSuccessful();
return true;
}
示例3: findConflicts
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
public MultiMap<PsiElement, String> findConflicts(Ref<UsageInfo[]> refUsages) {
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
addMethodConflicts(conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(refUsages.get()));
RenameUtil.removeConflictUsages(usagesSet);
if (myChangeInfo.isVisibilityChanged()) {
try {
addInaccessibilityDescriptions(usagesSet, conflictDescriptions);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
checkContract(conflictDescriptions, myChangeInfo.getMethod());
for (UsageInfo usageInfo : usagesSet) {
final PsiElement element = usageInfo.getElement();
if (usageInfo instanceof OverriderUsageInfo) {
final PsiMethod method = ((OverriderUsageInfo)usageInfo).getOverridingMethod();
final PsiMethod baseMethod = ((OverriderUsageInfo)usageInfo).getBaseMethod();
final int delta = baseMethod.getParameterList().getParametersCount() - method.getParameterList().getParametersCount();
if (delta > 0) {
final boolean[] toRemove = myChangeInfo.toRemoveParm();
if (toRemove[toRemove.length - 1]) { //todo check if implicit parameter is not the last one
conflictDescriptions.putValue(baseMethod, "Implicit last parameter should not be deleted");
}
}
checkContract(conflictDescriptions, method);
} else if (element instanceof PsiMethodReferenceExpression) {
conflictDescriptions.putValue(element, "Changed method is used in method reference");
}
}
return conflictDescriptions;
}
示例4: preprocessUsages
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
for (ChangeSignatureUsageProcessor usageProcessor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
final MultiMap<PsiElement, String> conflicts = usageProcessor.findConflicts(myChangeInfo, refUsages);
for (PsiElement key : conflicts.keySet()) {
Collection<String> collection = conflictDescriptions.get(key);
if (collection.isEmpty()) collection = new HashSet<String>();
collection.addAll(conflicts.get(key));
conflictDescriptions.put(key, collection);
}
}
final UsageInfo[] usagesIn = refUsages.get();
RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
RenameUtil.removeConflictUsages(usagesSet);
if (!conflictDescriptions.isEmpty()) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new ConflictsInTestsException(conflictDescriptions.values());
}
ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
if (!dialog.showAndGet()) {
if (dialog.isShowConflicts()) prepareSuccessful();
return false;
}
}
refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
prepareSuccessful();
return true;
}
示例5: findConflicts
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
public MultiMap<PsiElement, String> findConflicts(Ref<UsageInfo[]> refUsages) {
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
addMethodConflicts(conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(refUsages.get()));
RenameUtil.removeConflictUsages(usagesSet);
if (myChangeInfo.isVisibilityChanged()) {
try {
addInaccessibilityDescriptions(usagesSet, conflictDescriptions);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
for (UsageInfo usageInfo : usagesSet) {
final PsiElement element = usageInfo.getElement();
if (usageInfo instanceof OverriderUsageInfo) {
final PsiMethod method = (PsiMethod)element;
final PsiMethod baseMethod = ((OverriderUsageInfo)usageInfo).getBaseMethod();
final int delta = baseMethod.getParameterList().getParametersCount() - method.getParameterList().getParametersCount();
if (delta > 0) {
final boolean[] toRemove = myChangeInfo.toRemoveParm();
if (toRemove[toRemove.length - 1]) { //todo check if implicit parameter is not the last one
conflictDescriptions.putValue(baseMethod, "Implicit last parameter should not be deleted");
}
}
} else if (element instanceof PsiMethodReferenceExpression) {
conflictDescriptions.putValue(element, "Changed method is used in method reference");
}
}
return conflictDescriptions;
}
示例6: preprocessUsages
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(Ref<UsageInfo[]> refUsages) {
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
for (ChangeSignatureUsageProcessor usageProcessor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
final MultiMap<PsiElement, String> conflicts = usageProcessor.findConflicts(myChangeInfo, refUsages);
for (PsiElement key : conflicts.keySet()) {
Collection<String> collection = conflictDescriptions.get(key);
if (collection.size() == 0) collection = new HashSet<String>();
collection.addAll(conflicts.get(key));
conflictDescriptions.put(key, collection);
}
}
final UsageInfo[] usagesIn = refUsages.get();
RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
RenameUtil.removeConflictUsages(usagesSet);
if (!conflictDescriptions.isEmpty()) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new ConflictsInTestsException(conflictDescriptions.values());
}
ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
dialog.show();
if (!dialog.isOK()) {
if (dialog.isShowConflicts()) prepareSuccessful();
return false;
}
}
refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
prepareSuccessful();
return true;
}
示例7: preprocessUsages
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
protected boolean preprocessUsages(Ref<UsageInfo[]> refUsages) {
for (ChangeSignatureUsageProcessor processor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
if (!processor.setupDefaultValues(myChangeInfo, refUsages, myProject)) return false;
}
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
for (ChangeSignatureUsageProcessor usageProcessor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
final MultiMap<PsiElement, String> conflicts = usageProcessor.findConflicts(myChangeInfo, refUsages);
for (PsiElement key : conflicts.keySet()) {
Collection<String> collection = conflictDescriptions.get(key);
if (collection.size() == 0) collection = new HashSet<String>();
collection.addAll(conflicts.get(key));
conflictDescriptions.put(key, collection);
}
}
final UsageInfo[] usagesIn = refUsages.get();
RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
RenameUtil.removeConflictUsages(usagesSet);
if (!conflictDescriptions.isEmpty()) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new ConflictsInTestsException(conflictDescriptions.values());
}
if (myPrepareSuccessfulSwingThreadCallback != null) {
ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
dialog.show();
if (!dialog.isOK()) {
if (dialog.isShowConflicts()) prepareSuccessful();
return false;
}
}
}
if (myChangeInfo.isReturnTypeChanged()) {
askToRemoveCovariantOverriders(usagesSet);
}
refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
prepareSuccessful();
return true;
}
示例8: preprocessUsages
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(Ref<UsageInfo[]> refUsages)
{
for(ChangeSignatureUsageProcessor processor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions())
{
if(processor instanceof ChangeSignatureUsageProcessorEx && ((ChangeSignatureUsageProcessorEx) processor).setupDefaultValues
(myChangeInfo, refUsages, myProject))
{
return false;
}
}
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
for(ChangeSignatureUsageProcessor usageProcessor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions())
{
final MultiMap<PsiElement, String> conflicts = usageProcessor.findConflicts(myChangeInfo, refUsages);
for(PsiElement key : conflicts.keySet())
{
Collection<String> collection = conflictDescriptions.get(key);
if(collection.size() == 0)
{
collection = new HashSet<String>();
}
collection.addAll(conflicts.get(key));
conflictDescriptions.put(key, collection);
}
}
final UsageInfo[] usagesIn = refUsages.get();
RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
RenameUtil.removeConflictUsages(usagesSet);
if(!conflictDescriptions.isEmpty())
{
if(ApplicationManager.getApplication().isUnitTestMode())
{
throw new ConflictsInTestsException(conflictDescriptions.values());
}
if(myPrepareSuccessfulSwingThreadCallback != null)
{
ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
dialog.show();
if(!dialog.isOK())
{
if(dialog.isShowConflicts())
{
prepareSuccessful();
}
return false;
}
}
}
if(myChangeInfo.isReturnTypeChanged())
{
askToRemoveCovariantOverriders(usagesSet);
}
refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
prepareSuccessful();
return true;
}
示例9: findConflicts
import com.intellij.refactoring.rename.RenameUtil; //导入方法依赖的package包/类
public MultiMap<PsiElement, String> findConflicts(Ref<UsageInfo[]> refUsages)
{
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
addMethodConflicts(conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(refUsages.get()));
RenameUtil.removeConflictUsages(usagesSet);
if(myChangeInfo.isVisibilityChanged())
{
try
{
addInaccessibilityDescriptions(usagesSet, conflictDescriptions);
}
catch(IncorrectOperationException e)
{
LOG.error(e);
}
}
for(UsageInfo usageInfo : usagesSet)
{
final PsiElement element = usageInfo.getElement();
if(usageInfo instanceof OverriderUsageInfo)
{
final PsiMethod method = (PsiMethod) element;
final PsiMethod baseMethod = ((OverriderUsageInfo) usageInfo).getBaseMethod();
final int delta = baseMethod.getParameterList().getParametersCount() - method.getParameterList().getParametersCount();
if(delta > 0)
{
final boolean[] toRemove = myChangeInfo.toRemoveParm();
if(toRemove[toRemove.length - 1])
{ //todo check if implicit parameter is not the last one
conflictDescriptions.putValue(baseMethod, "Implicit last parameter should not be deleted");
}
}
}
else if(element instanceof PsiMethodReferenceExpression)
{
conflictDescriptions.putValue(element, "Changed method is used in method reference");
}
}
return conflictDescriptions;
}