You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2012/08/07 16:05:18 UTC
svn commit: r1370269 -
/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/text/TextMarkerAutoEditStrategy.java
Author: pkluegl
Date: Tue Aug 7 14:05:18 2012
New Revision: 1370269
URL: http://svn.apache.org/viewvc?rev=1370269&view=rev
Log:
UIMA-2341
- deactivated smart indentation
Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/text/TextMarkerAutoEditStrategy.java
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/text/TextMarkerAutoEditStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/text/TextMarkerAutoEditStrategy.java?rev=1370269&r1=1370268&r2=1370269&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/text/TextMarkerAutoEditStrategy.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/text/TextMarkerAutoEditStrategy.java Tue Aug 7 14:05:18 2012
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-*/
+ */
package org.apache.uima.textmarker.ide.ui.text;
@@ -37,7 +37,6 @@ import org.eclipse.jface.text.ITypedRegi
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.text.rules.FastPartitioner;
-
public class TextMarkerAutoEditStrategy extends DefaultIndentLineAutoEditStrategy {
// TODO
IPreferenceStore fStore;
@@ -467,8 +466,8 @@ public class TextMarkerAutoEditStrategy
}
// first check, if we not inside string, if yes, jump to start
- ITypedRegion region = TextUtilities.getPartition(d, fPartitioning, d
- .getLineOffset(lastNonEmptyLine), true);
+ ITypedRegion region = TextUtilities.getPartition(d, fPartitioning,
+ d.getLineOffset(lastNonEmptyLine), true);
if (region.getType() == TextMarkerPartitions.TM_STRING) {
lastNonEmptyLine = d.getLineOfOffset(region.getOffset());
}
@@ -794,10 +793,6 @@ public class TextMarkerAutoEditStrategy
* @param c
*/
private void smartPaste(IDocument d, DocumentCommand c) {
- /*
- * We are creating temp document, inserting text as is, and then sequentially calling
- * calcLineIndent for each new line.
- */
try {
String content = d.get(0, c.offset) + c.text;
Document temp = new Document(content);
@@ -815,26 +810,23 @@ public class TextMarkerAutoEditStrategy
line++;
offset = temp.getLineOffset(line);
} catch (BadLocationException e) {
- // ok, we are inserting only one string...
offset = temp.getLength();
}
while (offset < temp.getLength()) {
- // calculate indentation of this line
String resultIndent = calcLineIndent(temp, line, false, temp.getLineOffset(line));
- // change current line offset
String currentIndent = getLineIndent(temp, line);
- // String dbg = temp.get ();
if (resultIndent == null) {
resultIndent = commonIndent + currentIndent;
- if (getPhysicalLength(resultIndent) > getPhysicalLength(lastIndent))
- resultIndent = lastIndent;
+ // TODO commented to retain indent of pasted blocks
+ // if (getPhysicalLength(resultIndent) > getPhysicalLength(lastIndent))
+ // resultIndent = lastIndent;
}
temp.replace(offset, currentIndent.length(), resultIndent);
String currentLine = getDocumentLine(temp, line);
- if (currentLine.trim().length() > 0 && (!currentLine.trim().startsWith("#")))
+ if (currentLine.trim().length() > 0 && (!currentLine.trim().startsWith("//"))) {
lastIndent = resultIndent;
+ }
- // dbg = temp.get ();
if (temp.getLineOffset(line) + temp.getLineLength(line) == temp.getLength())
break;
line++;