本文整理匯總了Java中org.eclipse.core.runtime.IExtension類的典型用法代碼示例。如果您正苦於以下問題:Java IExtension類的具體用法?Java IExtension怎麽用?Java IExtension使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IExtension類屬於org.eclipse.core.runtime包,在下文中一共展示了IExtension類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: retrieveLocators
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
/**
* Retrieve all the locators registered with the extension point, and additionally store them in a cache.
*
* @return All locators registered with the extension point.
*/
public List<ILocator> retrieveLocators() {
if (locators == null) {
IExtensionRegistry reg = Platform.getExtensionRegistry();
IExtensionPoint ep = reg.getExtensionPoint("org.eclipse.gemoc.dsl.debug.locator");
IExtension[] extensions = ep.getExtensions();
ArrayList<ILocator> contributors = new ArrayList<ILocator>();
for (int i = 0; i < extensions.length; i++) {
IExtension ext = extensions[i];
IConfigurationElement[] ce = ext.getConfigurationElements();
for (int j = 0; j < ce.length; j++) {
ILocator locator;
try {
locator = (ILocator)ce[j].createExecutableExtension("class");
contributors.add(locator);
} catch (CoreException e) {
e.printStackTrace();
}
}
}
locators = contributors;
}
return locators;
}
示例2: getAvailableCodegenWizards
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
public ElementList getAvailableCodegenWizards() {
ElementList wizards = new ElementList("CodegenWizards"); //$NON-NLS-1$
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(org.eclipse.gemoc.commons.eclipse.pde.Activator.PLUGIN_ID, PLUGIN_POINT);
if (point == null)
return wizards;
IExtension[] extensions = point.getExtensions();
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
if (elements[j].getName().equals(TAG_WIZARD)) {
String targetPluginId = elements[j].getAttribute(WizardElement.ATT_TARGETPLUGINID);
if( targetPluginId == null || targetPluginId.equals(getTargetPluginId())){
WizardElement element = createWizardElement(elements[j]);
if (element != null) {
wizards.add(element);
}
}
}
}
}
return wizards;
}
示例3: initialize
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
/**
* Initializes the extensions map.
*
* @throws CoreException
* if the registry cannot be initialized
*/
public void initialize() {
try {
if (Platform.isRunning()) {
registry.clear();
final IExtension[] extensions = Platform.getExtensionRegistry()
.getExtensionPoint(OCCIE_EXTENSION_POINT).getExtensions();
for (int i = 0; i < extensions.length; i++) {
final IConfigurationElement[] configElements = extensions[i]
.getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
String scheme = configElements[j].getAttribute("scheme"); //$NON-NLS-1$
String uri = "platform:/plugin/" + extensions[i].getContributor().getName() + "/" + configElements[j].getAttribute("file"); //$NON-NLS-1$
registerExtension(scheme, uri);
}
}
}
} catch(NoClassDefFoundError ncdfe) {
LOGGER.info(" Running out of an Eclipse Platform...");
}
}
示例4: removed
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
@Override
public void removed(IExtension[] extensions) {
for (IExtension extension : extensions) {
if (SERVICE_REGISTERY_EXTENSION_POINT.equals(extension.getExtensionPointUniqueIdentifier())) {
for (IConfigurationElement element : extension.getConfigurationElements()) {
if (TOKEN_ELEMENT_NAME.equals(element.getName())) {
final String tokenName = element.getAttribute(SERVICE_TOKEN_ATTR_NAME);
final String bundleName = extension.getContributor().getName();
final List<String> services = new ArrayList<String>();
for (IConfigurationElement child : element.getChildren()) {
final String className = child.getAttribute(SERVICE_CLASS_ATTR_NAME);
services.add(className);
}
ServiceRegistry.INSTANCE.remove(tokenName, bundleName, services);
}
}
}
}
}
示例5: populate
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
private void populate() {
dataProviderActions = new HashMap();
final IExtension[] extensions =
SupportManager.getExtensions(Constants.DATA_PROVIDER_ACTIONS_EXTENSION_POINT_NAME);
for (int i = 0; i < extensions.length; i++) {
final IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
final DataProviderActionInfo dataProviderAction = getDataProviderAction(configElements[j]);
if (dataProviderAction != null) {
if (dataProviderActions.containsKey(dataProviderAction.getID())) {
final String messageFormat = "data provider action [{0}] has been defined multiple times {1}"; //$NON-NLS-1$
final String message = MessageFormat.format(
messageFormat,
dataProviderAction.getID(),
Utils.messageFor(configElements[j], Constants.DATA_PROVIDER_ACTIONS_EXTENSION_POINT_NAME));
SupportManager.log(IStatus.WARNING, message);
}
dataProviderActions.put(dataProviderAction.getID(), dataProviderAction);
}
}
}
}
示例6: populate
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
private void populate() {
categories = new HashMap();
final IExtension[] extensions = SupportManager.getExtensions(Constants.DATA_CATEGORIES_EXTENSION_POINT_NAME);
for (int i = 0; i < extensions.length; i++) {
final IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
final DataCategory dataCategory = getDataCategory(configElements[j]);
if (dataCategory != null) {
if (categories.containsKey(dataCategory.getID())) {
final String messageFormat = "data category [{0}] has been defined multiple times {1}"; //$NON-NLS-1$
final String message = MessageFormat.format(
messageFormat,
dataCategory.getID(),
Utils.messageFor(configElements[j], Constants.DATA_CATEGORIES_EXTENSION_POINT_NAME));
SupportManager.log(IStatus.WARNING, message);
}
categories.put(dataCategory.getID(), dataCategory);
}
}
}
}
示例7: populate
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
private void populate() {
exportHandlers = new HashMap();
final IExtension[] extensions = SupportManager.getExtensions(Constants.EXPORT_HANDLERS_EXTENSION_POINT_NAME);
for (int i = 0; i < extensions.length; i++) {
final IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
final ExportHandlerInfo exportHandler = getExportHandler(configElements[j]);
if (exportHandler != null) {
if (exportHandlers.containsKey(exportHandler.getID())) {
final String messageFormat = "export handler [{0}] has been defined multiple times {1}"; //$NON-NLS-1$
final String message = MessageFormat.format(
messageFormat,
exportHandler.getID(),
Utils.messageFor(configElements[j], Constants.EXPORT_HANDLERS_EXTENSION_POINT_NAME));
SupportManager.log(IStatus.WARNING, message);
}
exportHandlers.put(exportHandler.getID(), exportHandler);
}
}
}
}
示例8: loadUIValidator
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
private IFileModificationValidator loadUIValidator() {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(ID, DEFAULT_FILE_MODIFICATION_VALIDATOR_EXTENSION);
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
if (extensions.length > 0) {
IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
if (configElements.length > 0) {
try {
Object o = configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
if (o instanceof IFileModificationValidator) {
return (IFileModificationValidator)o;
}
} catch (CoreException e) {
SVNProviderPlugin.log(e.getStatus().getSeverity(), e.getMessage(), e);
}
}
}
}
return null;
}
示例9: loadExtensions
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
/**
* plugin.xmlからタグを読み込む.
*
* @throws CoreException
* @throws CoreException
*/
public static List<ExtendPopupMenu> loadExtensions(final ERDiagramEditor editor) throws CoreException {
final List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<ExtendPopupMenu>();
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);
if (extensionPoint != null) {
for (final IExtension extension : extensionPoint.getExtensions()) {
for (final IConfigurationElement configurationElement : extension.getConfigurationElements()) {
final ExtendPopupMenu extendPopupMenu = ExtendPopupMenu.createExtendPopupMenu(configurationElement, editor);
if (extendPopupMenu != null) {
extendPopupMenuList.add(extendPopupMenu);
}
}
}
}
return extendPopupMenuList;
}
示例10: getBookmarkTypes
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
public synchronized List<PluginBookmarkType> getBookmarkTypes() {
if (bookmarkTypes != null) {
return bookmarkTypes;
}
bookmarkTypes = new ArrayList<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
if (extensionPoint == null) {
StatusHelper.logError(MessageFormat.format("no {0} extension point", EXTENSION_POINT), null);
return bookmarkTypes;
}
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
if ("bookmarkType".equals(element.getName())) {
PluginBookmarkType bookmarkType = new PluginBookmarkType(element);
bookmarkTypes.add(bookmarkType);
}
}
}
return bookmarkTypes;
}
示例11: getBookmarkProblemDescriptors
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
private synchronized Map<String, IBookmarkProblemDescriptor> getBookmarkProblemDescriptors() {
if (bookmarkProblemDescriptors != null) {
return bookmarkProblemDescriptors;
}
bookmarkProblemDescriptors = new HashMap<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
if (extensionPoint == null) {
StatusHelper.logError(MessageFormat.format("no {0} extension point", EXTENSION_POINT), null);
return bookmarkProblemDescriptors;
}
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
IBookmarkProblemDescriptor bookmarkProblemDescriptor = getBookmarkProblemDescriptor(element);
if (bookmarkProblemDescriptor != null) {
bookmarkProblemDescriptors.put(bookmarkProblemDescriptor.getProblemType(),
bookmarkProblemDescriptor);
}
}
}
return bookmarkProblemDescriptors;
}
示例12: loadExtensions
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
/**
* plugin.xmlからタグを読み込む.
*
* @throws CoreException
*
* @throws CoreException
*/
public static List<ExtendPopupMenu> loadExtensions(ERDiagramEditor editor)
throws CoreException {
List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<ExtendPopupMenu>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry
.getExtensionPoint(EXTENSION_POINT_ID);
if (extensionPoint != null) {
for (IExtension extension : extensionPoint.getExtensions()) {
for (IConfigurationElement configurationElement : extension
.getConfigurationElements()) {
ExtendPopupMenu extendPopupMenu = ExtendPopupMenu
.createExtendPopupMenu(configurationElement, editor);
if (extendPopupMenu != null) {
extendPopupMenuList.add(extendPopupMenu);
}
}
}
}
return extendPopupMenuList;
}
示例13: getExtensions
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
/**
* Returns proxies for all registered extensions; does not cause the extension plug-ins to be loaded.
* The proxies contain -- and can therefore be queried for -- all the XML attribute values that the
* extensions provide in their <i>plugin.xml</i> file. Throws IllegalArgumentException
* if extension point is unknown
*
* @return array of proxies
*/
public static ValidExtension[] getExtensions() {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_NAME);
if (point == null) {
throw new IllegalArgumentException(MessageFormat.format(UNKNOWN_EXTENSION_POINT, PLUGIN_ID, EXTENSION_POINT_NAME));
}
IExtension[] extensions = point.getExtensions();
List<ValidExtension> found = new ArrayList<ValidExtension>();
for (IExtension e : extensions) {
ValidExtension obj = ValidExtension.parseExtension(e);
if (obj != null) {
found.add(obj);
}
}
return found.toArray(new ValidExtension[found.size()]);
}
示例14: parseExtension
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
/**
* Parses the extension's XML data and returns a proxy that now contains the static (=XML) attribute
* values of the extension.
*
* @param extension
* the extension to parse
* @return <i>null</i> on failure to parse
*/
static ValidExtension parseExtension(final IExtension extension) {
String sid = extension.getSimpleIdentifier();
String name = extension.getLabel();
String id = !Strings.isNullOrEmpty(sid.trim()) ? sid : (!Strings.isNullOrEmpty(name.trim()) ? name : "Unknown"); //$NON-NLS-1$
ValidExtension validExtension = new ValidExtension(extension);
try {
validExtension.getTopLevelElements(); // force parsing of first level of element containment
return validExtension;
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
final String message = MessageFormat.format(FAILED_TO_LOAD_EXTENSION, new Object[] {ValidExtension.class.getSimpleName(), id,
extension.getNamespaceIdentifier()});
AbstractValidElementBase.logException(e, message);
return null;
}
}
示例15: createArchiver
import org.eclipse.core.runtime.IExtension; //導入依賴的package包/類
public ICloudFoundryArchiver createArchiver(CloudFoundryApplicationModule appModule, CloudFoundryServer cloudServer)
throws CoreException {
final String ARCHIVER_DELEGATE = "org.eclipse.cft.server.standalone.core.archiverDelegate"; //$NON-NLS-1$
final String ARCHIVER_ELEMENT = "archiver"; //$NON-NLS-1$
final String CLASS_ATTR = "class"; //$NON-NLS-1$
// At present it just picks the first archiver extension
IExtensionPoint archiverExtnPoint = Platform.getExtensionRegistry().getExtensionPoint(ARCHIVER_DELEGATE);
if (archiverExtnPoint != null) {
for (IExtension extension : archiverExtnPoint.getExtensions()) {
for (IConfigurationElement config : extension.getConfigurationElements()) {
if (ARCHIVER_ELEMENT.equals(config.getName())) {
ICloudFoundryArchiver archiver = (ICloudFoundryArchiver) config
.createExecutableExtension(CLASS_ATTR);
return archiver;
}
}
}
}
throw CloudErrorUtil.toCoreException("Could not locate archivers"); //$NON-NLS-1$
}