本文整理匯總了Java中org.eclipse.core.resources.IFolder.getFolder方法的典型用法代碼示例。如果您正苦於以下問題:Java IFolder.getFolder方法的具體用法?Java IFolder.getFolder怎麽用?Java IFolder.getFolder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IFolder
的用法示例。
在下文中一共展示了IFolder.getFolder方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例2: 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;
}
示例3: 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();
}
示例4: ensureFolderPath
import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
public static IResource ensureFolderPath(IPath path) throws CoreException {
IPath p = path;
List<IPath> list = new ArrayList<IPath>();
while (p.segmentCount() > 0) {
IResource resource = getWorkspaceRoot().findMember(p);
if (resource == null) {
list.add((IPath) p.clone());
} else {
break;
}
p = p.removeLastSegments(1);
}
for (int i = list.size() - 1; i >= 0; i--) {
IFolder folder = (IFolder) getWorkspaceRoot().findMember(p);
IPath pth = list.get(i);
folder = folder.getFolder(pth.lastSegment());
folder.create(true, true, new NullProgressMonitor());
p = pth;
}
return getWorkspaceRoot().findMember(path);
}
示例5: 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;
}
示例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;
}
示例7: process
import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
@Override
public void process ( final String phase, final IFolder nodeDir, final IProgressMonitor monitor, final Map<String, String> properties ) throws Exception
{
if ( phase != null && !"package".equals ( phase ) )
{
return;
}
final String name = makeName ();
final IFolder folder = nodeDir.getFolder ( name );
folder.create ( true, true, monitor );
processLocal ( folder, monitor );
}
示例8: createFolder
import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
public static IFolder createFolder(IPath parentPath, IPath folder) throws CoreException {
IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace().getRoot();
IFolder pf = wroot.getFolder(parentPath);
int max = folder.segmentCount();
IFolder childFolder = pf;
for (int i = 0; i < max; i++) {
childFolder = childFolder.getFolder(folder.segment(i));
childFolder.create(IResource.NONE, true, new NullProgressMonitor());
}
return childFolder;
}
示例9: getFolder
import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
static IFolder getFolder(String name, DbObjType type, IProject project) throws CoreException {
IFolder schemaFolder = createSchema(name, false, project);
IFolder typeFolder = schemaFolder.getFolder(type.name());
if (!typeFolder.exists()) {
typeFolder.create(false, true, null);
}
return typeFolder;
}
示例10: process
import org.eclipse.core.resources.IFolder; //導入方法依賴的package包/類
@Override
public void process ( final String phase, final IFolder baseDir, final IProgressMonitor monitor, final Map<String, String> properties ) throws Exception
{
if ( phase != null && !"process".equals ( phase ) )
{
return;
}
final String name = makeName ();
final IFolder output = baseDir.getFolder ( new Path ( name ) );
output.create ( true, true, null );
final IFile exporterFile = output.getFile ( "exporter.xml" ); //$NON-NLS-1$
final IFile propFile = output.getFile ( "application.properties" ); //$NON-NLS-1$
final DocumentRoot root = ExporterFactory.eINSTANCE.createDocumentRoot ();
final ConfigurationType cfg = ExporterFactory.eINSTANCE.createConfigurationType ();
root.setConfiguration ( cfg );
final HiveType hive = ExporterFactory.eINSTANCE.createHiveType ();
cfg.getHive ().add ( hive );
hive.setRef ( getHiveId () );
final HiveConfigurationType hiveCfg = ExporterFactory.eINSTANCE.createHiveConfigurationType ();
hive.setConfiguration ( hiveCfg );
addConfiguration ( hiveCfg );
for ( final Endpoint ep : this.driver.getEndpoints () )
{
addEndpoint ( hive, ep );
}
// write exporter file
new ModelWriter ( root ).store ( URI.createPlatformResourceURI ( exporterFile.getFullPath ().toString (), true ) );
exporterFile.refreshLocal ( 1, monitor );
// write application properties
if ( propFile.exists () )
{
propFile.delete ( true, monitor );
}
final Properties p = new Properties ();
fillProperties ( p );
if ( !p.isEmpty () )
{
try (FileOutputStream fos = new FileOutputStream ( propFile.getRawLocation ().toOSString () ))
{
p.store ( fos, "Created by the Eclipse SCADA world generator" );
}
propFile.refreshLocal ( 1, monitor );
}
}