Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How do you implement your custom tag scanner?
How do you implement your custom tag scanner? [message #286683] Tue, 14 June 2005 17:05 Go to next message
Eclipse UserFriend
Originally posted by: jed.sce.carleton.ca

Hi all,

I've created a view which displays the same document on the XML editor. I
need a tag scanner which scans the tags on the editor then does some
"action" and omits it in the view. How would I implement such a tag
scanner? Is ther any tutorials I can read? Any help is appreciated. Thanks
in advance.

~Jade
Re: How do you implement your custom tag scanner? [message #286685 is a reply to message #286683] Tue, 14 June 2005 17:46 Go to previous messageGo to next message
Eclipse UserFriend
Jade,

Have you looked at the example XML Editor's rule based scanner? All the
example does is extend RuleBasedScanner. Then in the scanner class you
create tokens, rules based on those tokens and then set your rules.
Re: How do you implement your custom tag scanner? [message #286747 is a reply to message #286685] Thu, 16 June 2005 11:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jed.sce.carleton.ca

Hi,

Yes I did look at it. I didn't entirely understand how they set up the
"rules". If let's say I wanted the scanner to detect <p> and </p> and omit
it in the view. How should I do it? There's two scanners on the XML
example. XMLScanner, and XMLPartitionScanner, do I need both scanners to
scan for tags? Forgive me if its entirely obvious and I'm missing the
point. I'll keep on working at it. Thanks for the help!
Re: How do you implement your custom tag scanner? [message #286751 is a reply to message #286683] Thu, 16 June 2005 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

Scanners don't do actions; they just scan. If you want to omit something
from the view, do it with the result of the scan.

There are two scanners because one scans for partitions while the other
scans within partitions (to color).

Bob

Jade wrote:
> Hi all,
>
> I've created a view which displays the same document on the XML editor.
> I need a tag scanner which scans the tags on the editor then does some
> "action" and omits it in the view. How would I implement such a tag
> scanner? Is ther any tutorials I can read? Any help is appreciated.
> Thanks in advance.
>
> ~Jade
Re: How do you implement your custom tag scanner? [message #286756 is a reply to message #286751] Thu, 16 June 2005 14:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jed.sce.carleton.ca

Yep,

scanners just scan and return a token if I'm not mistaken. I'm trying to
figure out what I can do with it and and if and how I can make that token
do an action. Thanks for the help!
Re: How do you implement your custom tag scanner? [message #286763 is a reply to message #286756] Thu, 16 June 2005 16:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

Try thinking of it this way: The partition scanner divides the file into
sections and it stores those sections as typed positions in the
document. After the scan is complete, go over the partitions and decide
how you want to display them.

Bob

Jed wrote:
> Yep,
>
> scanners just scan and return a token if I'm not mistaken. I'm trying to
> figure out what I can do with it and and if and how I can make that
> token do an action. Thanks for the help!
>
Re: How do you implement your custom tag scanner? [message #286861 is a reply to message #286763] Mon, 20 June 2005 11:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jed.sce.carleton.ca

I understand what your saying, but when I put it into code it just doesnt
work. Do you have any examples or snippets that lets a view
'scan'/'partition' a document? Or anything the might be helpful? The xml
editor code works for an editor, I tried to make it work for a view, but
to no avail yet. Thanks for the help.
Re: How do you implement your custom tag scanner? [message #287063 is a reply to message #286861] Thu, 23 June 2005 12:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jed.sce.carleton.ca

Yeah,

I think the problem is configuring the sourceviewer for a view. The way
they do it for the xml editor is using SourceViewerConfiguration. This is
a bit different for a view. I'll try to find out more. If anyone know
anything that might help, thanks in advance!
Re: How do you implement your custom tag scanner? [message #287082 is a reply to message #287063] Thu, 23 June 2005 15:12 Go to previous messageGo to next message
Eclipse UserFriend
Look at the class JavaContentOutlinePage. You provide info to your view
using a content provider and a label provider. You could create your own
content provider class by extending ContentProvider. The protected
ITreeContentProvider class in JavaContentOutlinePage has a method named
parse() that takes a document. You could parse your document there and
omit whatever you don't want to show up in your view. Hopefully this
helps. I'm still quite new to eclipse myself.

[Updated on: Sat, 30 March 2013 00:14] by Moderator

Re: How do you implement your custom tag scanner? [message #287098 is a reply to message #287082] Thu, 23 June 2005 19:00 Go to previous messageGo to next message
Eclipse UserFriend
And I correct myself. I mean *viewer* for the content and label provider.
Re: How do you implement your custom tag scanner? [message #287145 is a reply to message #287082] Fri, 24 June 2005 13:23 Go to previous message
Eclipse UserFriend
Originally posted by: jed.sce.carleton.ca

Hi,

Dont you need a ContentProvider only if you're providing the view your own
content. However, in my case, I am getting a document from the xml editor
and displaying it in my view. I am using a sourceviewer since it can
handle documents but I dont think it can parse it. I am currently looking
at ViewerFilters and how they might possibly help. But whenever I import

org.eclipse.ui.views.navigator.ResourcePatternFilter

eclipse cant find it for some reason. I think I have all the jars thats
needed. Do you get the same thing? I might just extend the abstract
ViewerFileter class and put my filtering rules there, though I think I
need to learn how to parse the document. The eclipse readme says you can
browse the rest of ReadmeModelFactory, MarkElement, and
DefaultSectionsParser for details. But they're not there. Thanks for the
suggestions.
Previous Topic:eclipse and handling packages
Next Topic:Clear File History under File Menu
Goto Forum:
  


Current Time: Wed Apr 30 13:36:10 EDT 2025

Powered by FUDForum. Page generated in 0.10937 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top