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


Java PsiMigrationManager类代码示例

本文整理汇总了Java中com.intellij.psi.impl.migration.PsiMigrationManager的典型用法代码示例。如果您正苦于以下问题:Java PsiMigrationManager类的具体用法?Java PsiMigrationManager怎么用?Java PsiMigrationManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PsiMigrationManager类属于com.intellij.psi.impl.migration包,在下文中一共展示了PsiMigrationManager类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performRefactoring

import com.intellij.psi.impl.migration.PsiMigrationManager; //导入依赖的package包/类
protected void performRefactoring(@NotNull UsageInfo[] usages) {
  final PsiMigration psiMigration = PsiMigrationManager.getInstance(myProject).startMigration();
  LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());

  try {
    for (int i = 0; i < myMigrationMap.getEntryCount(); i++) {
      MigrationMapEntry entry = myMigrationMap.getEntryAt(i);
      if (entry.getType() == MigrationMapEntry.PACKAGE) {
        MigrationUtil.doPackageMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
      if (entry.getType() == MigrationMapEntry.CLASS) {
        MigrationUtil.doClassMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
    }

    for(RefactoringHelper helper: Extensions.getExtensions(RefactoringHelper.EP_NAME)) {
      Object preparedData = helper.prepareOperation(usages);
      //noinspection unchecked
      helper.performOperation(myProject, preparedData);
    }
  }
  finally {
    a.finish();
    psiMigration.finish();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:MigrationProcessor.java

示例2: performRefactoring

import com.intellij.psi.impl.migration.PsiMigrationManager; //导入依赖的package包/类
protected void performRefactoring(UsageInfo[] usages) {
  final PsiMigration psiMigration = PsiMigrationManager.getInstance(myProject).startMigration();
  LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());

  try {
    for (int i = 0; i < myMigrationMap.getEntryCount(); i++) {
      MigrationMapEntry entry = myMigrationMap.getEntryAt(i);
      if (entry.getType() == MigrationMapEntry.PACKAGE) {
        MigrationUtil.doPackageMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
      if (entry.getType() == MigrationMapEntry.CLASS) {
        MigrationUtil.doClassMigration(myProject, psiMigration, entry.getNewName(), usages);
      }
    }

    for(RefactoringHelper helper: Extensions.getExtensions(RefactoringHelper.EP_NAME)) {
      Object preparedData = helper.prepareOperation(usages);
      //noinspection unchecked
      helper.performOperation(myProject, preparedData);
    }
  }
  finally {
    a.finish();
    psiMigration.finish();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:MigrationProcessor.java

示例3: performRefactoring

import com.intellij.psi.impl.migration.PsiMigrationManager; //导入依赖的package包/类
@Override
protected void performRefactoring(@NotNull UsageInfo[] usages)
{
	finishFindMigration();
	final PsiMigration psiMigration = PsiMigrationManager.getInstance(myProject).startMigration();
	LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());

	myRefsToShorten = new ArrayList<>();
	try
	{
		boolean sameShortNames = false;
		for(int i = 0; i < myMigrationMap.getEntryCount(); i++)
		{
			MigrationMapEntry entry = myMigrationMap.getEntryAt(i);
			String newName = entry.getNewName();
			PsiElement element = entry.getType() == MigrationMapEntry.PACKAGE ? MigrationUtil.findOrCreatePackage(myProject, psiMigration, newName) : MigrationUtil.findOrCreateClass(myProject,
					psiMigration, newName);
			MigrationUtil.doMigration(element, newName, usages, myRefsToShorten);
			if(!sameShortNames && Comparing.strEqual(StringUtil.getShortName(entry.getOldName()), StringUtil.getShortName(entry.getNewName())))
			{
				sameShortNames = true;
			}
		}

		if(!sameShortNames)
		{
			myRefsToShorten.clear();
		}
	}
	finally
	{
		a.finish();
		psiMigration.finish();
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:36,代码来源:MigrationProcessor.java

示例4: startMigration

import com.intellij.psi.impl.migration.PsiMigrationManager; //导入依赖的package包/类
private PsiMigration startMigration(Project project) {
  final PsiMigration migration = PsiMigrationManager.getInstance(project).startMigration();
  findOrCreateEntries(project, migration);
  return migration;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:MigrationProcessor.java

示例5: startMigration

import com.intellij.psi.impl.migration.PsiMigrationManager; //导入依赖的package包/类
private PsiMigration startMigration(Project project)
{
	final PsiMigration migration = PsiMigrationManager.getInstance(project).startMigration();
	findOrCreateEntries(project, migration);
	return migration;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:MigrationProcessor.java


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