Bundle bundle = Platform.getBundle( "your.plugin.id" ); InputStream stream = FileLocator.openStream( bundle, "path.in.plugin", false ); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( "your.project" ); IFile file = project.getFile( "something/abc.txt" ); file.create( stream, true, null );
/** * Gets the content of the pom.xml file of the given {@link IProject} as {@link Document}. * * @param p * The {@link IProject} for which the pom should be returned. * @return The {@link Document} holding the pom.xml contents. * @throws CoreException */ public static Document getPomDocument(IProject p) throws CoreException { IFile pom = p.getFile(IMavenConstants.POM); return readXmlDocument(pom); }
private GradleProjectValidator(IProject project) { this.project = project; this.settingsFolder = project.getFolder(".settings"); this.preferencesFile = project.getFile(".settings/" + CorePlugin.PLUGIN_ID + ".prefs"); }
protected static void addFileIfExists(IProject p, List aList, String filename) { IFile aFile = p.getFile(filename); if (aFile != null && aFile.exists()) aList.add(aFile); }
public IResource getResource() { if (project != null) return project; return earProject.getFile(getText()); }
private void addJar(File jarFile, IProject project, IProgressMonitor monitor) throws CoreException { String jarName = jarFile.getName(); IFile file = project.getFile(jarName); monitor.subTask(NLS.bind(PDEUIMessages.NewProjectCreationOperation_copyingJar, jarName)); try (InputStream in = new FileInputStream(jarFile)) { file.create(in, true, monitor); } catch (IOException fnfe) { } }
public static IPath getBinaryProjectJARLocation(IProject aProject) { List sources = JemProjectUtilities.getLocalJARPathsFromClasspath(aProject); if (!sources.isEmpty()) { IPath path = (IPath) sources.get(0); return aProject.getFile(path).getLocation(); } return null; }
@Override protected IFile[] getChangedFiles() throws CoreException { IFile projectFile= fProject.getProject().getFile(".project"); //$NON-NLS-1$ if (projectFile != null && projectFile.exists()) { return new IFile[] {projectFile}; } return new IFile[0]; }
protected IFile[] getChangedFiles() throws CoreException { IFile projectFile= fProject.getProject().getFile(".project"); //$NON-NLS-1$ if (projectFile != null && projectFile.exists()) { return new IFile[] {projectFile}; } return new IFile[0]; }
@Override public void open() { if (fResource != null) SchemaEditor.openSchema(fResource.getProject().getFile(fElement)); }
private void setPomFile(IProject project) { if(project.isAccessible()) { IFile pomFile = project.getFile(IMavenConstants.POM_FILE_NAME); if(pomFile != null && pomFile.isAccessible()) { this.pomFile = pomFile; } } }
public Manifest getManifest() { IFile file = getProject().getFile(new Path(TypeConstants.META_INF_MANIFEST_MF)); if (file.exists()) { try (InputStream contents = file.getContents()) { return new Manifest(contents); } catch (IOException | CoreException e) { // unusable manifest } } return null; }
/** * TODO refactor change the method above to return IFile * {@link DoNotUseMeThisWillBeDeletedPost15} */ protected IFile saveToOutputPathIFile(IPath projectRelativePath, InputStream in) throws Exception { IFile iFile = vComponent.getProject().getFile(projectRelativePath); saveToIFile(iFile, in); return iFile; }
public void initializeTimeStamps() { IFile file= fCurrJProject.getProject().getFile(".classpath"); //$NON-NLS-1$ fFileTimeStamp= file.getModificationStamp(); fUserSettingsTimeStamp= getEncodedSettings(); }
private AJProjectModel getModelFromName(IProject project, String name) { if (name.equals(CURRENT_BUILD)) { return AJModel.getInstance().getModelForProject(project); } IPath mapFile = project.getFile(name).getLocation(); AJProjectModel model = new AJProjectModel(project); boolean success = model.loadModel(mapFile); if (!success) { return null; } return model; }
protected IFile getImportedJarAsIFile() { if (getProject() != null) { if (getText() != null && getText().endsWith(J2EEImportConstants.IMPORTED_JAR_SUFFIX)) { IFile file = getProject().getFile(getText()); if (file != null && file.exists()) return file; } } return null; }
private static IResource tryFindWorkspaceFile(InternalGradleBuild gradleBuild, Path filePath) { for (IProject project : getWorkspaceProjectsFor(gradleBuild)) { IPath projectLocation = project.getLocation(); if (projectLocation.isPrefixOf(filePath)) { IFile file = project.getFile(filePath.makeRelativeTo(projectLocation)); if (file.exists()) { return file; } } } return null; }
protected void refreshLocal(IProgressMonitor monitor) throws CoreException { IProject project = fManifestFile.getProject(); project.refreshLocal(IResource.DEPTH_ONE, monitor); IFile file = project.getFile("dev.properties"); //$NON-NLS-1$ if (file.exists()) file.delete(true, false, monitor); project.refreshLocal(IResource.DEPTH_ONE, monitor); }
public static boolean openSchema(IPath path) { String pluginId = path.segment(0); IPluginModelBase model = PluginRegistry.findModel(pluginId); if (model != null && model.getUnderlyingResource() != null) { IProject project = model.getUnderlyingResource().getProject(); IFile file = project.getFile(path.removeFirstSegments(1)); return openSchema(file); } return false; }
private IPath getFullPath(FilePatch2 diff) { IPath path = diff.getStrippedPath(getStripPrefixSegments(), isReversed()); DiffProject project = getProject(diff); if (project != null) return Utilities.getProject(project).getFile(path).getFullPath(); return getTarget().getFullPath().append(path); }