本文整理匯總了Java中org.eclipse.core.resources.IFile.getFullPath方法的典型用法代碼示例。如果您正苦於以下問題:Java IFile.getFullPath方法的具體用法?Java IFile.getFullPath怎麽用?Java IFile.getFullPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IFile
的用法示例。
在下文中一共展示了IFile.getFullPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createClasspathEntries
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Override
public List<IClasspathEntry> createClasspathEntries()
{
IPath srcJar = null;
if( underlyingResource.getFileExtension().equals("jar") )
{
String name = underlyingResource.getName();
IFile srcJarFile = underlyingResource.getProject().getFile(
"lib-src/" + name.substring(0, name.length() - 4) + "-sources.jar");
if( srcJarFile.exists() )
{
srcJar = srcJarFile.getFullPath();
}
}
return Arrays.asList(JavaCore.newLibraryEntry(underlyingResource.getFullPath(), srcJar, null));
}
示例2: getModelOutputFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public File getModelOutputFile (String outputName) throws CoreException, InterruptedException, FileNotFoundException {
IFile file = ResourceManager.toIFile(sourceFileModel);
IFolder folder = ResourceManager.ensureFolder(file.getProject(), ".gw4eoutput", new NullProgressMonitor());
IFile outfile = folder.getFile(new Path(outputName));
InputStream source = new ByteArrayInputStream("".getBytes());
if (outfile.exists()) {
outfile.setContents(source, IResource.FORCE, new NullProgressMonitor());
} else {
outfile.create(source, IResource.FORCE, new NullProgressMonitor());
}
outfile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
long max = System.currentTimeMillis() + 15 * 1000;
while (true) {
IFile out = folder.getFile(new Path(outputName));
if (out.exists()) break;
if (System.currentTimeMillis() > max) {
throw new InterruptedException (out.getFullPath() + " does not exist.");
}
Thread.sleep(500);
}
return ResourceManager.toFile(outfile.getFullPath());
}
示例3: getOutputFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public File getOutputFile () throws FileNotFoundException, CoreException, InterruptedException {
IFolder folder = ResourceManager.getWorkspaceRoot().getFolder(containerFullPath);
IFile outfile = folder.getFile(new Path(filename));
InputStream source = new ByteArrayInputStream("".getBytes());
if (outfile.exists()) {
outfile.setContents(source, IResource.FORCE, new NullProgressMonitor());
} else {
outfile.create(source, IResource.FORCE, new NullProgressMonitor());
}
outfile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
long max = System.currentTimeMillis() + 15 * 1000;
while (true) {
IFile out = folder.getFile(new Path(filename));
if (out.exists()) break;
if (System.currentTimeMillis() > max) {
throw new InterruptedException (out.getFullPath() + " does not exist.");
}
Thread.sleep(500);
}
return ResourceManager.toFile(outfile.getFullPath());
}
示例4: process
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private boolean process(Object element, RenameArguments arguments) {
if (element instanceof IFile) {
originalFile = (IFile) element;
newName = arguments.getNewName();
if (!acceptFile(originalFile))
return false;
RenameChange operation = new RenameGraphFileChange(originalFile.getProject(),originalFile.getFullPath(), newName);
renameOperations.add(operation);
return true;
}
if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
MoveGraphParticipant mgp = new MoveGraphParticipant();
moveOperations.addAll(mgp.create(folder,(folder.getParent().getFolder(new Path(arguments.getNewName())))));
return moveOperations.size()>0;
}
return false;
}
示例5: createFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static IFile createFile(IProject project, IFile file, InputStream contentStream, IProgressMonitor monitor) throws CoreException {
if (!file.exists())
{
IPath path = file.getProjectRelativePath();
if (path.segmentCount() > 1) {
IPath currentFolderPath = new Path("");
for (int i=0; i<path.segmentCount()-1; i++) {
currentFolderPath = currentFolderPath.append(path.segment(i));
createFolder(project, currentFolderPath, monitor);
}
}
try
{
file.create(contentStream, true, monitor);
}
finally
{
try {
contentStream.close();
} catch (IOException e) {
throw new CoreException(new Status(Status.ERROR, "", "Could not close stream for file " + file.getFullPath(), e));
}
}
}
return file;
}
示例6: setFileContent
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static void setFileContent(IProject project, IFile file, String fileContent, IProgressMonitor monitor) throws CoreException
{
if (file.exists())
{
ByteArrayInputStream contentStream = new ByteArrayInputStream(fileContent.getBytes());
try
{
file.setContents(contentStream, true, true, monitor);
}
finally
{
try {
contentStream.close();
} catch (IOException e) {
throw new CoreException(new Status(Status.ERROR, "", "Could not close stream for file " + file.getFullPath(), e));
}
}
}
}
示例7: getTargetFolderForTestImplementation
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* Return the folder for test implementation
*
* @param selectedFolder
* @return
*/
public static String getTargetFolderForTestImplementation(IFile file) {
IProject project = file.getProject();
IPath p = file.getFullPath();
if (isFolderMainResources(project, p))
return Constant.SOURCE_MAIN_JAVA;
return Constant.SOURCE_TEST_JAVA;
}
示例8: findSharedContexts
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* @param main
* @param candidatesGraphFiles
* @return
* @throws IOException
* @throws JavaModelException
* @throws InterruptedException
*/
public static List<IFile> findSharedContexts(IFile main, List<IFile> candidatesGraphFiles)
throws IOException, JavaModelException, InterruptedException {
IPath path = main.getFullPath();
File file = ResourceManager.toFile(path);
Context mainContext = GraphWalkerFacade.getContext(file.getAbsolutePath());
List<Context> candidates = new ArrayList<Context>();
Map<Context, IFile> mapping = new HashMap<Context, IFile>();
for (IFile graphFile : candidatesGraphFiles) {
try {
File gfile = ResourceManager.toFile(graphFile.getFullPath());
Context candidatContext = GraphWalkerFacade.getContext(gfile.getAbsolutePath());
mapping.put(candidatContext, graphFile);
candidates.add(candidatContext);
} catch (Exception e) {
ResourceManager.logException(e);
}
}
List<Context> contexts = new ArrayList<Context>();
findSharedContexts(contexts, mainContext, candidates);
List<IFile> ret = new ArrayList<IFile>();
for (Context context : contexts) {
IFile t = mapping.get(context);
ret.add(t);
}
return ret;
}
示例9: find
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* @param path
* @return
* @throws CoreException
*/
public static IPath find(IProject project, String path) throws CoreException {
IContainer root = (IContainer) getWorkspaceRoot().findMember(project.getName());
IFile file = processContainer(root, path);
if (file != null) {
return file.getFullPath();
}
return null;
}
示例10: getBuildPoliciesPathForGraphModel
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* @param resource
* @return
* @throws FileNotFoundException
*/
public static IPath getBuildPoliciesPathForGraphModel(IFile resource) throws FileNotFoundException {
String buildPolicyFilename = PreferenceManager.getBuildPoliciesFileName(resource.getProject().getName());
IPath path = resource.getParent().getFullPath().append(buildPolicyFilename);
IResource res = ResourceManager.getResource(path.toString());
if (res == null) {
throw new FileNotFoundException("No policies found in the folder of " + resource.getFullPath());
}
return path;
}
示例11: getExistingFileInTheSameFolder
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* Return a file named postfix in the same folder as the passed resource
* Fails if the file does not exist
*
* @param resource
* @param postfix
* @return
* @throws FileNotFoundException
*/
public static File getExistingFileInTheSameFolder(IFile resource, String postfix) throws FileNotFoundException {
if ((resource == null) || resource.getParent() == null) {
throw new FileNotFoundException(String.valueOf(resource) + " " + postfix);
}
IPath path = resource.getParent().getRawLocation().append(postfix);
File file = path.toFile();
if (!file.exists()) {
throw new FileNotFoundException("Expecting a " + postfix + " file in " + resource.getParent().getFullPath()
+ " including " + resource.getFullPath());
}
return file;
}
示例12: loadIFileAsProperties
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* Load the resource as a Properties java object
*
* @param resource
* @param file
* @return
* @throws FileNotFoundException
*/
public static Properties loadIFileAsProperties(IFile resource, String file) throws FileNotFoundException {
File buildPoliciesFile = ResourceManager.getExistingFileInTheSameFolder(resource, file);
if ((buildPoliciesFile == null) || !buildPoliciesFile.exists()) {
throw new FileNotFoundException("Expecting a " + file + " file in " + resource.getParent().getFullPath()
+ " including " + resource.getFullPath());
}
return getProperties(buildPoliciesFile);
}
示例13: createRenameChangeForTestImplementation
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public Change createRenameChangeForTestImplementation(IProgressMonitor pm) {
IResource[] roots = { getProject() };
String[] fileNamePatterns = new String[] { "*.java" };
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots, fileNamePatterns, false);
IPath path = Helper.buildGeneratedAnnotationValue(getOriginalFile());
Pattern pattern = Pattern.compile(Helper.getGeneratedAnnotationRegExp(path));
List<Change> changes = new ArrayList<Change>();
TextSearchRequestor collector = new TextSearchRequestor() {
@Override
public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
IFile file = matchAccess.getFile();
Change rename = new RenameCompilationUnitChange(getProject(),file.getFullPath(), getNewName(),CompilationUnitType.TEST_IMPLEMENTATION);
changes.add(rename);
return true;
}
};
TextSearchEngine.create().search(scope, collector, pattern, pm);
if (changes.isEmpty())
return null;
CompositeChange result = new CompositeChange("Rename GraphWalker Test Implementation(s)");
Map<IPath,IPath> maps = new HashMap<IPath,IPath> ();
for (Iterator<Change> iter = changes.iterator(); iter.hasNext();) {
RenameCompilationUnitChange mc = (RenameCompilationUnitChange)iter.next();
IPath mcPath = mc.getTargetFilePath();
IPath p = maps.get(mcPath);
if (p!=null) {
String[] parts = mc.getNewName().split(Pattern.quote("."));
String newValue = parts[0] + System.currentTimeMillis() + "." + parts[1];
mc.setNewName(newValue);
}
maps.put(mc.getTargetFilePath(),mc.getTargetFilePath());
result.add(mc);
}
return result;
}
示例14: createRenameChangeForTestInterface
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public Change createRenameChangeForTestInterface(IProgressMonitor pm) {
IResource[] roots = { getProject() };
String[] fileNamePatterns = new String[] { "*.java" };
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(roots, fileNamePatterns, false);
IPath path = Helper.buildModelAnnotationValue(originalFile);
Pattern pattern = Pattern.compile(Helper.getModelAnnotationRegExp(path));
List<Change> changes = new ArrayList<Change>();
TextSearchRequestor collector = new TextSearchRequestor() {
@Override
public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
IFile file = matchAccess.getFile();
Change rename = new RenameCompilationUnitChange(getProject(),file.getFullPath(), getNewName(),CompilationUnitType.TEST_INTERFACE);
changes.add(rename);
return true;
}
};
TextSearchEngine.create().search(scope, collector, pattern, pm);
if (changes.isEmpty())
return null;
CompositeChange result = new CompositeChange("Rename GraphWalker Test Interface(s)");
Map<IPath,IPath> maps = new HashMap<IPath,IPath> ();
for (Iterator<Change> iter = changes.iterator(); iter.hasNext();) {
RenameCompilationUnitChange mc = (RenameCompilationUnitChange)iter.next();
IPath p = maps.get(mc.getTargetFilePath());
if (p!=null) {
String[] parts = mc.getNewName().split(Pattern.quote("."));
mc.setNewName(parts[0] + System.currentTimeMillis() + "." + parts[1]);
}
result.add(mc);
}
return result;
}
示例15: perform
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Override
public Change perform(IProgressMonitor pm) throws CoreException {
IFolder folder = (IFolder)ResourceManager.getResource(destination.toString());
IFile file = folder.getFile(originalFile.getName());
UpdateEditorAction action = new UpdateEditorAction(project, this.originalFile.getFullPath(), file );
action.openclose();
return new RenameEditorChange(project, file.getFullPath(), originalFile.getName());
}