| 
| How to see the partition cutted bye the partitionmanager [message #326356] | Mon, 17 March 2008 11:45  |  | 
| Eclipse User  |  |  |  |  | Hi all, 
 I try to make a simple syntaxe color for a new languge (not known from
 the world) and if I understand, The first thing to do is to partition
 (PartitionScanner) the document and after that, linked that with eclipse
 via un IDocumentSetupParticipant.
 
 
 I would like to print the partition to see if eclipse do that correctly
 (to be exact if there no error) but I dont no how
 
 there is my setup méthod in IDocumentSetupPartitcpant
 
 @Override
 public void setup(IDocument document) {
 if (document instanceof IDocumentExtension3) {
 IDocumentExtension3 extension3 = (IDocumentExtension3) document;
 
 IDocumentPartitioner partitioner = new FastPartitioner(
 yaflplug.Activator.getDefault().getPart(),
 Partitioner.PARTITION_TYPE);
 extension3.setDocumentPartitioner(Activator.PARTITIONING,
 partitioner);
 partitioner.connect(document);
 
 // I Try that but that doesnt work
 //			ITypedRegion k = partitioner.getPartition(1);
 //		System.out.println("---> ");
 //	System.out.println(k.getLength());
 }
 }
 
 
 How to print the partition ?
 
 thanks
 
 a++
 |  |  |  | 
| 
| Re: How to see the partition cutted bye the partitionmanager [message #326408 is a reply to message #326356] | Tue, 18 March 2008 16:46  |  | 
| Eclipse User  |  |  |  |  | julien a écrit : > Hi all,
 >
 > I try to make a simple syntaxe color for a new languge (not known from
 > the world) and if I understand, The first thing to do is to partition
 > (PartitionScanner) the document and after that, linked that with eclipse
 > via un IDocumentSetupParticipant.
 >
 >
 > I would like to print the partition to see if eclipse do that correctly
 > (to be exact if there no error) but I dont no how
 >
 > there is my setup méthod in IDocumentSetupPartitcpant
 >
 >     @Override
 >     public void setup(IDocument document) {
 >         if (document instanceof IDocumentExtension3) {
 >             IDocumentExtension3 extension3 = (IDocumentExtension3)
 > document;
 >
 >             IDocumentPartitioner partitioner = new FastPartitioner(
 >                     yaflplug.Activator.getDefault().getPart(),
 >                     Partitioner.PARTITION_TYPE);
 >             extension3.setDocumentPartitioner(Activator.PARTITIONING,
 >                     partitioner);
 >             partitioner.connect(document);
 >
 > // I Try that but that doesnt work
 > //            ITypedRegion k = partitioner.getPartition(1);
 >     //        System.out.println("---> ");
 >         //    System.out.println(k.getLength());
 >         }
 >     }
 >
 >
 > How to print the partition ?
 >
 > thanks
 >
 > a++
 
 I put here my code from my partitionner
 and the file I would like to parse
 
 ***************************************
 --sfdfjslf
 fmsklf
 "---sdlf"
 fsfd
 
 sfs
 sfd
 
 ds
 d
 --sfdsfd
 --
 ***************************************
 
 ackage yaflplug.partitionner;
 
 import org.eclipse.jface.text.rules.EndOfLineRule;
 import org.eclipse.jface.text.rules.IPredicateRule;
 import org.eclipse.jface.text.rules.IToken;
 import org.eclipse.jface.text.rules.MultiLineRule;
 import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
 import org.eclipse.jface.text.rules.SingleLineRule;
 import org.eclipse.jface.text.rules.Token;
 
 public class Partitioner extends RuleBasedPartitionScanner {
 
 
 // IDENTIFIANT DES PARTITIONS
 public final static String P_COMMENT = "1";
 public final static String P_STRING = "2";
 public final static String P_INLINE = "3";
 public final static String P_DOC = "4";
 
 public final static String [] PARTITION_TYPE = {P_COMMENT,
 P_STRING,P_INLINE,P_DOC};
 
 public Partitioner() {
 super();
 
 IToken comment = new Token(P_COMMENT);
 IToken string = new Token(P_STRING);
 IToken inline = new Token(P_INLINE);
 IToken doc = new Token(P_DOC);
 
 
 IPredicateRule[] rules = new IPredicateRule[] {
 new EndOfLineRule("--", comment),
 new MultiLineRule("\"", "\"",string),
 new MultiLineRule("'", "'", string),
 new MultiLineRule("INLINE","END",inline),
 };
 // Prend en compte les règles
 setPredicateRules(rules);
 
 }
 }
 
 
 My question is the same, how to print the partition (to see if it's good
 and make junit test)
 
 
 thanks
 
 a++
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.03953 seconds