use of org.eclipse.core.resources.IFolder in project AutoRefactor by JnRouvignac.
the class JavaCoreHelper method createJavaProject.
public static IJavaProject createJavaProject(String projectName, String binFolderName) throws Exception {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(projectName);
if (!project.exists()) {
project.create(null);
} else {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
}
if (!project.isOpen()) {
project.open(null);
}
final IFolder binFolder = project.getFolder(binFolderName);
createFolder(binFolder);
addNatureToProject(project, JavaCore.NATURE_ID);
final IJavaProject javaProject = JavaCore.create(project);
javaProject.setOutputLocation(binFolder.getFullPath(), null);
javaProject.setRawClasspath(new IClasspathEntry[0], null);
return javaProject;
}
use of org.eclipse.core.resources.IFolder in project AutoRefactor by JnRouvignac.
the class JavaCoreHelper method addSourceContainer.
private static IPackageFragmentRoot addSourceContainer(IJavaProject javaProject, String containerName) throws Exception {
final IProject project = javaProject.getProject();
final IFolder folder = project.getFolder(containerName);
createFolder(folder);
IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(folder);
IClasspathEntry cpe = JavaCore.newSourceEntry(root.getPath(), EMPTY_PATHS, EMPTY_PATHS, null);
addToClasspath(javaProject, Arrays.asList(cpe));
return root;
}
use of org.eclipse.core.resources.IFolder in project azure-tools-for-java by Microsoft.
the class CreateProjectUtil method createSampleFile.
public static void createSampleFile(@NotNull String id, @NotNull String projectName) throws CoreException {
final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
final IFolder sourceRootFolder = project.getFolder("src");
if (!sourceRootFolder.exists()) {
sourceRootFolder.create(false, true, null);
}
final String rootPath = sourceRootFolder.getLocation().toFile().getAbsolutePath();
switch(id) {
case "com.microsoft.azure.hdinsight.local-scala.projwizard":
createResourceStructForLocalRunScalaProject(sourceRootFolder, rootPath, project);
AppInsightsClient.create(Messages.SparkProjectSystemScalaCreation, null);
break;
case "com.microsoft.azure.hdinsight.local-java.projwizard":
AppInsightsClient.create(Messages.SparkProjectSystemJavaSampleCreation, null);
copyFileTo(Java_Local_RunSample, rootPath);
break;
case "com.microsoft.azure.hdinsight.cluster-scala.projwizard":
AppInsightsClient.create(Messages.SparkProjectSystemScalaSampleCreation, null);
copyFileTo(Scala_Cluster_Run_Sample, rootPath);
break;
default:
break;
}
}
use of org.eclipse.core.resources.IFolder in project gfm_viewer by satyagraha.
the class GenerateMarkdownPreview method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
LOGGER.fine("");
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getActiveMenuSelection(event);
for (@SuppressWarnings("rawtypes") Iterator items = selection.iterator(); items.hasNext(); ) {
Object item = items.next();
if (item instanceof IFile) {
scheduler.generateIFile((IFile) item);
} else if (item instanceof IFolder) {
scheduler.generateIFolder((IFolder) item);
} else {
LOGGER.fine("unexpected selection: " + item);
}
}
return null;
}
use of org.eclipse.core.resources.IFolder in project dbeaver by serge-rider.
the class ScriptsExportWizard method exportScripts.
public void exportScripts(DBRProgressMonitor monitor, final ScriptsExportData exportData) throws IOException, CoreException, InterruptedException {
Collection<IResource> scripts = exportData.getScripts();
int totalFiles = 0;
for (IResource res : scripts) {
if (res instanceof IFolder) {
totalFiles += countFiles((IFolder) res);
} else {
totalFiles++;
}
}
monitor.beginTask("Export scripts", totalFiles);
for (IResource res : scripts) {
if (res instanceof IFolder) {
exportFolder(monitor, (IFolder) res, exportData);
} else {
exportScript(monitor, (IFile) res, exportData);
}
}
monitor.done();
}
Aggregations