Search in sources :

Example 1 with ReferenceProviderDescriptor

use of org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor in project eclipse.platform.text by eclipse.

the class QuickDiffExtensionsRegistry method reloadExtensions.

/**
 * Reads all extensions.
 * <p>
 * This method can be called more than once in
 * order to reload from a changed extension registry.
 * </p>
 */
public synchronized void reloadExtensions() {
    fDefaultDescriptor = null;
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    List<ReferenceProviderDescriptor> list = new ArrayList<>();
    IConfigurationElement[] elements = registry.getConfigurationElementsFor(TextEditorPlugin.PLUGIN_ID, TextEditorPlugin.REFERENCE_PROVIDER_EXTENSION_POINT);
    for (int i = 0; i < elements.length; i++) {
        ReferenceProviderDescriptor desc = new ReferenceProviderDescriptor(elements[i]);
        if (// $NON-NLS-1$
        desc.getId().equals("org.eclipse.ui.internal.editors.quickdiff.LastSaveReferenceProvider"))
            fDefaultDescriptor = desc;
        list.add(desc);
    }
    // make sure the default is the first one in the list
    if (fDefaultDescriptor != null) {
        list.remove(fDefaultDescriptor);
        list.add(0, fDefaultDescriptor);
    }
    fDescriptors = Collections.unmodifiableList(list);
}
Also used : ReferenceProviderDescriptor(org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor) ArrayList(java.util.ArrayList) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 2 with ReferenceProviderDescriptor

use of org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor in project eclipse.platform.text by eclipse.

the class QuickDiffConfigurationBlock method createQuickDiffReferenceListModel.

private String[][] createQuickDiffReferenceListModel() {
    List<ReferenceProviderDescriptor> descriptors = new QuickDiff().getReferenceProviderDescriptors();
    ArrayList<String[]> listModelItems = new ArrayList<>();
    for (Iterator<ReferenceProviderDescriptor> it = descriptors.iterator(); it.hasNext(); ) {
        ReferenceProviderDescriptor descriptor = it.next();
        String label = LegacyActionTools.removeMnemonics(descriptor.getLabel());
        listModelItems.add(new String[] { descriptor.getId(), label });
    }
    String[][] items = new String[listModelItems.size()][];
    listModelItems.toArray(items);
    return items;
}
Also used : ReferenceProviderDescriptor(org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor) QuickDiff(org.eclipse.ui.texteditor.quickdiff.QuickDiff) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 ReferenceProviderDescriptor (org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)1 QuickDiff (org.eclipse.ui.texteditor.quickdiff.QuickDiff)1