private static String getSourceAttachmentEncoding(IClasspathEntry entry) { if (entry != null && entry.getExtraAttributes() != null) { for (IClasspathAttribute attribute : entry.getExtraAttributes()) { if (IClasspathAttribute.SOURCE_ATTACHMENT_ENCODING.equals(attribute.getName())) { return attribute.getValue(); } } } return null; }
private static boolean getJ2EEModuleDependency(IClasspathEntry cpEntry) { IClasspathAttribute[] attrs = cpEntry.getExtraAttributes(); for (int i=0;i<attrs.length;i++){ IClasspathAttribute attr = attrs[i]; if (attr.getName().equals(IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY)){ return true; } } return false; } }
private static boolean isOptional(IClasspathEntry entry) { IClasspathAttribute[] extraAttributes = entry.getExtraAttributes(); for (int i = 0, length = extraAttributes.length; i < length; i++) { IClasspathAttribute attribute = extraAttributes[i]; if (IClasspathAttribute.OPTIONAL.equals(attribute.getName()) && Boolean.parseBoolean(attribute.getValue())) { return true; } } return false; }
private static boolean isOptional(IClasspathEntry entry) { for (IClasspathAttribute attribute : entry.getExtraAttributes()) { if (IClasspathAttribute.OPTIONAL.equals(attribute.getName()) && Boolean.parseBoolean(attribute.getValue())) { return true; } } return false; }
private static boolean isOptional(IClasspathEntry entry) { IClasspathAttribute[] extraAttributes = entry.getExtraAttributes(); for (int i = 0, length = extraAttributes.length; i < length; i++) { IClasspathAttribute attribute = extraAttributes[i]; if (IClasspathAttribute.OPTIONAL.equals(attribute.getName()) && Boolean.parseBoolean(attribute.getValue())) { return true; } } return false; }
@Override public IPath getExternalAnnotationsPath() { IClasspathEntry entry = getClasspathEntry(); if (null != entry) { String s = findClasspathAttribute(entry.getExtraAttributes(), IClasspathAttribute.EXTERNAL_ANNOTATION_PATH); if (null != s) { return new Path(s); } } return null; }
public static String getExtraAttribute(IClasspathEntry entry, String attributeName) { IClasspathAttribute[] extraAttributes = entry.getExtraAttributes(); for (int i = 0, length = extraAttributes.length; i < length; i++) { IClasspathAttribute attribute = extraAttributes[i]; if (attributeName.equals(attribute.getName())) { return attribute.getValue(); } } return null; }
private static String getNativeLibrariesPath(IClasspathEntry entry) { IClasspathAttribute[] extraAttributes= entry.getExtraAttributes(); for (int i= 0; i < extraAttributes.length; i++) { if (extraAttributes[i].getName().equals(JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY)) { return extraAttributes[i].getValue(); } } return null; }
private static String getNativeLibrariesPath(IClasspathEntry entry) { IClasspathAttribute[] extraAttributes= entry.getExtraAttributes(); for (int i= 0; i < extraAttributes.length; i++) { if (extraAttributes[i].getName().equals(JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY)) { return extraAttributes[i].getValue(); } } return null; }
public static String getExtraAttribute(IClasspathEntry entry, String attributeName) { IClasspathAttribute[] extraAttributes = entry.getExtraAttributes(); for (int i = 0, length = extraAttributes.length; i < length; i++) { IClasspathAttribute attribute = extraAttributes[i]; if (attributeName.equals(attribute.getName())) { return attribute.getValue(); } } return null; }
@Override public boolean isAutomodule() { IClasspathAttribute[] extraAttributes = getClasspathEntry().getExtraAttributes(); for (IClasspathAttribute attribute : extraAttributes) { if (IClasspathAttribute.MODULE.equals(attribute.getName()) && Boolean.TRUE.toString().equals(attribute.getValue())) { return true; } } return false; } }
private boolean isIgnoringOptionalProblems(IClasspathEntry entry) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { IClasspathAttribute[] extraAttributes= entry.getExtraAttributes(); for (int i= 0; i < extraAttributes.length; i++) { IClasspathAttribute attrib= extraAttributes[i]; if (IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS.equals(attrib.getName())) { return "true".equals(attrib.getValue()); //$NON-NLS-1$ } } } return false; }
private boolean isIgnoringOptionalProblems(IClasspathEntry entry) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { IClasspathAttribute[] extraAttributes= entry.getExtraAttributes(); for (int i= 0; i < extraAttributes.length; i++) { IClasspathAttribute attrib= extraAttributes[i]; if (IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS.equals(attrib.getName())) { return "true".equals(attrib.getValue()); //$NON-NLS-1$ } } } return false; }
public static void adjustClasspathProperty(IRuntimeClasspathEntry r, IClasspathEntry entry) { if (r.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { if (Arrays.stream(entry.getExtraAttributes()).anyMatch(attribute -> IClasspathAttribute.MODULE.equals(attribute.getName()) && Boolean.TRUE.toString().equals(attribute.getValue()))) { r.setClasspathProperty(IRuntimeClasspathEntry.MODULE_PATH); } else { r.setClasspathProperty(IRuntimeClasspathEntry.CLASS_PATH); } } }
private static boolean isTest(IClasspathEntry entry) { if (entry.getEntryKind() != ClasspathEntry.CPE_SOURCE) { return false; } for (final IClasspathAttribute attribute : entry.getExtraAttributes()) { if (MAVEN_SCOPE_ATTRIBUTE.equals(attribute.getName()) || GRADLE_SCOPE_ATTRIBUTE.equals(attribute.getName())) { return TEST_SCOPE.equals(attribute.getValue()); } } return entry.isTest(); }
private IClasspathEntry copyCPEntryWithoutModuleAttribute(IClasspathEntry entry) { IClasspathAttribute[] oldAttributes= entry.getExtraAttributes(); IClasspathAttribute[] newAttributes= new IClasspathAttribute[oldAttributes.length]; int count= 0; for (int i= 0; i < oldAttributes.length; i++) { if (!oldAttributes[i].getName().equals(IClasspathAttribute.MODULE)) newAttributes[count++]= oldAttributes[i]; } if (count == oldAttributes.length) return null; newAttributes= count == 0 ? new IClasspathAttribute[0] : Arrays.copyOf(newAttributes, count); return JavaCore.newContainerEntry(entry.getPath(), entry.getAccessRules(), newAttributes, entry.isExported()); }
private void updateClasspath(IPath newPath, IProgressMonitor monitor) throws JavaModelException { IClasspathEntry[] classpath= fProject.getRawClasspath(); IPath jreContainerPath= new Path(JavaRuntime.JRE_CONTAINER); for (int i= 0; i < classpath.length; i++) { IClasspathEntry curr= classpath[i]; if (curr.getEntryKind() == IClasspathEntry.CPE_CONTAINER && curr.getPath().matchingFirstSegments(jreContainerPath) > 0) { classpath[i]= JavaCore.newContainerEntry(newPath, curr.getAccessRules(), curr.getExtraAttributes(), curr.isExported()); } } fProject.setRawClasspath(classpath, monitor); }
@Override public IClasspathEntry getSelection() { if (fEditResult != null) { if (fOldClasspathEntry != null && fOldClasspathEntry.getPath().equals(fEditResult.getPath())) { return JavaCore.newContainerEntry(fEditResult.getPath(), fOldClasspathEntry.getAccessRules(), fOldClasspathEntry.getExtraAttributes(), fOldClasspathEntry.isExported()); } else { return JavaCore.newContainerEntry(fEditResult.getPath(), false); } } return null; }
@Override public IClasspathEntry getSelection() { if (fEditResult != null) { if (fOldClasspathEntry != null && fOldClasspathEntry.getPath().equals(fEditResult.getPath())) { return JavaCore.newContainerEntry(fEditResult.getPath(), fOldClasspathEntry.getAccessRules(), fOldClasspathEntry.getExtraAttributes(), fOldClasspathEntry.isExported()); } else { return JavaCore.newContainerEntry(fEditResult.getPath(), false); } } return null; }
private IClasspathEntry toClasspathEntry(EclipseSourceDirectory sourceFolder, IClasspathEntry existingEntry) { SourceFolderEntryBuilder builder = new SourceFolderEntryBuilder(this.project, existingEntry.getPath()); builder.setOutput(existingEntry.getOutputLocation()); builder.setAttributes(existingEntry.getExtraAttributes()); builder.setIncludes(existingEntry.getInclusionPatterns()); builder.setExcludes(existingEntry.getExclusionPatterns()); synchronizeAttributesFromModel(builder, sourceFolder); return builder.build(); }