List of usage examples for org.eclipse.jdt.core IJavaProject getElementName
String getElementName();
From source file:com.google.gdt.eclipse.core.ui.ProjectSelectionBlock.java
License:Open Source License
private void addEventHandlers() { projectText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { IStatus status = validateProject(); for (Listener listener : listeners) { listener.projectSelected(project, status); }//from ww w .ja v a 2s . c o m } }); chooseProjectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Set<String> requiredNatures = requiredNaturesToErrors != null ? requiredNaturesToErrors.keySet() : null; IJavaProject selectedProject = JavaProjectSelectionDialog.chooseProject(composite.getShell(), JavaCore.create(project), requiredNatures); if (selectedProject != null) { projectText.setText(selectedProject.getElementName()); } } }); }
From source file:com.google.gdt.eclipse.core.validators.AbstractProjectValidator.java
License:Open Source License
protected static void addNoSdkMarker(String problemMarkerID, IJavaProject javaProject, String sdkTypeName) throws CoreException { MarkerUtilities.createQuickFixMarker(problemMarkerID, ProjectStructureOrSdkProblemType.NO_SDK, sdkTypeName, javaProject.getProject(), javaProject.getElementName(), sdkTypeName); }
From source file:com.google.gdt.eclipse.designer.gwtext.parser.ClassLoaderValidator.java
License:Open Source License
public void validate(IJavaProject javaProject, GwtState state) throws Exception { ClassLoader classLoader = state.getClassLoader(); if (javaProject.findType("com.gwtext.client.widgets.Component") != null) { try {/*from w w w. java 2 s . c om*/ Class<?> classComponent = classLoader.loadClass("com.gwtext.client.widgets.Component"); ReflectionUtils.invokeMethod(classComponent, "checkExtVer()"); } catch (Throwable e) { throw new DesignerException(IExceptionConstants.NOT_CONFIGURED, javaProject.getElementName()); } } }
From source file:com.google.gdt.eclipse.designer.wizards.model.common.ClientPackageSelectionDialogField.java
License:Open Source License
/** * Return strings presentation of package. *//*w w w . ja v a 2 s . c o m*/ private static String getPackageString(IPackageFragment packageFragment) { try { if (packageFragment != null) { IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) packageFragment.getParent(); IJavaProject javaProject = packageFragmentRoot.getJavaProject(); if (packageFragmentRoot.getUnderlyingResource() == javaProject.getUnderlyingResource()) { return javaProject.getElementName() + "/" + packageFragment.getElementName(); } else { return javaProject.getElementName() + "/" + packageFragmentRoot.getElementName() + "/" + packageFragment.getElementName(); } } return ""; } catch (Throwable e) { throw ReflectionUtils.propagate(e); } }
From source file:com.google.gdt.eclipse.designer.wizards.ui.JUnitWizard.java
License:Open Source License
@Override protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException { IPackageFragmentRoot fragmentRoot = m_mainPage.getPackageFragmentRoot(); if (fragmentRoot != null) { IJavaProject project = fragmentRoot.getJavaProject(); if (project != null && project.findType("junit.framework.TestCase") == null) { try { ProjectUtils.addPluginLibraries(project, "org.junit"); } catch (Throwable e) { DesignerPlugin.log(e);// w w w . j ava 2 s . c o m throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Unable add JUnit jar to classpath " + project.getElementName(), e)); } } } m_mainPage.createType(monitor); }
From source file:com.google.gdt.eclipse.maven.enhancement.MavenEnhancerClasspathBuilder.java
License:Open Source License
public List<String> buildClasspath(IJavaProject javaProject) { try {/*from w w w . j a v a 2s . com*/ if (!MavenUtils.hasMavenNature(javaProject.getProject())) { return null; } List<String> classpath = LaunchUtilities.getDefaultClasspath(javaProject); GaeSdk gaeSdk = GaeSdk.findSdkFor(javaProject); if (gaeSdk != null) { String toolsJarLocation = gaeSdk.getInstallationPath().append(GaeSdk.APPENGINE_TOOLS_API_JAR_PATH) .toOSString(); // Add this to the top of the classpath, just in case they have // some other version of appengine-api-tools.jar on their build // path (they shouldn't though). classpath.add(0, toolsJarLocation); } return classpath; } catch (CoreException ce) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to generate the enhancer's classpath for project " + javaProject.getElementName(), ce)); return null; } }
From source file:com.google.gdt.eclipse.maven.launch.MavenClasspathProvider.java
License:Open Source License
private static void addGwtDevjarIfPossible(IJavaProject proj, Set<IRuntimeClasspathEntry> classpath) throws CoreException { GWTRuntime runtime = GWTRuntime.findSdkFor(proj); if (runtime == null) { Activator.getDefault().getLog().log( new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unable to find a GWT Runtime for project " + proj.getElementName() + ". Cannot add gwt-dev to the runtime classpath.")); return;//from ww w . j ava 2 s .c o m } IStatus validationStatus = runtime.validate(); if (!validationStatus.isOK()) { throw new CoreException(validationStatus); } try { IPath devJarPath = Path.fromOSString(runtime.getDevJar().getAbsolutePath()); IRuntimeClasspathEntry devJarCpEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(devJarPath); classpath.add(devJarCpEntry); } catch (SdkException sdke) { throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to add gwt-dev.jar to the runtime classpath.", sdke)); } }
From source file:com.google.gwt.eclipse.core.compile.GWTCompileRunner.java
License:Open Source License
/** * Computes a GWT compiler-tailored list of classpath entries for the given * Java project.//from ww w . j a v a 2 s. com */ /* * This is package-scoped so it can be JUnit tested. */ static List<IRuntimeClasspathEntry> computeClasspath(IJavaProject javaProject) throws CoreException { // Get the unresolved runtime classpath IRuntimeClasspathEntry[] unresolvedRuntimeClasspath = JavaRuntime .computeUnresolvedRuntimeClasspath(javaProject); List<IRuntimeClasspathEntry> resolvedRuntimeClasspath = new ArrayList<IRuntimeClasspathEntry>(); for (IRuntimeClasspathEntry unresolvedClasspathEntry : unresolvedRuntimeClasspath) { if (JavaRuntime.isVMInstallReference(unresolvedClasspathEntry)) { continue; } // Add resolved entries for this unresolved entry resolvedRuntimeClasspath.addAll( Arrays.asList(JavaRuntime.resolveRuntimeClasspathEntry(unresolvedClasspathEntry, javaProject))); } /* * Prepend the resolved classpath with the source entries (parallels the * launch config's ordering of entries) */ try { resolvedRuntimeClasspath.addAll(0, GWTProjectUtilities.getGWTSourceFolderPathsFromProjectAndDependencies(javaProject, false)); } catch (SdkException e) { throw new CoreException(new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID, e.getLocalizedMessage(), e)); } /* * Try and add gwt-dev jar to the compiler classpath. It may already be on * the build classpath, but in some cases (i.e. when using Maven), it may * not be. Adding it to the end of the classpath (even if is duplicated) * does no harm. * * TODO: Consider invoking the appropriate ModuleClasspathProvider. */ GWTRuntime gwtRuntime = GWTRuntime.findSdkFor(javaProject); if (gwtRuntime == null) { GWTPluginLog.logWarning("Unable to find GWT runtime for project " + javaProject.getElementName() + ", will try to continue GWT compilation.."); return resolvedRuntimeClasspath; } IStatus validationStatus = gwtRuntime.validate(); if (!validationStatus.isOK()) { GWTPluginLog.logWarning("GWT runtime for project " + javaProject.getElementName() + " is not valid: " + validationStatus.getMessage() + ". Will attempt to proceed with GWT compilation anyway."); return resolvedRuntimeClasspath; } try { File gwtDevJar = gwtRuntime.getDevJar(); resolvedRuntimeClasspath.add( JavaRuntime.newArchiveRuntimeClasspathEntry(Path.fromOSString(gwtDevJar.getAbsolutePath()))); } catch (SdkException e) { GWTPluginLog.logWarning(e, "Unable to add gwt-dev.jar to the compiler's classpath; will attempt GWT compilation anyway."); } return resolvedRuntimeClasspath; }
From source file:com.google.gwt.eclipse.core.compile.ui.GWTCompileDialog.java
License:Open Source License
private void addEventHandlers() { projectText.addModifyListener(listener); chooseProjectButton.addSelectionListener(new SelectionAdapter() { @Override//from w w w . ja va2s. co m public void widgetSelected(SelectionEvent e) { IJavaProject selectedProject = chooseProject(); if (selectedProject != null) { projectText.setText(selectedProject.getElementName()); } } }); logLevelComboViewer.addPostSelectionChangedListener(listener); outputStyleComboViewer.addPostSelectionChangedListener(listener); extraArgsText.addModifyListener(listener); vmArgsText.addModifyListener(listener); applyButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { try { GWTCompileSettings settings = getCompileSettings(); GWTProjectProperties.setGwtCompileSettings(project, settings); originalSettings = settings; applyButton.setEnabled(false); } catch (BackingStoreException e) { GWTPluginLog.logError(e); } } }); }
From source file:com.google.test.metric.eclipse.ui.internal.compilation.TestabilityCompilationParticipant.java
License:Apache License
@Override public boolean isActive(IJavaProject project) { return configurationHelper.isExistingLaunchConfigurationWithRunOnBuild(project.getElementName()); }