当前位置: 首页>>代码示例>>Java>>正文


Java IPluginExtension类代码示例

本文整理汇总了Java中org.eclipse.pde.core.plugin.IPluginExtension的典型用法代码示例。如果您正苦于以下问题:Java IPluginExtension类的具体用法?Java IPluginExtension怎么用?Java IPluginExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IPluginExtension类属于org.eclipse.pde.core.plugin包,在下文中一共展示了IPluginExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateModel

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
@Override
protected void updateModel ( final IProgressMonitor monitor ) throws CoreException
{
    final IPluginModelFactory factory = this.model.getPluginFactory ();
    final IPluginBase plugin = this.model.getPluginBase ();

    // setManifestHeader ( Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME, "OSGI-INF/in10/bundle.properties" );

    final IPluginExtension ext = createExtension ( "org.eclipse.scada.ae.ui.views.configuration", false ); //$NON-NLS-1$
    plugin.add ( ext );

    final IPluginElement menu = createAlarmsMenu ( factory, plugin );

    createMonitorView ( factory, ext, menu, "monitors.not_ok", "All &Alarms" ); //$NON-NLS-1$
    createMonitorView ( factory, ext, menu, "monitors.ack_required", "A&cknowledge required" ); //$NON-NLS-1$
    createMonitorView ( factory, ext, menu, "monitors.not_ok", "Only active alarms" ); //$NON-NLS-1$
    addSeperator ( factory, menu, "separator2" ); //$NON-NLS-1$
    createEventView ( factory, ext, menu, "events.all", "&Latest Events", 20000, "monitors.not_ok" ); //$NON-NLS-1$ //$NON-NLS-3$
    createQueryView ( factory, ext, menu, "eventHistoryView", "Query &Historic Events" ); //$NON-NLS-1$
    createAlarmNotifier ( factory, ext );
    createColumnInformation ( factory, ext, "defaultConfiguration", this.defaultConfigurationConfiguration );//$NON-NLS-1$

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:AEViewSection.java

示例2: createAlarmsMenu

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
protected IPluginElement createAlarmsMenu ( final IPluginModelFactory factory, final IPluginBase plugin ) throws CoreException
{
    final IPluginExtension menuExt = createExtension ( "org.eclipse.ui.menus", false ); //$NON-NLS-1$
    plugin.add ( menuExt );

    final IPluginElement menuEle = factory.createElement ( menuExt );
    menuExt.add ( menuEle );
    menuEle.setName ( "menuContribution" ); //$NON-NLS-1$
    menuEle.setAttribute ( "locationURI", "menu:org.eclipse.ui.main.menu?after=file" ); //$NON-NLS-1$ //$NON-NLS-2$

    final IPluginElement menu = factory.createElement ( menuEle );
    menuEle.add ( menu );
    menu.setName ( "menu" ); //$NON-NLS-1$
    menu.setAttribute ( "label", "Alarms" ); //$NON-NLS-1$

    return menu;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:AEViewSection.java

示例3: createColumnInformation

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
private void createColumnInformation ( final IPluginModelFactory factory, final IPluginExtension ext, final String id, final List<ColumnInformation> configuration ) throws CoreException
{
    final IPluginElement ele = addElement ( factory, ext, "columnInformationDefinition", id );//$NON-NLS-1$

    for ( final ColumnInformation ci : configuration )
    {
        final IPluginElement colEle = factory.createElement ( ele );
        ele.add ( colEle );
        colEle.setName ( "columnInformation" ); //$NON-NLS-1$
        colEle.setAttribute ( "initialSize", String.format ( "%d", ci.getInitialSize () ) ); //$NON-NLS-1$ //$NON-NLS-2$
        colEle.setAttribute ( "sortable", ci.isSortable () ? "true" : "false" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        colEle.setAttribute ( "label", ci.getLabel () ); //$NON-NLS-1$
        colEle.setAttribute ( "type", ci.getType () ); //$NON-NLS-1$
        if ( ci.getParameters () != null )
        {
            for ( final Map.Entry<String, String> entry : ci.getParameters ().entrySet () )
            {
                final IPluginElement colPara = factory.createElement ( colEle );
                colEle.add ( colPara );
                colPara.setName ( "columnParameter" ); //$NON-NLS-1$
                colPara.setAttribute ( "key", entry.getKey () ); //$NON-NLS-1$
                colPara.setAttribute ( "value", entry.getValue () ); //$NON-NLS-1$
            }
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:27,代码来源:AEViewSection.java

示例4: createEventView

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
protected void createEventView ( final IPluginModelFactory factory, final IPluginExtension ext, final IPluginElement menu, final String eventPoolQueryId, final String label, final int size, final String monitorId ) throws CoreException
{
    final IPluginElement ele = factory.createElement ( ext );
    ele.setName ( "eventPoolView" );//$NON-NLS-1$
    ele.setAttribute ( "id", makeId ( eventPoolQueryId ) ); //$NON-NLS-1$
    ele.setAttribute ( "eventPoolQueryId", eventPoolQueryId );
    ele.setAttribute ( "columnInformationDefinition", "defaultConfiguration" ); //$NON-NLS-1$ //$NON-NLS-2$
    ele.setAttribute ( "connectionString", makeConnectionId ( "ae" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    ele.setAttribute ( "connectionType", "ID" ); //$NON-NLS-1$ //$NON-NLS-2$
    ele.setAttribute ( "monitorQueryId", monitorId ); //$NON-NLS-1$
    ele.setAttribute ( "label", clear ( label ) ); //$NON-NLS-1$
    ele.setAttribute ( "maxNumberOfEvents", String.format ( "%d", size ) ); //$NON-NLS-1$ //$NON-NLS-2$
    ext.add ( ele );

    createShowView ( factory, menu, makeId ( eventPoolQueryId ), label, "org.eclipse.scada.ae.ui.views.views.eventpool" );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:AEViewSection.java

示例5: updateModel

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
@Override
protected void updateModel ( final IProgressMonitor monitor ) throws CoreException
{
    final String name = this.name != null ? this.name : getName ();

    final IPluginModelFactory factory = this.model.getPluginFactory ();

    final IPluginExtension ext = createExtension ( "org.eclipse.scada.vi.details.detailView", true ); //$NON-NLS-1$
    if ( !ext.isInTheModel () )
    {
        this.model.getPluginBase ().add ( ext );
    }

    final IPluginElement view = addElement ( factory, ext, "detailView", makeId ( name ) ); //$NON-NLS-1$
    final IPluginElement viewClass = addElement ( factory, view, "class", null ); //$NON-NLS-1$
    viewClass.setAttribute ( "class", "org.eclipse.scada.vi.details.swt.impl.DetailViewImpl" ); //$NON-NLS-1$  //$NON-NLS-2$

    addParameter ( factory, viewClass, "uri", String.format ( "platform:/plugin/%s/%s", this.model.getPluginBase ().getId (), makeViewFileName ( name ) ) ); //$NON-NLS-1$  //$NON-NLS-2$
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:20,代码来源:DetailViewTemplate.java

示例6: createConnections

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
protected void createConnections ( final IPluginModelFactory factory ) throws CoreException
{
    final IPluginExtension ext = factory.createExtension ();
    this.model.getPluginBase ().add ( ext );
    ext.setPoint ( "org.eclipse.scada.core.ui.connection.login.context" ); //$NON-NLS-1$

    final IPluginElement context = addElement ( factory, ext, "context", makeId ( getHostname () ) ); //$NON-NLS-1$
    context.setAttribute ( "label", getContextLabel () ); //$NON-NLS-1$

    final IPluginElement fac = addElement ( factory, context, "factory", null ); //$NON-NLS-1$
    fac.setAttribute ( "class", "org.eclipse.scada.core.ui.connection.login.factory.ConnectionLoginFactory" );

    createConnection ( factory, context, "da", "NORMAL" ); //$NON-NLS-1$
    createConnection ( factory, context, "ae", "NORMAL" ); //$NON-NLS-1$
    createConnection ( factory, context, "hd", "OPTIONAL" ); //$NON-NLS-1$
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:ConnectionContextTemplate.java

示例7: testAddElement

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Tests, if the marker help extension is updated correctly, i.e. add marker help elements for new checks
 * and delete the elements of removed checks.
 *
 * @throws Exception
 *           the exception
 */
@Test
public void testAddElement() throws Exception {
  final CheckCatalog catalogWithOneCheck = parser.parse(CATALOG_WITH_FIRST_CHECK_LIVE);
  IPluginExtension extension = createMarkerHelpExtension(catalogWithOneCheck);

  assertEquals("Original catalog has one marker help extension", 1, extension.getChildCount());

  CheckCatalog catalogWithTwoChecks = parser.parse(CATALOG_WITH_TWO_CHECKS);
  markerUtil.updateExtension(catalogWithTwoChecks, extension);

  Set<String> contextIds = Sets.newHashSet();
  // Test if the marker help element for the old Check has been removed
  for (IPluginObject element : extension.getChildren()) {
    contextIds.add(((IPluginElement) element).getAttribute(CheckMarkerHelpExtensionHelper.CONTEXT_ID_ATTRIBUTE_TAG).getValue());
  }
  assertEquals("The extension has two elements", 2, extension.getChildCount());
  assertTrue("Both checks are elements of the extension ", contextIds.containsAll(Sets.newHashSet(FIRSTCHECK_CONTEXID, SECONDCHECK_CONTEXTID)));
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:26,代码来源:CheckMarkerHelpExtensionTest.java

示例8: testCheckHasTwoIssueCodes

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Tests if a marker help element is added if an additional issueCode is added to an existing check.
 *
 * @throws Exception
 *           the exception
 */
@Test
public void testCheckHasTwoIssueCodes() throws Exception {
  IPluginExtension extension = createMarkerHelpExtension(parser.parse(CATALOG_WITH_FIRST_CHECK_LIVE));

  CheckCatalog twoIssueCodes = parser.parse(CATALOG_CHECK_HAS_TWO_ISSUECODES);
  markerUtil.updateExtension(twoIssueCodes, extension);

  List<String> issueCodesOfCheck = Lists.newArrayList();
  for (final XIssueExpression i : generatorExtension.issues(twoIssueCodes.getChecks().get(0))) {
    issueCodesOfCheck.add(CheckGeneratorExtensions.issueCodeValue(twoIssueCodes.getChecks().get(0), CheckGeneratorExtensions.issueCode(i)));
  }
  List<String> issueCodesInExtension = Lists.newArrayList();
  for (IPluginObject obj : extension.getChildren()) {
    for (IPluginObject element : ((IPluginElement) obj).getChildren()) {
      issueCodesInExtension.add(((IPluginElement) element).getAttribute(CheckMarkerHelpExtensionHelper.ATTRIBUTE_VALUE_TAG).getValue());
    }
  }
  assertTrue("A marker help element for both issueCodes has been created.", Iterables.elementsEqual(issueCodesInExtension, issueCodesOfCheck));
  assertEquals("extension has two marker help elements", 2, issueCodesInExtension.size());
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:27,代码来源:CheckMarkerHelpExtensionTest.java

示例9: doUpdateExtension

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
@Override
protected void doUpdateExtension(final CheckCatalog catalog, final IPluginExtension extension, final Iterable<IPluginElement> elements) throws CoreException {
  final IQualifiedNameProvider nameProvider = getFromServiceProvider(IQualifiedNameProvider.class, catalog);

  // Get current marker help element context IDs for this catalog
  List<String> catalogContextIds = Lists.newArrayList();
  for (final Check check : catalog.getAllChecks()) {
    catalogContextIds.add(getQualifiedContextId(extension, check));
  }

  // Remove elements of this catalog
  for (IPluginElement e : elements) {
    if (e.getAttribute(CONTEXT_ID_ATTRIBUTE_TAG) != null) {
      String contextId = e.getAttribute(CONTEXT_ID_ATTRIBUTE_TAG).getValue();
      if (isCatalogContextId(nameProvider.apply(catalog), EcoreUtil.getURI(catalog), extension, contextId)) {
        extension.remove(e);
      }
    }
  }

  // Add new elements
  Iterable<? extends IPluginObject> updatedElements = getElements(catalog, extension);
  for (IPluginObject object : updatedElements) {
    extension.add(object);
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:27,代码来源:CheckMarkerHelpExtensionHelper.java

示例10: getElements

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Creates a marker help element for every check in the catalog. The new elements are added to the given extension.
 *
 * @param catalog
 *          the catalog
 * @param extension
 *          the extension to add the new element to
 * @return new marker help elements in given extension which don't exist yet, but should; returns an empty list if the extension is up to date
 * @throws CoreException
 *           the core exception
 */
@Override
public Iterable<IPluginElement> getElements(final CheckCatalog catalog, final IPluginExtension extension) throws CoreException {
  List<IPluginElement> result = Lists.newArrayList();

  Multimap<String, String> contextIdToAttributeValues = HashMultimap.<String, String> create();
  for (Check check : catalog.getAllChecks()) {
    final String contextId = getQualifiedContextId(extension, check);
    for (String issueCode : getIssueCodeValues(check)) {
      if (!contextIdToAttributeValues.get(contextId).contains(issueCode)) {
        contextIdToAttributeValues.put(contextId, issueCode);
        IPluginElement markerHelp = createMarkerHelpElement(extension, check, contextId);
        markerHelp.add(createAttributeElement(markerHelp, issueCode));
        result.add(markerHelp);
      }
    }
  }

  return result;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:31,代码来源:CheckMarkerHelpExtensionHelper.java

示例11: createExtension

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Creates the extension. Note that the <code>id</code> attribute is optional and thus not created.
 *
 * @param catalog
 *          the catalog for which to crate the extension content.
 * @param extensionId
 *          the extension id, may be <code>null</code>
 * @param pluginModel
 *          the model
 * @return the plugin extension
 * @throws CoreException
 *           a core exception
 */
protected IPluginExtension createExtension(final CheckCatalog catalog, final String extensionId, final IPluginModelBase pluginModel) throws CoreException {
  IPluginExtension newExtension = pluginModel.getFactory().createExtension();

  newExtension.setPoint(getExtensionPointId());
  if (extensionId != null) {
    newExtension.setId(extensionId);
  }
  if (getExtensionPointName(catalog) != null) {
    newExtension.setName(getExtensionPointName(catalog));
  }

  // Add contents to the extension
  for (final IPluginObject p : getElements(catalog, newExtension)) {
    newExtension.add(p);
  }

  return newExtension;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:32,代码来源:AbstractCheckExtensionHelper.java

示例12: getExtensionType

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Returns the {@link ExtensionType} for a given plugin extension.
 *
 * @param extension
 *          the extension
 * @return the extension type
 */
private ExtensionType getExtensionType(final IPluginExtension extension) {
  String point = extension.getPoint();
  if (point.equals(CheckValidatorExtensionHelper.CHECK_EXTENSION_POINT_ID)) {
    return ExtensionType.VALIDATOR;
  } else if (point.equals(CheckPreferencesExtensionHelper.PREFERENCES_EXTENSION_POINT_ID)) {
    return ExtensionType.PREFERENCE_INITIALIZER;
  } else if (point.equals(CheckQuickfixExtensionHelper.QUICKFIX_EXTENSION_POINT_ID)) {
    return ExtensionType.QUICKFIX;
  } else if (point.equals(CheckTocExtensionHelper.TOC_EXTENSION_POINT_ID)) {
    return ExtensionType.TOC;
  } else if (point.equals(CheckContextsExtensionHelper.CONTEXTS_EXTENSION_POINT_ID)) {
    return ExtensionType.CONTEXTS;
  } else if (point.equals(CheckMarkerHelpExtensionHelper.MARKERHELP_EXTENSION_POINT_ID)) {
    return ExtensionType.MARKERHELP;
  }
  return null;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:25,代码来源:CheckExtensionHelperManager.java

示例13: findExtensions

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Finds extensions of given {@link ExtensionType extension type} in given {@link IPluginModelBase plugin model}.
 * If {@code type} is {@link ExtensionType#ALL}, all extensions which may be mapped to {@link ExtensionType} are
 * returned. (They must have an ID pattern as defined in {@link #getExtensionId(CheckCatalog, ExtensionType)}).
 *
 * @param pluginModel
 *          the plugin in which to find the extensions
 * @param catalogName
 *          qualified catalog name
 * @param type
 *          the extension type to be looked up
 * @return a collection of extensions in the plugin.xml that match given extension type
 */
private Collection<IPluginExtension> findExtensions(final IPluginModelBase pluginModel, final QualifiedName catalogName, final ExtensionType type) {
  IPluginExtension[] pluginExtensions = pluginModel.getPluginBase().getExtensions();
  final String extensionId = getExtensionId(catalogName, type);
  final String point = getExtensionHelper(type) == null ? null : getExtensionHelper(type).getExtensionPointId();

  return Collections2.filter(Arrays.asList(pluginExtensions), new Predicate<IPluginExtension>() {
    @Override
    public boolean apply(final IPluginExtension extension) {
      final String currentExtensionId = extension.getId();
      if (type == ExtensionType.ALL) {
        if (currentExtensionId == null) {
          return getAllExtensionPointIds().contains(extension.getPoint());
        } else {
          final int pos = currentExtensionId.lastIndexOf('.');
          return pos != -1 && getAllExtensionPointIds().contains(extension.getPoint()) && Strings.equal(currentExtensionId.substring(0, pos), extensionId);
        }
      } else {
        return Strings.equal(currentExtensionId, extensionId) && Strings.equal(extension.getPoint(), point);
      }
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:36,代码来源:CheckExtensionHelperManager.java

示例14: updateExtensions

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Update check catalog extensions if necessary.
 *
 * @param catalog
 *          the catalog
 * @param pluginModel
 *          the plugin model
 * @param monitor
 *          the monitor
 * @throws CoreException
 *           the core exception
 */
public void updateExtensions(final CheckCatalog catalog, final IPluginModelBase pluginModel, final IProgressMonitor monitor) throws CoreException {
  QualifiedName catalogName = nameProvider.apply(catalog);
  Collection<IPluginExtension> catalogExtensions = findExtensions(pluginModel, catalogName, ExtensionType.ALL);

  // Update extensions as appropriate
  for (IPluginExtension extension : catalogExtensions) {
    if (!hasGrammar(catalog)) {
      pluginModel.getPluginBase().remove(extension); // no extensions for Catalogs without valid grammar
      continue; // nothing more to do if no grammar is available
    } else {
      for (ICheckExtensionHelper helper : getExtensionHelpers()) { // TODO getExtensionHelper using extension.getPoint() would make this more efficient
        helper.updateExtension(catalog, extension);
      }
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:29,代码来源:CheckExtensionHelperManager.java

示例15: addExtensions

import org.eclipse.pde.core.plugin.IPluginExtension; //导入依赖的package包/类
/**
 * Add check catalog extensions if not already existing.
 *
 * @param catalog
 *          the catalog
 * @param pluginModel
 *          the plugin model
 * @param monitor
 *          the monitor
 * @throws CoreException
 *           the core exception
 */
public void addExtensions(final CheckCatalog catalog, final IPluginModelBase pluginModel, final IProgressMonitor monitor) throws CoreException {
  QualifiedName catalogName = nameProvider.apply(catalog);
  Collection<IPluginExtension> catalogExtensions = findExtensions(pluginModel, catalogName, ExtensionType.ALL);
  Iterable<ExtensionType> registeredExtensionTypes = findExtensionTypes(catalogExtensions);

  if (hasGrammar(catalog)) {
    for (ExtensionType type : ExtensionType.values()) {
      ICheckExtensionHelper helper = getExtensionHelper(type);
      if (helper == null) {
        continue;
      }
      if (!Iterables.contains(registeredExtensionTypes, type)) {
        helper.addExtensionToPluginBase(pluginModel, catalog, type, getExtensionId(nameProvider.apply(catalog), type));
      }
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:30,代码来源:CheckExtensionHelperManager.java


注:本文中的org.eclipse.pde.core.plugin.IPluginExtension类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。