[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: compare two StyleRange[ ]'s

If you're getting StyleRanges for an individual character each time then the
result of getStyleRanges(int,int,boolean) will always be an array of size 1.
You should then be able to use a[0].similarTo(b[0]), no?

Grant


"Subin Modeel" <subin.mdl@xxxxxxxxx> wrote in message
news:1d565903f8f8655f1d5f821289394c1b$1@xxxxxxxxxxxxxxxxxx
> Hi...
>
> i want to compare two StyleRange[],currently there is a method to do
> so,called
> "similarTo". But it applies to StyleRange and not StyleRange[ ].
>
> i have a code,which takes styleranges from styledtext into varaiables a,b.
> "getStyleRanges" method takes three parameters
>       1)start
>       2)length
>       3)includeRange
>
> i take one character at a time,get the stylerange,then i want to compare
> whether they are equal.
> but there is no method to do so.
>
> I try to use "equals",but that gives the output as unequal,even when the
> values a and b are equal.
>
> StyleRange[] a=new StyleRange[0];
> StyleRange[] b=new StyleRange[0];
>
>
> a=styledText.getStyleRanges(i, 1, true); //get stylerange of 1st charater
> b=styledText.getStyleRanges(i+1, 1, true);  //get stylerange of 2st
> charater
>
>
> if(a.equals(b))
>      { System.out.println("equal");
>      }
>      else{
> System.out.println("unequal");
>          }
>
> kindly help me solve this.
> thanking you
> Subin
>