1.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Mon Jun 11 10:51:08 2012 +0530
1.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Wed Jun 13 14:16:05 2012 +0530
1.3 @@ -78,7 +78,8 @@
1.4 */
1.5 public class PlsqlFormatter extends ExtFormatter {
1.6
1.7 - private boolean isIndentOnly = false;
1.8 + private boolean isAutoIndent = true;
1.9 + private boolean isAutoUppercase = true;
1.10 private boolean isTyping = false;
1.11
1.12 public PlsqlFormatter(Class kitClass) {
1.13 @@ -211,7 +212,7 @@
1.14 */
1.15 @Override
1.16 public int[] getReformatBlock(JTextComponent target, String arg1) {
1.17 - if (isIndentOnly || arg1.length() != 1) //We dont need to consider spaces
1.18 + if (!isAutoUppercase || arg1.length() != 1) //We dont need to consider spaces
1.19 {
1.20 return null;
1.21 }
1.22 @@ -254,8 +255,9 @@
1.23
1.24 //Get indent only value from the preferences
1.25 Preferences prefs = MimeLookup.getLookup(PlsqlEditorKit.MIME_TYPE).lookup(Preferences.class);
1.26 - isIndentOnly = prefs.getBoolean("indentOnly", false);
1.27 -
1.28 + isAutoIndent = prefs.getBoolean("autoIndent", false);
1.29 + isAutoUppercase = prefs.getBoolean("autoUppercase", false);
1.30 +
1.31 try {
1.32 PlsqlFormatSupport plsqlFormatSup = (PlsqlFormatSupport) createFormatSupport(fw);
1.33 FormatTokenPosition pos = plsqlFormatSup.getFormatStartPosition();
1.34 @@ -277,7 +279,7 @@
1.35
1.36 if (pos != null && pos.getToken() != null) {
1.37 //if a new line indent
1.38 - if (!isIndentOnly) {
1.39 + if (isAutoUppercase) {
1.40 plsqlFormatSup.formatKeyWords(plsqlFormatSup, pos, blockFactory, startOffset - colStart);
1.41 if (startOffset != -1 && pane != null) {
1.42 pane.setCaretPosition(startOffset); // set the correct caret position
1.43 @@ -287,13 +289,14 @@
1.44 isTyping = false;
1.45 return;
1.46 }
1.47 - if (!isIndentOnly) {
1.48 + if (isAutoUppercase) {
1.49 if (startOffset == -1) {
1.50 plsqlFormatSup.formatLine(plsqlFormatSup, pos, blockFactory);
1.51 } else {
1.52 plsqlFormatSup.formatKeyWords(plsqlFormatSup, pos, blockFactory, startOffset - colStart);
1.53 }
1.54 }
1.55 + if(isAutoIndent){
1.56 while (pos != null) {
1.57 // Indent the current line
1.58
1.59 @@ -322,6 +325,7 @@
1.60 pos = plsqlFormatSup.findLineStart(pos);
1.61 }
1.62 }
1.63 + }
1.64 } catch (IllegalStateException e) {
1.65 }
1.66
2.1 --- a/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/Bundle.properties Mon Jun 11 10:51:08 2012 +0530
2.2 +++ b/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/Bundle.properties Wed Jun 13 14:16:05 2012 +0530
2.3 @@ -1,8 +1,8 @@
2.4 OpenIDE-Module-Name=PL/SQL Formatting Options
2.5 OpenIDE-Module-Display-Category=PL/SQL Support
2.6 -
2.7 -PlsqlTabsAndIndents.chkIndentOnly.text=Indent Only
2.8 AN_Preview=Preview
2.9 AD_Preview=Preview
2.10 SAMPLE_Default=Text
2.11 -SAMPLE_TabsIndents=Text
2.12 \ No newline at end of file
2.13 +SAMPLE_TabsIndents=Text
2.14 +PlsqlTabsAndIndents.chkIndent.text=Auto Indent
2.15 +PlsqlTabsAndIndents.chkUppercase.text=Auto Keyword Uppercase
3.1 --- a/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlFormatOptions.java Mon Jun 11 10:51:08 2012 +0530
3.2 +++ b/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlFormatOptions.java Wed Jun 13 14:16:05 2012 +0530
3.3 @@ -82,7 +82,8 @@
3.4 public static final String tabSize = SimpleValueNames.TAB_SIZE;
3.5 public static final String spacesPerTab = SimpleValueNames.SPACES_PER_TAB;
3.6 public static final String indentSize = SimpleValueNames.INDENT_SHIFT_WIDTH;
3.7 - public static final String indentOnly = "indentOnly"; //NOI18N
3.8 + public static final String autoIndent = "autoIndent"; //NOI18N
3.9 + public static final String autoUppercase = "autoUppercase";
3.10
3.11 private PlsqlFormatOptions() {
3.12 }
3.13 @@ -125,7 +126,8 @@
3.14 {tabSize, "3"}, //NOI18N
3.15 {spacesPerTab, "3"}, //NOI18N
3.16 {indentSize, "3"}, //NOI18N
3.17 - {indentOnly, FALSE}, //NOI18N
3.18 + {autoIndent, TRUE}, //NOI18N
3.19 + {autoUppercase, TRUE}, //NOI18N
3.20 };
3.21
3.22 defaults = new HashMap<String, String>();
4.1 --- a/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlTabsAndIndents.form Mon Jun 11 10:51:08 2012 +0530
4.2 +++ b/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlTabsAndIndents.form Wed Jun 13 14:16:05 2012 +0530
4.3 @@ -1,4 +1,4 @@
4.4 -<?xml version="1.0" encoding="UTF-8" ?>
4.5 +<?xml version="1.1" encoding="UTF-8" ?>
4.6
4.7 <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4.8 <AuxValues>
4.9 @@ -16,10 +16,13 @@
4.10 <Layout>
4.11 <DimensionLayout dim="0">
4.12 <Group type="103" groupAlignment="0" attributes="0">
4.13 - <Group type="102" alignment="0" attributes="0">
4.14 + <Group type="102" attributes="0">
4.15 <EmptySpace max="-2" attributes="0"/>
4.16 - <Component id="chkIndentOnly" min="-2" max="-2" attributes="0"/>
4.17 - <EmptySpace pref="66" max="32767" attributes="0"/>
4.18 + <Group type="103" groupAlignment="0" attributes="0">
4.19 + <Component id="chkIndent" alignment="0" min="-2" max="-2" attributes="0"/>
4.20 + <Component id="chkUppercase" alignment="0" min="-2" max="-2" attributes="0"/>
4.21 + </Group>
4.22 + <EmptySpace max="32767" attributes="0"/>
4.23 </Group>
4.24 </Group>
4.25 </DimensionLayout>
4.26 @@ -27,17 +30,26 @@
4.27 <Group type="103" groupAlignment="0" attributes="0">
4.28 <Group type="102" alignment="0" attributes="0">
4.29 <EmptySpace max="-2" attributes="0"/>
4.30 - <Component id="chkIndentOnly" min="-2" max="-2" attributes="0"/>
4.31 - <EmptySpace max="32767" attributes="0"/>
4.32 + <Component id="chkIndent" min="-2" max="-2" attributes="0"/>
4.33 + <EmptySpace pref="7" max="32767" attributes="0"/>
4.34 + <Component id="chkUppercase" min="-2" max="-2" attributes="0"/>
4.35 + <EmptySpace max="-2" attributes="0"/>
4.36 </Group>
4.37 </Group>
4.38 </DimensionLayout>
4.39 </Layout>
4.40 <SubComponents>
4.41 - <Component class="javax.swing.JCheckBox" name="chkIndentOnly">
4.42 + <Component class="javax.swing.JCheckBox" name="chkIndent">
4.43 <Properties>
4.44 <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
4.45 - <ResourceString bundle="org/netbeans/modules/plsql/format/options/Bundle.properties" key="PlsqlTabsAndIndents.chkIndentOnly.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
4.46 + <ResourceString bundle="org/netbeans/modules/plsql/format/options/Bundle.properties" key="PlsqlTabsAndIndents.chkIndent.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
4.47 + </Property>
4.48 + </Properties>
4.49 + </Component>
4.50 + <Component class="javax.swing.JCheckBox" name="chkUppercase">
4.51 + <Properties>
4.52 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
4.53 + <ResourceString bundle="org/netbeans/modules/plsql/format/options/Bundle.properties" key="PlsqlTabsAndIndents.chkUppercase.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
4.54 </Property>
4.55 </Properties>
4.56 </Component>
5.1 --- a/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlTabsAndIndents.java Mon Jun 11 10:51:08 2012 +0530
5.2 +++ b/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlTabsAndIndents.java Wed Jun 13 14:16:05 2012 +0530
5.3 @@ -54,7 +54,8 @@
5.4 /** Creates new form PlsqlTabsAndIndents */
5.5 public PlsqlTabsAndIndents() {
5.6 initComponents();
5.7 - chkIndentOnly.putClientProperty(OPTION_ID, indentOnly);
5.8 + chkIndent.putClientProperty(OPTION_ID, autoIndent);
5.9 + chkUppercase.putClientProperty(OPTION_ID, autoUppercase);
5.10 }
5.11
5.12 public static PreferencesCustomizer.Factory getController() {
5.13 @@ -71,9 +72,12 @@
5.14 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
5.15 private void initComponents() {
5.16
5.17 - chkIndentOnly = new javax.swing.JCheckBox();
5.18 + chkIndent = new javax.swing.JCheckBox();
5.19 + chkUppercase = new javax.swing.JCheckBox();
5.20
5.21 - chkIndentOnly.setText(org.openide.util.NbBundle.getMessage(PlsqlTabsAndIndents.class, "PlsqlTabsAndIndents.chkIndentOnly.text")); // NOI18N
5.22 + chkIndent.setText(org.openide.util.NbBundle.getMessage(PlsqlTabsAndIndents.class, "PlsqlTabsAndIndents.chkIndent.text")); // NOI18N
5.23 +
5.24 + chkUppercase.setText(org.openide.util.NbBundle.getMessage(PlsqlTabsAndIndents.class, "PlsqlTabsAndIndents.chkUppercase.text")); // NOI18N
5.25
5.26 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
5.27 this.setLayout(layout);
5.28 @@ -81,21 +85,26 @@
5.29 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
5.30 .addGroup(layout.createSequentialGroup()
5.31 .addContainerGap()
5.32 - .addComponent(chkIndentOnly)
5.33 - .addContainerGap(66, Short.MAX_VALUE))
5.34 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
5.35 + .addComponent(chkIndent)
5.36 + .addComponent(chkUppercase))
5.37 + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
5.38 );
5.39 layout.setVerticalGroup(
5.40 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
5.41 .addGroup(layout.createSequentialGroup()
5.42 .addContainerGap()
5.43 - .addComponent(chkIndentOnly)
5.44 - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
5.45 + .addComponent(chkIndent)
5.46 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
5.47 + .addComponent(chkUppercase)
5.48 + .addContainerGap())
5.49 );
5.50 }// </editor-fold>//GEN-END:initComponents
5.51
5.52
5.53 // Variables declaration - do not modify//GEN-BEGIN:variables
5.54 - private javax.swing.JCheckBox chkIndentOnly;
5.55 + private javax.swing.JCheckBox chkIndent;
5.56 + private javax.swing.JCheckBox chkUppercase;
5.57 // End of variables declaration//GEN-END:variables
5.58
5.59 }