protected static String[] computeBaseClassPath(IJavaProject myJavaProject) throws CoreException { if (!myJavaProject.exists()) return new String[0]; return JavaRuntime.computeDefaultRuntimeClassPath(myJavaProject); }
private Object getActualTarget(Object target) { if (target instanceof IProject) { IJavaProject jp= JavaCore.create((IProject)target); if (jp.exists()) return jp; } return target; }
public IJavaSearchScope createJavaProjectSearchScope(String[] projectNames, int includeMask) { ArrayList<IJavaElement> res= new ArrayList<>(); IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); for (int i= 0; i < projectNames.length; i++) { IJavaProject project= JavaCore.create(root.getProject(projectNames[i])); if (project.exists()) { res.add(project); } } return createJavaSearchScope(res, includeMask); }
private static boolean canInheritJavadoc(IMember member) { if (member instanceof IMethod && member.getJavaProject().exists()) { /* * Exists test catches ExternalJavaProject, in which case no hierarchy can be built. */ try { return !((IMethod) member).isConstructor(); } catch (JavaModelException e) { } } return false; }
private boolean isOnClassPath(ICompilationUnit element) { IJavaProject project= element.getJavaProject(); if (project == null || !project.exists()) return false; return project.isOnClasspath(element); }
private boolean isOnClassPath(ICompilationUnit element) { IJavaProject project= element.getJavaProject(); if (project == null || !project.exists()) return false; return project.isOnClasspath(element); }
private boolean isOnClassPath(ICompilationUnit element) { IJavaProject project= element.getJavaProject(); if (project == null || !project.exists()) return false; return project.isOnClasspath(element); }
/** * @see ITypeHierarchy */ public boolean exists() { if (!this.needsRefresh) return true; return (this.focusType == null || this.focusType.exists()) && javaProject().exists(); } /**
/** * Returns the java project that corresponds to the given path. * Returns null if the path doesn't correspond to a project. */ private static IJavaProject getJavaProject(IPath path, IJavaModel model) { IJavaProject project = model.getJavaProject(path.lastSegment()); if (project.exists()) { return project; } return null; }
private boolean isOnClassPath(ICompilationUnit element) throws JavaModelException { IJavaProject project= element.getJavaProject(); if (project == null || !project.exists()) return false; return project.isOnClasspath(element); }
private static IStatus validatePackageName(String text, IJavaProject project) { if (project == null || !project.exists()) { return JavaConventions.validatePackageName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3); } return JavaConventionsUtil.validatePackageName(text, project); }
public IJavaProject getJavaProject(Project model) { for (IProject iproj : iworkspace.getRoot().getProjects()) { if (iproj.getName().equals(model.getName())) { IJavaProject ij = JavaCore.create(iproj); if (ij != null && ij.exists()) { return ij; } // current project is not a Java project } } return null; }
public void run(IAction action) { if (project != null && project.exists()) { try { JBPMRuntimeManager.getDefault().addBuilder(project, null); } catch (Throwable t) { JBPMEclipsePlugin.log(t); } } }
private void createPackageFragmentRoot(IPackageFragmentRoot root) throws CoreException { final IJavaProject project= root.getJavaProject(); if (!project.exists()) createJavaProject(project.getProject()); final IFolder folder= project.getProject().getFolder(root.getElementName()); if (!folder.exists()) CoreUtility.createFolder(folder, true, true, new NullProgressMonitor()); final List<IClasspathEntry> list= Arrays.asList(project.getRawClasspath()); list.add(JavaCore.newSourceEntry(folder.getFullPath())); project.setRawClasspath(list.toArray(new IClasspathEntry[list.size()]), new NullProgressMonitor()); }
private void createPackageFragmentRoot(IPackageFragmentRoot root) throws CoreException { final IJavaProject project= root.getJavaProject(); if (!project.exists()) createJavaProject(project.getProject()); final IFolder folder= project.getProject().getFolder(root.getElementName()); if (!folder.exists()) CoreUtility.createFolder(folder, true, true, new NullProgressMonitor()); final List list= Arrays.asList(project.getRawClasspath()); list.add(JavaCore.newSourceEntry(folder.getFullPath())); project.setRawClasspath((IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]), new NullProgressMonitor()); }
private IRuntimeClasspathEntry[] resolveProject(IRuntimeClasspathEntry projectEntry, IProject project, ILaunchConfiguration configuration) throws CoreException { if (!project.isOpen()) { return EMPTY_RESULT; } IJavaProject javaProject = JavaCore.create(project); if (javaProject == null || !javaProject.exists()) { return EMPTY_RESULT; } LaunchConfigurationScope configurationScopes = LaunchConfigurationScope.from(configuration); return resolveOutputLocations(projectEntry, javaProject, configurationScopes); }
private boolean isEclipseNLSAvailable() { if (fNLSRefactoring == null || fNLSRefactoring.getCu() == null) return false; IJavaProject jp= fNLSRefactoring.getCu().getJavaProject(); if (jp == null || !jp.exists()) return false; try { return jp.findType("org.eclipse.osgi.util.NLS") != null; //$NON-NLS-1$ } catch (JavaModelException e) { return false; } }
public boolean isEclipseNLSAvailable() { if (getCu() == null) return false; IJavaProject javaProject= getCu().getJavaProject(); if (javaProject == null || !javaProject.exists()) return false; try { return javaProject.findType("org.eclipse.osgi.util.NLS") != null; //$NON-NLS-1$ } catch (JavaModelException e) { return false; } }
private IStatus validatePackageName(String text) { IJavaProject project= getJavaProject(); if (project == null || !project.exists()) { return JavaConventions.validatePackageName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3); } String sourceLevel= project.getOption(JavaCore.COMPILER_SOURCE, true); String compliance= project.getOption(JavaCore.COMPILER_COMPLIANCE, true); return JavaConventions.validatePackageName(text, sourceLevel, compliance); }
private static IFile getCandidate(IAdaptable element) throws JavaModelException { IResource resource = (IResource) element.getAdapter(IResource.class); if (!(resource instanceof IFile) || !ArchiveFileFilter.isArchivePath(resource.getFullPath())) return null; IJavaProject project = JavaCore.create(resource.getProject()); if (project != null && project.exists() && (project.findPackageFragmentRoot(resource.getFullPath()) == null)) return (IFile) resource; return null; }