List of usage examples for org.eclipse.jdt.core IJavaProject getElementName
String getElementName();
From source file:org.org.eclipse.core.utils.jdt.tools.JavaProjectClasspathHelper.java
License:Open Source License
public static void updateRawClasspath(IJavaProject javaProject, List<IClasspathEntry> classpath, IProgressMonitor monitor) throws JavaModelException { monitor.subTask("Updating the classpath of project " + javaProject.getElementName() + "."); javaProject.setRawClasspath((IClasspathEntry[]) classpath.toArray(new IClasspathEntry[0]), new NullProgressMonitor()); monitor.worked(1);/*from w ww .ja va2 s . c o m*/ }
From source file:org.org.eclipse.dws.core.internal.bridges.ProjectInteractionHelper.java
License:Open Source License
/** * Adds the to raw classpath./* ww w . j a v a2 s . co m*/ * * @param classpathEntryWrappers the classpath entry wrappers * @param javaProject the java project * @param monitor the monitor * * @return the list< classpath entry definition> */ private static List<ClasspathEntryDefinition> addToRawClasspath( List<ClasspathEntryDefinition> classpathEntryWrappers, IJavaProject javaProject, IProgressMonitor monitor) { monitor.beginTask("Adding libraries to the classpath of project :" + javaProject.getElementName(), classpathEntryWrappers.size() + 1); IClasspathEntry[] rawClassPath = JavaProjectClasspathHelper.getRawClasspath(javaProject); List<IClasspathEntry> formerEntries = new LinkedList<IClasspathEntry>(Arrays.asList(rawClassPath)); List<IClasspathEntry> newEntries = new LinkedList<IClasspathEntry>(); for (ClasspathEntryDefinition classpathEntryWrapper : classpathEntryWrappers) { IClasspathEntry newLibraryEntry = null; if (classpathEntryWrapper.getEntryType() == EntryType.PATH) { newLibraryEntry = ClasspathHelper.createEntry(classpathEntryWrapper, monitor); } else { newLibraryEntry = createDWSVariableEntry(classpathEntryWrapper, javaProject, monitor); } // ClasspathHelper.addToClasspath(classpath, newLibraryEntry, monitor); newEntries.add(newLibraryEntry); classpathEntryWrapper.setClasspathEntry(javaProject.encodeClasspathEntry(newLibraryEntry)); } JavaProjectClasspathHelper.updateRawClasspath(javaProject, formerEntries, newEntries, monitor); return classpathEntryWrappers; }
From source file:org.org.eclipse.dws.core.internal.bridges.ProjectInteractionHelper.java
License:Open Source License
/** * Gets the classpath entries./*from w w w .ja va 2s . c o m*/ * * @param javaProject the java project * * @return the classpath entries */ public static Set<DWSClasspathEntryDescriptor> getClasspathEntries(IJavaProject javaProject) { Set<DWSClasspathEntryDescriptor> classpathEntryDescriptors = new LinkedHashSet<DWSClasspathEntryDescriptor>(); try { if (javaProject.exists()) { for (IClasspathEntry classpathEntry : javaProject.getRawClasspath()) { DWSClasspathEntryDescriptor classpathEntryDescriptor = new DWSClasspathEntryDescriptor(); classpathEntryDescriptor .setEncodedClasspathEntry(javaProject.encodeClasspathEntry(classpathEntry)); classpathEntryDescriptor.setPath(classpathEntry.getPath().toPortableString()); classpathEntryDescriptor.setProjectName(javaProject.getElementName()); IJavaModelStatus javaModelStatus = JavaConventions.validateClasspathEntry(javaProject, classpathEntry, false); classpathEntryDescriptor.setValid(classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY || classpathEntry.getEntryKind() == IClasspathEntry.CPE_VARIABLE && javaModelStatus.isOK()); classpathEntryDescriptors.add(classpathEntryDescriptor); } } } catch (JavaModelException e) { throw new JavaProjectInteractionException( "An error occured while scanning for classpath entries in project:" + javaProject, e); } return classpathEntryDescriptors; }
From source file:org.org.eclipse.dws.core.internal.jobs.DownloadAndAddToClasspathJob.java
License:Open Source License
/** * Instantiates a new download and add to classpath job. * // w ww . j a v a2s. c o m * @param javaProject * the java project * @param libraries * the libraries */ public DownloadAndAddToClasspathJob(IJavaProject javaProject, Set<ResolvedArtifact> libraries) { super(JOB_ID + javaProject.getElementName()); this.setPriority(Job.LONG); this.setUser(true); this.javaProject = javaProject; this.libraries = libraries; this.setRule(new BatchSimilarRule(Maven2Jobs.MAVEN2_DOWNLOAD_JOB_FAMILY)); }
From source file:org.org.eclipse.dws.core.internal.jobs.UpdateJavadocAndSourcesJob.java
License:Open Source License
/** * Instantiates a new update javadoc and sources job. * //from w ww .j a va 2s .com * @param project * the project * @param libraries * the libraries */ public UpdateJavadocAndSourcesJob(IJavaProject project, Set<LibraryWithMissingJavadocOrSourcesWrapper> libraries) { super(JOB_ID + project.getElementName()); // this.projectName = project.getElementName(); this.project = project; this.libraries = libraries; this.setPriority(Job.INTERACTIVE); this.setUser(true); this.setRule(new BatchSimilarRule(Maven2Jobs.MAVEN2_OTHER_JOB_FAMILY)); }
From source file:org.robovm.eclipse.internal.RoboVMTab.java
License:Open Source License
private void handleProjectButtonSelected() { IJavaProject project = chooseJavaProject(); if (project == null) { return;//from w w w . j a v a 2 s . c o m } projectText.setText(project.getElementName()); }
From source file:org.seasar.kijimuna.core.rtti.RttiLoaderTest.java
License:Apache License
public void testGetProject() { IJavaProject jp = project.getJavaProject(); RttiLoader loader = new RttiLoader(jp.getElementName(), false); assertEquals(loader.getProject(), jp); }
From source file:org.seasar.kijimuna.core.rtti.RttiLoaderTest.java
License:Apache License
public void testIsAutoConvert() { IJavaProject jp = project.getJavaProject(); RttiLoader loader = new RttiLoader(jp.getElementName(), false); assertFalse(loader.isAutoConvert()); loader = new RttiLoader(jp.getElementName(), true); assertTrue(loader.isAutoConvert());/*from w ww . j av a 2s . co m*/ }
From source file:org.seasar.kijimuna.core.rtti.RttiLoaderTest.java
License:Apache License
public void testLoadRtti1() throws Exception { IJavaProject jp = project.getJavaProject(); RttiLoader loader = new RttiLoader(jp.getElementName(), false); IRtti rtti = loader.loadRtti(Integer.TYPE); assertEquals(rtti.getQualifiedName(), "int"); }
From source file:org.seasar.kijimuna.core.rtti.RttiLoaderTest.java
License:Apache License
public void testLoadRtti2() throws Exception { IJavaProject jp = project.getJavaProject(); RttiLoader loader = new RttiLoader(jp.getElementName(), false); IRtti rtti = loader.loadRtti("java.lang.Integer"); assertEquals(rtti.getQualifiedName(), "java.lang.Integer"); }