/** * Helper method that tests if an classpath entry can be found in a * container. <code>null</code> is returned if the entry can not be found * or if the container does not allows the configuration of source * attachments * @param jproject The container's parent project * @param containerPath The path of the container * @param libPath The path of the library to be found * @return IClasspathEntry A classpath entry from the container of * <code>null</code> if the container can not be modified. * @throws JavaModelException thrown if accessing the container failed */ public static IClasspathEntry getClasspathEntryToEdit(IJavaProject jproject, IPath containerPath, IPath libPath) throws JavaModelException { IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject); ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); if (container != null && initializer != null && initializer.canUpdateClasspathContainer(containerPath, jproject)) { return findEntryInContainer(container, libPath); } return null; // attachment not possible }
/** * Helper method that tests if an classpath entry can be found in a * container. <code>null</code> is returned if the entry can not be found * or if the container does not allows the configuration of source * attachments * @param jproject The container's parent project * @param containerPath The path of the container * @param libPath The path of the library to be found * @return IClasspathEntry A classpath entry from the container of * <code>null</code> if the container can not be modified. * @throws JavaModelException thrown if accessing the container failed */ public static IClasspathEntry getClasspathEntryToEdit(IJavaProject jproject, IPath containerPath, IPath libPath) throws JavaModelException { IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject); ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); if (container != null && initializer != null && initializer.canUpdateClasspathContainer(containerPath, jproject)) { return findEntryInContainer(container, libPath); } return null; // attachment not possible }
/** * Helper method that tests if an classpath entry can be found in a * container. <code>null</code> is returned if the entry can not be found * or if the container does not allows the configuration of source * attachments * @param jproject The container's parent project * @param containerPath The path of the container * @param libPath The path of the library to be found * @return IClasspathEntry A classpath entry from the container of * <code>null</code> if the container can not be modified. * @throws JavaModelException thrown if accessing the container failed */ public static IClasspathEntry getClasspathEntryToEdit(IJavaProject jproject, IPath containerPath, IPath libPath) throws JavaModelException { IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject); ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); if (container != null && initializer != null && initializer.canUpdateClasspathContainer(containerPath, jproject)) { return findEntryInContainer(container, libPath); } return null; // attachment not possible }
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, containerPath.toString())); 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; } if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) { setDescription(Messages.format(PreferencesMessages.NativeLibrariesPropertyPage_read_only, containerName)); return null; } IClasspathEntry entry= JavaModelUtil.findEntryInContainer(container, jarPath); Assert.isNotNull(entry); return entry; }
IClasspathContainer classpathContainer= JavaCore.getClasspathContainer(entryPath, root.getJavaProject()); if (classpathContainer != null) { IClasspathEntry entryInContainer= JavaModelUtil.findEntryInContainer(classpathContainer, root.getPath()); if (entryInContainer != null) { addLibraryProposal(project, root, entryInContainer, addedClaspaths, proposals, cuChange);
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, containerPath.toString())); 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; } if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) { setDescription(Messages.format(PreferencesMessages.JavadocConfigurationPropertyPage_read_only, containerName)); return null; } IClasspathEntry entry= JavaModelUtil.findEntryInContainer(container, jarPath); Assert.isNotNull(entry); setDescription(PreferencesMessages.JavadocConfigurationPropertyPage_IsPackageFragmentRoot_description); return entry; }
IClasspathContainer classpathContainer= JavaCore.getClasspathContainer(entryPath, root.getJavaProject()); if (classpathContainer != null) { IClasspathEntry entryInContainer= JavaModelUtil.findEntryInContainer(classpathContainer, root.getPath()); if (entryInContainer != null) { addLibraryProposal(project, root, entryInContainer, addedClaspaths, proposals);
IClasspathContainer classpathContainer= JavaCore.getClasspathContainer(entryPath, root.getJavaProject()); if (classpathContainer != null) { IClasspathEntry entryInContainer= JavaModelUtil.findEntryInContainer(classpathContainer, root.getPath()); if (entryInContainer != null) { addLibraryProposal(project, root, entryInContainer, addedClaspaths, proposals, null);
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 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 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; }
return createMessageContent(composite, Messages.format(PreferencesMessages.SourceAttachmentPropertyPage_read_only, containerName)); entry= JavaModelUtil.findEntryInContainer(container, fRoot.getPath()); Assert.isNotNull(entry);
return; entry= JavaModelUtil.findEntryInContainer(container, root.getPath()); Assert.isNotNull(entry);
entry= JavaModelUtil.findEntryInContainer(container, root.getPath()); Assert.isNotNull(entry);
entry= JavaModelUtil.findEntryInContainer(container, root.getPath()); Assert.isNotNull(entry);
canEditEncoding= !(attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED || attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY); entry= JavaModelUtil.findEntryInContainer(container, fRoot.getPath());
canEditEncoding= !(attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED || attributeStatus.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY); entry= JavaModelUtil.findEntryInContainer(container, fRoot.getPath());
entry = JavaModelUtil.findEntryInContainer(container, root.getPath()); if (entry == null) { throw constructCoreException(Messages.format("Cannot find the ClasspathEntry from container '{0}'.", containerName));