當前位置: 首頁>>代碼示例>>Java>>正文


Java IFolder.getFile方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IFolder.getFile方法的典型用法代碼示例。如果您正苦於以下問題:Java IFolder.getFile方法的具體用法?Java IFolder.getFile怎麽用?Java IFolder.getFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IFolder的用法示例。


在下文中一共展示了IFolder.getFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deleteCorrospondingXmlAndPropertyFileifUserDeleteJobFile

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
private boolean deleteCorrospondingXmlAndPropertyFileifUserDeleteJobFile(IProject iProject) {
	if (modifiedResource.getProjectRelativePath()!=null && StringUtils.equalsIgnoreCase(modifiedResource.getProjectRelativePath().segment(0),
			CustomMessages.ProjectSupport_JOBS)) {
		IFile propertyFileName = null;
		IFolder jobsFolder = iProject.getFolder(CustomMessages.ProjectSupport_JOBS);
		IFolder propertiesFolder = iProject.getFolder(Messages.PARAM);
		if (jobsFolder != null) {
			xmlIFile=jobsFolder.getFile(modifiedResource.getFullPath().removeFirstSegments(2).removeFileExtension().addFileExtension(Constants.XML_EXTENSION_FOR_IPATH));
		}
		if (propertiesFolder != null) {
			propertyFileName = propertiesFolder.getFile(modifiedResource.getFullPath().removeFileExtension()
					.addFileExtension(Constants.PROPERTIES).toFile().getName());
		}
		String message = getErrorMessageIfUserDeleteJobRelatedFiles(propertyFileName, xmlIFile);
		showErrorMessage(xmlIFile, propertyFileName, Messages.bind(message, modifiedResource.getName()));
	} else {
		flag = true;
	}
	return flag;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:21,代碼來源:JobDeleteParticipant.java

示例2: loadPackagesFromPropertyFileSettingFolder

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
public void loadPackagesFromPropertyFileSettingFolder() {
	Properties properties = new Properties();
	IFolder folder = BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject().getFolder(
			PathConstant.PROJECT_RESOURCES_FOLDER);
	IFile file = folder.getFile(PathConstant.EXPRESSION_EDITOR_EXTERNAL_JARS_PROPERTIES_FILES);
	try {
		LOGGER.debug("Loading property file");
		targetList.removeAll();
		if (file.getLocation().toFile().exists()) {
			FileInputStream inStream = new FileInputStream(file.getLocation().toString());
			properties.load(inStream);
			for (Object key : properties.keySet()) {
				String jarFileName = StringUtils.trim(StringUtils.substringAfter((String) key, Constants.DASH));
				if (BuildExpressionEditorDataSturcture.INSTANCE.getIPackageFragment(jarFileName) != null) {
					targetList.add((String) key+SWT.SPACE+Constants.DASH+SWT.SPACE+properties.getProperty((String)key));
				}
			}
		}
	} catch (IOException | RuntimeException exception) {
		LOGGER.error("Exception occurred while loading jar files from projects setting folder", exception);
	}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:CategoriesDialogTargetComposite.java

示例3: createTestProject

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
/**
 * Creates a project with two files.
 */
@SuppressWarnings("resource")
@BeforeClass
public static void createTestProject() throws Exception {
	staticProject = ProjectUtils.createJSProject(PROJECT_NAME);
	IFolder path = staticProject.getFolder("src").getFolder("path");
	path.create(true, true, null);
	IFile libFile = path.getFile("Libs.n4js");
	libFile.create(new StringInputStream(
			"export public class MyFirstClass {} export public class MySecondClass {} class MyHiddenClass {}",
			libFile.getCharset()), true, monitor());
	IFile moreLibFile = path.getFile("MoreLibs.n4js");
	moreLibFile.create(new StringInputStream(
			"export public class MoreLibFirstClass {} export public class MoreLibSecondClass {}",
			moreLibFile.getCharset()), true, monitor());
	IFile testFile = path.getFile("Test.n4js");
	testFile.create(new StringInputStream("", testFile.getCharset()), true, monitor());
	addNature(staticProject, XtextProjectHelper.NATURE_ID);
	ProjectUtils.waitForAutoBuild();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:AbstractN4JSContentAssistTest.java

示例4: getOrCreateServiceClass

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
/**
 * Gets or creates the debug service class.
 * 
 * @param serviceFolder
 *            the containing {@link IFolder}
 * @param projectName
 *            the project name
 * @param languageName
 *            the language name
 * @param layerName
 *            the debug layer name
 * @param monitor
 *            the {@link IProgressMonitor}
 * @return the debug service class qualified name
 * @throws IOException
 * @throws CoreException
 */
public static String getOrCreateServiceClass(IFolder serviceFolder,
		String projectName, String languageName, String layerName,
		IProgressMonitor monitor) throws IOException, CoreException {
	final String className = toCamelCase(languageName.replaceAll("\\W", "")) + "DebugServices";
	final IFile classFile = serviceFolder.getFile(new Path(className
			+ ".java"));
	final String packageName = projectName + ".services";
	final String res = packageName + "." + className;

	if (!classFile.exists()) {
		if (!serviceFolder.exists()) {
			AddDebugLayerHandler.createFolder(serviceFolder,
					monitor);
		}
		createServiceClass(classFile, packageName, className, languageName,
				layerName, monitor);
	} else {
		addStringCoupleIfNeeded(classFile, languageName, layerName, monitor);
	}

	return res;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:40,代碼來源:AddDebugLayerHandler.java

示例5: getModelOutputFile

import org.eclipse.core.resources.IFolder; //導入方法依賴的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());
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:25,代碼來源:GraphElementPage.java

示例6: doSaveAs

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
@Override
public void doSaveAs() {
	String jobId = getActiveProject() + "." + getJobName();
	DataViewerUtility.INSTANCE.closeDataViewerWindows(JobManager.INSTANCE.getPreviouslyExecutedJobs().get(jobId));
	
	deleteDebugFiles(jobId);
	
	Map<String, String> currentParameterMap = getCurrentParameterMap();
	IFile file=opeSaveAsDialog();
	saveJob(file,true);
	IWorkspaceRoot workSpaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = workSpaceRoot.getProject(getActiveProject());
	IFolder paramFolder = project.getFolder(Messages.PARAM);
	IFile filename=paramFolder.getFile(oldFileName.replace(Messages.JOBEXTENSION,Messages.PROPERTIES_EXTENSION));
	copyParameterFile(currentParameterMap,filename);
	
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:18,代碼來源:ELTGraphicalEditor.java

示例7: getFile

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
/**
 * @param projectname
 * @param folder
 * @param filename
 * @return whether the file exists in the specified project & folder
 * @throws CoreException
 */
public static File getFile(String projectname, String folder, String pkg, String filename) throws CoreException {
	IProject project = getProject(projectname);
	IFolder destFolder = project.getFolder(new Path(folder));
	IFolder container = destFolder;
	if (pkg != null) {
		StringTokenizer st = new StringTokenizer(pkg, "/");
		while (st.hasMoreTokens()) {
			String dir = st.nextToken();
			IFolder f = container.getFolder(new Path(dir));
			if (!f.exists()) {
				f.create(true, true, null);
			}
			container = f;
		}
	}
	IFile file = container.getFile(new Path(filename));
	return file.getRawLocation().makeAbsolute().toFile();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:26,代碼來源:ResourceManager.java

示例8: loadClassesFromSettingsFolder

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
private void loadClassesFromSettingsFolder() {
	Properties properties = new Properties();
	IFolder folder=getCurrentProject().getFolder(PathConstant.PROJECT_RESOURCES_FOLDER);
	IFile file = folder.getFile(PathConstant.EXPRESSION_EDITOR_EXTERNAL_JARS_PROPERTIES_FILES);
	try {
		LOGGER.debug("Loading property file");
		if (file.getLocation().toFile().exists()) {
			FileInputStream inStream = new FileInputStream(file.getLocation().toString());
			properties.load(inStream);
			
			for(Object key:properties.keySet()){
				String packageName=StringUtils.remove((String)key,Constants.DOT+Constants.ASTERISK);
				if(StringUtils.isNotBlank(properties.getProperty((String)key)) && StringUtils.isNotBlank(packageName)){
					loadUserDefinedClassesInClassRepo(properties.getProperty((String)key),packageName);
				}
			}
		}
	} catch (IOException |RuntimeException exception) {
		LOGGER.error("Exception occurred while loading jar files from projects setting folder",exception);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:22,代碼來源:BuildExpressionEditorDataSturcture.java

示例9: createPropertiesFilesForPastedFiles

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
private void createPropertiesFilesForPastedFiles(IFolder paramFolder, List<IFile> pastedFileList,
		List<String> copiedPropertiesList){
	for (int i = 0; i < copiedPropertiesList.size(); i++) {
		try(InputStream inputStream = paramFolder.getFile(copiedPropertiesList.get(i)).getContents()) {
			IFile file = paramFolder
					.getFile(pastedFileList.get(i).getName().replace(JOB_EXTENSION,PROPERTIES_EXTENSION));
			if (!file.exists()) {
				file.create(inputStream, true, null);
			} else {
				int userInput=showErrorMessage(file, file.getName() + " already exists.Do you want to replace it?");
				if (userInput == SWT.YES) {
					file.setContents(inputStream, true,false, null);
				}
			}
		} catch (CoreException | IOException coreException) {
			logger.error("Error while creating properties files for pasted files ::{}", coreException.getMessage());
			
		} 
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:21,代碼來源:PasteHandler.java

示例10: deleteCorrospondingJobAndPropertyFileifUserDeleteXmlFile

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
private boolean deleteCorrospondingJobAndPropertyFileifUserDeleteXmlFile(IProject iProject) {
	if (modifiedResource.getProjectRelativePath()!=null && StringUtils.equalsIgnoreCase(modifiedResource.getProjectRelativePath().segment(0),
			CustomMessages.ProjectSupport_JOBS)) {
		IFile propertyFileName = null;
		IFolder jobsFolder = iProject.getFolder(CustomMessages.ProjectSupport_JOBS);
		IFolder propertiesFolder = iProject.getFolder(Messages.PARAM);

		if (jobsFolder != null) {
			jobIFile=jobsFolder.getFile(modifiedResource.getFullPath().removeFirstSegments(2).removeFileExtension().addFileExtension(Constants.JOB_EXTENSION_FOR_IPATH));
		}
		if (propertiesFolder != null) {
			propertyFileName = propertiesFolder.getFile(modifiedResource.getFullPath().removeFileExtension()
					.addFileExtension(Constants.PROPERTIES).toFile().getName());
		}
		String message = getErrorMessageIfUserDeleteXmlRelatedFiles(jobIFile, propertyFileName);
		showErrorMessage(jobIFile, propertyFileName, Messages.bind(message, modifiedResource.getName()));
	} else {
		flag = true;
	}
	return flag;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:22,代碼來源:JobDeleteParticipant.java

示例11: validatePage

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
protected boolean validatePage() {
	boolean returnCode=  super.validatePage() && validateFilename();
	if(returnCode){
		IPath iPath=new Path(getContainerFullPath()+JOBS_FOLDER_NAME);
		IFolder folder=ResourcesPlugin.getWorkspace().getRoot().getFolder(iPath);
		if(!StringUtils.endsWithIgnoreCase(getFileName(), Constants.JOB_EXTENSION)){
			IFile newFile= folder.getFile(getFileName()+Constants.JOB_EXTENSION);
			if(newFile.exists()){
				setErrorMessage("'"+newFile.getName()+"'"+Constants.ALREADY_EXISTS);
				return false;
			}
		}
	}
	return returnCode;
	
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:JobCreationPage.java

示例12: createArchive

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
private void createArchive(String projectName) throws CoreException, IOException {
	IProject project = workspace.getProject(projectName);
	IFolder libFolder = project.getFolder(LIB_FOLDER_NAME);
	libFolder.create(false, true, null);

	IFile archiveFile = libFolder.getFile(host.archiveProjectId + ".nfar");
	ByteArrayOutputStream byteArrayOutputSteam = new ByteArrayOutputStream();
	final ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputSteam);
	zipOutputStream.putNextEntry(new ZipEntry("src/A.js"));
	zipOutputStream.putNextEntry(new ZipEntry("src/B.js"));
	zipOutputStream.putNextEntry(new ZipEntry("src/sub/B.js"));
	zipOutputStream.putNextEntry(new ZipEntry("src/sub/C.js"));
	zipOutputStream.putNextEntry(new ZipEntry("src/sub/leaf/D.js"));

	zipOutputStream.putNextEntry(new ZipEntry(IN4JSProject.N4MF_MANIFEST));
	// this will close the stream
	CharStreams.write("ProjectId: " + host.archiveProjectId + "\n" +
			"ProjectType: library\n" +
			"ProjectVersion: 0.0.1-SNAPSHOT\n" +
			"VendorId: org.eclipse.n4js\n" +
			"VendorName: \"Eclipse N4JS Project\"\n" +
			"Libraries { \"" + LIB_FOLDER_NAME + "\"\n }\n" +
			"Output: \"src-gen\"" +
			"Sources {\n" +
			"	source { " +
			"		\"src\"\n" +
			"	}\n" +
			"}\n", CharStreams.newWriterSupplier(new OutputSupplier<ZipOutputStream>() {
				@Override
				public ZipOutputStream getOutput() throws IOException {
					return zipOutputStream;
				}
			}, Charsets.UTF_8));

	archiveFile.create(new ByteArrayInputStream(byteArrayOutputSteam.toByteArray()), false, null);

	host.setArchiveFileURI(URI.createPlatformResourceURI(archiveFile.getFullPath().toString(), true));
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:39,代碼來源:EclipseBasedProjectModelSetup.java

示例13: findArtifactInFolder

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
@Override
public URI findArtifactInFolder(URI folderLocation, String folderRelativePath) {
	final String folderLocationString = folderLocation.toPlatformString(true);
	if (null != folderLocationString) {
		final IFolder folder = workspace.getFolder(new Path(folderLocationString));
		final String subPathStr = folderRelativePath.replace(File.separator, "/");
		final IPath subPath = new Path(subPathStr);
		final IFile file = folder != null ? folder.getFile(subPath) : null;
		if (file != null && file.exists()) {
			return folderLocation.appendSegments(subPathStr.split("/"));
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:EclipseBasedN4JSWorkspace.java

示例14: findOldGraphFile

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
private void findOldGraphFile(IProgressMonitor monitor) throws JavaModelException, FileNotFoundException {
	AnnotationParsing ap = JDTManager.findAnnotationParsingInModelAnnotation(testInterface, "file");
	this.model = ap.getValue("file");
	IPackageFragmentRoot[] roots = testInterface.getJavaProject().getPackageFragmentRoots();
	for (int j = 0; j < roots.length; j++) {
		IPackageFragmentRoot root = roots[j];
		IFolder resource = (IFolder) root.getResource();
		if (resource==null) throw new FileNotFoundException (model);
		IFile graphFile = resource.getFile(model);
		if (graphFile.exists()) {
			oldGraphFile = graphFile;
			break;
		}
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:16,代碼來源:TestConvertor.java

示例15: getBuildPoliciesForGraph

import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
/**
 * @param file
 * @return The build policies file located in the same folder as the graph
 *         file
 * @throws FileNotFoundException
 */
public static IFile getBuildPoliciesForGraph(IFile file) throws FileNotFoundException {
	String name = PreferenceManager.getBuildPoliciesFileName(file.getProject().getName());
	IFolder folder = (IFolder) file.getParent();
	IFile policiesFile = folder.getFile(name);
	if (policiesFile == null || !policiesFile.exists())
		throw new FileNotFoundException(folder.getFullPath().append(name).toString());
	return policiesFile;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:15,代碼來源:BuildPolicyManager.java


注:本文中的org.eclipse.core.resources.IFolder.getFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。