当前位置: 首页>>代码示例>>Java>>正文


Java RenameUtil.removeConflictUsages方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GrChangeSignatureConflictSearcher.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ChangeSignatureProcessor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:JavaChangeSignatureUsageProcessor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:GrChangeSignatureProcessor.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:JavaChangeSignatureUsageProcessor.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:GrChangeSignatureProcessor.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:42,代码来源:ChangeSignatureProcessor.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:62,代码来源:ChangeSignatureProcessor.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:44,代码来源:JavaChangeSignatureUsageProcessor.java


注:本文中的com.intellij.refactoring.rename.RenameUtil.removeConflictUsages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。