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


Java IFolder.create方法代码示例

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


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

示例1: createManifest

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
private void createManifest(String projectName, String string) throws CoreException, UnsupportedEncodingException {
	IProject project = workspace.getProject(projectName);
	IFile manifestFile = project.getFile(IN4JSProject.N4MF_MANIFEST);
	@SuppressWarnings("resource")
	StringInputStream content = new StringInputStream(string, Charsets.UTF_8.name());
	manifestFile.create(content, false, null);
	manifestFile.setCharset(Charsets.UTF_8.name(), null);

	IFolder src = project.getFolder("src");
	src.create(false, true, null);
	IFolder sub = src.getFolder("sub");
	sub.create(false, true, null);
	IFolder leaf = sub.getFolder("leaf");
	leaf.create(false, true, null);
	src.getFile("A.js").create(new ByteArrayInputStream(new byte[0]), false, null);
	src.getFile("B.js").create(new ByteArrayInputStream(new byte[0]), false, null);
	sub.getFile("B.js").create(new ByteArrayInputStream(new byte[0]), false, null);
	sub.getFile("C.js").create(new ByteArrayInputStream(new byte[0]), false, null);
	leaf.getFile("D.js").create(new ByteArrayInputStream(new byte[0]), false, null);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:EclipseBasedProjectModelSetup.java

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

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

示例4: createSchema

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
static IFolder createSchema(String name, boolean open, IProject project) throws CoreException {
    IFolder projectFolder = project.getFolder(DbObjType.SCHEMA.name());
    if (!projectFolder.exists()) {
        projectFolder.create(false, true, null);
    }
    IFolder schemaFolder = projectFolder.getFolder(name);
    if (!schemaFolder.exists()) {
        schemaFolder.create(false, true, null);
    }
    IFile file = projectFolder.getFile(name + POSTFIX);
    if (!file.exists()) {
        StringBuilder sb = new StringBuilder();
        sb.append(MessageFormat.format(PATTERN, DbObjType.SCHEMA, name));
        sb.append(MessageFormat.format(OWNER_TO, DbObjType.SCHEMA, name));
        file.create(new ByteArrayInputStream(sb.toString().getBytes()), false, null);
    }
    if (open) {
        openFileInEditor(file);
    }
    return schemaFolder;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:22,代码来源:IPgObjectPage.java

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

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

示例7: createFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
public static void createFolder(String path, IProject project, IProgressMonitor monitor) throws CoreException {
	String[] strings = path.split("/");
	IContainer currentContainer = project;
	for ( String s : strings ) {
		IFolder folder = currentContainer.getFolder( new Path(s) );
		folder.create(true, true, monitor);
		currentContainer = folder;
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:10,代码来源:IFolderUtils.java

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

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

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

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

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

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

示例14: createFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
public static void createFolder(IFolder folder, boolean force, boolean local, IProgressMonitor monitor)
		throws CoreException {
	if (!folder.exists()) {
		IContainer parent = folder.getParent();
		if (parent instanceof IFolder) {
			createFolder((IFolder) parent, force, local, new NullProgressMonitor());
		}
		folder.create(force, local, monitor);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:ProjectHelper.java

示例15: ensureFolder

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 * @param folder
 * @throws CoreException
 */
public static void ensureFolder(IFolder folder) throws CoreException {
	if (!folder.exists()) {
		ensureFolder((IFolder) folder.getParent());
		folder.create(false, false, null);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:11,代码来源:ResourceManager.java


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