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


Java IFolder类代码示例

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


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

示例1: selectionChanged

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
@Override
public void selectionChanged(SelectionChangedEvent event) {
	IStructuredSelection selection = (IStructuredSelection) event.getSelection();
	Object selected = selection.getFirstElement();
	if (selected instanceof TemplateProvider) {
		provider = (TemplateProvider) selected;
	}
	if (selected instanceof IFolder) {
		targetFolder 	= ((IFolder) selected);
		project  		= targetFolder.getProject();
	}
	if (selected instanceof InitialBuildPolicies) {
		policies 	= ((InitialBuildPolicies) selected);
	}
	if (selected instanceof String) {
		filename 	= ((String) selected);
	}		
	fExtraPage.validatePage();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:GW4EModelWizard.java

示例2: loadResource

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
protected void loadResource(TreeParent parentTreeObject, Object folderObject, IResource[] members) throws CoreException {
	ResourceFolderTreeObject resourceFolderTreeObject;
	if (folderObject instanceof String) resourceFolderTreeObject = new ResourceFolderTreeObject(viewer, (String) folderObject);
	else resourceFolderTreeObject = new ResourceFolderTreeObject(viewer, (IFolder) folderObject);
	parentTreeObject.addChild(resourceFolderTreeObject);

	ResourceTreeObject resourceTreeObject;
	for (int i = 0; i < members.length; i++) {
		IResource resource = members[i];
		String name = resource.getName();
		if (resource instanceof IFolder) {
			if (name.equals("_data")) continue;
			if (name.equals("_lib")) continue;
			if (name.equals("_private")) continue;
			loadResource(resourceFolderTreeObject, ((IFolder) resource), ((IFolder) resource).members());
		}
		else {
			if (name.equals(".project")) continue;
			if (name.endsWith(".etr")) continue;
			resourceTreeObject = new ResourceTreeObject(viewer, (IFile) resource);
			resourceFolderTreeObject.addChild(resourceTreeObject);
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:25,代码来源:ProjectLoadingJob.java

示例3: 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

示例4: testNoErrorMarkersWhenReferencedFileIsCreatedBeforeReferencingFile

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
/**
 * <ol>
 * <li>create Class1 file with having Class1.field0 -> should have no errors</li>
 * <li>create Class0 file with referencing Class1.field0 -> should have no errors as Class1 already created</li>
 * </ol>
 */
//@formatter:on
@Test
public void testNoErrorMarkersWhenReferencedFileIsCreatedBeforeReferencingFile() throws Exception {
	// create project and test files
	final IProject project = createJSProject("testNoErrorMarkersWhenReferencedFileIsCreatedBeforeReferencingFile");
	IFolder folder = configureProjectWithXtext(project);
	IFolder moduleFolder = createFolder(folder, TestFiles.moduleFolder());

	IFile file2 = createTestFile(moduleFolder, "Class1", TestFiles.class1());
	assertMarkers("File2 should have no errors", file2, 0);

	IFile file1 = createTestFile(moduleFolder, "Class0", TestFiles.class0());

	// The value of the local variable dummy is not used
	assertMarkers("File1 should have no errors", file1, 1);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:BuilderParticipantPluginTest.java

示例5: 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

示例6: testMethodChainingWithCreatingFilesInReverseOrder

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
/**
 *
 * 01. MyClassOne import MyVariableTwo, calls in chain
 * 01a. method of variable type (MyClassTwo),
 * 01b. method of type of this variable type method (MyRoleThree),
 * 01c. MyRoleThree method (typed with MyInterfaceFour)
 * 01d. finally a MyInterfaceFour's method
 * 02. Creating files in an order that there are initial error markers as required files are not created yet
 * 03. When all files have been created no file should have error markers
 *
 * @throws Exception when creating resources fails
 */
//@formatter:on
@Test
public void testMethodChainingWithCreatingFilesInReverseOrder() throws Exception {
	final IProject project = createJSProject("testMethodChainingWithCreatingFilesInReverseOrder");
	IFolder folder = configureProjectWithXtext(project);
	IFolder moduleFolder = createFolder(folder, MemberTestFiles.moduleFolder());

	IFile fileMyClassOne = createTestFile(moduleFolder, "MyClassOne", MemberTestFiles.myClassOne());
	IFile fileMyVariableTwo = createTestFile(moduleFolder, "MyVariableTwo", MemberTestFiles.myVariableTwo());
	IFile fileMyClassTwo = createTestFile(moduleFolder, "MyClassTwo", MemberTestFiles.myClassTwo());
	IFile fileRoleThree = createTestFile(moduleFolder, "MyRoleThree", MemberTestFiles.myRoleThree());
	IFile fileMyInterfaceFour = createTestFile(moduleFolder, "MyInterfaceFour", MemberTestFiles.myInterfaceFour());
	waitForAutoBuild();

	assertMarkers("File MyInterfaceFour should have no errors", fileMyInterfaceFour, 0);
	assertMarkers("File MyRoleThree should have no errors", fileRoleThree, 0);
	assertMarkers("File MyClassTwo should have no errors", fileMyClassTwo, 0);
	assertMarkers("File MyVariableTwo should have no errors", fileMyVariableTwo, 0);
	assertMarkers("File MyClassOne should have no errors", fileMyClassOne, 0);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:33,代码来源:BuilderParticipantPluginTest.java

示例7: getImage

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
@Override
public Image getImage(final Object element) {
  if (element instanceof IProject) {
    if (((IProject) element).isOpen()) {
      return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
    } else {
      return PlatformUI.getWorkbench().getSharedImages()
          .getImage(SharedImages.IMG_OBJ_PROJECT_CLOSED);
    }
  } else if (element instanceof IFolder) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
  } else if (element instanceof IFile) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
  } else if (element instanceof IMarker) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OPEN_MARKER);
  }

  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:20,代码来源:WizardTreeViewLabelProvider.java

示例8: 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

示例9: testWorkspaceProjectHidingExternalProject_after

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
/**
 * Check if index is populated only with workspace project content when the external location with single project is
 * registered and workspace contains project with the same name. External library is registered before project is
 * created in the workspace.
 */
public void testWorkspaceProjectHidingExternalProject_after() throws Exception {

	IProject createJSProject = ProjectUtils.createJSProject("LibFoo");
	IFolder src = configureProjectWithXtext(createJSProject);
	IFile manifest = createJSProject.getProject().getFile("manifest.n4mf");
	assertMarkers("manifest of first project should have no errors", manifest, 0);

	createTestFile(src, "Foo", "console.log('hi')");
	createTestFile(src, "AAAA", "console.log('hi')");
	createTestFile(src, "BBB", "console.log('hi')");
	waitForAutoBuild();

	copyProjectsToLocation(externalLibrariesRoot, "LibFoo");
	setExternalLibrariesPreferenceStoreLocations(externalLibraryPreferenceStore, externalLibrariesRoot);

	Collection<String> expectedWorkspace = collectIndexableFiles(ResourcesPlugin.getWorkspace());

	assertResourceDescriptions(expectedWorkspace, BuilderUtil.getAllResourceDescriptions());

	removeExternalLibrariesPreferenceStoreLocations(externalLibraryPreferenceStore, externalLibrariesRoot);

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:ExternalPackagesPluginTest.java

示例10: createChange

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	
	copyToPath=getArguments().getDestination().toString();
	IWorkspaceRoot workSpaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = workSpaceRoot.getProject(copyToPath.split("/")[1]);
	IFolder jobFolder = project.getFolder(copyToPath.substring(copyToPath.indexOf('/', 2)));
	previousJobFiles=new ArrayList<>();
	for (IResource iResource : jobFolder.members()) {
		if (!(iResource instanceof IFolder)) {
			IFile iFile = (IFile) iResource;
			 if (iFile.getFileExtension().equalsIgnoreCase(Messages.JOB_EXT)) {
				 previousJobFiles.add(iFile);
			 }
		}
	}
	copiedFileList.add(modifiedResource);
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:JobCopyParticipant.java

示例11: getImage

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
@Override
public Image getImage(Object element) {
  if (element instanceof IProject) {
    if (((IProject) element).isOpen()) {
      return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
    } else {
      return PlatformUI.getWorkbench().getSharedImages()
          .getImage(SharedImages.IMG_OBJ_PROJECT_CLOSED);
    }
  } else if (element instanceof IFolder) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
  } else if (element instanceof IFile) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
  } else if (element instanceof IMarker) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OPEN_MARKER);
  }

  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:20,代码来源:CreatingAtomWizardLabelProvider.java

示例12: 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

示例13: customizeManifest

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
public void customizeManifest(Element rootElem, IProject project, IProgressMonitor monitor) throws CoreException
{
	if( equella.isLanguageStrings() )
	{
		Element runtime = rootElem.getChild("runtime");
		addLibrary(runtime, "resources", "resources/", "resources");
		JPFProject.getResourcesFolder(project).create(true, true, monitor);
	}
	Element requires = rootElem.getChild("requires");
	if( equella.isGuiceModule() )
	{
		addImport(requires, "com.tle.core.guice");
		addExtension(rootElem, "com.tle.core.guice", "module", "guiceModules");
	}
	if( equella.isLanguageStrings() )
	{
		addImport(requires, "com.tle.common.i18n");
		Element ext = addExtension(rootElem, "com.tle.common.i18n", "bundle", "strings");
		addParameter(ext, "file", "lang/i18n.properties");
		IFolder langFolder = JPFProject.getResourcesFolder(project).getFolder("lang");
		langFolder.create(true, true, monitor);
		langFolder.getFile("i18n.properties").create(new ByteArrayInputStream("# add your strings".getBytes()),
			true, monitor);
	}

}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:NewJPFPluginWizardPageOne.java

示例14: getEditedFileFolder

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
public static File getEditedFileFolder() {
	IWorkbenchPage page = null;
	IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
	for (int i = 0; i < windows.length; i++) {
		if (windows[i] != null) {
			IWorkbenchWindow window = windows[i];
			page = windows[i].getActivePage();
			if (page != null)
				break;
		}
	}
	IEditorPart part = page.getActiveEditor();
	FileEditorInput editor = (FileEditorInput) part.getEditorInput();
	IFile file = editor.getFile();
	IFolder folder = (IFolder) file.getParent();
	File f = null;
	try {
		f = ResourceManager.toFile(folder.getFullPath());
	} catch (FileNotFoundException e) {
		ResourceManager.logException(e);
	}
	return f;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:EditorHelper.java

示例15: computeCompilationUnitDestination

import org.eclipse.core.resources.IFolder; //导入依赖的package包/类
private IFolder computeCompilationUnitDestination() throws CoreException {
	IPath pkg = null;
	switch (type) {
	case TEST_INTERFACE:
		IProject project = graphFile.getProject();
		boolean isMain = PreferenceManager.isInMainPath(getDestination().getFile(graphFile.getName()).getFullPath());
		pkg = ResourceManager.getPathWithinPackageFragment(getDestination().getFile("foo.txt")).removeLastSegments(1);
		IPath pathFolderForTestInterface = project.getFullPath()
				.append(GraphWalkerContextManager.getTargetFolderForTestInterface(project.getName(), isMain))
				.append(pkg);
		ResourceManager.ensureFolderPath(pathFolderForTestInterface);
		return (IFolder) ResourceManager.getResource(pathFolderForTestInterface.toString());

	case TEST_IMPLEMENTATION:
		IPath path = PreferenceManager.getTargetFolderForGeneratedTests(getDestination().getFile(graphFile.getName()));
		pkg = ResourceManager.getPathWithinPackageFragment(getDestination().getFile("foo.txt")).removeLastSegments(1);
		IPath newpath = path.append(pkg);
		ResourceManager.ensureFolderPath(newpath);
		return (IFolder) ResourceManager.getResource(newpath.toString());
	}

	throw new IllegalStateException("Unknown type " + type);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:MoveCompilationUnitChange.java


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