當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。