Example usage for org.eclipse.jdt.core IClasspathAttribute SOURCE_ATTACHMENT_ENCODING

List of usage examples for org.eclipse.jdt.core IClasspathAttribute SOURCE_ATTACHMENT_ENCODING

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IClasspathAttribute SOURCE_ATTACHMENT_ENCODING.

Prototype

String SOURCE_ATTACHMENT_ENCODING

To view the source code for org.eclipse.jdt.core IClasspathAttribute SOURCE_ATTACHMENT_ENCODING.

Click Source Link

Document

Constant for the name of the encoding to be used for source attachments.

Usage

From source file:at.bestsolution.fxide.jdt.text.javadoc.JavadocContentAccess2.java

License:Open Source License

private static String getSourceAttachmentEncoding(IPackageFragmentRoot root) throws JavaModelException {
    String encoding = ResourcesPlugin.getEncoding();
    IClasspathEntry entry = root.getRawClasspathEntry();

    if (entry != null) {
        int kind = entry.getEntryKind();
        if (kind == IClasspathEntry.CPE_LIBRARY || kind == IClasspathEntry.CPE_VARIABLE) {
            IClasspathAttribute[] extraAttributes = entry.getExtraAttributes();
            for (int i = 0; i < extraAttributes.length; i++) {
                IClasspathAttribute attrib = extraAttributes[i];
                if (IClasspathAttribute.SOURCE_ATTACHMENT_ENCODING.equals(attrib.getName())) {
                    return attrib.getValue();
                }/*from ww  w .j  av  a 2 s . c  om*/
            }
        }
    }

    return encoding;
}

From source file:com.codenvy.ide.ext.java.server.internal.core.ClasspathEntry.java

License:Open Source License

public String getSourceAttachmentEncoding() {
    for (int i = 0, length = this.extraAttributes.length; i < length; i++) {
        IClasspathAttribute attribute = this.extraAttributes[i];
        if (IClasspathAttribute.SOURCE_ATTACHMENT_ENCODING.equals(attribute.getName()))
            return attribute.getValue();
    }//from   w ww.j a  v a2s .  co  m
    return null;
}

From source file:org.continuousassurance.swamp.eclipse.BuildfileGenerator.java

License:Apache License

/**
 * Gets the encoding of a classpath entry. Falls back to project encoding
 * if none found//from w ww. j av  a 2 s .co  m
 * @param entry the entry
 * @return the encoding or empty string if unspecified
 */
private static String getEncodingAttribute(IClasspathEntry entry) {
    IClasspathAttribute[] attributes = entry.getExtraAttributes();
    for (IClasspathAttribute attr : attributes) {
        if (attr.getName().equals(IClasspathAttribute.SOURCE_ATTACHMENT_ENCODING)) {
            return attr.getValue();
        }
    }
    return "";
}