當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。