Uploaded image for project: 'XWiki Eclipse'
  1. XWiki Eclipse
  2. XECLIPSE-30

Design improvements and refactoring

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 1.0
    • 1.0 M1
    • None

    Description

      Refactor XEclipse in order to leverage Eclipse platform's features that (...that to some extent, have been re-implemented in XEclipse)

      1) Deferred tree content managers.
      Basically a deferred tree content manager allows you to "fetch" tree children in a deferred way.
      One example is the "SVN Repository" or "CVS Repository" views in your Eclipse IDE. When you expand a node it displays a "Pending..." element
      and, when the fetching job is over, the actual elements (i.e., files and directories available on the repository) are displayed.
      The same mechanism could be used in XEclipse to fetch Spaces and Pages.

      Using the deferred tree content fetching mechanism eliminates the need of having additional logic in XWikiSpace for understanding when pages are ready (i.e., all the code that manages isPagesReady in XWikiSpace.java). You will simply have a method getPages that could take possibly forever and that directly fetches the pages from the XMLRPC source (or from the offline cache).

      I think that this will also have impact on the Decorators that are used to wrap XWiki* elements in order to provide a visual feedback on what's going on (i.e., all the GuiUtils.runOperationWithProgress will be unnecessary since the deferred tree content manager will take care of everything)

      2) Adapters
      There is a TreeAdapter interface that is used for providing labels, children and so on.
      All classes that can be "displayed" in a tree implements this interface (i.e., XWikiConnection, XWikiPage, XWikiSpace).
      I this "pollutes" the model because, for example, getPages and getTreeChildren basically return the same thing and, therefore, are duplicated methods. Moreover in this way we put "GUI"-oriented stuff in the model and this is not good.

      The Eclipse platform has a mechanism for providing adapters that are able to give information about model elements to GUI components[2].
      When you need structural information about an object, you can then query the platform for an adapter that matches a given interface and is suitable for a given object. In our case I can register an adapter for XWikiSpace that implements the getChildren method and that will simply call the getPages method of the XWikiSpace model object.

      In this way we can clearly separate the "GUI" code from the "model" code and leave Eclipse handle the rest.

      Attachments

        Activity

          People

            fmancinelli Fabio Mancinelli
            fmancinelli Fabio Mancinelli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: