[hg] main-silver: Issue #218958: Surround with... first line shi...

  • From: Dusan Balek < >
  • To: ,
  • Subject: [hg] main-silver: Issue #218958: Surround with... first line shi...
  • Date: Thu, 29 Nov 2012 03:31:33 -0800

changeset 39b5a92a6e79 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/39b5a92a6e79
description:
        Issue #218958: Surround with... first line shifts to the most left 
position - fixed.

diffstat:

 
editor.codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateParameterImpl.java
 |  4 ++--
 
java.editor/src/org/netbeans/modules/java/editor/resources/DefaultAbbrevs.xml 
                |  8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diffs (35 lines):

diff --git 
a/editor.codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateParameterImpl.java
 
b/editor.codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateParameterImpl.java
--- 
a/editor.codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateParameterImpl.java
+++ 
b/editor.codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateParameterImpl.java
@@ -381,8 +381,8 @@
                 value = handler.getComponent().getSelectedText();
                 if (value == null)
                     value = ""; //NOI18N
-                else
-                    value = value.trim();
+                if (value.endsWith("\n"))
+                    value = value.substring(0, value.length() - 1);
                 if (getHints().get(CodeTemplateParameter.LINE_HINT_NAME) != 
null && !value.endsWith("\n")) //NOI18N
                     value += "\n"; //NOI18N
             }
diff --git 
a/java.editor/src/org/netbeans/modules/java/editor/resources/DefaultAbbrevs.xml
 
b/java.editor/src/org/netbeans/modules/java/editor/resources/DefaultAbbrevs.xml
--- 
a/java.editor/src/org/netbeans/modules/java/editor/resources/DefaultAbbrevs.xml
+++ 
b/java.editor/src/org/netbeans/modules/java/editor/resources/DefaultAbbrevs.xml
@@ -332,11 +332,15 @@
      ${cursor}]]></code></codetemplate>
      <codetemplate abbreviation="csort"><code><![CDATA[${collsType 
type="java.util.Collections" default="Collections" 
editable="false"}.sort(${var instanceof="java.util.List"});
          ${cursor}]]></code></codetemplate>
-     <codetemplate abbreviation="form" 
contexts="BLOCK,CASE,LABELED_STATEMENT,DO_WHILE_LOOP,ENHANCED_FOR_LOOP,FOR_LOOP,IF,WHILE_LOOP"
 descriptionId="CT_form"><code><![CDATA[for (${entryType iterableElementType 
default="Map.Entry<Object, Object>" editable=false} ${entry newVarName 
default="en"} : ${map instanceof="java.util.Map" default="m"}.entrySet()) {
+     <codetemplate abbreviation="form" 
contexts="BLOCK,CASE,LABELED_STATEMENT,DO_WHILE_LOOP,ENHANCED_FOR_LOOP,FOR_LOOP,IF,WHILE_LOOP"
 descriptionId="CT_form">
+         <code>
+<![CDATA[for (${entryType iterableElementType default="Map.Entry<Object, 
Object>" editable=false} ${entry newVarName default="en"} : ${map 
instanceof="java.util.Map" default="m"}.entrySet()) {
             ${KeyType rightSideType default="Object"} ${key newVarName 
default="key"} = ${entry}.getKey();
             ${ValType rightSideType default="Object"} ${val newVarName 
default="val"} = ${entry}.getValue();
             ${selection}${cursor}
-        }]]></code></codetemplate>
+}]]>
+         </code>
+     </codetemplate>
 
      <!-- Instantiating common classes -->
      <codetemplate abbreviation="map"><code><![CDATA[${map 
type="java.util.Map" default="Map" editable="false"}<${keytype 
default="String"},${valtype default="String"}> ${var newVarName default="m"} 
= new ${mtype type="java.util.HashMap" 
editable="false"}<${keytype},${valtype}>(${cursor});

[hg] main-silver: Issue #218958: Surround with... first line shi...

Dusan Balek 11/29/2012

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close