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


Java IFolder.exists方法代码示例

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


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

示例1: createSubjobInSpecifiedFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 * @param subJobXMLPath
 * @param parameterFilePath
 * @param parameterFile
 * @param subJobFile
 * @param importFromPath
 * @param subjobPath
 * @return
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 * @throws NoSuchMethodException
 * @throws JAXBException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws IOException
 * @throws CoreException
 * @throws FileNotFoundException
 */
public static Container createSubjobInSpecifiedFolder(IPath subJobXMLPath, IPath parameterFilePath, IFile parameterFile,
		IFile subJobFile, IPath importFromPath,String subjobPath) throws InstantiationException, IllegalAccessException,
		InvocationTargetException, NoSuchMethodException, JAXBException, ParserConfigurationException,
		SAXException, IOException, CoreException, FileNotFoundException {
	UiConverterUtil converterUtil = new UiConverterUtil();
	Object[] subJobContainerArray=null;
		IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFile(subJobXMLPath);
		File file = new File(xmlFile.getFullPath().toString());
	if (file.exists()) {
		subJobContainerArray = converterUtil.convertToUiXml(importFromPath.toFile(), subJobFile, parameterFile,true);
	} else {
		IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(parameterFilePath.segment(1));
		IFolder iFolder = iProject.getFolder(subjobPath.substring(0, subjobPath.lastIndexOf('/')));
		if (!iFolder.exists()) {
			iFolder.create(true, true, new NullProgressMonitor());
		}
		IFile subjobXmlFile = iProject.getFile(subjobPath);
		subJobContainerArray = converterUtil.convertToUiXml(importFromPath.toFile(), subJobFile, parameterFile,true);
		if (!subjobXmlFile.exists() && subJobContainerArray[1] == null) {
			subjobXmlFile.create(new FileInputStream(importFromPath.toString()), true, new NullProgressMonitor());
		}
	}
	return (Container) subJobContainerArray[0];
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:44,代码来源:SubjobUiConverterUtil.java

示例2: doFinish

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
private void doFinish(IPath containerPath, String[] path, IProgressMonitor monitor) throws CoreException {
	monitor.beginTask("Creating package " + String.join(".", path), path.length);
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();

	IResource resource = root.findMember(containerPath);
	if (!resource.exists() || !(resource instanceof IContainer)) {
		throwCoreException("Container \"" + containerPath + "\" does not exist.");
	}

	IContainer container = (IContainer) resource;
	for(int i = 0; i < path.length; i++) {
		Path p = new Path(path[i]);
		final IFolder folder = container.getFolder(p);
		if(!folder.exists())
			folder.create(true, false, monitor);
		container = container.getFolder(p);
		monitor.worked(1);
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:20,代码来源:NewPackageWizard.java

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

示例4: processFile

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
public static void processFile ( final IContainer parent, final Definition definition, final Profile profile, final IProgressMonitor monitor ) throws Exception
{
    monitor.beginTask ( makeJobLabel ( definition, profile ), 100 );

    final IFolder output = parent.getFolder ( new Path ( "output" ) ); //$NON-NLS-1$
    if ( output.exists () )
    {
        output.delete ( true, new SubProgressMonitor ( monitor, 9 ) );
    }
    output.create ( true, true, new SubProgressMonitor ( monitor, 1 ) );

    final Builder builder = new Builder ( definition, profile );
    final Recipe recipe = builder.build ();

    try
    {
        final Map<String, Object> initialContent = new HashMap<String, Object> ();
        initialContent.put ( "output", output ); //$NON-NLS-1$

        recipe.execute ( initialContent, new SubProgressMonitor ( monitor, 90 ) );
    }
    finally
    {
        monitor.done ();
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:27,代码来源:RecipeHelper.java

示例5: createFile

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 * Create a file in a folder with the specified name and content
 * 
 * @param projectname
 * @param destFolder
 * @param filename
 * @param content
 * @throws CoreException
 */
public static IFile createFile(String projectname, String destFolder, String pkg, String filename, String content)
		throws CoreException {
	IProject project = getProject(projectname);
	IFolder folder = project.getFolder(new Path(destFolder));
	if (!folder.exists())
		folder.create(true, true, null);
	IFolder container = folder;
	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 newFile = container.getFile(new Path(filename));
	newFile.create(new ByteArrayInputStream(content.getBytes()), true, null);
	return newFile;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:33,代码来源:ResourceManager.java

示例6: createFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/***/
protected IFolder createFolder(IFolder superFolder, String path) throws CoreException {
	IFolder folder = superFolder.getFolder(path);
	if (!folder.exists()) {
		createParentFolder(folder);
		folder.create(true, true, null);
	}
	return folder;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:AbstractBuilderParticipantTest.java

示例7: createProjectScriptFile

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
private IEditorInput createProjectScriptFile(String content, String filename) throws CoreException, IOException {
    Log.log(Log.LOG_INFO, "Creating file " + filename); //$NON-NLS-1$
    IProject iProject = proj.getProject();
    IFolder folder = iProject.getFolder(PROJ_PATH.MIGRATION_DIR);
    if (!folder.exists()){
        folder.create(IResource.NONE, true, null);
    }
    IFile file = folder.getFile(filename + ".sql"); //$NON-NLS-1$
    InputStream source = new ByteArrayInputStream(content.getBytes(proj.getProjectCharset()));
    file.create(source, IResource.NONE, null);
    return new FileEditorInput(iProject.getFile(file.getProjectRelativePath()));
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:13,代码来源:ProjectEditorDiffer.java

示例8: createParentFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/***/
protected void createParentFolder(IFolder folder) throws CoreException {
	IContainer parent = folder.getParent();
	if (parent instanceof IFolder) {
		IFolder parentFolder = (IFolder) parent;
		if (!parentFolder.exists()) {
			createParentFolder(parentFolder);
			parentFolder.create(true, true, null);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:12,代码来源:AbstractBuilderParticipantTest.java

示例9: createFolderPath

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 * Creates all non-existing segments of the given path.
 *
 * @param path
 *            The path to create
 * @param parent
 *            The container in which the path should be created in
 * @param monitor
 *            A progress monitor. May be {@code null}
 *
 * @return The folder specified by the path
 */
private IContainer createFolderPath(IPath path, IContainer parent, IProgressMonitor monitor) {
	IContainer activeContainer = parent;

	if (null != monitor) {
		monitor.beginTask("Creating folders", path.segmentCount());
	}

	for (String segment : path.segments()) {
		IFolder folderToCreate = activeContainer.getFolder(new Path(segment));
		try {
			if (!folderToCreate.exists()) {
				createFolder(segment, activeContainer, monitor);
			}
			if (null != monitor) {
				monitor.worked(1);
			}
			activeContainer = folderToCreate;
		} catch (CoreException e) {
			LOGGER.error("Failed to create module folders.", e);
			MessageDialog.open(MessageDialog.ERROR, getShell(),
					FAILED_TO_CREATE_FOLDER_TITLE, String.format(FAILED_TO_CREATE_FOLDER_MESSAGE,
							folderToCreate.getFullPath().toString(), e.getMessage()),
					SWT.NONE);
			break;
		}
	}
	return activeContainer;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:41,代码来源:ModuleSpecifierSelectionDialog.java

示例10: fullBuild

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
protected void fullBuild(IProgressMonitor monitor) throws CoreException{
	Visuflow.getDefault().getLogger().info("Build Start");
	String targetFolder = "sootOutput";
	IJavaProject project = JavaCore.create(getProject());
	IResourceDelta delta = getDelta(project.getProject());
	if (delta == null || !delta.getAffectedChildren()[0].getProjectRelativePath().toString().equals(targetFolder)) {
		classpath = getSootCP(project);
		String location = GlobalSettings.get("Target_Path");
		IFolder folder = project.getProject().getFolder(targetFolder);

		// at this point, no resources have been created
		if (!folder.exists()) {
			// Changed to force because of bug id vis-119
			folder.create(IResource.FORCE, true, monitor);

		} else {
			for (IResource resource : folder.members()) {
				resource.delete(IResource.FORCE, monitor);
			}
		}
		classpath = location + classpath;
		String[] sootString = new String[] { "-cp", classpath, "-exclude", "javax", "-allow-phantom-refs", "-no-bodies-for-excluded", "-process-dir",
				location, "-src-prec", "only-class", "-w", "-output-format", "J", "-keep-line-number", "-output-dir",
				folder.getLocation().toOSString()/* , "tag.ln","on" */ };
		ICFGStructure icfg = new ICFGStructure();
		JimpleModelAnalysis analysis = new JimpleModelAnalysis();
		analysis.setSootString(sootString);
		List<VFClass> jimpleClasses = new ArrayList<>();
		try {
			analysis.createICFG(icfg, jimpleClasses);
			fillDataModel(icfg, jimpleClasses);
		} catch(Exception e) {
			logger.error("Couldn't execute analysis", e);
		}

		folder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:39,代码来源:JimpleBuilder.java

示例11: createFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 * Create recursively folders in the project.
 * Do nothing if folder already exists.
 * @param project
 * @param path
 * @param monitor
 * @return
 * @throws CoreException
 */
public static IFolder createFolder(IProject project, IPath path, IProgressMonitor monitor) throws CoreException {
	IFolder folder = project.getFolder(path);
	if (!folder.exists()) {
		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);
			}				
		}
		folder.create(true, true, monitor);
	}
	return folder;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:24,代码来源:IProjectUtils.java

示例12: addResource

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
private void addResource ( final IProject project, final String name, final InputStream stream, final IProgressMonitor monitor ) throws CoreException
{
    try
    {
        final String[] toks = name.split ( "\\/" ); //$NON-NLS-1$
        IContainer container = project;
        for ( int i = 0; i < toks.length - 1; i++ )
        {
            final IFolder folder = container.getFolder ( new Path ( toks[i] ) );
            if ( !folder.exists () )
            {
                folder.create ( true, true, null );
            }
            container = folder;
        }
        final IFile file = project.getFile ( name );
        if ( file.exists () )
        {
            file.setContents ( stream, IResource.FORCE, monitor );
        }
        else
        {
            file.create ( stream, true, monitor );
        }
    }
    finally
    {
        try
        {
            stream.close ();
        }
        catch ( final IOException e )
        {
        }
    }
    monitor.done ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:38,代码来源:ClientTemplate.java

示例13: createTemprarySourceFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
private IPath createTemprarySourceFolder(){
	IPath tempSrcFolder=new Path(PathConstant.TEMP_BUILD_PATH_SETTINGS_FOLDER);
	IFolder  folder=BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject().getFolder(tempSrcFolder);
	try {
	if(!folder.exists()){
			folder.create(true, true,null);
		}
	} catch (CoreException e) {
		LOGGER.error("CoreException occurred while creating temporary source folder",e);
		return null;
	}
	LOGGER.debug("Created temporary build path at "+PathConstant.TEMP_BUILD_PATH_SETTINGS_FOLDER);
	return folder.getFullPath();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:15,代码来源:LaunchExpressionEditor.java

示例14: getPropertyFilePath

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
private static String getPropertyFilePath(IJavaProject project) {
	LOGGER.debug("Adding UserFunctions.propertis file URL to build-path");
	IFolder settingFolder=project.getProject().getFolder(PathConstant.PROJECT_RESOURCES_FOLDER);
	if(settingFolder.exists()){
		IFile file=settingFolder.getFile(PathConstant.EXPRESSION_EDITOR_EXTERNAL_JARS_PROPERTIES_FILES);
		if(file.exists()){
			return file.getLocation().toString();
		}
	}
	return Constants.EMPTY_STRING;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:12,代码来源:ValidateExpressionToolButton.java

示例15: createProject

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
public static IJavaProject createProject(String name) throws CoreException {

		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IProject project = root.getProject(name);
		if (!project.exists()) {
			project.create(new NullProgressMonitor());
		} else {
			project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
		}

		if (!project.isOpen()) {
			project.open(new NullProgressMonitor());
		}

		IFolder binFolder = project.getFolder("bin");
		if (!binFolder.exists()) {
			createFolder(binFolder, false, true, new NullProgressMonitor());
		}
		IPath outputLocation = binFolder.getFullPath();

		addNatureToProject(project, JavaCore.NATURE_ID, new NullProgressMonitor());

		IJavaProject jproject = JavaCore.create(project);
		jproject.setOutputLocation(outputLocation, new NullProgressMonitor());

		IClasspathEntry[] entries = PreferenceConstants.getDefaultJRELibrary();

		jproject.setRawClasspath(entries, new NullProgressMonitor());

		return jproject;
	}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:32,代码来源:ProjectHelper.java


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