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