Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Platform - User Assistance (UA) » Usage of AbstractContentExtensionProvider and IHelpContentProducer together
Usage of AbstractContentExtensionProvider and IHelpContentProducer together [message #730008] Tue, 27 September 2011 13:20 Go to next message
Riccardo Missing name is currently offline Riccardo Missing name
Messages: 9
Registered: September 2011
Junior Member
I try to provide help content for a complex application and the content of the help is highly dynamic and a mix off static pages, extensions, replacements and dynamicly created content. For this reason I use my own implementations of AbstractTocProvider, AbstractContentExtensionProvider and IHelpContentProducer which are registered via the corresponding extension points.

My problem is, that I need to create the content of a content extensions (IContentExtensions created by an AbstractContentExtensionProvider) dynamicly via a IHelpContentProducer, but my content producer is not ask for the content of the content extensions.

I know, that content producers are registered per plug-in and only work within the plug-in scope. Therefore I use a binding and the producer is called for help pages but not for content extensions.

So, I am not sure what I am doing wrong and thankful for any help.
Re: Usage of AbstractContentExtensionProvider and IHelpContentProducer together [message #730084 is a reply to message #730008] Tue, 27 September 2011 15:29 Go to previous messageGo to next message
Riccardo Missing name is currently offline Riccardo Missing name
Messages: 9
Registered: September 2011
Junior Member
I did some tests and debugging with the following setup:

A plugin "pluginA" which provides a simple help page "myTopic.xhtml" and plugin "pluginB" which contributes a replacement for an element with the id "elementId" in "myTopic.xhtml". The contribtion is provited via the extension point "org.eclipse.help.contentExtension"

<extension point="org.eclipse.help.contentExtension">
  <contentExtension
     file="extension.xml">
  </contentExtension>
</extension>


and the "extension.xml" looks like follows

<?xml version="1.0" encoding="UTF-8"?>
<contentExtension>
  <replacement
    content="replacement.xhtml#newElement"
    path="/pluginA/myTopic.xhtml#elementId">
  </replacement>
</contentExtension>


With this setup everything works as expected and after that I switcht to an implematation of AbstractContentExtensionProvider. So I changed the "org.eclipse.help.contentExtension" to

<extension point="org.eclipse.help.contentExtension">
  <contentExtensionProvider
    class="pluginB.provider.MyContentExtensionProvider">
  </contentExtensionProvider>
</extension>


The implementation of "MyContentExtensionProvider" is simple and returns the same values as defined in the "extension.xml".

public class MyContentExtensionProvider extends AbstractContentExtensionProvider {
  @Override
  public IContentExtension[] getContentExtensions(String locale) {
    return new IContentExtension[] { createExtension() };
  }

  private IContentExtension createExtension() {
    return new IContentExtension() {
      @Override
      public boolean isEnabled(IEvaluationContext context) {
        return true;
      }

      @Override
      public IUAElement[] getChildren() {
        return new IUAElement[0];
      }

      @Override
      public String getContent() {
        return "replacement.xhtml#newElement";
      }

      @Override
      public String getPath() {
        return "/pluginA/myTopic.xhtml#elementId";
      }

      @Override
      public int getType() {
        return REPLACEMENT;
      }
    };
  }
}


With this changes the replacement does not work anymore and after debugging i found out, that "getContent()" must return "/pluginB/replacement.xhtml#newElement" in order to work as expected.

I am not sure if i missed something in the API documentation, if the documentation with the example is not correct or if this is a bug.
Re: Usage of AbstractContentExtensionProvider and IHelpContentProducer together [message #730712 is a reply to message #730084] Thu, 29 September 2011 00:21 Go to previous message
Chris Goldthorpe is currently offline Chris Goldthorpe
Messages: 815
Registered: July 2009
Senior Member
I see what you mean, I just modified a testcase in org.eclipse.ua.tests and saw exactly the same thing. It appears that the code which handles ContentExtensionProvider extensions expects a fully qualified path. Changing the API documentation makes the most sense I think at this stage.
Previous Topic:Implementing org.eclipse.ui.cheatsheets.cheatSheetItemExtension
Next Topic:Error Message
Goto Forum:
  


Current Time: Tue Sep 23 18:31:12 GMT 2014

Powered by FUDForum. Page generated in 0.01537 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software