protected void createOutputLocation(IJavaProject project, String folderName, IProgressMonitor monitor) throws JavaModelException, CoreException { IFolder folder = FileUtils.createFolder(project, folderName, monitor); IPath path = folder.getFullPath(); project.setOutputLocation(path, null); }
@Override protected void enhanceProject(IProject project, SubMonitor monitor, Shell shell) throws CoreException { super.enhanceProject(project, monitor, shell); if (builderIds.contains(JavaCore.BUILDER_ID)) { SubMonitor subMonitor = SubMonitor.convert(monitor, 10); try { subMonitor.subTask(Messages.JavaProjectFactory_ConfigureJavaProject + projectName); IJavaProject javaProject = JavaCore.create(project); List<IClasspathEntry> classpathEntries = new ArrayList<IClasspathEntry>(); for (final IProject referencedProject : project.getReferencingProjects()) { final IClasspathEntry referencedProjectClasspathEntry = JavaCore.newProjectEntry(referencedProject .getFullPath()); classpathEntries.add(referencedProjectClasspathEntry); } for (final String folderName : folders) { final IFolder sourceFolder = project.getFolder(folderName); final IClasspathEntry srcClasspathEntry = JavaCore.newSourceEntry(sourceFolder.getFullPath()); classpathEntries.add(srcClasspathEntry); } classpathEntries.add(JavaCore.newContainerEntry(new Path("org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"))); //$NON-NLS-1$ addMoreClasspathEntriesTo(classpathEntries); javaProject.setRawClasspath(classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]), subMonitor.newChild(1)); javaProject.setOutputLocation(new Path("/" + project.getName() + "/bin"), subMonitor.newChild(1)); //$NON-NLS-1$ //$NON-NLS-2$ } catch (JavaModelException e) { logger.error(e.getMessage(), e); } } }
delta.setNewEntries((CPListElement[])fEntries.toArray(new CPListElement[fEntries.size()])); fJavaProject.setOutputLocation(fOutputLocation, monitor); delta.setDefaultOutputLocation(fOutputLocation);
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("", 3); //$NON-NLS-1$ try { if (!hasChange(fJavaProject)) return; BuildpathDelta delta= new BuildpathDelta(getToolTipText()); ClasspathModifier.commitClassPath(fEntries, fJavaProject, monitor); delta.setNewEntries(fEntries.toArray(new CPListElement[fEntries.size()])); fJavaProject.setOutputLocation(fOutputLocation, monitor); delta.setDefaultOutputLocation(fOutputLocation); for (Iterator<IResource> iterator= fProvider.getCreatedResources().iterator(); iterator.hasNext();) { IResource resource= iterator.next(); resource.delete(false, null); delta.addDeletedResource(resource); } fProvider.resetCreatedResources(); informListeners(delta); selectAndReveal(new StructuredSelection(fJavaProject)); } catch (JavaModelException e) { showExceptionDialog(e, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_ClearAll_tooltip); } catch (CoreException e) { showExceptionDialog(e, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_ClearAll_tooltip); } finally { monitor.done(); } } };
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("", 3); //$NON-NLS-1$ try { if (!hasChange(fJavaProject)) return; BuildpathDelta delta= new BuildpathDelta(getToolTipText()); ClasspathModifier.commitClassPath(fEntries, fJavaProject, monitor); delta.setNewEntries(fEntries.toArray(new CPListElement[fEntries.size()])); fJavaProject.setOutputLocation(fOutputLocation, monitor); delta.setDefaultOutputLocation(fOutputLocation); for (Iterator<IResource> iterator= fProvider.getCreatedResources().iterator(); iterator.hasNext();) { IResource resource= iterator.next(); resource.delete(false, null); delta.addDeletedResource(resource); } fProvider.resetCreatedResources(); informListeners(delta); selectAndReveal(new StructuredSelection(fJavaProject)); } catch (JavaModelException e) { showExceptionDialog(e, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_ClearAll_tooltip); } catch (CoreException e) { showExceptionDialog(e, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_ClearAll_tooltip); } finally { monitor.done(); } } };
public static void createOutputLocation(IJavaProject project, String folderName, IProgressMonitor monitor) throws JavaModelException, CoreException { IFolder folder = createFolder(project, folderName, monitor); IPath path = folder.getFullPath(); JavaModelManager.getJavaModelManager().getPerProjectInfo(project.getProject(), true); project.setRawClasspath(new IClasspathEntry[0], monitor); project.setOutputLocation(path, monitor); }
public static void update(ProjectContext projectContext, IJavaProject project, EclipseProject eclipseProject, IProgressMonitor monitor) throws CoreException { String outputLocation = eclipseProject.getOutputLocation().getPath(); if (sourceDirHasNestedOutputLocation(eclipseProject.getSourceDirectories(), outputLocation)) { String newOutputLocation = outputLocation + "-default"; projectContext.warning("One or more source directories specify output location nested in the default output. Default output changed from " + outputLocation + " to " + newOutputLocation + ".", null); outputLocation = newOutputLocation; } project.setOutputLocation(project.getPath().append(outputLocation), monitor); }
private void setClasspath(IProject project, IFieldData data) throws JavaModelException, CoreException { IJavaProject javaProject = JavaCore.create(project); // Set output folder if (data.getOutputFolderName() != null) { IPath path = project.getFullPath().append(data.getOutputFolderName()); javaProject.setOutputLocation(path, null); } IClasspathEntry[] entries = getClassPathEntries(javaProject, data); javaProject.setRawClasspath(entries, null); }
javaProject.setOutputLocation(new Path("/" + project.getName() + "/runtime"), new SubProgressMonitor(progressMonitor, 1)); //$NON-NLS-1$ //$NON-NLS-2$
project.setOutputLocation(outputLocation, new SubProgressMonitor(monitor, 1)); delta.setDefaultOutputLocation(outputLocation); } else {
project.setOutputLocation(outputLocation, new SubProgressMonitor(monitor, 1)); delta.setDefaultOutputLocation(outputLocation); } else {
project.setOutputLocation(outputLocation, new SubProgressMonitor(monitor, 1)); delta.setDefaultOutputLocation(outputLocation); } else {
@Override protected void createOutputLocation(IJavaProject project, IProgressMonitor monitor) throws JavaModelException, CoreException { String target = "bin"; if (startPage.getInitialProjectContent()==IKieProjectWizardPage.EMPTY_PROJECT) target = emptyProjectPage.shouldCreateMavenProject() ? "target/classes" : "bin"; else if (startPage.getInitialProjectContent()==IKieProjectWizardPage.SAMPLE_FILES_PROJECT) target = sampleFilesProjectPage.shouldCreateMavenProject() ? "target/classes" : "bin"; IFolder folder = project.getProject().getFolder(target); FileUtils.createFolder(folder, monitor); IPath path = folder.getFullPath(); project.setOutputLocation(path, null); }
public void commitDefaultOutputFolder() { if (!fBuildPathsBlock.isOKStatus()) return; try { IPath path= new Path(fOutputLocationField.getText()).makeAbsolute(); IPath outputLocation= fJavaProject.getOutputLocation(); if (path.equals(outputLocation)) return; if (!outputLocation.equals(fJavaProject.getPath())) { IFolder folder= fJavaProject.getProject().getWorkspace().getRoot().getFolder(outputLocation); if (folder.exists() && JavaCore.create(folder) == null) { folder.delete(true, null); } } fJavaProject.setOutputLocation(path, null); } catch (JavaModelException e) { JavaPlugin.log(e); } catch (CoreException e) { JavaPlugin.log(e); } }
public IProject createProxyProject(IProgressMonitor monitor) throws CoreException { IWorkspaceRoot root = PDECore.getWorkspace().getRoot(); IProject project = root.getProject(SearchablePluginsManager.PROXY_PROJECT_NAME); if (project.exists()) { if (!project.isOpen()) { project.open(monitor); } return project; } SubMonitor subMonitor = SubMonitor.convert(monitor, NLS.bind(PDECoreMessages.SearchablePluginsManager_createProjectTaskName, SearchablePluginsManager.PROXY_PROJECT_NAME), 5); project.create(subMonitor.split(1)); project.open(subMonitor.split(1)); CoreUtility.addNatureToProject(project, JavaCore.NATURE_ID, subMonitor.split(1)); IJavaProject jProject = JavaCore.create(project); jProject.setOutputLocation(project.getFullPath(), subMonitor.split(1)); computeClasspath(jProject, subMonitor.split(1)); return project; }
public void commitDefaultOutputFolder() { if (!fBuildPathsBlock.isOKStatus()) return; try { IPath path= new Path(fOutputLocationField.getText()).makeAbsolute(); IPath outputLocation= fJavaProject.getOutputLocation(); if (path.equals(outputLocation)) return; if (!outputLocation.equals(fJavaProject.getPath())) { IFolder folder= fJavaProject.getProject().getWorkspace().getRoot().getFolder(outputLocation); if (folder.exists() && JavaCore.create(folder) == null) { folder.delete(true, null); } } fJavaProject.setOutputLocation(path, null); } catch (JavaModelException e) { JavaPlugin.log(e); } catch (CoreException e) { JavaPlugin.log(e); } }
public void commitDefaultOutputFolder() { if (!fBuildPathsBlock.isOKStatus()) return; try { IPath path= new Path(fOutputLocationField.getText()).makeAbsolute(); IPath outputLocation= fJavaProject.getOutputLocation(); if (path.equals(outputLocation)) return; if (!outputLocation.equals(fJavaProject.getPath())) { IFolder folder= fJavaProject.getProject().getWorkspace().getRoot().getFolder(outputLocation); if (folder.exists() && JavaCore.create(folder) == null) { folder.delete(true, null); } } fJavaProject.setOutputLocation(path, null); } catch (JavaModelException e) { JavaPlugin.log(e); } catch (CoreException e) { JavaPlugin.log(e); } }
subMonitor.worked(1); javaNature.setOutputLocation(outputLocation, subMonitor.split(1)); } else { subMonitor.worked(4);
private void createProject(IProgressMonitor monitor) throws CoreException { CoreUtility.createProject(fProject, fLocation, monitor); fProject.open(monitor); IProjectDescription desc = fProject.getWorkspace().newProjectDescription(fProject.getName()); desc.setLocation(fLocation); if (!fProject.hasNature(PDE.FEATURE_NATURE)) CoreUtility.addNatureToProject(fProject, PDE.FEATURE_NATURE, monitor); if (fFeatureData.hasCustomHandler()) { if (!fProject.hasNature(JavaCore.NATURE_ID)) CoreUtility.addNatureToProject(fProject, JavaCore.NATURE_ID, monitor); if (fFeatureData.getSourceFolderName() != null && fFeatureData.getSourceFolderName().trim().length() > 0) { IFolder folder = fProject.getFolder(fFeatureData.getSourceFolderName()); if (!folder.exists()) CoreUtility.createFolder(folder); } IJavaProject jproject = JavaCore.create(fProject); jproject.setOutputLocation(fProject.getFullPath().append(fFeatureData.getJavaBuildFolderName()), monitor); jproject.setRawClasspath(new IClasspathEntry[] {JavaCore.newSourceEntry(fProject.getFullPath().append(fFeatureData.getSourceFolderName())), JavaCore.newContainerEntry(new Path(JavaRuntime.JRE_CONTAINER))}, monitor); } }
output.create(true, true, monitor); javaProject.setOutputLocation(output.getFullPath(), monitor);