Search in sources :

Example 1 with HTMLDocumentTypeRegistry

use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry in project webtools.sourceediting by eclipse.

the class ContentSettingsRegistry method getSystemIdFrom.

public static String getSystemIdFrom(String publicId) {
    if (publicId == null || publicId.length() == 0)
        return null;
    HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
    Enumeration e = reg.getEntries();
    while (e.hasMoreElements()) {
        HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
        if (entry.getPublicId().equals(publicId))
            return entry.getSystemId();
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) HTMLDocumentTypeEntry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry) HTMLDocumentTypeRegistry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry)

Example 2 with HTMLDocumentTypeRegistry

use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry in project webtools.sourceediting by eclipse.

the class WebContentSettingsPropertyPage method getSystemIdFrom.

private String getSystemIdFrom(String publicId) {
    if (publicId == null || publicId.length() == 0)
        return null;
    HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
    Enumeration e = reg.getEntries();
    while (e.hasMoreElements()) {
        HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
        if (entry.getPublicId().equals(publicId))
            return entry.getSystemId();
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) HTMLDocumentTypeEntry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry) HTMLDocumentTypeRegistry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry)

Example 3 with HTMLDocumentTypeRegistry

use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry in project webtools.sourceediting by eclipse.

the class WebContentSettingsPropertyPage method populateDoctypeValues.

private void populateDoctypeValues() {
    fDocumentTypeIds = new ArrayList();
    // add none first
    fDocumentTypeCombo.add(SELECT_NONE);
    fDocumentTypeIds.add(null);
    HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
    Enumeration e = reg.getEntries();
    while (e.hasMoreElements()) {
        HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
        String publicId = entry.getPublicId();
        String displayName = entry.getDisplayName();
        displayName = displayName != null ? displayName : publicId;
        fDocumentTypeCombo.add(displayName);
        fDocumentTypeIds.add(publicId);
        if (displayName.length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) {
            maxLengthStringInHTMLDocumentTypeRegistry = displayName;
        }
        if (entry.getSystemId() == null)
            // if HTML entry
            continue;
        if (entry.getSystemId().length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
            maxLengthStringInHTMLDocumentTypeRegistry = entry.getSystemId();
    }
}
Also used : Enumeration(java.util.Enumeration) HTMLDocumentTypeEntry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry) ArrayList(java.util.ArrayList) HTMLDocumentTypeRegistry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry)

Example 4 with HTMLDocumentTypeRegistry

use of org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry in project webtools.sourceediting by eclipse.

the class ContentSettingsRegistry method setHTMLDocumentTypeRegistryInto.

public static void setHTMLDocumentTypeRegistryInto(ComboList combo) {
    // $NON-NLS-1$
    combo.add(NONE, "");
    HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
    Enumeration e = reg.getEntries();
    while (e.hasMoreElements()) {
        HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
        String publicId = entry.getPublicId();
        String displayName = entry.getDisplayName();
        if (displayName != null) {
            combo.add(displayName, publicId);
            if (displayName.length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
                maxLengthStringInHTMLDocumentTypeRegistry = displayName;
        } else
            combo.add(publicId, publicId);
        if (publicId.length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
            maxLengthStringInHTMLDocumentTypeRegistry = publicId;
        if (entry.getSystemId() == null)
            // if HTML entry
            continue;
        if (entry.getSystemId().length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
            maxLengthStringInHTMLDocumentTypeRegistry = entry.getSystemId();
    }
    combo.sortByKey(1);
}
Also used : Enumeration(java.util.Enumeration) HTMLDocumentTypeEntry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry) HTMLDocumentTypeRegistry(org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry)

Aggregations

Enumeration (java.util.Enumeration)4 HTMLDocumentTypeEntry (org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeEntry)4 HTMLDocumentTypeRegistry (org.eclipse.wst.html.core.internal.document.HTMLDocumentTypeRegistry)4 ArrayList (java.util.ArrayList)1