Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [imp-dev] FYI: New support for the structured comparison viewer

wow! I like it. can't wait to add it our IDE's

On Sat, Mar 13, 2010 at 12:25 AM, Robert M. Fuhrer
<rfuhrer@xxxxxxxxxxxxxx> wrote:
> Hi All,
> I just committed a few changes to add a draft implementation of a new IMP
> language service: a "Compare Node Identifier", which enables the structured
> compare viewer on source files in IMP-based IDEs.
> I'd like to solicit comments on the shape of the new interface, as well as
> on the overall approach.
> That said, I'm actually fairly pleased with how simply this all worked out.
> ==================================================================================
> Details:
> The structured compare viewer basically needs 3 things:
>  1) a tree representing the source file's contents
>  2) a label provider
>  3) a way to identify the unique entities in a given source file (e.g.,
> functions, types, methods, etc.), so that it knows what chunks of source
> text to compare in detail
> For (1), the treeModelBuilder extension point already provides what's
> necessary.
> For (2), the labelProvider already provides what's necessary.
> For (3), we needed something new. I added a simple interface
> ICompareNodeIdentifier that looks like this:
> public interface ICompareNodeIdentifier extends ILanguageService {
>     /**
>      * Returns a "type code" for the given entity, which generally indicates
> the
>      * kind of entity it is, and thus serves to distinguish it from other
> entities
>      * that might have the same ID. The implementation of this interface is
> free
>      * to use any set of "type codes" that it wishes.
>      */
>     public int getTypeCode(Object o);
>     /**
>      * Returns an ID for the given entity which is unique within the given
> file,
>      * and which can thus be used to identify entities across two versions
> of the
>      * same source file. The implementation of this interface is free to use
> any
>      * set/format for IDs that it wishes.
>      */
>     public String getID(Object o);
> }
> This is the only additional language-specific code needed to enable the
> structured comparison view for a given language. The rest is in services
> most IDEs already probably provide, and in the IMP runtime itself.
> For example ICompareNodeIdentifier implementations, see the
> CompareNodeIdentifier classes in the LPG and prefspecs IDEs.
> Cheers,
>  - Bob
>
> _______________________________________________
> imp-dev mailing list
> imp-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/imp-dev
>
>



-- 
Jurgen Vinju
- Centrum Wiskunde & Informatica - SEN1
- INRIA Lille - ATEAMS
- Universiteit van Amsterdam

  www: http://jurgen.vinju.org,http://www.cwi.nl,
http://www.meta-environment.nl,http://twitter.com/jurgenvinju
skype: jurgen.vinju


Back to the top