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


Java ResourceUtil类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil的典型用法代码示例。如果您正苦于以下问题:Java ResourceUtil类的具体用法?Java ResourceUtil怎么用?Java ResourceUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceUtil类属于org.eclipse.jdt.internal.corext.refactoring.util包,在下文中一共展示了ResourceUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
  Set<IFile> combined = new HashSet<IFile>();
  combined.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits())));
  if (fRenameSubpackages) {
    IPackageFragment[] allPackages = JavaElementUtil.getPackageAndSubpackages(fPackage);
    for (int i = 0; i < allPackages.length; i++) {
      combined.addAll(Arrays.asList(ResourceUtil.getFiles(allPackages[i].getCompilationUnits())));
    }
  } else {
    combined.addAll(Arrays.asList(ResourceUtil.getFiles(fPackage.getCompilationUnits())));
  }
  if (fQualifiedNameSearchResult != null)
    combined.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles()));
  return combined.toArray(new IFile[combined.size()]);
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:RenamePackageProcessor.java

示例2: checkInitialConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  RefactoringStatus result =
      Checks.validateModifiesFiles(
          ResourceUtil.getFiles(new ICompilationUnit[] {fCu}), getValidationContext());
  if (result.hasFatalError()) return result;

  initAST(pm);

  if (fAnonymousInnerClassNode == null)
    return RefactoringStatus.createFatalErrorStatus(
        RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_place_caret);
  if (!fSelfInitializing) initializeDefaults();
  if (getSuperConstructorBinding() == null)
    return RefactoringStatus.createFatalErrorStatus(
        RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_compile_errors);
  if (getSuperTypeBinding().isLocal())
    return RefactoringStatus.createFatalErrorStatus(
        RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_extends_local_class);
  return new RefactoringStatus();
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:ConvertAnonymousToNestedRefactoring.java

示例3: checkInitialConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  try {
    pm.beginTask("", 1); // $NON-NLS-1$

    RefactoringStatus result =
        Checks.validateModifiesFiles(
            ResourceUtil.getFiles(new ICompilationUnit[] {fCu}), getValidationContext());
    if (result.hasFatalError()) return result;

    VariableDeclaration declaration = getVariableDeclaration();

    result.merge(checkSelection(declaration));
    if (result.hasFatalError()) return result;

    result.merge(checkInitializer(declaration));
    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:InlineTempRefactoring.java

示例4: checkInitialConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  try {
    pm.beginTask("", 6); // $NON-NLS-1$

    RefactoringStatus result =
        Checks.validateModifiesFiles(
            ResourceUtil.getFiles(new ICompilationUnit[] {fCu}), getValidationContext());
    if (result.hasFatalError()) return result;

    if (fCompilationUnitNode == null) {
      fCompilationUnitNode =
          RefactoringASTParser.parseWithASTProvider(fCu, true, new SubProgressMonitor(pm, 3));
    } else {
      pm.worked(3);
    }

    result.merge(checkSelection(new SubProgressMonitor(pm, 3)));
    if (!result.hasFatalError() && isLiteralNodeSelected()) fReplaceAllOccurrences = false;
    return result;

  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ExtractTempRefactoring.java

示例5: confirmFileOverwritting

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
private void confirmFileOverwritting(IConfirmQuery overwriteQuery, IConfirmQuery skipQuery) {
  List<IFile> filesToNotOverwrite = new ArrayList<IFile>(1);
  for (int i = 0; i < fFiles.length; i++) {
    IFile file = fFiles[i];
    if (willOverwrite(file)) {
      IContainer destination = (IContainer) ResourceUtil.getResource(fDestination);
      if (ParentChecker.isDescendantOf(file, destination.findMember(file.getName()))) {
        if (!skip(BasicElementLabels.getResourceName(file), skipQuery)) {
          filesToNotOverwrite.add(file);
        }
      } else if (!overwrite(file, overwriteQuery)) {
        filesToNotOverwrite.add(file);
      }
    }
  }
  IFile[] files = filesToNotOverwrite.toArray(new IFile[filesToNotOverwrite.size()]);
  fFiles = ArrayTypeConverter.toFileArray(ReorgUtils.setMinus(fFiles, files));
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:OverwriteHelper.java

示例6: checkFinalConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
	pm.beginTask("", 2);//$NON-NLS-1$
	try {
		RefactoringStatus result= new RefactoringStatus();

		if (JdtFlags.isStatic(fType))
			result.merge(checkEnclosingInstanceName(fEnclosingInstanceFieldName));

		String newCUName= JavaModelUtil.getRenamedCUName(fType.getCompilationUnit(), fType.getElementName());
		if (fType.getPackageFragment().getCompilationUnit(newCUName).exists()) {
			String message= Messages.format(RefactoringCoreMessages.MoveInnerToTopRefactoring_compilation_Unit_exists, new String[] { BasicElementLabels.getResourceName(newCUName), JavaElementLabels.getElementLabel(fType.getPackageFragment(), JavaElementLabels.ALL_DEFAULT)});
			result.addFatalError(message);
		}
		result.merge(checkEnclosingInstanceName(fEnclosingInstanceFieldName));
		result.merge(Checks.checkCompilationUnitName(newCUName, fType));
		result.merge(checkConstructorParameterNames());
		result.merge(checkTypeNameInPackage());
		fChangeManager= createChangeManager(new SubProgressMonitor(pm, 1), result);
		result.merge(Checks.validateModifiesFiles(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()), getValidationContext()));
		return result;
	} finally {
		pm.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:MoveInnerToTopRefactoring.java

示例7: checkFinalConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public final RefactoringStatus checkFinalConditions(final IProgressMonitor monitor, final CheckConditionsContext context) throws CoreException, OperationCanceledException {
	Assert.isNotNull(monitor);
	Assert.isNotNull(context);
	final RefactoringStatus status= new RefactoringStatus();
	fChangeManager= new TextEditBasedChangeManager();
	try {
		monitor.beginTask("", 200); //$NON-NLS-1$
		monitor.setTaskName(RefactoringCoreMessages.UseSuperTypeProcessor_checking);
		fChangeManager= createChangeManager(new SubProgressMonitor(monitor, 200), status);
		if (!status.hasFatalError()) {
			Checks.addModifiedFilesToChecker(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()), context);
		}
	} finally {
		monitor.done();
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:UseSuperTypeProcessor.java

示例8: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
	Set<IFile> combined= new HashSet<IFile>();
	combined.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits())));
	if (fRenameSubpackages) {
		IPackageFragment[] allPackages= JavaElementUtil.getPackageAndSubpackages(fPackage);
		for (int i= 0; i < allPackages.length; i++) {
			combined.addAll(Arrays.asList(ResourceUtil.getFiles(allPackages[i].getCompilationUnits())));
		}
	} else {
		combined.addAll(Arrays.asList(ResourceUtil.getFiles(fPackage.getCompilationUnits())));
	}
	if (fQualifiedNameSearchResult != null)
		combined.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles()));
	return combined.toArray(new IFile[combined.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:RenamePackageProcessor.java

示例9: checkInitialConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
       RefactoringStatus result= Checks.validateModifiesFiles(
       	ResourceUtil.getFiles(new ICompilationUnit[]{fCu}),
		getValidationContext());
	if (result.hasFatalError())
	    return result;

	initAST(pm);

	if (fAnonymousInnerClassNode == null)
	    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_place_caret);
	if (!fSelfInitializing)
		initializeDefaults();
	if (getSuperConstructorBinding() == null)
	    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_compile_errors);
	if (getSuperTypeBinding().isLocal())
		return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_extends_local_class);
	return new RefactoringStatus();
   }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ConvertAnonymousToNestedRefactoring.java

示例10: checkInitialConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
	try {
		pm.beginTask("", 1); //$NON-NLS-1$

		RefactoringStatus result= Checks.validateModifiesFiles(ResourceUtil.getFiles(new ICompilationUnit[]{fCu}), getValidationContext());
		if (result.hasFatalError())
			return result;

		VariableDeclaration declaration= getVariableDeclaration();

		result.merge(checkSelection(declaration));
		if (result.hasFatalError())
			return result;

		result.merge(checkInitializer(declaration));
		return result;
	} finally {
		pm.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:InlineTempRefactoring.java

示例11: checkInitialConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
	try {
		pm.beginTask("", 6); //$NON-NLS-1$

		RefactoringStatus result= Checks.validateModifiesFiles(ResourceUtil.getFiles(new ICompilationUnit[] { fCu}), getValidationContext());
		if (result.hasFatalError())
			return result;

		if (fCompilationUnitNode == null) {
			fCompilationUnitNode= RefactoringASTParser.parseWithASTProvider(fCu, true, new SubProgressMonitor(pm, 3));
		} else {
			pm.worked(3);
		}

		result.merge(checkSelection(new SubProgressMonitor(pm, 3)));
		if (!result.hasFatalError() && isLiteralNodeSelected())
			fReplaceAllOccurrences= false;
		return result;

	} finally {
		pm.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:ExtractTempRefactoring.java

示例12: confirmFileOverwritting

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
private void confirmFileOverwritting(IConfirmQuery overwriteQuery, IConfirmQuery skipQuery) {
	List<IFile> filesToNotOverwrite= new ArrayList<IFile>(1);
	for (int i= 0; i < fFiles.length; i++) {
		IFile file= fFiles[i];
		if (willOverwrite(file)) {
			IContainer destination= (IContainer) ResourceUtil.getResource(fDestination);
			if (ParentChecker.isDescendantOf(file, destination.findMember(file.getName()))) {
				if (!skip(BasicElementLabels.getResourceName(file), skipQuery)) {
					filesToNotOverwrite.add(file);
				}
			} else if (!overwrite(file, overwriteQuery)) {
				filesToNotOverwrite.add(file);
			}
		}
	}
	IFile[] files= filesToNotOverwrite.toArray(new IFile[filesToNotOverwrite.size()]);
	fFiles= ArrayTypeConverter.toFileArray(ReorgUtils.setMinus(fFiles, files));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:OverwriteHelper.java

示例13: willOverwrite

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
private boolean willOverwrite(IResource resource) {
	if (resource == null)
		return false;

	IResource destinationResource= ResourceUtil.getResource(fDestination);
	if (destinationResource.equals(resource.getParent()))
		return false;

	if (destinationResource instanceof IContainer) {
		IContainer container= (IContainer)destinationResource;
		IResource member=  container.findMember(resource.getName());
		if (member == null || !member.exists())
			return false;

		return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:OverwriteHelper.java

示例14: copyCuToPackage

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
private static Change copyCuToPackage(ICompilationUnit cu, IPackageFragment dest, NewNameProposer nameProposer, INewNameQueries copyQueries) {
	// XXX workaround for bug 31998 we will have to disable renaming of
	// linked packages (and cus)
	IResource res= ReorgUtils.getResource(cu);
	if (res != null && res.isLinked()) {
		if (ResourceUtil.getResource(dest) instanceof IContainer)
			return copyFileToContainer(cu, (IContainer) ResourceUtil.getResource(dest), nameProposer, copyQueries);
	}

	String newName= nameProposer.createNewName(cu, dest);
	Change simpleCopy= new CopyCompilationUnitChange(cu, dest, copyQueries.createStaticQuery(newName));
	if (newName == null || newName.equals(cu.getElementName()))
		return simpleCopy;

	try {
		IPath newPath= cu.getResource().getParent().getFullPath().append(JavaModelUtil.getRenamedCUName(cu, newName));
		INewNameQuery nameQuery= copyQueries.createNewCompilationUnitNameQuery(cu, newName);
		return new CreateCopyOfCompilationUnitChange(newPath, cu.getSource(), cu, nameQuery);
	} catch (CoreException e) {
		// Using inferred change
		return simpleCopy;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:ReorgPolicyFactory.java

示例15: checkFinalConditions

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入依赖的package包/类
@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
	try {
		pm.beginTask(RefactoringCoreMessages.IntroduceFactory_checking_preconditions, 1);
		RefactoringStatus result= new RefactoringStatus();

		if (fFactoryClassName != null)
			result.merge(setFactoryClass(fFactoryClassName));
		if (result.hasFatalError())
			return result;
		fArgTypes= fCtorBinding.getParameterTypes();
		fCtorIsVarArgs= fCtorBinding.isVarargs();
		fAllCallsTo= findAllCallsTo(fCtorBinding, pm, result);
		fFormalArgNames= findCtorArgNames();

		ICompilationUnit[]	affectedFiles= collectAffectedUnits(fAllCallsTo);
		result.merge(Checks.validateModifiesFiles(ResourceUtil.getFiles(affectedFiles), getValidationContext()));

		if (fCallSitesInBinaryUnits)
			result.merge(RefactoringStatus.createWarningStatus(RefactoringCoreMessages.IntroduceFactory_callSitesInBinaryClass));

		return result;
	} finally {
		pm.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:27,代码来源:IntroduceFactoryRefactoring.java


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