Home » Eclipse Projects » Eclipse Platform » TextEditor problem.
TextEditor problem. [message #325641] |
Mon, 25 February 2008 06:46 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
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/*
Dollyn
|
|
|
Re: TextEditor problem. [message #325643 is a reply to message #325641] |
Mon, 25 February 2008 08:49 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: valere.fedronic.ext.streamezzo.com
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.
|
|
|
Re: TextEditor problem. [message #325727 is a reply to message #325643] |
Tue, 26 February 2008 06:37 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
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/*
Dollyn
|
|
|
Re: TextEditor problem. [message #325731 is a reply to message #325727] |
Tue, 26 February 2008 08:24 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: valere.fedronic.ext.streamezzo.com
There is only one action, the 'ToggleComment' action.
>>
if (isSelectionCommented(selection))
operationCode= ITextOperationTarget.STRIP_PREFIX; //uncomment
else
operationCode= ITextOperationTarget.PREFIX; //comment
Take a look at this class
org.eclipse.jdt.internal.ui.javaeditor.ToggleCommentAction
Valère.
Dollyn a écrit :
> 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.
>>>
>
|
|
|
Goto Forum:
Current Time: Sat Aug 17 17:37:31 GMT 2024
Powered by FUDForum. Page generated in 0.02234 seconds
|