Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-ui-dev] [Q] Plugging in th Packages view

Hi,

if you want to adapt the structure from the Java model to a different
structure that
you present in a view then you should implement a custom content provider.

To do what you want to do, you implement a new View that you
compose out of existing parts:

*     use a JFace TreeViewer with a custom content provider. You can
      wrapper the existing ContentProvider so that you can reuse
      it for navigating in the model.
*     use the JavaElementLabelProvider to render the Java items you
      might have to wrapper it so that you can render your Group nodes in
      a custom way
*     use the Java actions to populate your menus

You can then add your new View as a perspective extension to existing Java
perspectives.

The most interesting part of the custom content provider will be the
handling
of notifications since you have to map JavaElementDeltas to your new
structure and the
update the TreeViewer accordingly.

You can do this in a 1.0 compatible way, but you will have to use internal
API. The Java actions are exposed as API since 2.0 only. Also in 1.0
there is no support show/update the error ticks. In 2.0 we are now
providing
decorators as API for adding the error tick adornments.

--erich



                                                                                                                                  
                      "Stefan Buynov"                                                                                             
                      <s_buynov@prosyst         To:      <jdt-ui-dev@xxxxxxxxxxx>                                                 
                      .bg>                      cc:                                                                               
                      Sent by:                  Subject: [jdt-ui-dev] [Q] Plugging in th Packages view                            
                      jdt-ui-dev-admin@                                                                                           
                      eclipse.org                                                                                                 
                                                                                                                                  
                                                                                                                                  
                      05/31/2002 10:44                                                                                            
                      AM                                                                                                          
                      Please respond to                                                                                           
                      jdt-ui-dev                                                                                                  
                                                                                                                                  
                                                                                                                                  



Hi,

I'm not sure if this is the right group for my problem, but I'm giving it a
shot.
I'd like to remark that my view should be R1.0 compatible. I need to make a
view like the Packages view from the JDT plugin, but it must have a
slightly different structure. Down to the IJavaProject level everything is
the same. The resources in the project however, must be grouped as subnodes
of my custom node selectively (as user specifies), and there might be
resources, that are not in my custom treeviewer at all (if they are not
selected in any of the groups). Here is the desired structure:

* Java model (IJavaModel)
    *Java project (IJavaProject)
-->       * Group (IGroup) - this is my custom node
                package fragment root (IPackageFragmentRoot)
                package fragment (IPackageFragment)
                compilation unit (ICompilationUnit)
                binary class file (IClassFile)

Now, I've been trying for awhile to rewrite the original
org.eclipse.jdt.ui.JavaElementContentProvider and implement my structure
with some partial success, but I'm experiencing some nasty difficulties
(SWT/JFace architecture differs quite a lot from AWT/Swing).
I would like to ask you for some suggestions or recommendations for this
task.

Am I doing it the right way (rewriting the JavaElementContentProvider) ? Is
there a mechanism in the Packages view, that I'm missing, for insertion of
custom nodes in the structure ? Did anyone do something familiar to this,
and what was the result?

Any comments or suggestions are very much appreciated.
TIA.

Regards,
Stefan

Take a moment - be inspired.





Back to the top