Search in sources :

Example 6 with IExtension

use of org.eclipse.core.runtime.IExtension in project tdi-studio-se by Talend.

the class JavaJobScriptsExportWSWizardPagePresenter method initExtraCheckersFromExtensionPoint.

/**
	 * Inits the extra checkers from plugin extension
	 * <code>org.talend.repository.ui.wizards.exportjob.extraBuildChecker</code>
	 */
private void initExtraCheckersFromExtensionPoint() {
    IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_EXTRA_BUILD_CHECKER).getExtensions();
    for (IExtension extension : extensions) {
        IConfigurationElement[] eles = extension.getConfigurationElements();
        for (IConfigurationElement ele : eles) {
            try {
                ExtraBuildChecker checker = (ExtraBuildChecker) ele.createExecutableExtension(EXTRA_BUILD_CHECKER);
                addExtraChecker(checker);
            } catch (CoreException e) {
                ExceptionHandler.process(new RuntimeException("Can't load extra Job Build checker - " + ele, e));
            }
        }
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) ExtraBuildChecker(org.talend.repository.ui.wizards.exportjob.extrachecker.ExtraBuildChecker) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 7 with IExtension

use of org.eclipse.core.runtime.IExtension in project translationstudio8 by heartsome.

the class SelfHelpDisplay method createHelpDisplay.

private static void createHelpDisplay() {
    IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(HELP_DISPLAY_EXTENSION_ID);
    if (point != null) {
        IExtension[] extensions = point.getExtensions();
        if (extensions.length != 0) {
            // We need to pick up the non-default configuration
            IConfigurationElement[] elements = extensions[0].getConfigurationElements();
            if (elements.length == 0)
                return;
            IConfigurationElement displayElement = elements[0];
            // Instantiate the help display
            try {
                helpDisplay = (AbstractHelpDisplay) (displayElement.createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE));
            } catch (CoreException e) {
                HelpBasePlugin.logStatus(e.getStatus());
            }
        }
    }
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 8 with IExtension

use of org.eclipse.core.runtime.IExtension in project translationstudio8 by heartsome.

the class ApplicationActionBarAdvisor method removeUnusedAction.

/**
	 * 移除无用的菜单项:<br/>
	 * File 菜单下的“open file...”和“Convert Line Delimiters To”
	 */
private void removeUnusedAction() {
    ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
    IActionSetDescriptor[] actionSets = reg.getActionSets();
    List<String> actionSetIds = Arrays.asList("org.eclipse.ui.actionSet.openFiles", "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo", "org.eclipse.ui.actions.showKeyAssistHandler");
    for (int i = 0; i < actionSets.length; i++) {
        if (actionSetIds.contains(actionSets[i].getId())) {
            IExtension ext = actionSets[i].getConfigurationElement().getDeclaringExtension();
            reg.removeExtension(ext, new Object[] { actionSets[i] });
        }
    }
}
Also used : ActionSetRegistry(org.eclipse.ui.internal.registry.ActionSetRegistry) IExtension(org.eclipse.core.runtime.IExtension) IActionSetDescriptor(org.eclipse.ui.internal.registry.IActionSetDescriptor)

Example 9 with IExtension

use of org.eclipse.core.runtime.IExtension in project dbeaver by serge-rider.

the class ApplicationActionBarAdvisor method removeUnWantedActions.

private void removeUnWantedActions() {
    ActionSetRegistry asr = WorkbenchPlugin.getDefault().getActionSetRegistry();
    IActionSetDescriptor[] actionSets = asr.getActionSets();
    for (IActionSetDescriptor actionSet : actionSets) {
        for (String element : actionSetId) {
            if (element.equals(actionSet.getId())) {
                log.debug("Disable Eclipse action set '" + actionSet.getId() + "'");
                IExtension ext = actionSet.getConfigurationElement().getDeclaringExtension();
                asr.removeExtension(ext, new Object[] { actionSet });
            }
        }
    }
}
Also used : ActionSetRegistry(org.eclipse.ui.internal.registry.ActionSetRegistry) IExtension(org.eclipse.core.runtime.IExtension) IActionSetDescriptor(org.eclipse.ui.internal.registry.IActionSetDescriptor)

Example 10 with IExtension

use of org.eclipse.core.runtime.IExtension in project tdi-studio-se by Talend.

the class ComponentsProviderManager method loadComponentsProvidersFromExtension.

private void loadComponentsProvidersFromExtension() {
    if (providers == null) {
        providers = new ArrayList<AbstractComponentsProvider>();
        IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
        //$NON-NLS-1$
        IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("org.talend.core.components_provider");
        IExtension[] extensions = extensionPoint.getExtensions();
        for (IExtension extension : extensions) {
            IConfigurationElement[] configurationElements = extension.getConfigurationElements();
            for (IConfigurationElement configurationElement : configurationElements) {
                //$NON-NLS-1$
                String id = configurationElement.getAttribute("id");
                //$NON-NLS-1$
                String folderName = configurationElement.getAttribute("folderName");
                String contributerName = configurationElement.getContributor().getName();
                IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
                if (!brandingService.isPoweredOnlyCamel() && id.equals("org.talend.designer.camel.components.localprovider.CamelLocalComponentsProvider")) {
                    folderName = "camel";
                }
                try {
                    AbstractComponentsProvider componentsProvider = (AbstractComponentsProvider) configurationElement.createExecutableExtension(//$NON-NLS-1$
                    "class");
                    componentsProvider.setId(id);
                    componentsProvider.setFolderName(folderName);
                    componentsProvider.setContributer(contributerName);
                    providers.add(componentsProvider);
                } catch (CoreException e) {
                    //$NON-NLS-1$
                    log.error("unable to load component provider" + id, e);
                }
            }
        }
    }
}
Also used : AbstractComponentsProvider(org.talend.core.model.components.AbstractComponentsProvider) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) IBrandingService(org.talend.core.ui.branding.IBrandingService) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Aggregations

IExtension (org.eclipse.core.runtime.IExtension)15 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)12 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)12 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)10 CoreException (org.eclipse.core.runtime.CoreException)8 ActionSetRegistry (org.eclipse.ui.internal.registry.ActionSetRegistry)2 IActionSetDescriptor (org.eclipse.ui.internal.registry.IActionSetDescriptor)2 AbstractComponentsProvider (org.talend.core.model.components.AbstractComponentsProvider)2 IBrandingService (org.talend.core.ui.branding.IBrandingService)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 InvalidRegistryObjectException (org.eclipse.core.runtime.InvalidRegistryObjectException)1 PluginVersionInfo (org.eclipse.help.internal.search.PluginVersionInfo)1 IAction (org.eclipse.jface.action.IAction)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1