Search in sources :

Example 1 with IBranchNameProvider

use of org.eclipse.egit.ui.IBranchNameProvider in project egit by eclipse.

the class CreateBranchPage method getBranchNameProvider.

private IBranchNameProvider getBranchNameProvider() {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IConfigurationElement[] config = registry.getConfigurationElementsFor(BRANCH_NAME_PROVIDER_ID);
    if (config.length > 0) {
        Object provider;
        try {
            // $NON-NLS-1$
            provider = config[0].createExecutableExtension("class");
            if (provider instanceof IBranchNameProvider)
                return (IBranchNameProvider) provider;
        } catch (Throwable e) {
            Activator.logError(UIText.CreateBranchPage_CreateBranchNameProviderFailed, e);
        }
    }
    return null;
}
Also used : IBranchNameProvider(org.eclipse.egit.ui.IBranchNameProvider) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Example 2 with IBranchNameProvider

use of org.eclipse.egit.ui.IBranchNameProvider in project egit by eclipse.

the class CreateBranchPage method getBranchNameSuggestionFromProvider.

private String getBranchNameSuggestionFromProvider() {
    final AtomicReference<String> ref = new AtomicReference<>();
    final IBranchNameProvider branchNameProvider = getBranchNameProvider();
    if (branchNameProvider != null)
        SafeRunner.run(new SafeRunnable() {

            @Override
            public void run() throws Exception {
                ref.set(branchNameProvider.getBranchNameSuggestion());
            }
        });
    return ref.get();
}
Also used : SafeRunnable(org.eclipse.jface.util.SafeRunnable) IBranchNameProvider(org.eclipse.egit.ui.IBranchNameProvider) AtomicReference(java.util.concurrent.atomic.AtomicReference)

Aggregations

IBranchNameProvider (org.eclipse.egit.ui.IBranchNameProvider)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)1 SafeRunnable (org.eclipse.jface.util.SafeRunnable)1