[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: TextEditor problem.

Hi,
First, thanks for your help.

And there is another problem:
In my own text editor, I want the comment and uncomment (just like in
the java editor, you press the Ctrl + /, the rows selected are commented
or uncommented). So I followed what the jdt does: a command and a
binding, but what my editor does is different, it always comment the
selected rows even if they are commentd already. And in the jdt, I find
a command "uncomment", but no binding to this command.
and what should i do to make my editor works just like the java editor?

Hope that you can understand me.




valere fedronic wrote:
> Hi,
>
> Line prefix operation ==  Comment line (prefix the line with //)
> Line shift operation == Tab / Shift+Tab
>
>
> Take a look at the TextViewer.doOperation(int op) .
>   
> case SHIFT_RIGHT:
> 	shift(false, true, false);
> 	break;
> case SHIFT_LEFT:
> 	shift(false, false, false);
> 	break;
> case PREFIX:
> 	shift(true, true, true);
> 	break;
>
>
> The shift() method can be configured to use a specific defaultPrefix (//
> or # ...) and indentPrefix (\t or space ...).
> The SourceViewerConfiguration is used to configure the source viewer
> (ISourceViewer#configure(SourceViewerConfiguration)).
>
>
> Valère.
>
>
> Dollyn a écrit :
>   
>> In the SourceViewerConfiguration class, There is 2 method,
>> getDefaultPrefix and getIndentPrefixes. The questions are:
>> 1. about the getDefaultPrefix. The document says that "Returns the
>> default prefixes to be used by the line-prefix operation", so, what is
>> the line-prefix operation?
>> 2. about the getIndentPrefixes. The document says that "Returns the
>> prefixes to be used by the line-shift operation", and what is the
>> line-shift operation.(Is it the auto indent??).
>>
>> Any example is welecome.
>>
>> Thanks.
>>     

-- 

*/Dollyn/*