Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] IModelProviderEvent structure, methods and use?

Kiril,

      Since I put the ModelProviderListener and ModelEvent stuff together,
let me try to answer your questions.  (And, I am more than happy to work
with you to get these sorts of changes into WTP 3.0.  I am moreso hesitant
about putting these sorts of changes into 2.0.x because of their nature.)

1.  The only reason I can see as to why we shouldn't change the parameter
to be <? extends Object> instead of <Object> is your point #4.  (In other
words, we should add a parameter to the constructor that is <? extends
Object>, and remove the addResources from the interface.

2.  This is just a semantic change.  And I don't believe that the benefit
outweighs the cost of changing such an API.  One can easily argue that a
resource has changed if it has been modified, added, or removed from the
model.,

3.  As with bug 217418, I agree.  When I coded this, I stored the changed
objects in a List, so I set the return type to be a List.  I should have
made it agree with addResources() and made it a Collection.

4. Once again, I agree.  I used the set* and add* methods to fill in the
information that I wanted to send, adding methods instead of constructor
parameters, which made it easier to change things around on the class as I
put it together.  I should have switched them all to constructor parameters
once I had finalized the desired objects for the event.  (And you will note
that Chuck tweaked some of these later from generic calls to specific
calls... but I think we have pretty much finalized the desired parameters
now.)

Other than item #2, please feel free to open enhancements and submit
patches.  (I would prefer it if you deprecate the interface's add* and set*
methods, giving adopters this release to get off of them.)

FWIW,

- Carl Anderson
WTP programmer



                                                                           
             "Mitov, Kiril"                                                
             <k.mitov@xxxxxxx>                                             
             Sent by:                                                   To 
             wtp-dev-bounces@e         "General discussion of project-wide 
             clipse.org                or architectural issues."           
                                       <wtp-dev@xxxxxxxxxxx>               
                                                                        cc 
             02/01/2008 08:09                                              
             AM                                                    Subject 
                                       [wtp-dev] IModelProviderEvent       
                                       structure, methods and use?         
             Please respond to                                             
                 "General                                                  
               discussion of                                               
              project-wide or                                              
               architectural                                               
                 issues."                                                  
             <wtp-dev@eclipse.                                             
                   org>                                                    
                                                                           
                                                                           




Hi,


Thanks for helping me.


I am working on a new ModelProvider and I am currently working on the
notifications.


I have a number of question about IModelProviderEvent and the methods
provided by this class.


I have just opened a enchansment request
https://bugs.eclipse.org/bugs/show_bug.cgi?id=217418


but I then realize that maybe I do not understand the structure of
IModelProviderEvent and its use so here are my questions.


1. Why is the method public abstract void addResources(Collection<Object>
someResources); with a parameter of Collection<Object>. Cant it be public
abstract void addResources(Collection<? extends Object> someResources);


This way I will be able to execute


private void processAddedFiles(IModelProviderEvent modelEvent,
Collection<IFile> addedFiles) throws JavaModelException {


                modelEvent.addResources(addedFiles);
}


and add the addedFiles collection directly to modelEvent.


2.What is the purpose of public abstract List<Object> getChangedResources
(); If this method is for retrieving the files that this modelEvent is
desribing wont it be more appropriate to name it getAffectedResources().
Since I can also have removed and added resources. Not just
changedResources.


3.Why should the getChangedResources() method return a List. Since
addResources is accepting Collection won`t it be more appropriate to return
a Collection. Every implementation may provide a different collection for
such a general class as IModelProviderEvent


4.What is the purpose of the set* and add* methods. From my point of view
this methods should be part of the implenetation not from an interface
since the one notified with a model event wont need to add or set a
resource to the event. Only when constucting the event such functionality
is needed.


I am willing to open enchansment requests and to propose patches changing
the IModelProviderEvent. I will also change ModelProviderEvent which is the
default empty implementation, but maybe I am missing something.


Thank you for the help.


Best Regards,
Kiril _______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev






Back to the top