Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to see the partition cutted bye the partitionmanager
How to see the partition cutted bye the partitionmanager [message #326356] Mon, 17 March 2008 15:45 Go to next message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
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 20:46 Go to previous message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
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++
Previous Topic:Image reuse: navigator link to editor image in plugin markup?
Next Topic:No local history?
Goto Forum:
  


Current Time: Fri Jul 19 12:18:43 GMT 2024

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

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

Back to the top