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


Java ResourceUtil.getFile方法代码示例

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


在下文中一共展示了ResourceUtil.getFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
  if (!fWillRenameType) {
    IFile file = ResourceUtil.getFile(fCu);
    if (file != null) return new IFile[] {file};
  }
  return new IFile[0];
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:RenameCompilationUnitProcessor.java

示例2: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
	if (!fWillRenameType) {
		IFile file= ResourceUtil.getFile(fCu);
		if (file != null)
			return new IFile[] {file};
	}
	return new IFile[0];
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:RenameCompilationUnitProcessor.java

示例3: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
  return new IFile[] {ResourceUtil.getFile(fCu)};
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:RenameLocalVariableProcessor.java

示例4: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
  return new IFile[] {
    ResourceUtil.getFile(fTypeParameter.getDeclaringMember().getCompilationUnit())
  };
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:RenameTypeParameterProcessor.java

示例5: createChange

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Change createChange(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
	try {
		final Map<String, String> arguments= new HashMap<String, String>();
		String project= null;
		final IType declaring= getDeclaringType();
		final IJavaProject javaProject= declaring.getJavaProject();
		if (javaProject != null)
			project= javaProject.getElementName();
		int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
		try {
			if (declaring.isLocal() || declaring.isAnonymous())
				flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
		} catch (JavaModelException exception) {
			JavaPlugin.log(exception);
		}
		final String description= Messages.format(RefactoringCoreMessages.ExtractSupertypeProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fTypeName));
		final String header= Messages.format(RefactoringCoreMessages.ExtractSupertypeProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fDestinationType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getElementLabel(fCachedDeclaringType, JavaElementLabels.ALL_FULLY_QUALIFIED)});
		final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
		final IType[] types= getTypesToExtract();
		String[] settings= new String[types.length];
		for (int index= 0; index < settings.length; index++)
			settings[index]= JavaElementLabels.getElementLabel(types[index], JavaElementLabels.ALL_FULLY_QUALIFIED);
		comment.addSetting(JDTRefactoringDescriptorComment.createCompositeSetting(RefactoringCoreMessages.ExtractSupertypeProcessor_subtypes_pattern, settings));
		comment.addSetting(Messages.format(RefactoringCoreMessages.ExtractSupertypeProcessor_refactored_element_pattern, JavaElementLabels.getElementLabel(fDestinationType, JavaElementLabels.ALL_FULLY_QUALIFIED)));
		settings= new String[fMembersToMove.length];
		for (int index= 0; index < settings.length; index++)
			settings[index]= JavaElementLabels.getElementLabel(fMembersToMove[index], JavaElementLabels.ALL_FULLY_QUALIFIED);
		comment.addSetting(JDTRefactoringDescriptorComment.createCompositeSetting(RefactoringCoreMessages.ExtractInterfaceProcessor_extracted_members_pattern, settings));
		addSuperTypeSettings(comment, true);
		final ExtractSuperclassDescriptor descriptor= RefactoringSignatureDescriptorFactory.createExtractSuperclassDescriptor(project, description, comment.asString(), arguments, flags);
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fTypeName);
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, getDeclaringType()));
		arguments.put(ATTRIBUTE_REPLACE, Boolean.valueOf(fReplace).toString());
		arguments.put(ATTRIBUTE_INSTANCEOF, Boolean.valueOf(fInstanceOf).toString());
		arguments.put(ATTRIBUTE_STUBS, Boolean.valueOf(fCreateMethodStubs).toString());
		arguments.put(ATTRIBUTE_EXTRACT, new Integer(fMembersToMove.length).toString());
		for (int offset= 0; offset < fMembersToMove.length; offset++)
			arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fMembersToMove[offset]));
		arguments.put(ATTRIBUTE_DELETE, new Integer(fDeletedMethods.length).toString());
		for (int offset= 0; offset < fDeletedMethods.length; offset++)
			arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + fMembersToMove.length + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fDeletedMethods[offset]));
		arguments.put(ATTRIBUTE_ABSTRACT, new Integer(fAbstractMethods.length).toString());
		for (int offset= 0; offset < fAbstractMethods.length; offset++)
			arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + fMembersToMove.length + fDeletedMethods.length + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fAbstractMethods[offset]));
		arguments.put(ATTRIBUTE_TYPES, new Integer(fTypesToExtract.length).toString());
		for (int offset= 0; offset < fTypesToExtract.length; offset++)
			arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + fMembersToMove.length + fDeletedMethods.length + fAbstractMethods.length + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fTypesToExtract[offset]));
		final DynamicValidationRefactoringChange change= new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.ExtractSupertypeProcessor_extract_supertype, fChangeManager.getAllChanges());
		final IFile file= ResourceUtil.getFile(declaring.getCompilationUnit());
		if (fSuperSource != null && fSuperSource.length() > 0)
			change.add(new CreateCompilationUnitChange(declaring.getPackageFragment().getCompilationUnit(JavaModelUtil.getRenamedCUName(declaring.getCompilationUnit(), fTypeName)), fSuperSource, file.getCharset(false)));
		return change;
	} finally {
		monitor.done();
		clearCaches();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:ExtractSupertypeProcessor.java

示例6: createChange

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
@Override
public final Change createChange(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
	Assert.isNotNull(monitor);
	try {
		monitor.beginTask("", 1); //$NON-NLS-1$
		monitor.setTaskName(RefactoringCoreMessages.ExtractInterfaceProcessor_creating);
		final Map<String, String> arguments= new HashMap<String, String>();
		String project= null;
		final IJavaProject javaProject= fSubType.getJavaProject();
		if (javaProject != null)
			project= javaProject.getElementName();
		int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
		try {
			if (fSubType.isLocal() || fSubType.isAnonymous())
				flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
		} catch (JavaModelException exception) {
			JavaPlugin.log(exception);
		}
		final IPackageFragment fragment= fSubType.getPackageFragment();
		final ICompilationUnit cu= fragment.getCompilationUnit(JavaModelUtil.getRenamedCUName(fSubType.getCompilationUnit(), fSuperName));
		final IType type= cu.getType(fSuperName);
		final String description= Messages.format(RefactoringCoreMessages.ExtractInterfaceProcessor_description_descriptor_short, BasicElementLabels.getJavaElementName(fSuperName));
		final String header= Messages.format(RefactoringCoreMessages.ExtractInterfaceProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getElementLabel(fSubType, JavaElementLabels.ALL_FULLY_QUALIFIED) });
		final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
		comment.addSetting(Messages.format(RefactoringCoreMessages.ExtractInterfaceProcessor_refactored_element_pattern, JavaElementLabels.getElementLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)));
		final String[] settings= new String[fMembers.length];
		for (int index= 0; index < settings.length; index++)
			settings[index]= JavaElementLabels.getElementLabel(fMembers[index], JavaElementLabels.ALL_FULLY_QUALIFIED);
		comment.addSetting(JDTRefactoringDescriptorComment.createCompositeSetting(RefactoringCoreMessages.ExtractInterfaceProcessor_extracted_members_pattern, settings));
		addSuperTypeSettings(comment, true);
		final ExtractInterfaceDescriptor descriptor= RefactoringSignatureDescriptorFactory.createExtractInterfaceDescriptor(project, description, comment.asString(), arguments, flags);
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fSubType));
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fSuperName);
		for (int index= 0; index < fMembers.length; index++)
			arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (index + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fMembers[index]));
		arguments.put(ATTRIBUTE_ABSTRACT, Boolean.valueOf(fAbstract).toString());
		arguments.put(ATTRIBUTE_COMMENTS, Boolean.valueOf(fComments).toString());
		arguments.put(ATTRIBUTE_PUBLIC, Boolean.valueOf(fPublic).toString());
		arguments.put(ATTRIBUTE_REPLACE, Boolean.valueOf(fReplace).toString());
		arguments.put(ATTRIBUTE_INSTANCEOF, Boolean.valueOf(fInstanceOf).toString());
		final DynamicValidationRefactoringChange change= new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.ExtractInterfaceRefactoring_name, fChangeManager.getAllChanges());
		final IFile file= ResourceUtil.getFile(fSubType.getCompilationUnit());
		if (fSuperSource != null && fSuperSource.length() > 0)
			change.add(new CreateCompilationUnitChange(fSubType.getPackageFragment().getCompilationUnit(JavaModelUtil.getRenamedCUName(fSubType.getCompilationUnit(), fSuperName)), fSuperSource, file.getCharset(false)));
		monitor.worked(1);
		return change;
	} finally {
		monitor.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:51,代码来源:ExtractInterfaceProcessor.java

示例7: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
	return new IFile[] {ResourceUtil.getFile(fCu)};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:RenameLocalVariableProcessor.java

示例8: getChangedFiles

import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil; //导入方法依赖的package包/类
@Override
protected IFile[] getChangedFiles() throws CoreException {
	return new IFile[] {ResourceUtil.getFile(fTypeParameter.getDeclaringMember().getCompilationUnit())};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:RenameTypeParameterProcessor.java


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