Search in sources :

Example 1 with PluginLafInfo

use of org.eclipse.wb.internal.swing.laf.model.PluginLafInfo in project windowbuilder by eclipse.

the class LafSupport method createLAFList.

/**
 * Enumerates all available {@link LafInfo} and stores it into <code>m_lafList</code>.
 */
private static void createLAFList() {
    if (m_lafList == null) {
        m_lafList = Lists.newArrayList();
        CategoryInfo rootCategory = new CategoryInfo(ROOT_ID, "<root>");
        m_lafList.add(rootCategory);
        // add "undefined" and "current system"
        rootCategory.add(SystemLafInfo.INSTANCE);
        rootCategory.add(UndefinedLafInfo.INSTANCE);
        rootCategory.add(new SeparatorLafInfo());
        // enumerate system LAFs
        CategoryInfo jdkCategory = new CategoryInfo("JRE", "JRE");
        m_lafList.add(jdkCategory);
        LookAndFeelInfo[] systemLAFs = UIManager.getInstalledLookAndFeels();
        for (int i = 0; i < systemLAFs.length; i++) {
            LookAndFeelInfo laf = systemLAFs[i];
            jdkCategory.add(new LafInfo(laf.getName(), laf.getName(), laf.getClassName()));
        }
        // add LAFs using plugin API
        List<IConfigurationElement> categoryElements = ExternalFactoriesHelper.getElements(EXTERNAL_LAF_POINT, "category");
        for (IConfigurationElement categoryElement : categoryElements) {
            CategoryInfo category;
            if (ROOT_ID.equals(ExternalFactoriesHelper.getRequiredAttribute(categoryElement, "id"))) {
                category = rootCategory;
            } else {
                category = new CategoryInfo(categoryElement);
                m_lafList.add(category);
            }
            for (IConfigurationElement lafElement : categoryElement.getChildren("LookAndFeel")) {
                if (isConditionTrue(lafElement)) {
                    category.add(new PluginLafInfo(lafElement));
                }
            }
        }
        // apply commands
        commands_apply();
    }
}
Also used : SystemLafInfo(org.eclipse.wb.internal.swing.laf.model.SystemLafInfo) PluginLafInfo(org.eclipse.wb.internal.swing.laf.model.PluginLafInfo) AbstractCustomLafInfo(org.eclipse.wb.internal.swing.laf.model.AbstractCustomLafInfo) SeparatorLafInfo(org.eclipse.wb.internal.swing.laf.model.SeparatorLafInfo) UndefinedLafInfo(org.eclipse.wb.internal.swing.laf.model.UndefinedLafInfo) LafInfo(org.eclipse.wb.internal.swing.laf.model.LafInfo) CategoryInfo(org.eclipse.wb.internal.swing.laf.model.CategoryInfo) LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) PluginLafInfo(org.eclipse.wb.internal.swing.laf.model.PluginLafInfo) SeparatorLafInfo(org.eclipse.wb.internal.swing.laf.model.SeparatorLafInfo) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Aggregations

LookAndFeelInfo (javax.swing.UIManager.LookAndFeelInfo)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 AbstractCustomLafInfo (org.eclipse.wb.internal.swing.laf.model.AbstractCustomLafInfo)1 CategoryInfo (org.eclipse.wb.internal.swing.laf.model.CategoryInfo)1 LafInfo (org.eclipse.wb.internal.swing.laf.model.LafInfo)1 PluginLafInfo (org.eclipse.wb.internal.swing.laf.model.PluginLafInfo)1 SeparatorLafInfo (org.eclipse.wb.internal.swing.laf.model.SeparatorLafInfo)1 SystemLafInfo (org.eclipse.wb.internal.swing.laf.model.SystemLafInfo)1 UndefinedLafInfo (org.eclipse.wb.internal.swing.laf.model.UndefinedLafInfo)1