private static void initializeClientContextIDs() {
    registeredClientContextIds = new java.util.HashSet<String>();

    IExtensionPoint extPoint =
        Platform.getExtensionRegistry().getExtensionPoint(EP_UI_REGISTERED_CLIENT_CONTEXTS);

    for (IExtension extension : extPoint.getExtensions()) {
      for (IConfigurationElement next : extension.getConfigurationElements()) {

        registeredClientContextIds.add(next.getAttribute(A_ID));
      }
    }

    IExtensionTracker extTracker = ValidationUIPlugin.getExtensionTracker();

    if (extTracker != null) {
      IExtensionChangeHandler extensionHandler =
          new IExtensionChangeHandler() {

            public void addExtension(IExtensionTracker tracker, IExtension extension) {

              addClientContextIDs(extension.getConfigurationElements());
            }

            public void removeExtension(IExtension extension, Object[] objects) {
              // client-context IDs cannot be undefined
            }
          };

      extTracker.registerHandler(
          extensionHandler, ExtensionTracker.createExtensionPointFilter(extPoint));
    }
  }
 /** Private constructor. */
 private KeywordRegistry() {
   IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
   tracker.registerHandler(
       this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
   IExtension[] extensions = getExtensionPointFilter().getExtensions();
   for (int i = 0; i < extensions.length; i++) {
     addExtension(PlatformUI.getWorkbench().getExtensionTracker(), extensions[i]);
   }
 }
Exemple #3
0
 /**
  * Adds a working set descriptor.
  *
  * @param descriptor working set descriptor to add. Must not exist in the registry yet.
  */
 public void addWorkingSetDescriptor(WorkingSetDescriptor descriptor) {
   Assert.isTrue(
       !workingSetDescriptors.containsValue(descriptor),
       "working set descriptor already registered"); //$NON-NLS-1$
   IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
   tracker.registerObject(
       descriptor.getConfigurationElement().getDeclaringExtension(),
       descriptor,
       IExtensionTracker.REF_WEAK);
   workingSetDescriptors.put(descriptor.getId(), descriptor);
 }
 /** Constructs a new contributor manager. */
 public ObjectContributorManager() {
   contributors = new Hashtable(5);
   contributorRecordSet = new HashSet(5);
   objectLookup = null;
   resourceAdapterLookup = null;
   adaptableLookup = null;
   if (canHandleExtensionTracking()) {
     IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
     tracker.registerHandler(this, null);
   }
 }
  public TriggerPointManager() {
    super();
    triggerMap.put(
        ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID,
        new AbstractTriggerPoint() {

          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.activities.ITriggerPoint#getId()
           */
          public String getId() {
            return ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID;
          }

          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.activities.ITriggerPoint#getStringHint(java.lang.String)
           */
          public String getStringHint(String key) {
            if (ITriggerPoint.HINT_INTERACTIVE.equals(key)) {
              // TODO: change to false when we have mapped our
              // trigger points
              return Boolean.TRUE.toString();
            }
            return null;
          }

          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.activities.ITriggerPoint#getBooleanHint(java.lang.String)
           */
          public boolean getBooleanHint(String key) {
            if (ITriggerPoint.HINT_INTERACTIVE.equals(key)) {
              // TODO: change to false when we have mapped our
              // trigger points
              return true;
            }
            return false;
          }
        });
    IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
    tracker.registerHandler(
        this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));

    IExtensionPoint point = getExtensionPointFilter();
    IExtension[] extensions = point.getExtensions();
    for (int i = 0; i < extensions.length; i++) {
      addExtension(tracker, extensions[i]);
    }
  }
 @Override
 public void addExtension(IExtensionTracker tracker, IExtension extension) {
   IConfigurationElement[] elements = extension.getConfigurationElements();
   for (int i = 0; i < elements.length; i++) {
     IConfigurationElement element = elements[i];
     if (element.getName().equals(tag)) {
       String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
       String file = element.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
       if (file == null || id == null) {
         Persistence.log(
             element,
             Persistence.ACTIVITY_IMAGE_BINDING_DESC,
             "definition must contain icon and ID"); //$NON-NLS-1$
         continue; // ignore - malformed
       }
       if (registry.getDescriptor(id) == null) { // first come, first serve
         ImageDescriptor descriptor =
             AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespace(), file);
         if (descriptor != null) {
           registry.put(id, descriptor);
           tracker.registerObject(extension, id, IExtensionTracker.REF_WEAK);
         }
       }
     }
   }
 }
 @Override
 public void addExtension(final IExtensionTracker tracker, final IExtension extension) {
   final IConfigurationElement[] configs = extension.getConfigurationElements();
   for (final IConfigurationElement element : configs) {
     final IPortTemplateDesc desc = addConfig(element);
     if (desc != null) {
       tracker.registerObject(extension, desc, IExtensionTracker.REF_SOFT);
     }
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.core.runtime.dynamicHelpers.IExtensionAdditionHandler#addInstance(org.eclipse.core.runtime.dynamicHelpers.IExtensionTracker,
  *      org.eclipse.core.runtime.IExtension)
  */
 public void addExtension(IExtensionTracker tracker, IExtension extension) {
   IConfigurationElement[] elements = extension.getConfigurationElements();
   for (int i = 0; i < elements.length; i++) {
     IConfigurationElement element = elements[i];
     if (element.getName().equals(IWorkbenchRegistryConstants.TAG_TRIGGERPOINT)) {
       String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
       if (id == null) {
         continue;
       }
       RegistryTriggerPoint triggerPoint = new RegistryTriggerPoint(id, element);
       triggerMap.put(id, triggerPoint);
       tracker.registerObject(extension, triggerPoint, IExtensionTracker.REF_WEAK);
     }
   }
 }
Exemple #9
0
 public WorkingSetRegistry() {
   IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
   tracker.registerHandler(
       this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
 }