[jbosstools-issues] [JBoss JIRA] (JBIDE-10621) Redesign HyperlinkDetector so that partitioning and hyperlinks not do twice the same job.

Denis Maliarevich (JIRA) jira-events at lists.jboss.org
Wed Feb 1 09:54:48 EST 2012


    [ https://issues.jboss.org/browse/JBIDE-10621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663403#comment-12663403 ] 

Denis Maliarevich commented on JBIDE-10621:
-------------------------------------------

I've created JBIDE-10778 about the situation.
                
> Redesign HyperlinkDetector so that partitioning and hyperlinks not do twice the same job.
> -----------------------------------------------------------------------------------------
>
>                 Key: JBIDE-10621
>                 URL: https://issues.jboss.org/browse/JBIDE-10621
>             Project: Tools (JBoss Tools)
>          Issue Type: Enhancement
>          Components: common/jst/core
>    Affects Versions: 3.3.0.M5
>            Reporter: Viacheslav Kabanovich
>            Assignee: Victor Rubezhny
>             Fix For: 3.3.0.Beta1
>
>
> By now we have many hyperlink detector implementations which parse document to find a typed region by offset and then create hyperlink object that has nothing to parse more, just execute open-on for already computed region. But the old HyperlinkDetector does its job in two stages: (1) compute region and its type; (2) create hyperlink object by the type without passing to it the computed region. I do not think that it is hard to modify HyperlinkDetector logic so that region created by partitioner would not be lost, but passed to hyperlink object. After that each hyperlink implementation may be reviewed to decide can it just use that passed region or there is a good reason to compute it again.
> I suggest: 
> (1) Method IHyperlinkPartitioner.getChildPartitionType(IDocument, IHyperlinkRegion) should return IHyperlinkRegion instead of String;
> (note: it is logical then to rename it to getChildPartitionRegion)
> (2) All methods getPartitionTypes(IDocument, int) and method BaseHyperlinkDetector.getPartitionType(IDocument, int) should return IHyperlinkRegion instead of String; (note: it is logical then to rename it to getPartitionRegions and getPartitionRegion)
> (3) Signature of method BaseHyperlinkDetector.getHyperlinks(ITextViewer, IRegion, String, String partitionType) should be modified as BaseHyperlinkDetector.getHyperlinks(ITextViewer, IRegion, String, IHyperlinkRegion hyperlinkRegion); in its implementation we will assign String partitionType = hyperlinkRegion.getType() and hyperlinkRegion is ready to be passed to AbstractHyperlink;
> (4) Add public method setRegion(IRegion) and protected field IRegion to AbstractHyperlink; in sub-classes that already have such field (in CDI) remove it.
> (5) In each implementation of abstract method AbstractHyperlink.doGetHyperlinkRegion(int) that realizes some non-trivial logic for retrieving region (about 30 of them) try to use that object; and if it is not ok, fix partitioner.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list