/** * Remove all JRE runtime entries from the given set * * @param scope * set to filter * @return filtered set without JRE runtime entries */ public static Set<IPackageFragmentRoot> filterJREEntries( Collection<IPackageFragmentRoot> scope) throws JavaModelException { final Set<IPackageFragmentRoot> filtered = new HashSet<IPackageFragmentRoot>(); for (final IPackageFragmentRoot root : scope) { final IClasspathEntry entry = root.getRawClasspathEntry(); switch (entry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: case IClasspathEntry.CPE_LIBRARY: case IClasspathEntry.CPE_VARIABLE: filtered.add(root); break; case IClasspathEntry.CPE_CONTAINER: IClasspathContainer container = JavaCore.getClasspathContainer( entry.getPath(), root.getJavaProject()); if (container != null && container.getKind() == IClasspathContainer.K_APPLICATION) { filtered.add(root); } break; } } return filtered; }
static IClasspathEntry[] getAppEngineServerRuntimeClasspathEntries(IProject project) { IJavaProject javaProject = JavaCore.create(project); IPath containerPath = new Path( "org.eclipse.jst.server.core.container/com.google.cloud.tools.eclipse.appengine.standard.runtimeClasspathProvider"); try { for (IClasspathEntry entry : javaProject.getRawClasspath()) { if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && containerPath.isPrefixOf(entry.getPath())) { // resolve and return the entries IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject); return container.getClasspathEntries(); } } } catch (JavaModelException ex) { fail(ex.toString()); /* NOTREACHED */ } fail("AppEngine Server Runtime classpath container not found"); return null; }
@Override protected IStatus run(IProgressMonitor monitor) { try { IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, javaProject); LibraryClasspathContainer newContainer = attachSource(container); if (newContainer != null) { JavaCore.setClasspathContainer(containerPath, new IJavaProject[]{ javaProject }, new IClasspathContainer[]{ newContainer }, monitor); serializer.saveContainer(javaProject, newContainer); } } catch (Exception ex) { // it's not needed to be logged normally logger.log(Level.FINE, Messages.getString("SourceAttachmentFailed"), ex); } return Status.OK_STATUS; // even if it fails, we should not display an error to the user }
@VisibleForTesting LibraryClasspathContainer attachSource(IClasspathContainer container) throws Exception { if (!(container instanceof LibraryClasspathContainer)) { logger.log(Level.FINE, Messages.getString("ContainerClassUnexpected", container.getClass().getName(), LibraryClasspathContainer.class.getName())); return null; } LibraryClasspathContainer libraryClasspathContainer = (LibraryClasspathContainer) container; IPath sourceArtifactPath = sourceArtifactPathProvider.call(); List<IClasspathEntry> newClasspathEntries = new ArrayList<>(); for (IClasspathEntry entry : libraryClasspathContainer.getClasspathEntries()) { if (!entry.getPath().equals(libraryPath)) { newClasspathEntries.add(entry); } else { newClasspathEntries.add(JavaCore.newLibraryEntry( entry.getPath(), sourceArtifactPath, null /* sourceAttachmentRootPath */, entry.getAccessRules(), entry.getExtraAttributes(), entry.isExported())); } } return libraryClasspathContainer.copyWithNewEntries(newClasspathEntries); }
public boolean isInsideJRE(IJavaElement element) { IPackageFragmentRoot root = (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); if (root != null) { try { IClasspathEntry entry = root.getRawClasspathEntry(); if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), root.getJavaProject()); return container != null && container.getKind() == IClasspathContainer.K_DEFAULT_SYSTEM; } return false; } catch (JavaModelException e) { JavaPlugin.log(e); } } return true; // include JRE in doubt }
/** * Returns a persisted container from previous session if any. Note that it is not the original * container from previous session (i.e. it did not get serialized) but rather a summary of its * entries recreated for CP initialization purpose. As such it should not be stored into container * caches. */ public IClasspathContainer getPreviousSessionContainer( IPath containerPath, IJavaProject project) { Map previousContainerValues = (Map) this.previousSessionContainers.get(project); if (previousContainerValues != null) { IClasspathContainer previousContainer = (IClasspathContainer) previousContainerValues.get(containerPath); if (previousContainer != null) { if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) // verbose_reentering_project_container_access(containerPath, project, // previousContainer); return previousContainer; } } return null; // break cycle if none found }
public IClasspathContainer getClasspathContainer( final IPath containerPath, final IJavaProject project) throws JavaModelException { IClasspathContainer container = containerGet(project, containerPath); if (container == null) { // if (batchContainerInitializations()) { // // avoid deep recursion while initializing container on workspace restart // // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=60437) // try { // container = initializeAllContainers(project, containerPath); // } finally { // batchInitializationFinished(); // } // } else { container = initializeContainer(project, containerPath); // containerBeingInitializedRemove(project, containerPath); SetContainerOperation operation = new SetContainerOperation( containerPath, new IJavaProject[] {project}, new IClasspathContainer[] {container}); operation.runOperation(null); // } } return container; }
public void updateClasspath(MavenProject mavenProject) { IJavaProject javaProject = JavaCore.create(mavenProject.getProject()); if (javaProject != null) { IClasspathEntry[] entries = getClasspath(mavenProject); MavenClasspathContainer container = new MavenClasspathContainer(entries); try { JavaCore.setClasspathContainer( new Path(MavenClasspathContainer.CONTAINER_ID), new IJavaProject[] {javaProject}, new IClasspathContainer[] {container}, new NullProgressMonitor()); } catch (JavaModelException e) { LOG.error(e.getMessage(), e); } } }
public void testInitialize() throws Exception { // Start with gwt-user.jar and gwt-dev-PLAT.jar on the classpath for this // test removeGWTRuntimeFromTestProject(); // Add the default GWT runtime to the test project (this implicitly calls // the GWTRuntimeContainerInitializer.intialize(...) method. IJavaProject project = getTestProject(); GWTUpdateProjectSdkCommand command = new GWTUpdateProjectSdkCommand( project, null, GWTPreferences.getDefaultRuntime(), UpdateType.DEFAULT_CONTAINER, null); command.execute(); JobsUtilities.waitForIdle(); // Verify the bound classpath container IClasspathContainer container = JavaCore.getClasspathContainer( defaultRuntimePath, project); assertEquals(IClasspathContainer.K_APPLICATION, container.getKind()); assertEquals(defaultRuntimePath, container.getPath()); }
/** * Replace an {@link IClasspathEntry#CPE_CONTAINER} entry with the given * container ID, with its corresponding resolved classpath entries. * * @param javaProject java project * @param containerId container ID to replace * @return true if a container was replaced * * @throws JavaModelException */ public static boolean replaceContainerWithClasspathEntries( IJavaProject javaProject, String containerId) throws JavaModelException { IClasspathEntry[] classpathEntries = javaProject.getRawClasspath(); int containerIndex = ClasspathUtilities.indexOfClasspathEntryContainer( classpathEntries, containerId); if (containerIndex != -1) { List<IClasspathEntry> newClasspathEntries = new ArrayList<IClasspathEntry>( Arrays.asList(classpathEntries)); IClasspathEntry classpathContainerEntry = newClasspathEntries.remove(containerIndex); IClasspathContainer classpathContainer = JavaCore.getClasspathContainer( classpathContainerEntry.getPath(), javaProject); if (classpathContainer != null) { newClasspathEntries.addAll(containerIndex, Arrays.asList(classpathContainer.getClasspathEntries())); ClasspathUtilities.setRawClasspath(javaProject, newClasspathEntries); return true; } } return false; }
@Override public void initialize(IPath containerPath, final IJavaProject javaProject) throws CoreException { SdkClasspathContainer<T> sdkClasspathContainer = null; final T sdk = resolveSdkFromContainerPath(containerPath, javaProject); if (sdk != null) { String description = getDescription(containerPath, javaProject); sdkClasspathContainer = createClasspathContainer(containerPath, sdk, description, javaProject); } // Container will be set to null if it could not be resolved which will // result in a classpath error for the project. JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {javaProject}, new IClasspathContainer[] {sdkClasspathContainer}, null); }
@Override public void requestClasspathContainerUpdate(IPath containerPath, IJavaProject project, IClasspathContainer containerSuggestion) throws CoreException { SdkClasspathContainer<T> sdkClasspathContainer = null; T sdk = resolveSdkFromContainerPath(containerPath, project); if (sdk != null) { String description = getDescription(containerPath, project); sdkClasspathContainer = updateClasspathContainer(containerPath, sdk, description, project, containerSuggestion); } // Container will be set to null if it could not be resolved which will // result in a classpath error for the project. JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project}, new IClasspathContainer[] {sdkClasspathContainer}, null); }
private void resolveClasspathEntries(Set<URL> urls, IWorkspaceRoot root, IClasspathEntry[] entries) throws JavaModelException { for (int i = 0; i < entries.length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { IPath path = entry.getPath(); if (path.segmentCount() >= 2) { IFolder sourceFolder = root.getFolder(path); try { urls.add(new URL("file:///" + sourceFolder.getRawLocation().toOSString() + "/")); } catch (MalformedURLException e) { } } } else if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { IPath sourcePath = entry.getPath(); covertPathToUrl(javaProject.getProject(), urls, sourcePath); IPath sourceOutputPath = entry.getOutputLocation(); covertPathToUrl(javaProject.getProject(), urls, sourceOutputPath); } else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (entry.getPath().equals(JRClasspathContainer.ID)) continue; IClasspathContainer cont = JavaCore.getClasspathContainer(entry.getPath(), javaProject); resolveClasspathEntries(urls, root, cont.getClasspathEntries()); } } }
private static void convertContainer(IClasspathEntry entry, IJavaProject project, Map<IPath, String> oldLocationMap) { try { IClasspathContainer container= JavaCore.getClasspathContainer(entry.getPath(), project); if (container == null) { return; } IClasspathEntry[] entries= container.getClasspathEntries(); boolean hasChange= false; for (int i= 0; i < entries.length; i++) { IClasspathEntry curr= entries[i]; IClasspathEntry updatedEntry= getConvertedEntry(curr, project, oldLocationMap); if (updatedEntry != null) { entries[i]= updatedEntry; hasChange= true; } } if (hasChange) { BuildPathSupport.requestContainerUpdate(project, container, entries); } } catch (CoreException e) { // ignore } }
public boolean isInsideJRE(IJavaElement element) { IPackageFragmentRoot root= (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); if (root != null) { try { IClasspathEntry entry= root.getRawClasspathEntry(); if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { IClasspathContainer container= JavaCore.getClasspathContainer(entry.getPath(), root.getJavaProject()); return container != null && container.getKind() == IClasspathContainer.K_DEFAULT_SYSTEM; } return false; } catch (JavaModelException e) { JavaPlugin.log(e); } } return true; // include JRE in doubt }
private IClasspathEntry handleContainerEntry(IPath containerPath, IJavaProject jproject, IPath jarPath) throws JavaModelException { ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject); if (initializer == null || container == null) { setDescription(Messages.format(PreferencesMessages.JavadocConfigurationPropertyPage_invalid_container, BasicElementLabels.getPathLabel(containerPath, false))); return null; } String containerName= container.getDescription(); IStatus status= initializer.getAttributeStatus(containerPath, jproject, IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME); if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED) { setDescription(Messages.format(PreferencesMessages.JavadocConfigurationPropertyPage_not_supported, containerName)); return null; } IClasspathEntry entry= JavaModelUtil.findEntryInContainer(container, jarPath); if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) { setDescription(Messages.format(PreferencesMessages.JavadocConfigurationPropertyPage_read_only, containerName)); fIsReadOnly= true; return entry; } Assert.isNotNull(entry); setDescription(PreferencesMessages.JavadocConfigurationPropertyPage_IsPackageFragmentRoot_description); return entry; }
private IClasspathEntry handleContainerEntry(IPath containerPath, IJavaProject jproject, IPath jarPath) throws JavaModelException { ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject); if (initializer == null || container == null) { setDescription(Messages.format(PreferencesMessages.NativeLibrariesPropertyPage_invalid_container, BasicElementLabels.getPathLabel(containerPath, false))); return null; } String containerName= container.getDescription(); IStatus status= initializer.getAttributeStatus(containerPath, jproject, JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY); if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED) { setDescription(Messages.format(PreferencesMessages.NativeLibrariesPropertyPage_not_supported, containerName)); return null; } IClasspathEntry entry= JavaModelUtil.findEntryInContainer(container, jarPath); if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) { setDescription(Messages.format(PreferencesMessages.NativeLibrariesPropertyPage_read_only, containerName)); fIsReadOnly= true; return entry; } Assert.isNotNull(entry); return entry; }
private static void updateContainerClasspath(IJavaProject jproject, IPath containerPath, IClasspathEntry newEntry, String[] changedAttributes, IProgressMonitor monitor) throws CoreException { IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject); if (container == null) { throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, "Container " + containerPath + " cannot be resolved", null)); //$NON-NLS-1$//$NON-NLS-2$ } IClasspathEntry[] entries= container.getClasspathEntries(); IClasspathEntry[] newEntries= new IClasspathEntry[entries.length]; for (int i= 0; i < entries.length; i++) { IClasspathEntry curr= entries[i]; if (curr.getEntryKind() == newEntry.getEntryKind() && curr.getPath().equals(newEntry.getPath())) { newEntries[i]= getUpdatedEntry(curr, newEntry, changedAttributes, jproject); } else { newEntries[i]= curr; } } requestContainerUpdate(jproject, container, newEntries); monitor.worked(1); }
public CPUserLibraryElement(String name, IClasspathContainer container, IJavaProject project) { fName= name; fChildren= new ArrayList<CPListElement>(); if (container != null) { IClasspathEntry[] entries= container.getClasspathEntries(); CPListElement[] res= new CPListElement[entries.length]; for (int i= 0; i < res.length; i++) { IClasspathEntry curr= entries[i]; CPListElement elem= CPListElement.createFromExisting(this, curr, project); //elem.setAttribute(CPListElement.SOURCEATTACHMENT, curr.getSourceAttachmentPath()); //elem.setAttribute(CPListElement.JAVADOC, JavaUI.getLibraryJavadocLocation(curr.getPath())); fChildren.add(elem); } fIsSystemLibrary= container.getKind() == IClasspathContainer.K_SYSTEM; } else { fIsSystemLibrary= false; } }
public boolean hasChanges(IClasspathContainer oldContainer) { if (oldContainer == null || (oldContainer.getKind() == IClasspathContainer.K_SYSTEM) != fIsSystemLibrary) { return true; } IClasspathEntry[] oldEntries= oldContainer.getClasspathEntries(); if (fChildren.size() != oldEntries.length) { return true; } for (int i= 0; i < oldEntries.length; i++) { CPListElement child= fChildren.get(i); if (!child.getClasspathEntry().equals(oldEntries[i])) { return true; } } return false; }
/** * Search the Ivy classpath containers within the specified Java project * * @param javaProject * the project to search into * @return the Ivy classpath container if found */ public static List<IvyClasspathContainer> getContainers(IJavaProject javaProject) { List<IvyClasspathContainer> containers = new ArrayList<>(); if (javaProject == null || !javaProject.exists()) { return containers; } try { for (IClasspathEntry entry : javaProject.getRawClasspath()) { if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { IPath path = entry.getPath(); if (isIvyClasspathContainer(path)) { IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject); if (cp instanceof IvyClasspathContainer) { containers.add((IvyClasspathContainer) cp); } } } } } catch (JavaModelException e) { // unless there are issues with the JDT, this should never happen IvyPlugin.log(e); } return containers; }
private IRuntimeClasspathEntry[] computeDefaultContainerEntries(IRuntimeClasspathEntry entry, IJavaProject project) throws CoreException { IvyClasspathContainerImpl ivycp; if (project == null) { ivycp = new IvyClasspathContainerImpl(null, entry.getPath(), null, null); } else { IClasspathContainer container = JavaCore .getClasspathContainer(entry.getPath(), project); if (container == null) { String message = "Could not resolve classpath container: " + entry.getPath().toString(); throw new CoreException(new Status(IStatus.ERROR, IvyPlugin.ID, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR, message, null)); // execution will not reach here - exception will be thrown } ivycp = (IvyClasspathContainerImpl) container; } return computeDefaultContainerEntries(ivycp, entry); }
public boolean performFinish() { containerPage.finish(); IClasspathEntry newEntry = containerPage.getSelection(); IPath path = newEntry.getPath(); IJavaProject project = containerPage.getProject(); try { IvyClasspathContainerImpl ivycp = new IvyClasspathContainerImpl(project, path, new IClasspathEntry[0], new IClasspathAttribute[0]); JavaCore.setClasspathContainer(path, new IJavaProject[] {project}, new IClasspathContainer[] {ivycp}, null); IClasspathEntry[] entries = project.getRawClasspath(); List<IClasspathEntry> newEntries = new ArrayList<>(Arrays.asList(entries)); newEntries.add(newEntry); entries = newEntries.toArray(new IClasspathEntry[newEntries.size()]); project.setRawClasspath(entries, project.getOutputLocation(), null); ivycp.launchResolve(false, null); } catch (JavaModelException e) { IvyPlugin.log(e); return false; } return true; }
@Override public void initialize(IPath containerPath, IJavaProject javaProject) throws CoreException { IProject project = javaProject.getProject(); IPluginModel model = JPFPluginModelManager.instance().findModel(project); JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { javaProject }, new IClasspathContainer[] { new JPFClasspathContainer(model) }, null); }
@Override protected IStatus run(IProgressMonitor monitor) { try { boolean more = false; do { IJavaProject[] projects = null; IClasspathContainer[] containers = null; synchronized( fProjects ) { projects = fProjects.toArray(new IJavaProject[fProjects.size()]); containers = fContainers.toArray(new IClasspathContainer[fContainers.size()]); fProjects.clear(); fContainers.clear(); } JavaCore.setClasspathContainer(JPFClasspathPlugin.CONTAINER_PATH, projects, containers, monitor); synchronized( fProjects ) { more = !fProjects.isEmpty(); } } while( more ); } catch( JavaModelException e ) { return e.getStatus(); } return Status.OK_STATUS; }
/** * Queues more projects/containers. * * @param projects * @param containers */ void add(IJavaProject[] projects, IClasspathContainer[] containers) { synchronized( fProjects ) { for( int i = 0; i < containers.length; i++ ) { fProjects.add(projects[i]); fContainers.add(containers[i]); } } }
public static IClasspathEntry findEntryInContainer(IClasspathContainer container, IPath libPath) { if (container == null || libPath == null) { return null; } for (IClasspathEntry cpe : container.getClasspathEntries()) { IClasspathEntry resolved = JavaCore.getResolvedClasspathEntry(cpe); if (resolved != null && libPath.equals(resolved.getPath())) { return cpe; } } return null; }
@Test public void testAttachSource_shortCircuitOnGenericClasspathContainer() throws Exception { IClasspathContainer invalidContainer = mock(IClasspathContainer.class); LibraryClasspathContainer newContainer = attacherJob.attachSource(invalidContainer); assertNull(newContainer); }
@Override public void initialize(IPath containerPath, IJavaProject project) throws CoreException { if (containerPath.segmentCount() != 2) { throw new CoreException(StatusUtil.error(this, "containerPath does not have exactly 2 segments: " + containerPath.toString())); } if (!containerPath.segment(0).equals(containerPathPrefix)) { throw new CoreException( StatusUtil.error(this, MessageFormat.format("Unexpected first segment of container path, " + "expected: {0} was: {1}", containerPathPrefix, containerPath.segment(0)))); } try { LibraryClasspathContainer container = serializer.loadContainer(project, containerPath); if (container != null && jarPathsAreValid(container)) { JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project}, new IClasspathContainer[] {container}, new NullProgressMonitor()); } else { resolverService.resolveContainer(project, containerPath, new NullProgressMonitor()); } } catch (IOException ex) { throw new CoreException( StatusUtil.error(this, "Failed to load persisted container descriptor", ex)); } }
@Override protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException { gradleBuild(getProject(), "assembleDebug", monitor); //$NON-NLS-1$ // Update the dependencies // TODO should really so this when build files change IJavaProject javaProject = JavaCore.create(getProject()); JavaCore.setClasspathContainer(AndroidClasspathContainer.path, new IJavaProject[] { javaProject }, new IClasspathContainer[] { new AndroidClasspathContainer(javaProject) }, monitor); return new IProject[] { getProject() }; }
@Override public void initialize(IPath containerPath, IJavaProject project) throws CoreException { if (containerPath.equals(AndroidClasspathContainer.path)) { JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { new AndroidClasspathContainer(project) }, null); } }
/** * Returns the label of a classpath container. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param containerPath the path of the container * @param project the project the container is resolved in * @return the label of the classpath container * @throws JavaModelException when resolving of the container failed */ public static String getContainerEntryLabel(IPath containerPath, IJavaProject project) throws JavaModelException { IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, project); if (container != null) { return org.eclipse.jdt.internal.core.manipulation.util.Strings.markLTR(container.getDescription()); } ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); if (initializer != null) { return org.eclipse.jdt.internal.core.manipulation.util.Strings.markLTR(initializer.getDescription(containerPath, project)); } return BasicElementLabels.getPathLabel(containerPath, false); }
/** * Returns the label of a classpath container. The returned label is BiDi-processed with {@link * TextProcessor#process(String, String)}. * * @param containerPath the path of the container * @param project the project the container is resolved in * @return the label of the classpath container * @throws JavaModelException when resolving of the container failed */ public static String getContainerEntryLabel(IPath containerPath, IJavaProject project) throws JavaModelException { IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, project); if (container != null) { return Strings.markLTR(container.getDescription()); } ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); if (initializer != null) { return Strings.markLTR(initializer.getDescription(containerPath, project)); } return BasicElementLabels.getPathLabel(containerPath, false); }