sync'd release701 branch with trunk
authorJiri Rechtacek <jrechtacek@netbeans.org>
Tue, 14 Feb 2012 17:31:28 +0100
changeset 16810da59e1b5ab
parent 93 bf3ce9e8e063
parent 165 3a2a9a082157
child 169 fc1f88683289
sync'd release701 branch with trunk
Libraries/ThirdParty/libs.commons/build.xml
Libraries/ThirdParty/libs.commons/manifest.mf
Libraries/ThirdParty/libs.commons/nbproject/build-impl.xml
Libraries/ThirdParty/libs.commons/nbproject/genfiles.properties
Libraries/ThirdParty/libs.commons/nbproject/platform.properties
Libraries/ThirdParty/libs.commons/nbproject/project.properties
Libraries/ThirdParty/libs.commons/nbproject/project.xml
Libraries/ThirdParty/libs.commons/nbproject/suite.properties
Libraries/ThirdParty/libs.commons/src/org/netbeans/libs/commons/Bundle.properties
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlCommitAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryNextAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryPreviousAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlMultipleExecuteAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlRollbackAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/ViewDataAction.java
PLSQL/Execution/src/org/netbeans/modules/plsql/execution/layer.xml
PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java
PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/IFSItemGeneral.java
PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/IFSRecordGeneral.java
PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/resource/IFSItemGeneral.xml
PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/resource/IFSRecordGeneral.xml
PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/reports/resource/GrantIfssys.xml
PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/reports/resource/RefreshDictionary.xml
PLSQL/Utilities/nbproject/project.xml
PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/LogInWarningDialog.form
PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/LogInWarningDialog.java
PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/localization/PlsqlFileFinder.java
Utilities/Oracle/src/org/netbeans/modules/plsqlsupport/db/DatabaseConnectionManager.java
Utilities/Oracle/src/org/netbeans/modules/plsqlsupport/db/ui/SQLExecutionAction.java
build.properties
build.xml
nbproject/platform.properties
nbproject/platform.xml
nbproject/project.properties
plsql-support.kit/nbproject/project.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgeol	Tue Feb 14 17:31:28 2012 +0100
     1.3 @@ -0,0 +1,9 @@
     1.4 +[patterns]
     1.5 +**.api = CRLF
     1.6 +**.apy = CRLF
     1.7 +**.cdb = CRLF
     1.8 +**.cre = CRLF
     1.9 +**.ins = CRLF
    1.10 +**.rdf = CRLF
    1.11 +**.upg = CRLF
    1.12 +
     2.1 Binary file Libraries/ThirdParty/ant/ant-contrib-1.0b3.jar has changed
     3.1 --- a/Options/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
     3.2 +++ b/Options/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
     3.3 @@ -3,6 +3,7 @@
     3.4  Created-By: 10.0-b23 (Sun Microsystems Inc.)
     3.5  AutoUpdate-Show-In-Client: false
     3.6  OpenIDE-Module: org.netbeans.modules.plsqlsupport.options
     3.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsqlsupport/options/Bundle.properties
     3.8 -OpenIDE-Module-Specification-Version: 1.7.12
     3.9 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsqlsupport/op
    3.10 + tions/Bundle.properties
    3.11 +OpenIDE-Module-Specification-Version: 1.7.15
    3.12  
     4.1 --- a/PLSQL/Annotation/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
     4.2 +++ b/PLSQL/Annotation/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
     4.3 @@ -4,7 +4,7 @@
     4.4  AutoUpdate-Show-In-Client: false
     4.5  OpenIDE-Module: org.netbeans.modules.plsql.annotation
     4.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/annotation/layer.xml
     4.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/annotation/Bundle.p
     4.8 - roperties
     4.9 -OpenIDE-Module-Specification-Version: 1.8.8
    4.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/annotatio
    4.11 + n/Bundle.properties
    4.12 +OpenIDE-Module-Specification-Version: 1.8.12
    4.13  
     5.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/Bundle.properties	Wed Dec 07 13:36:21 2011 +0100
     5.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/Bundle.properties	Tue Feb 14 17:31:28 2012 +0100
     5.3 @@ -2,5 +2,3 @@
     5.4  OpenIDE-Module-Display-Category=PL/SQL Support
     5.5  CTL_PlsqlValidateFilesAction=Validate Files
     5.6  CTL_PlsqlValidateFilesSummary=Validate Files Summary
     5.7 -#method names that should be ignored when giving the warning to General_Sys.Init_Method is missing
     5.8 -INIT_METHOD_EXCEPTS=Init,Language_Refreshed,Enumerate,Enumerate_Db,Enumerate_States__,Enumerate_States_Db__,Enumerate_Events__\
     6.1 --- a/PLSQL/Completion/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
     6.2 +++ b/PLSQL/Completion/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
     6.3 @@ -3,8 +3,8 @@
     6.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
     6.5  OpenIDE-Module: org.netbeans.modules.plsql.completion
     6.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/completion/layer.xml
     6.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/completion/Bundle.p
     6.8 - roperties
     6.9 -OpenIDE-Module-Specification-Version: 1.8.4
    6.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/completio
    6.11 + n/Bundle.properties
    6.12 +OpenIDE-Module-Specification-Version: 1.8.5
    6.13  AutoUpdate-Show-In-Client: false
    6.14  
     7.1 --- a/PLSQL/Debugging/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
     7.2 +++ b/PLSQL/Debugging/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
     7.3 @@ -3,8 +3,8 @@
     7.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
     7.5  OpenIDE-Module: org.netbeans.modules.plsql.debug
     7.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/debug/layer.xml
     7.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/debug/Bundle.proper
     7.8 - ties
     7.9 -OpenIDE-Module-Specification-Version: 1.7.18
    7.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/debug/Bun
    7.11 + dle.properties
    7.12 +OpenIDE-Module-Specification-Version: 1.7.19
    7.13  AutoUpdate-Show-In-Client: false
    7.14  
     8.1 --- a/PLSQL/Execution/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
     8.2 +++ b/PLSQL/Execution/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
     8.3 @@ -3,8 +3,8 @@
     8.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
     8.5  OpenIDE-Module: org.netbeans.modules.plsql.execution
     8.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/execution/layer.xml
     8.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/execution/Bundle.pr
     8.8 - operties
     8.9 -OpenIDE-Module-Specification-Version: 1.8.8
    8.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/execution
    8.11 + /Bundle.properties
    8.12 +OpenIDE-Module-Specification-Version: 1.8.19
    8.13  AutoUpdate-Show-In-Client: false
    8.14  
     9.1 --- a/PLSQL/Execution/nbproject/project.properties	Wed Dec 07 13:36:21 2011 +0100
     9.2 +++ b/PLSQL/Execution/nbproject/project.properties	Tue Feb 14 17:31:28 2012 +0100
     9.3 @@ -1,2 +1,9 @@
     9.4 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
     9.5 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
     9.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
     9.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
     9.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120
     9.9 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
    9.10 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
    9.11  javac.source=1.6
    9.12  javac.compilerargs=-Xlint -Xlint:-serial
    10.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CopyAsJavaStringAction.java	Wed Dec 07 13:36:21 2011 +0100
    10.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CopyAsJavaStringAction.java	Tue Feb 14 17:31:28 2012 +0100
    10.3 @@ -46,6 +46,9 @@
    10.4  import javax.swing.JEditorPane;
    10.5  import javax.swing.text.BadLocationException;
    10.6  import javax.swing.text.Document;
    10.7 +import org.openide.awt.ActionID;
    10.8 +import org.openide.awt.ActionReference;
    10.9 +import org.openide.awt.ActionRegistration;
   10.10  import org.openide.cookies.EditorCookie;
   10.11  import org.openide.loaders.DataObject;
   10.12  import org.openide.nodes.Node;
   10.13 @@ -56,6 +59,9 @@
   10.14  import org.openide.util.actions.CookieAction;
   10.15  import org.openide.util.datatransfer.ExClipboard;
   10.16  
   10.17 +@ActionID(id = "org.netbeans.modules.plsql.execution.CopyAsJavaStringAction", category = "PLSQL")
   10.18 +@ActionRegistration(displayName = "#CTL_CopyAsJavaStringAction")
   10.19 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 285)
   10.20  public class CopyAsJavaStringAction extends CookieAction {
   10.21  
   10.22      @Override
    11.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CreateTestBlockAction.java	Wed Dec 07 13:36:21 2011 +0100
    11.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CreateTestBlockAction.java	Tue Feb 14 17:31:28 2012 +0100
    11.3 @@ -66,6 +66,10 @@
    11.4  import org.netbeans.api.lexer.TokenSequence;
    11.5  import org.netbeans.api.project.FileOwnerQuery;
    11.6  import org.netbeans.api.project.Project;
    11.7 +import org.openide.awt.ActionID;
    11.8 +import org.openide.awt.ActionReference;
    11.9 +import org.openide.awt.ActionReferences;
   11.10 +import org.openide.awt.ActionRegistration;
   11.11  import org.openide.cookies.EditorCookie;
   11.12  import org.openide.loaders.DataObject;
   11.13  import org.openide.nodes.Node;
   11.14 @@ -76,6 +80,11 @@
   11.15  import org.openide.util.actions.CookieAction;
   11.16  import org.openide.windows.WindowManager;
   11.17  
   11.18 +@ActionID(id = "org.netbeans.modules.plsql.execution.CreateTestBlockAction", category = "PLSQL")
   11.19 +@ActionRegistration(displayName = "#CTL_CreateTestBlockAction")
   11.20 +@ActionReferences(value = {
   11.21 +   @ActionReference(path = "Shortcuts", name = "AS-B"),
   11.22 +   @ActionReference(path = "Editors/text/x-plsql/Popup", position = 281)})
   11.23  public final class CreateTestBlockAction extends CookieAction {
   11.24  
   11.25      private static final PlsqlFileValidatorService validator = Lookup.getDefault().lookup(PlsqlFileValidatorService.class);
    12.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/DescribeAction.java	Wed Dec 07 13:36:21 2011 +0100
    12.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/DescribeAction.java	Tue Feb 14 17:31:28 2012 +0100
    12.3 @@ -47,8 +47,9 @@
    12.4  import java.util.List;
    12.5  import javax.swing.text.Document;
    12.6  import org.netbeans.api.db.explorer.DatabaseConnection;
    12.7 -import org.netbeans.api.project.FileOwnerQuery;
    12.8 -import org.netbeans.api.project.Project;
    12.9 +import org.openide.awt.ActionID;
   12.10 +import org.openide.awt.ActionReference;
   12.11 +import org.openide.awt.ActionRegistration;
   12.12  import org.openide.cookies.EditorCookie;
   12.13  import org.openide.loaders.DataObject;
   12.14  import org.openide.nodes.Node;
   12.15 @@ -61,6 +62,9 @@
   12.16   *
   12.17   * @author YADHLK
   12.18   */
   12.19 +@ActionID(id = "org.netbeans.modules.plsql.execution.DescribeAction", category = "PLSQL")
   12.20 +@ActionRegistration(displayName = "#CTL_DescribeAction")
   12.21 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 283)
   12.22  public class DescribeAction extends CookieAction {
   12.23  
   12.24     private String viewName = null;
   12.25 @@ -78,7 +82,6 @@
   12.26     @Override
   12.27     protected void performAction(Node[] activatedNodes) {
   12.28        DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
   12.29 -      Project project = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
   12.30        EditorCookie ec = dataObject.getCookie(EditorCookie.class);
   12.31        final Document doc = ec.getDocument();
   12.32        final DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(dataObject);
   12.33 @@ -117,10 +120,10 @@
   12.34        return HelpCtx.DEFAULT_HELP;
   12.35     }
   12.36  
   12.37 +   @Override
   12.38     protected boolean enable(Node[] activatedNodes) {
   12.39        viewName = null;
   12.40  
   12.41 -      Project project = null;
   12.42        if (!super.enable(activatedNodes)) {
   12.43           return false;
   12.44        }
    13.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PasteAsSqlCommandAction.java	Wed Dec 07 13:36:21 2011 +0100
    13.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PasteAsSqlCommandAction.java	Tue Feb 14 17:31:28 2012 +0100
    13.3 @@ -45,9 +45,6 @@
    13.4  import java.awt.datatransfer.DataFlavor;
    13.5  import java.awt.datatransfer.Transferable;
    13.6  import java.awt.datatransfer.UnsupportedFlavorException;
    13.7 -import java.io.IOException;
    13.8 -import java.util.regex.Matcher;
    13.9 -import java.util.regex.Pattern;
   13.10  import javax.swing.JEditorPane;
   13.11  import javax.swing.text.BadLocationException;
   13.12  import javax.swing.text.Caret;
   13.13 @@ -55,6 +52,9 @@
   13.14  import javax.swing.text.JTextComponent;
   13.15  import org.netbeans.lib.editor.codetemplates.api.CodeTemplate;
   13.16  import org.netbeans.lib.editor.codetemplates.api.CodeTemplateManager;
   13.17 +import org.openide.awt.ActionID;
   13.18 +import org.openide.awt.ActionReference;
   13.19 +import org.openide.awt.ActionRegistration;
   13.20  import org.openide.cookies.EditorCookie;
   13.21  import org.openide.loaders.DataObject;
   13.22  import org.openide.nodes.Node;
   13.23 @@ -65,6 +65,9 @@
   13.24  import org.openide.util.actions.CookieAction;
   13.25  import org.openide.util.datatransfer.ExClipboard;
   13.26  
   13.27 +@ActionID(id = "org.netbeans.modules.plsql.execution.PasteAsSqlCommandAction", category = "PLSQL")
   13.28 +@ActionRegistration(displayName = "#CTL_PasteAsSqlCommandAction")
   13.29 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 286)
   13.30  public class PasteAsSqlCommandAction extends CookieAction {
   13.31  
   13.32      @Override
    14.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlCommitAction.java	Wed Dec 07 13:36:21 2011 +0100
    14.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlCommitAction.java	Tue Feb 14 17:31:28 2012 +0100
    14.3 @@ -1,7 +1,7 @@
    14.4  /*
    14.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6   *
    14.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    14.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    14.9   *
   14.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   14.11   * Other names may be trademarks of their respective owners.
   14.12 @@ -41,7 +41,6 @@
   14.13   */
   14.14  package org.netbeans.modules.plsql.execution;
   14.15  
   14.16 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   14.17  import java.awt.Component;
   14.18  import java.awt.event.ActionEvent;
   14.19  import java.awt.image.BufferedImage;
   14.20 @@ -57,20 +56,21 @@
   14.21  import org.netbeans.api.db.explorer.DatabaseConnection;
   14.22  import org.netbeans.api.progress.ProgressHandle;
   14.23  import org.netbeans.api.progress.ProgressHandleFactory;
   14.24 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   14.25  import org.netbeans.modules.plsqlsupport.options.OptionsUtilities;
   14.26 +import org.openide.awt.ActionID;
   14.27 +import org.openide.awt.ActionRegistration;
   14.28  import org.openide.awt.DropDownButtonFactory;
   14.29  import org.openide.cookies.EditorCookie;
   14.30  import org.openide.cookies.SaveCookie;
   14.31  import org.openide.loaders.DataObject;
   14.32 -import org.openide.util.ContextAwareAction;
   14.33 -import org.openide.util.Exceptions;
   14.34 -import org.openide.util.ImageUtilities;
   14.35 -import org.openide.util.Lookup;
   14.36 -import org.openide.util.NbBundle;
   14.37 -import org.openide.util.Utilities;
   14.38 +import org.openide.util.*;
   14.39  import org.openide.util.actions.Presenter;
   14.40  import org.openide.windows.IOProvider;
   14.41  import org.openide.windows.InputOutput;
   14.42 +
   14.43 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlCommitAction", category = "PLSQL")
   14.44 +@ActionRegistration(displayName = "#CTL_PlsqlCommit")
   14.45  public class PlsqlCommitAction extends AbstractAction implements ContextAwareAction, Presenter.Toolbar {
   14.46  
   14.47      private static final List<String> EXTENSIONS = Arrays.asList(new String[]{"tdb"});
   14.48 @@ -82,7 +82,6 @@
   14.49  
   14.50      public PlsqlCommitAction() {
   14.51          this(Utilities.actionsGlobalContext());
   14.52 -
   14.53      }
   14.54  
   14.55      public PlsqlCommitAction(Lookup context) {
   14.56 @@ -112,9 +111,9 @@
   14.57          } else {
   14.58              setEnabled(false);
   14.59          }
   14.60 -
   14.61      }
   14.62  
   14.63 +    @Override
   14.64      public Action createContextAwareInstance(Lookup context) {
   14.65          return new PlsqlCommitAction(context);
   14.66  
   14.67 @@ -125,17 +124,20 @@
   14.68              connectionProvider = DatabaseConnectionManager.getInstance(dataObject);
   14.69          }
   14.70  
   14.71 -         connection = dataObject.getLookup().lookup(DatabaseConnection.class);
   14.72 +        connection = dataObject.getLookup().lookup(DatabaseConnection.class);
   14.73      }
   14.74  
   14.75 +    @Override
   14.76      public void actionPerformed(ActionEvent event) {
   14.77  
   14.78          prepareConnection();
   14.79 -        if (connectionProvider == null || connection == null)
   14.80 +        if (connectionProvider == null || connection == null) {
   14.81              return;
   14.82 +        }
   14.83  
   14.84 -        if(!connectionProvider.hasDataToCommit(connection))
   14.85 +        if (!connectionProvider.hasDataToCommit(connection)) {
   14.86              return;
   14.87 +        }
   14.88  
   14.89          EditorCookie edCookie = dataObject.getLookup().lookup(EditorCookie.class);
   14.90          Document document = edCookie.getDocument();
   14.91 @@ -148,20 +150,23 @@
   14.92  
   14.93          try {
   14.94              io = IOProvider.getDefault().getIO(obj.getPrimaryFile().getNameExt(), false);
   14.95 -            if(!io.isClosed())
   14.96 +            if (!io.isClosed()) {
   14.97                  io.getOut().println((new StringBuilder()).append("> Commit Statement successfully"));
   14.98 +            }
   14.99  
  14.100 -                if(connection.getJDBCConnection()!=null)
  14.101 -                  connectionProvider.commitRollbackTransactions(connection, true);
  14.102 +            if (connection.getJDBCConnection() != null) {
  14.103 +                connectionProvider.commitRollbackTransactions(connection, true);
  14.104 +            }
  14.105  
  14.106          } catch (Exception ex) {
  14.107 -           io.getOut().println((new StringBuilder()).append(">!!! Error Commit Statement"));
  14.108 -           Exceptions.printStackTrace(ex);
  14.109 +            io.getOut().println((new StringBuilder()).append(">!!! Error Commit Statement"));
  14.110 +            Exceptions.printStackTrace(ex);
  14.111          } finally {
  14.112              handle.finish();
  14.113          }
  14.114      }
  14.115  
  14.116 +    @Override
  14.117      public Component getToolbarPresenter() {
  14.118          if (!isEnabled()) {
  14.119              return null;
  14.120 @@ -175,10 +180,6 @@
  14.121          return button;
  14.122      }
  14.123  
  14.124 -    private void updateButton() {
  14.125 -          button.setEnabled(true);
  14.126 -    }
  14.127 -
  14.128      private void saveIfModified(DataObject dataObj) {
  14.129          try {
  14.130              SaveCookie saveCookie = dataObj.getCookie(SaveCookie.class);
    15.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutableBlocksMaker.java	Wed Dec 07 13:36:21 2011 +0100
    15.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutableBlocksMaker.java	Tue Feb 14 17:31:28 2012 +0100
    15.3 @@ -57,480 +57,490 @@
    15.4  
    15.5  public class PlsqlExecutableBlocksMaker {
    15.6  
    15.7 -   public PlsqlExecutableBlocksMaker(Document doc) {
    15.8 -      try {
    15.9 -         this.doc = doc;
   15.10 -         dataObj = FileExecutionUtil.getDataObject(doc);
   15.11 -         docContent = doc.getText(0, doc.getLength());
   15.12 -         originalFileName = FileExecutionUtil.getActivatedFileName(dataObj);
   15.13 -         docLines = FileExecutionUtil.splitStringToVector(docContent);
   15.14 -         executableObjs = new ArrayList<PlsqlExecutableObject>();
   15.15 -      } catch (BadLocationException ex) {
   15.16 -         Exceptions.printStackTrace(ex);
   15.17 -      }
   15.18 -   }
   15.19 +    public PlsqlExecutableBlocksMaker(Document doc) {
   15.20 +        try {
   15.21 +            this.doc = doc;
   15.22 +            dataObj = FileExecutionUtil.getDataObject(doc);
   15.23 +            docContent = doc.getText(0, doc.getLength());
   15.24 +            originalFileName = FileExecutionUtil.getActivatedFileName(dataObj);
   15.25 +            docLines = FileExecutionUtil.splitStringToVector(docContent);
   15.26 +            executableObjs = new ArrayList<PlsqlExecutableObject>();
   15.27 +        } catch (BadLocationException ex) {
   15.28 +            Exceptions.printStackTrace(ex);
   15.29 +        }
   15.30 +    }
   15.31  
   15.32 -   /**
   15.33 -    * Method that will make executable objects of a plsql file
   15.34 -    */
   15.35 -   public List<PlsqlExecutableObject> makeExceutableObjects() {
   15.36 -      PlsqlBlockFactory blockFac = dataObj.getLookup().lookup(PlsqlBlockFactory.class);
   15.37 +    /**
   15.38 +     * Method that will make executable objects of a plsql file
   15.39 +     */
   15.40 +    public List<PlsqlExecutableObject> makeExceutableObjects() {
   15.41 +        PlsqlBlockFactory blockFac = dataObj.getLookup().lookup(PlsqlBlockFactory.class);
   15.42  
   15.43 -      if (blockFac == null) {
   15.44 -         return null;
   15.45 -      }
   15.46 +        if (blockFac == null) {
   15.47 +            return null;
   15.48 +        }
   15.49  
   15.50 -      //check whether the initial parsing has happened
   15.51 -      Object object = doc.getProperty("Listener");
   15.52 -      if ((object == null) || (!object.equals("YES"))) {
   15.53 -         blockFac.initHierarchy(doc);
   15.54 -      } else {
   15.55 -         //force reparsing of the document
   15.56 -         blockFac.reParse(doc);
   15.57 -      }
   15.58 +        //check whether the initial parsing has happened
   15.59 +        Object object = doc.getProperty("Listener");
   15.60 +        if ((object == null) || (!object.equals("YES"))) {
   15.61 +            blockFac.initHierarchy(doc);
   15.62 +        } else {
   15.63 +            //force reparsing of the document
   15.64 +            blockFac.reParse(doc);
   15.65 +        }
   15.66  
   15.67  
   15.68 -      try {
   15.69 -         List<PlsqlBlock> blockHier = blockFac.getBlockHierarchy();
   15.70 -         for (int i = 0; i < blockHier.size(); i++) {
   15.71 -            PlsqlBlock block = blockHier.get(i);
   15.72 -            PlsqlBlockType type = block.getType();
   15.73 -            String name = block.getName();
   15.74 -            int start = block.getStartOffset();
   15.75 -            int startLine = FileExecutionUtil.getLineNoForOffset(doc, start);
   15.76 -            int end = block.getEndOffset();
   15.77 -            String content = doc.getText(start, end - start);
   15.78 -            PlsqlExecutableObject obj = null;
   15.79 +        try {
   15.80 +            List<PlsqlBlock> blockHier = blockFac.getBlockHierarchy();
   15.81 +            for (int i = 0; i < blockHier.size(); i++) {
   15.82 +                PlsqlBlock block = blockHier.get(i);
   15.83 +                PlsqlBlockType type = block.getType();
   15.84 +                String name = block.getName();
   15.85 +                int start = block.getStartOffset();
   15.86 +                int startLine = FileExecutionUtil.getLineNoForOffset(doc, start);
   15.87 +                int end = block.getEndOffset();
   15.88 +                String content = doc.getText(start, end - start);
   15.89 +                PlsqlExecutableObject obj = null;
   15.90  
   15.91 -            if (type == PlsqlBlockType.VIEW) {
   15.92 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.VIEW, start, end);
   15.93 -            } else if (type == PlsqlBlockType.TABLE_COMMENT) {
   15.94 -               executableObjs = createCommentBlocks(start, content, name, PlsqlExecutableObjectType.TABLECOMMENT, executableObjs, blockFac);
   15.95 -            } else if (type == PlsqlBlockType.COLUMN_COMMENT) {
   15.96 -               executableObjs = createCommentBlocks(start, content, name, PlsqlExecutableObjectType.COLUMNCOMMENT, executableObjs, blockFac);
   15.97 -            } else if (type == PlsqlBlockType.PACKAGE) {
   15.98 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.PACKAGE, start, end);
   15.99 -            } else if (type == PlsqlBlockType.PACKAGE_BODY) {
  15.100 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.PACKAGEBODY, start, end);
  15.101 -            } else if (type == PlsqlBlockType.PROCEDURE_IMPL) {
  15.102 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.PROCEDURE, start, end);
  15.103 -            } else if (type == PlsqlBlockType.FUNCTION_IMPL) {
  15.104 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.FUNCTION, start, end);
  15.105 -            } else if (type == PlsqlBlockType.DECLARE_END) {
  15.106 -               if (!content.trim().endsWith(";"))
  15.107 -                  content = content + ";";
  15.108 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.DECLAREEND, start, end);
  15.109 -            } else if (type == PlsqlBlockType.BEGIN_END) {
  15.110 -               if (!content.trim().endsWith(";"))
  15.111 -                  content = content + ";";
  15.112 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.BEGINEND, start, end);
  15.113 -            } else if (type == PlsqlBlockType.COMMENT) {
  15.114 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.COMMENT, start, end);
  15.115 -            } else if (type == PlsqlBlockType.TRIGGER) {
  15.116 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.TRIGGER, start, end);
  15.117 -            } else if (type == PlsqlBlockType.STATEMENT) {
  15.118 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.STATEMENT, start, end);
  15.119 -            } else if (type == PlsqlBlockType.JAVA_SOURCE) {
  15.120 -               obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.JAVASOURCE, start, end);
  15.121 +                if (type == PlsqlBlockType.VIEW) {
  15.122 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.VIEW, start, end);
  15.123 +                } else if (type == PlsqlBlockType.TABLE_COMMENT) {
  15.124 +                    executableObjs = createCommentBlocks(start, content, name, PlsqlExecutableObjectType.TABLECOMMENT, executableObjs, blockFac);
  15.125 +                } else if (type == PlsqlBlockType.COLUMN_COMMENT) {
  15.126 +                    executableObjs = createCommentBlocks(start, content, name, PlsqlExecutableObjectType.COLUMNCOMMENT, executableObjs, blockFac);
  15.127 +                } else if (type == PlsqlBlockType.PACKAGE) {
  15.128 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.PACKAGE, start, end);
  15.129 +                } else if (type == PlsqlBlockType.PACKAGE_BODY) {
  15.130 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.PACKAGEBODY, start, end);
  15.131 +                } else if (type == PlsqlBlockType.PROCEDURE_IMPL) {
  15.132 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.PROCEDURE, start, end);
  15.133 +                } else if (type == PlsqlBlockType.FUNCTION_IMPL) {
  15.134 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.FUNCTION, start, end);
  15.135 +                } else if (type == PlsqlBlockType.DECLARE_END) {
  15.136 +                    if (!content.trim().endsWith(";")) {
  15.137 +                        content = content + ";";
  15.138 +                    }
  15.139 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.DECLAREEND, start, end);
  15.140 +                } else if (type == PlsqlBlockType.BEGIN_END) {
  15.141 +                    if (!content.trim().endsWith(";")) {
  15.142 +                        content = content + ";";
  15.143 +                    }
  15.144 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.BEGINEND, start, end);
  15.145 +                } else if (type == PlsqlBlockType.COMMENT) {
  15.146 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.COMMENT, start, end);
  15.147 +                } else if (type == PlsqlBlockType.TRIGGER) {
  15.148 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.TRIGGER, start, end);
  15.149 +                } else if (type == PlsqlBlockType.STATEMENT) {
  15.150 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.STATEMENT, start, end);
  15.151 +                } else if (type == PlsqlBlockType.JAVA_SOURCE) {
  15.152 +                    obj = new PlsqlExecutableObject(startLine, content, name, PlsqlExecutableObjectType.JAVASOURCE, start, end);
  15.153 +                }
  15.154 +
  15.155 +                if (obj != null) {
  15.156 +                    obj.setDocLinesArray(docLines);
  15.157 +                    obj.setOriginalFileName(originalFileName);
  15.158 +                    executableObjs.add(obj);
  15.159 +                }
  15.160              }
  15.161  
  15.162 -            if (obj != null) {
  15.163 -               obj.setDocLinesArray(docLines);
  15.164 -               obj.setOriginalFileName(originalFileName);
  15.165 -               executableObjs.add(obj);
  15.166 +            //Now add the unknown objects and sort
  15.167 +            blockHier = sortBlockHier(blockHier);
  15.168 +            addOtherObjects(blockHier, executableObjs);
  15.169 +            sortExecutableObjects(executableObjs);
  15.170 +        } catch (BadLocationException ex) {
  15.171 +            Exceptions.printStackTrace(ex);
  15.172 +        }
  15.173 +
  15.174 +        return executableObjs;
  15.175 +    }
  15.176 +
  15.177 +    /**
  15.178 +     * Method that will add other objects (unrecognized blocks)
  15.179 +     * @param blockHier
  15.180 +     * @param executableObjs 
  15.181 +     */
  15.182 +    private void addOtherObjects(List<PlsqlBlock> blockHier, List<PlsqlExecutableObject> executableObjs) {
  15.183 +        int startDoc = doc.getStartPosition().getOffset();
  15.184 +        int endDocument = doc.getEndPosition().getOffset();
  15.185 +        try {
  15.186 +            for (int i = 0; i < blockHier.size(); i++) {
  15.187 +                PlsqlBlock block = blockHier.get(i);
  15.188 +                if (block.getType() != PlsqlBlockType.COMMENT) {
  15.189 +                    int startBlock = block.getStartOffset();
  15.190 +                    int endBlock = block.getEndOffset();
  15.191 +
  15.192 +                    if (startDoc < startBlock) {
  15.193 +                        //Create a block
  15.194 +                        String content = doc.getText(startDoc, startBlock - startDoc);
  15.195 +                        checkAndAddBlocks(executableObjs, content, startDoc, startBlock);
  15.196 +                    }
  15.197 +                    startDoc = endBlock;
  15.198 +                }
  15.199              }
  15.200 -         }
  15.201  
  15.202 -         //Now add the unknown objects and sort
  15.203 -         blockHier = sortBlockHier(blockHier);
  15.204 -         addOtherObjects(blockHier, executableObjs);
  15.205 -         sortExecutableObjects(executableObjs);
  15.206 -      } catch (BadLocationException ex) {
  15.207 -         Exceptions.printStackTrace(ex);
  15.208 -      }
  15.209 +            //After the blocks if there is something left add that
  15.210 +            if (startDoc != endDocument) {
  15.211 +                String content = doc.getText(startDoc, endDocument - startDoc);
  15.212 +                checkAndAddBlocks(executableObjs, content, startDoc, endDocument);
  15.213 +            }
  15.214 +        } catch (BadLocationException ex) {
  15.215 +            Exceptions.printStackTrace(ex);
  15.216 +        }
  15.217 +    }
  15.218  
  15.219 -      return executableObjs;
  15.220 -   }
  15.221 +    /**
  15.222 +     * Method that will add unknown blocks to executable objects
  15.223 +     * @param executableObjs
  15.224 +     * @param content
  15.225 +     * @param startoffset
  15.226 +     */
  15.227 +    private void addUnknownBlock(List<PlsqlExecutableObject> executableObjs, String content, int startDoc) {
  15.228 +        int startLine = FileExecutionUtil.getLineNoForOffset(doc, startDoc);
  15.229  
  15.230 -   /**
  15.231 -    * Method that will add other objects (unrecognized blocks)
  15.232 -    * @param blockHier
  15.233 -    * @param executableObjs 
  15.234 -    */
  15.235 -   private void addOtherObjects(List<PlsqlBlock> blockHier, List<PlsqlExecutableObject> executableObjs) {
  15.236 -      int startDoc = doc.getStartPosition().getOffset();
  15.237 -      int endDocument = doc.getEndPosition().getOffset();
  15.238 -      try {
  15.239 -         for (int i = 0; i < blockHier.size(); i++) {
  15.240 -            PlsqlBlock block = blockHier.get(i);
  15.241 -            int startBlock = block.getStartOffset();
  15.242 -            int endBlock = block.getEndOffset();
  15.243 +        //Ingore '/' and ';' which are added manually
  15.244 +        if ((content.trim().equals(";")) || (content.trim().equals("/")) || (content.trim().equals(""))) {
  15.245 +            return;
  15.246 +        }
  15.247  
  15.248 -            if (startDoc < startBlock) {
  15.249 -               //Create a block
  15.250 -               String content = doc.getText(startDoc, startBlock - startDoc);
  15.251 -               checkAndAddBlocks(executableObjs, content, startDoc, startBlock);
  15.252 +        PlsqlExecutableObject obj = new PlsqlExecutableObject(startLine, content, "", PlsqlExecutableObjectType.UNKNOWN, startDoc, startDoc + content.length());
  15.253 +        obj.setDocLinesArray(docLines);
  15.254 +        obj.setOriginalFileName(originalFileName);
  15.255 +        executableObjs.add(obj);
  15.256 +    }
  15.257 +
  15.258 +    /**
  15.259 +     * Method that will check and add unknown blocks
  15.260 +     * @param executableObjs
  15.261 +     * @param content
  15.262 +     * @param startDoc
  15.263 +     * @param endOff
  15.264 +     */
  15.265 +    private void checkAndAddBlocks(List<PlsqlExecutableObject> executableObjs, String content, int startDoc, int endOff) {
  15.266 +        TokenHierarchy tokenHierarchy = TokenHierarchy.get(doc);
  15.267 +        @SuppressWarnings("unchecked")
  15.268 +        TokenSequence<PlsqlTokenId> ts = tokenHierarchy.tokenSequence(PlsqlTokenId.language());
  15.269 +        ts.move(startDoc);
  15.270 +        boolean moveNext = ts.moveNext();
  15.271 +        Token<PlsqlTokenId> token = ts.token();
  15.272 +        int offset = 0;
  15.273 +        boolean startOfBlock = true;
  15.274 +
  15.275 +        //Get the define by the name
  15.276 +        while (moveNext) {
  15.277 +            String text = token.text().toString();
  15.278 +            if (ts.offset() >= endOff) {
  15.279 +                break;
  15.280              }
  15.281 -            startDoc = endBlock;
  15.282 -         }
  15.283  
  15.284 -         //After the blocks if there is something left add that
  15.285 -         if (startDoc != endDocument) {
  15.286 -            String content = doc.getText(startDoc, endDocument - startDoc);
  15.287 -            checkAndAddBlocks(executableObjs, content, startDoc, endDocument);
  15.288 -         }
  15.289 -      } catch (BadLocationException ex) {
  15.290 -         Exceptions.printStackTrace(ex);
  15.291 -      }
  15.292 -   }
  15.293 +            if (startOfBlock && (token.id() == PlsqlTokenId.LINE_COMMENT || token.id() == PlsqlTokenId.BLOCK_COMMENT || token.id() == PlsqlTokenId.WHITESPACE || token.id() == PlsqlTokenId.IGNORE_MARKER)) {
  15.294 +                //skip comments at the beginning of a statement (and in between or after statement)
  15.295 +                offset = ts.offset() - startDoc + token.toString().length();
  15.296 +            } else if (token.id() == PlsqlTokenId.OPERATOR) {
  15.297 +                if (text.equals(";")) {
  15.298 +                    int temp = ts.offset();
  15.299 +                    addUnknownBlock(executableObjs, content.substring(offset, temp - startDoc), startDoc + offset);
  15.300 +                    startOfBlock = true;
  15.301 +                    offset = temp - startDoc + 1; //add 1 to avoid the ;
  15.302  
  15.303 -   /**
  15.304 -    * Method that will add unknown blocks to executable objects
  15.305 -    * @param executableObjs
  15.306 -    * @param content
  15.307 -    * @param startoffset
  15.308 -    */
  15.309 -   private void addUnknownBlock(List<PlsqlExecutableObject> executableObjs, String content, int startDoc) {
  15.310 -      int startLine = FileExecutionUtil.getLineNoForOffset(doc, startDoc);
  15.311 +                } else if (text.equals("/")) {
  15.312 +                    int temp = ts.offset();
  15.313 +                    boolean isSeparator = true;
  15.314  
  15.315 -      //Ingore '/' and ';' which are added manually
  15.316 -      if ((content.trim().equals(";")) || (content.trim().equals("/")) || (content.trim().equals(""))) {
  15.317 -         return;
  15.318 -      }
  15.319 +                    Token<PlsqlTokenId> tokenPre = ts.token();
  15.320 +                    while (ts.movePrevious()) {
  15.321 +                        tokenPre = ts.token();
  15.322  
  15.323 -      PlsqlExecutableObject obj = new PlsqlExecutableObject(startLine, content, "", PlsqlExecutableObjectType.UNKNOWN, startDoc, startDoc + content.length());
  15.324 -      obj.setDocLinesArray(docLines);
  15.325 -      obj.setOriginalFileName(originalFileName);
  15.326 -      executableObjs.add(obj);
  15.327 -   }
  15.328 +                        if ((tokenPre.id() == PlsqlTokenId.WHITESPACE)
  15.329 +                                && (tokenPre.text().toString().contains("\n"))) {
  15.330 +                            break;
  15.331 +                        } else {
  15.332 +                            isSeparator = false;
  15.333 +                            break;
  15.334 +                        }
  15.335 +                    }
  15.336  
  15.337 -   /**
  15.338 -    * Method that will check and add unknown blocks
  15.339 -    * @param executableObjs
  15.340 -    * @param content
  15.341 -    * @param startDoc
  15.342 -    * @param endOff
  15.343 -    */
  15.344 -   private void checkAndAddBlocks(List<PlsqlExecutableObject> executableObjs, String content, int startDoc, int endOff) {
  15.345 -      TokenHierarchy tokenHierarchy = TokenHierarchy.get(doc);
  15.346 -      @SuppressWarnings("unchecked")
  15.347 -      TokenSequence<PlsqlTokenId> ts = tokenHierarchy.tokenSequence(PlsqlTokenId.language());
  15.348 -      ts.move(startDoc);
  15.349 -      boolean moveNext = ts.moveNext();
  15.350 -      Token<PlsqlTokenId> token = ts.token();
  15.351 -      int offset = 0;
  15.352 -      boolean startOfBlock = true;
  15.353 +                    ts.move(temp);
  15.354 +                    ts.moveNext();
  15.355 +                    if (!isSeparator) {
  15.356 +                        moveNext = ts.moveNext();
  15.357 +                        token = ts.token();
  15.358 +                        continue;
  15.359 +                    }
  15.360  
  15.361 -      //Get the define by the name
  15.362 -      while (moveNext) {
  15.363 -         String text = token.text().toString();
  15.364 -         if (ts.offset() >= endOff) {
  15.365 -            break;
  15.366 -         }
  15.367 +                    Token<PlsqlTokenId> tokenNext = ts.token();
  15.368 +                    while (ts.moveNext()) {
  15.369 +                        tokenNext = ts.token();
  15.370  
  15.371 -         if (startOfBlock && (token.id() == PlsqlTokenId.LINE_COMMENT || token.id() == PlsqlTokenId.BLOCK_COMMENT || token.id() == PlsqlTokenId.WHITESPACE)) {
  15.372 -            //skip comments at the beginning of a statement (and in between or after statement)
  15.373 -            offset = ts.offset() - startDoc + token.toString().length();
  15.374 -         } else if (token.id() == PlsqlTokenId.OPERATOR) {
  15.375 -            if (text.equals(";")) {
  15.376 -               int temp = ts.offset();
  15.377 -               addUnknownBlock(executableObjs, content.substring(offset, temp - startDoc), startDoc + offset);
  15.378 -               startOfBlock = true;
  15.379 -               offset = temp - startDoc + 1; //add 1 to avoid the ;
  15.380 +                        if ((tokenNext.id() == PlsqlTokenId.WHITESPACE)
  15.381 +                                && (tokenNext.text().toString().contains("\n"))) {
  15.382 +                            break;
  15.383 +                        } else {
  15.384 +                            isSeparator = false;
  15.385 +                            break;
  15.386 +                        }
  15.387 +                    }
  15.388  
  15.389 -            } else if (text.equals("/")) {
  15.390 -               int temp = ts.offset();
  15.391 -               boolean isSeparator = true;
  15.392 +                    ts.move(temp);
  15.393 +                    ts.moveNext();
  15.394 +                    if (!isSeparator) {
  15.395 +                        moveNext = ts.moveNext();
  15.396 +                        token = ts.token();
  15.397 +                        continue;
  15.398 +                    }
  15.399  
  15.400 -               Token<PlsqlTokenId> tokenPre = ts.token();
  15.401 -               while (ts.movePrevious()) {
  15.402 -                  tokenPre = ts.token();
  15.403 +                    addUnknownBlock(executableObjs, content.substring(offset, temp - startDoc), startDoc + offset);
  15.404 +                    startOfBlock = true;
  15.405 +                    offset = temp - startDoc + 1; //add 1 to avoid the /
  15.406  
  15.407 -                  if ((tokenPre.id() == PlsqlTokenId.WHITESPACE) &&
  15.408 -                          (tokenPre.text().toString().contains("\n"))) {
  15.409 -                     break;
  15.410 -                  } else {
  15.411 -                     isSeparator = false;
  15.412 -                     break;
  15.413 -                  }
  15.414 -               }
  15.415 +                } else {
  15.416 +                    startOfBlock = false;
  15.417 +                }
  15.418 +            } else if (startOfBlock && token.id() == PlsqlTokenId.SQL_PLUS) {
  15.419 +                //find next line break (if end of stream the block will be included anyway so nothing to worry about
  15.420 +                String tokenText = FileExecutionUtil.readLine(ts, token);
  15.421 +                if (ts.moveNext()) { //Next token is line end - potentially plus whitespaces...
  15.422 +                    int temp = ts.offset() + ts.token().text().length();
  15.423 +                    addUnknownBlock(executableObjs, tokenText, startDoc + offset);
  15.424 +                    startOfBlock = true;
  15.425 +                    offset = temp - startDoc;
  15.426 +                }
  15.427 +            } else if (token.id() != PlsqlTokenId.WHITESPACE) {
  15.428 +                startOfBlock = false;
  15.429 +            }
  15.430  
  15.431 -               ts.move(temp);
  15.432 -               ts.moveNext();
  15.433 -               if (!isSeparator) {
  15.434 -                  moveNext = ts.moveNext();
  15.435 -                  token = ts.token();
  15.436 -                  continue;
  15.437 -               }
  15.438 +            moveNext = ts.moveNext();
  15.439 +            token = ts.token();
  15.440 +        }
  15.441  
  15.442 -               Token<PlsqlTokenId> tokenNext = ts.token();
  15.443 -               while (ts.moveNext()) {
  15.444 -                  tokenNext = ts.token();
  15.445 +        //Add remainings as another block
  15.446 +        addUnknownBlock(executableObjs, content.substring(offset), startDoc + offset);
  15.447 +    }
  15.448  
  15.449 -                  if ((tokenNext.id() == PlsqlTokenId.WHITESPACE) &&
  15.450 -                          (tokenNext.text().toString().contains("\n"))) {
  15.451 -                     break;
  15.452 -                  } else {
  15.453 -                     isSeparator = false;
  15.454 -                     break;
  15.455 -                  }
  15.456 -               }
  15.457 +    /**
  15.458 +     * Seperate individual comment blocks
  15.459 +     * @param startLine
  15.460 +     * @param content
  15.461 +     * @param name
  15.462 +     * @param blocks
  15.463 +     */
  15.464 +    private List<PlsqlExecutableObject> createCommentBlocks(int startLine, String content, String name, PlsqlExecutableObjectType type, List<PlsqlExecutableObject> blocks, PlsqlBlockFactory blockFac) {
  15.465 +        String blockContent;
  15.466 +        int start = 0;
  15.467 +        int nextPos = -1;
  15.468 +        PlsqlExecutableObject obj = null;
  15.469 +        int startPos = 0;
  15.470  
  15.471 -               ts.move(temp);
  15.472 -               ts.moveNext();
  15.473 -               if (!isSeparator) {
  15.474 -                  moveNext = ts.moveNext();
  15.475 -                  token = ts.token();
  15.476 -                  continue;
  15.477 -               }
  15.478 +        for (; startPos < content.length(); startPos = nextPos + 1) {
  15.479 +            nextPos = content.indexOf(";", startPos);
  15.480 +            if (nextPos == -1) {
  15.481 +                int slash = content.indexOf("/", startPos);
  15.482 +                //check whether this index is the only one in the line
  15.483 +                while (slash != -1 && !isOnlyCharInLine(content, slash)) {
  15.484 +                    slash = content.indexOf("/", slash + 1);
  15.485 +                }
  15.486 +                nextPos = slash;
  15.487 +            }
  15.488 +            if (nextPos != -1) {
  15.489 +                start = FileExecutionUtil.getLineNoForOffset(doc, startLine + startPos);
  15.490 +                blockContent = content.substring(startPos, nextPos);
  15.491 +                if (type == PlsqlExecutableObjectType.TABLECOMMENT) {
  15.492 +                    name = getTableName(blockContent, blockFac);
  15.493 +                }
  15.494 +                obj = new PlsqlExecutableObject(start, blockContent, name, type, startLine + startPos, nextPos);
  15.495 +                obj.setDocLinesArray(docLines);
  15.496 +                obj.setOriginalFileName(originalFileName);
  15.497 +                blocks.add(obj);
  15.498 +            } else {
  15.499 +                break;
  15.500 +            }
  15.501 +        }
  15.502  
  15.503 -               addUnknownBlock(executableObjs, content.substring(offset, temp - startDoc), startDoc + offset);
  15.504 -               startOfBlock = true;
  15.505 -               offset = temp - startDoc + 1; //add 1 to avoid the /
  15.506 -
  15.507 -            } else {
  15.508 -               startOfBlock = false;
  15.509 +        //If there is only one block add that, or the last block
  15.510 +        if (startLine + startPos < startLine + content.length()) {
  15.511 +            start = FileExecutionUtil.getLineNoForOffset(doc, startLine + startPos);
  15.512 +            blockContent = content.substring(startPos);
  15.513 +            if (type == PlsqlExecutableObjectType.TABLECOMMENT) {
  15.514 +                name = getTableName(blockContent, blockFac);
  15.515              }
  15.516 -         } else if (startOfBlock && token.id() == PlsqlTokenId.SQL_PLUS) {
  15.517 -            //find next line break (if end of stream the block will be included anyway so nothing to worry about
  15.518 -            String tokenText = FileExecutionUtil.readLine(ts, token);
  15.519 -            if (ts.moveNext()) { //Next token is line end - potentially plus whitespaces...
  15.520 -               int temp = ts.offset() + ts.token().text().length();
  15.521 -               addUnknownBlock(executableObjs, tokenText, startDoc + offset);
  15.522 -               startOfBlock = true;
  15.523 -               offset = temp - startDoc;
  15.524 -            }
  15.525 -         } else if (token.id() != PlsqlTokenId.WHITESPACE) {
  15.526 -               startOfBlock = false;
  15.527 -         }
  15.528 -
  15.529 -         moveNext = ts.moveNext();
  15.530 -         token = ts.token();
  15.531 -      }
  15.532 -
  15.533 -      //Add remainings as another block
  15.534 -      addUnknownBlock(executableObjs, content.substring(offset), startDoc + offset);
  15.535 -   }
  15.536 -
  15.537 -   /**
  15.538 -    * Seperate individual comment blocks
  15.539 -    * @param startLine
  15.540 -    * @param content
  15.541 -    * @param name
  15.542 -    * @param blocks
  15.543 -    */
  15.544 -   private List<PlsqlExecutableObject> createCommentBlocks(int startLine, String content, String name, PlsqlExecutableObjectType type, List<PlsqlExecutableObject> blocks, PlsqlBlockFactory blockFac) {
  15.545 -      String blockContent;
  15.546 -      int start = 0;
  15.547 -      int nextPos = -1;
  15.548 -      PlsqlExecutableObject obj = null;
  15.549 -      int startPos = 0;
  15.550 -
  15.551 -      for (; startPos < content.length(); startPos = nextPos + 1) {
  15.552 -         nextPos = content.indexOf(";", startPos);
  15.553 -         if (nextPos == -1) {
  15.554 -            int slash = content.indexOf("/", startPos);
  15.555 -            //check whether this index is the only one in the line
  15.556 -            while (slash != -1 && !isOnlyCharInLine(content, slash)) {
  15.557 -               slash = content.indexOf("/", slash + 1);
  15.558 -            }
  15.559 -            nextPos = slash;
  15.560 -         }
  15.561 -         if (nextPos != -1) {
  15.562 -            start = FileExecutionUtil.getLineNoForOffset(doc, startLine + startPos);
  15.563 -            blockContent = content.substring(startPos, nextPos);
  15.564 -            if (type == PlsqlExecutableObjectType.TABLECOMMENT) {
  15.565 -               name = getTableName(blockContent, blockFac);
  15.566 -            }
  15.567 -            obj = new PlsqlExecutableObject(start, blockContent, name, type, startLine + startPos, nextPos);
  15.568 +            obj = new PlsqlExecutableObject(start, blockContent, name, type,
  15.569 +                    startLine + startPos, startLine + startPos + blockContent.length());
  15.570              obj.setDocLinesArray(docLines);
  15.571              obj.setOriginalFileName(originalFileName);
  15.572              blocks.add(obj);
  15.573 -         } else {
  15.574 -            break;
  15.575 -         }
  15.576 -      }
  15.577 +        }
  15.578  
  15.579 -      //If there is only one block add that, or the last block
  15.580 -      if (startLine + startPos < startLine + content.length()) {
  15.581 -         start = FileExecutionUtil.getLineNoForOffset(doc, startLine + startPos);
  15.582 -         blockContent = content.substring(startPos);
  15.583 -         if (type == PlsqlExecutableObjectType.TABLECOMMENT)
  15.584 -               name = getTableName(blockContent, blockFac);
  15.585 -         obj = new PlsqlExecutableObject(start, blockContent, name, type,
  15.586 -                 startLine + startPos, startLine + startPos + blockContent.length());
  15.587 -         obj.setDocLinesArray(docLines);
  15.588 -         obj.setOriginalFileName(originalFileName);
  15.589 -         blocks.add(obj);
  15.590 -      }
  15.591 +        return blocks;
  15.592 +    }
  15.593  
  15.594 -      return blocks;
  15.595 -   }
  15.596 +    /**
  15.597 +     * Check whether the given index character is the only character in that line
  15.598 +     * @param content
  15.599 +     * @param slash
  15.600 +     * @return
  15.601 +     */
  15.602 +    private boolean isOnlyCharInLine(String content, int slash) {
  15.603 +        int startPos = slash + 1;
  15.604 +        boolean isEndOk = false;
  15.605 +        for (; startPos < content.length(); startPos++) {
  15.606 +            int ch = content.charAt(startPos);
  15.607 +            if (Character.isWhitespace(ch)) {
  15.608 +                if (ch == '\n') {
  15.609 +                    isEndOk = true;
  15.610 +                    break;
  15.611 +                }
  15.612 +            } else {
  15.613 +                break;
  15.614 +            }
  15.615 +        }
  15.616  
  15.617 -   /**
  15.618 -    * Check whether the given index character is the only character in that line
  15.619 -    * @param content
  15.620 -    * @param slash
  15.621 -    * @return
  15.622 -    */
  15.623 -   private boolean isOnlyCharInLine(String content, int slash) {
  15.624 -      int startPos = slash + 1;
  15.625 -      boolean isEndOk = false;
  15.626 -      for (; startPos < content.length(); startPos++) {
  15.627 -         int ch = content.charAt(startPos);
  15.628 -         if (Character.isWhitespace(ch)) {
  15.629 -            if (ch == '\n') {
  15.630 -               isEndOk = true;
  15.631 -               break;
  15.632 +        startPos = slash - 1;
  15.633 +        boolean isStartOk = false;
  15.634 +        for (; startPos >= 0; startPos--) {
  15.635 +            int ch = content.charAt(startPos);
  15.636 +            if (Character.isWhitespace(ch)) {
  15.637 +                if (ch == '\n') {
  15.638 +                    isStartOk = true;
  15.639 +                    break;
  15.640 +                }
  15.641 +            } else {
  15.642 +                break;
  15.643              }
  15.644 -         } else {
  15.645 -            break;
  15.646 -         }
  15.647 -      }
  15.648 +        }
  15.649  
  15.650 -      startPos = slash - 1;
  15.651 -      boolean isStartOk = false;
  15.652 -      for (; startPos >= 0; startPos--) {
  15.653 -         int ch = content.charAt(startPos);
  15.654 -         if (Character.isWhitespace(ch)) {
  15.655 -            if (ch == '\n') {
  15.656 -               isStartOk = true;
  15.657 -               break;
  15.658 +        if (isStartOk && isEndOk) {
  15.659 +            return true;
  15.660 +        }
  15.661 +
  15.662 +        return false;
  15.663 +    }
  15.664 +
  15.665 +    private String getTableName(String content, PlsqlBlockFactory blockFac) {
  15.666 +        int start = content.toUpperCase(Locale.ENGLISH).indexOf("TABLE");
  15.667 +        if (start == -1) {
  15.668 +            return "";
  15.669 +        }
  15.670 +        //next word is the name of the table
  15.671 +        start = start + 5;
  15.672 +        int end = -1;
  15.673 +        for (int i = start; i < content.length(); i++) {
  15.674 +            char ch = content.charAt(i);
  15.675 +            if (Character.isWhitespace(ch) && end != -1) //whitespace after the next word...
  15.676 +            {
  15.677 +                break;
  15.678 +            } else if (!Character.isJavaIdentifierPart(ch) && ch != '&' && end != -1) {
  15.679 +                break;
  15.680 +            } else {
  15.681 +                end = i;
  15.682              }
  15.683 -         } else {
  15.684 -            break;
  15.685 -         }
  15.686 -      }
  15.687 +        }
  15.688  
  15.689 -      if (isStartOk && isEndOk)
  15.690 -         return true;
  15.691 -      
  15.692 -      return false;
  15.693 -   }
  15.694 +        if (end == -1) {
  15.695 +            return "";
  15.696 +        }
  15.697 +        String name = content.substring(start, end + 1).trim();
  15.698  
  15.699 -   private String getTableName(String content, PlsqlBlockFactory blockFac) {
  15.700 -      int start = content.toUpperCase(Locale.ENGLISH).indexOf("TABLE");
  15.701 -      if(start==-1)
  15.702 -         return "";
  15.703 -      //next word is the name of the table
  15.704 -      start=start+5;
  15.705 -      int end = -1;
  15.706 -      for(int i=start; i<content.length(); i++) {
  15.707 -         char ch = content.charAt(i);
  15.708 -         if(Character.isWhitespace(ch) && end!=-1) //whitespace after the next word...
  15.709 -            break;
  15.710 -         else if(!Character.isJavaIdentifierPart(ch) && ch!='&' && end!=-1)
  15.711 -            break;
  15.712 -         else
  15.713 -            end=i;
  15.714 -      }
  15.715 +        return blockFac.getDefine(name);
  15.716 +    }
  15.717  
  15.718 -      if(end == -1)
  15.719 -         return "";
  15.720 -      String name = content.substring(start, end+1).trim();
  15.721 -      
  15.722 -      return blockFac.getDefine(name);
  15.723 -   }
  15.724 +    /**
  15.725 +     * Method that will sort the given block hierarchy according to the offset
  15.726 +     * @param blockHier
  15.727 +     */
  15.728 +    private List<PlsqlBlock> sortBlockHier(List<PlsqlBlock> blockHier) {
  15.729 +        List<PlsqlBlock> sortedHier = new ArrayList<PlsqlBlock>();
  15.730 +        //Put all the objects into a hash map
  15.731 +        HashMap<Integer, PlsqlBlock> tmpList = new HashMap<Integer, PlsqlBlock>();
  15.732  
  15.733 -   /**
  15.734 -    * Method that will sort the given block hierarchy according to the offset
  15.735 -    * @param blockHier
  15.736 -    */
  15.737 -   private List<PlsqlBlock> sortBlockHier(List<PlsqlBlock> blockHier) {
  15.738 -      List<PlsqlBlock> sortedHier = new ArrayList<PlsqlBlock>();
  15.739 -      //Put all the objects into a hash map
  15.740 -      HashMap<Integer, PlsqlBlock> tmpList = new HashMap<Integer, PlsqlBlock>();
  15.741 +        for (int i = 0; i < blockHier.size(); i++) {
  15.742 +            PlsqlBlock block = blockHier.get(i);
  15.743 +            if (block != null) {
  15.744 +                tmpList.put(block.getStartOffset(), block);
  15.745 +            }
  15.746 +        }
  15.747  
  15.748 -      for (int i = 0; i < blockHier.size(); i++) {
  15.749 -         PlsqlBlock block = blockHier.get(i);
  15.750 -         if (block != null) {
  15.751 -            tmpList.put(block.getStartOffset(), block);
  15.752 -         }
  15.753 -      }
  15.754 +        //Get the keyset and sort
  15.755 +        @SuppressWarnings("unchecked")
  15.756 +        HashMap<Integer, PlsqlBlock> clonedLst = (HashMap<Integer, PlsqlBlock>) tmpList.clone();
  15.757 +        Set<Integer> keys = clonedLst.keySet();
  15.758 +        List<Integer> sortedKeys = new ArrayList<Integer>();
  15.759  
  15.760 -      //Get the keyset and sort
  15.761 -      @SuppressWarnings("unchecked")
  15.762 -      HashMap<Integer, PlsqlBlock> clonedLst = (HashMap<Integer, PlsqlBlock>) tmpList.clone();
  15.763 -      Set<Integer> keys = clonedLst.keySet();
  15.764 -      List<Integer> sortedKeys = new ArrayList<Integer>();
  15.765 +        while (keys.size() > 0) {
  15.766 +            Integer obj = getMin(keys);
  15.767 +            sortedKeys.add(obj);
  15.768 +            keys.remove(obj);
  15.769 +        }
  15.770  
  15.771 -      while (keys.size() > 0) {
  15.772 -         Integer obj = getMin(keys);
  15.773 -         sortedKeys.add(obj);
  15.774 -         keys.remove(obj);
  15.775 -      }
  15.776 +        //clear executable objects and add in the order
  15.777 +        for (int x = 0; x < sortedKeys.size(); x++) {
  15.778 +            int tmp = sortedKeys.get(x);
  15.779 +            PlsqlBlock block = tmpList.get(tmp);
  15.780 +            if (block != null) {
  15.781 +                sortedHier.add(block);
  15.782 +            }
  15.783 +        }
  15.784  
  15.785 -      //clear executable objects and add in the order
  15.786 -      for (int x = 0; x < sortedKeys.size(); x++) {
  15.787 -         int tmp = sortedKeys.get(x);
  15.788 -         PlsqlBlock block = tmpList.get(tmp);
  15.789 -         if (block != null) {
  15.790 -            sortedHier.add(block);
  15.791 -         }
  15.792 -      }
  15.793 +        return sortedHier;
  15.794 +    }
  15.795  
  15.796 -      return sortedHier;
  15.797 -   }
  15.798 +    /**
  15.799 +     * Method that will sort all the executable objects according to the offset
  15.800 +     * @param executableObjs 
  15.801 +     */
  15.802 +    private void sortExecutableObjects(List<PlsqlExecutableObject> executableObjs) {
  15.803 +        //Put all the objects into a hash map
  15.804 +        HashMap<Integer, PlsqlExecutableObject> tmpList = new HashMap<Integer, PlsqlExecutableObject>();
  15.805  
  15.806 -   /**
  15.807 -    * Method that will sort all the executable objects according to the offset
  15.808 -    * @param executableObjs 
  15.809 -    */
  15.810 -   private void sortExecutableObjects(List<PlsqlExecutableObject> executableObjs) {
  15.811 -      //Put all the objects into a hash map
  15.812 -      HashMap<Integer, PlsqlExecutableObject> tmpList = new HashMap<Integer, PlsqlExecutableObject>();
  15.813 +        for (int i = 0; i < executableObjs.size(); i++) {
  15.814 +            PlsqlExecutableObject exeObj = executableObjs.get(i);
  15.815 +            if (exeObj != null) {
  15.816 +                tmpList.put(exeObj.getStartOffset(), exeObj);
  15.817 +            }
  15.818 +        }
  15.819  
  15.820 -      for (int i = 0; i < executableObjs.size(); i++) {
  15.821 -         PlsqlExecutableObject exeObj = executableObjs.get(i);
  15.822 -         if (exeObj != null) {
  15.823 -            tmpList.put(exeObj.getStartOffset(), exeObj);
  15.824 -         }
  15.825 -      }
  15.826 +        //Get the keyset and sort
  15.827 +        @SuppressWarnings("unchecked")
  15.828 +        HashMap<Integer, PlsqlExecutableObject> clonedLst = (HashMap<Integer, PlsqlExecutableObject>) tmpList.clone();
  15.829 +        Set<Integer> keys = clonedLst.keySet();
  15.830 +        List<Integer> sortedKeys = new ArrayList<Integer>();
  15.831  
  15.832 -      //Get the keyset and sort
  15.833 -      @SuppressWarnings("unchecked")
  15.834 -      HashMap<Integer, PlsqlExecutableObject> clonedLst = (HashMap<Integer, PlsqlExecutableObject>) tmpList.clone();
  15.835 -      Set<Integer> keys = clonedLst.keySet();
  15.836 -      List<Integer> sortedKeys = new ArrayList<Integer>();
  15.837 +        while (keys.size() > 0) {
  15.838 +            Integer obj = getMin(keys);
  15.839 +            sortedKeys.add(obj);
  15.840 +            keys.remove(obj);
  15.841 +        }
  15.842  
  15.843 -      while (keys.size() > 0) {
  15.844 -         Integer obj = getMin(keys);
  15.845 -         sortedKeys.add(obj);
  15.846 -         keys.remove(obj);
  15.847 -      }
  15.848 +        //clear executable objects and add in the order
  15.849 +        executableObjs.clear();
  15.850 +        for (int x = 0; x < sortedKeys.size(); x++) {
  15.851 +            int tmp = sortedKeys.get(x);
  15.852 +            PlsqlExecutableObject exeObj = tmpList.get(tmp);
  15.853 +            if (exeObj != null) {
  15.854 +                executableObjs.add(exeObj);
  15.855 +            }
  15.856 +        }
  15.857 +    }
  15.858  
  15.859 -      //clear executable objects and add in the order
  15.860 -      executableObjs.clear();
  15.861 -      for (int x = 0; x < sortedKeys.size(); x++) {
  15.862 -         int tmp = sortedKeys.get(x);
  15.863 -         PlsqlExecutableObject exeObj = tmpList.get(tmp);
  15.864 -         if (exeObj != null) {
  15.865 -            executableObjs.add(exeObj);
  15.866 -         }
  15.867 -      }
  15.868 -   }
  15.869 +    /**
  15.870 +     * Method that will return the minimum object of the given set
  15.871 +     * @param keys
  15.872 +     * @return
  15.873 +     */
  15.874 +    private Integer getMin(Set<Integer> keys) {
  15.875 +        int min = -1;
  15.876  
  15.877 -   /**
  15.878 -    * Method that will return the minimum object of the given set
  15.879 -    * @param keys
  15.880 -    * @return
  15.881 -    */
  15.882 -   private Integer getMin(Set<Integer> keys) {
  15.883 -      int min = -1;
  15.884 +        for (Iterator it = keys.iterator(); it.hasNext();) {
  15.885 +            int tmp = (Integer) it.next();
  15.886 +            if ((min == -1) || (tmp < min)) {
  15.887 +                min = tmp;
  15.888 +            }
  15.889 +        }
  15.890  
  15.891 -      for (Iterator it = keys.iterator(); it.hasNext();) {
  15.892 -         int tmp = (Integer) it.next();
  15.893 -         if ((min == -1) || (tmp < min)) {
  15.894 -            min = tmp;
  15.895 -         }
  15.896 -      }
  15.897 -
  15.898 -      return min;
  15.899 -   }
  15.900 -   private String docContent;
  15.901 -   private List<String> docLines;
  15.902 -   private List<PlsqlExecutableObject> executableObjs;
  15.903 -   private DataObject dataObj;
  15.904 -   private Document doc;
  15.905 -   private String originalFileName;
  15.906 +        return min;
  15.907 +    }
  15.908 +    private String docContent;
  15.909 +    private List<String> docLines;
  15.910 +    private List<PlsqlExecutableObject> executableObjs;
  15.911 +    private DataObject dataObj;
  15.912 +    private Document doc;
  15.913 +    private String originalFileName;
  15.914  }
    16.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutableObject.java	Wed Dec 07 13:36:21 2011 +0100
    16.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutableObject.java	Tue Feb 14 17:31:28 2012 +0100
    16.3 @@ -45,65 +45,61 @@
    16.4  
    16.5  public class PlsqlExecutableObject {
    16.6  
    16.7 -   public PlsqlExecutableObject() {
    16.8 -   }
    16.9 +    public PlsqlExecutableObject(int startLineNo, String plsqlString, String name,
   16.10 +            PlsqlExecutableObjectType type, int startOffset, int endOffset) {
   16.11 +        this.startLineNo = startLineNo;
   16.12 +        this.plsqlString = plsqlString;
   16.13 +        this.executableObjName = name;
   16.14 +        this.type = type;
   16.15 +        this.startOffset = startOffset;
   16.16 +        this.endoffset = endOffset;
   16.17 +    }
   16.18  
   16.19 -   public PlsqlExecutableObject(int startLineNo, String plsqlString, String name, 
   16.20 -           PlsqlExecutableObjectType type, int startOffset, int endOffset) {
   16.21 -      this.startLineNo = startLineNo;
   16.22 -      this.plsqlString = plsqlString;
   16.23 -      this.executableObjName = name;
   16.24 -      this.type = type;
   16.25 -      this.startOffset = startOffset;
   16.26 -      this.endoffset = endOffset;
   16.27 -   }
   16.28 +    public String getPlsqlString() {
   16.29 +        return plsqlString;
   16.30 +    }
   16.31  
   16.32 -   public String getPlsqlString() {
   16.33 -      return plsqlString;
   16.34 -   }
   16.35 +    public int getStartLineNo() {
   16.36 +        return startLineNo;
   16.37 +    }
   16.38  
   16.39 -   public int getStartLineNo() {
   16.40 -      return startLineNo;
   16.41 -   }
   16.42 +    public PlsqlExecutableObjectType getType() {
   16.43 +        return type;
   16.44 +    }
   16.45  
   16.46 -   public PlsqlExecutableObjectType getType() {
   16.47 -      return type;
   16.48 -   }
   16.49 +    public String getExecutableObjName() {
   16.50 +        return executableObjName;
   16.51 +    }
   16.52  
   16.53 -   public String getExecutableObjName() {
   16.54 -      return executableObjName;
   16.55 -   }
   16.56 +    public List getDocLinesArray() {
   16.57 +        return docLinesArray;
   16.58 +    }
   16.59  
   16.60 -   public List getDocLinesArray() {
   16.61 -      return docLinesArray;
   16.62 -   }
   16.63 +    public void setDocLinesArray(List docLinesArray) {
   16.64 +        this.docLinesArray = docLinesArray;
   16.65 +    }
   16.66  
   16.67 -   public void setDocLinesArray(List docLinesArray) {
   16.68 -      this.docLinesArray = docLinesArray;
   16.69 -   }
   16.70 +    public void setOriginalFileName(String originalFileName) {
   16.71 +        this.originalFileName = originalFileName;
   16.72 +    }
   16.73  
   16.74 -   public void setOriginalFileName(String originalFileName) {
   16.75 -      this.originalFileName = originalFileName;
   16.76 -   }
   16.77 +    public String getOriginalFileName() {
   16.78 +        return originalFileName;
   16.79 +    }
   16.80  
   16.81 -   public String getOriginalFileName() {
   16.82 -      return originalFileName;
   16.83 -   }
   16.84 -   
   16.85 -   public int getStartOffset() {
   16.86 -      return startOffset;
   16.87 -   }
   16.88 -   
   16.89 -   public int getEndOffset() {
   16.90 -      return endoffset;
   16.91 -   }
   16.92 -   
   16.93 -   private String plsqlString;
   16.94 -   private int startLineNo;
   16.95 -   private int startOffset;
   16.96 -   private int endoffset;
   16.97 -   private PlsqlExecutableObjectType type;
   16.98 -   private String executableObjName;
   16.99 -   private List docLinesArray;
  16.100 -   private String originalFileName;
  16.101 +    public int getStartOffset() {
  16.102 +        return startOffset;
  16.103 +    }
  16.104 +
  16.105 +    public int getEndOffset() {
  16.106 +        return endoffset;
  16.107 +    }
  16.108 +    private String plsqlString;
  16.109 +    private int startLineNo;
  16.110 +    private int startOffset;
  16.111 +    private int endoffset;
  16.112 +    private PlsqlExecutableObjectType type;
  16.113 +    private String executableObjName;
  16.114 +    private List docLinesArray;
  16.115 +    private String originalFileName;
  16.116  }
    17.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java	Wed Dec 07 13:36:21 2011 +0100
    17.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java	Tue Feb 14 17:31:28 2012 +0100
    17.3 @@ -41,9 +41,6 @@
    17.4   */
    17.5  package org.netbeans.modules.plsql.execution;
    17.6  
    17.7 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
    17.8 -import org.netbeans.modules.plsql.filetype.PlsqlDataObject;
    17.9 -import org.netbeans.modules.plsql.utilities.PlsqlFileValidatorService;
   17.10  import java.awt.Component;
   17.11  import java.awt.event.ActionEvent;
   17.12  import java.awt.event.ActionListener;
   17.13 @@ -58,6 +55,7 @@
   17.14  import java.util.ArrayList;
   17.15  import java.util.List;
   17.16  import java.util.Locale;
   17.17 +
   17.18  import javax.swing.AbstractAction;
   17.19  import javax.swing.Action;
   17.20  import javax.swing.ImageIcon;
   17.21 @@ -69,10 +67,17 @@
   17.22  import javax.swing.event.PopupMenuEvent;
   17.23  import javax.swing.event.PopupMenuListener;
   17.24  import javax.swing.text.Document;
   17.25 +
   17.26  import org.netbeans.api.db.explorer.DatabaseConnection;
   17.27  import org.netbeans.api.progress.ProgressHandle;
   17.28  import org.netbeans.api.progress.ProgressHandleFactory;
   17.29 +import org.netbeans.modules.plsql.filetype.PlsqlDataObject;
   17.30 +import org.netbeans.modules.plsql.utilities.PlsqlFileValidatorService;
   17.31 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   17.32  import org.netbeans.modules.plsqlsupport.options.OptionsUtilities;
   17.33 +import org.openide.awt.ActionID;
   17.34 +import org.openide.awt.ActionReference;
   17.35 +import org.openide.awt.ActionRegistration;
   17.36  import org.openide.awt.DropDownButtonFactory;
   17.37  import org.openide.cookies.EditorCookie;
   17.38  import org.openide.cookies.SaveCookie;
   17.39 @@ -88,6 +93,9 @@
   17.40  import org.openide.util.Utilities;
   17.41  import org.openide.util.actions.Presenter;
   17.42  
   17.43 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlExecuteAction", category = "PLSQL")
   17.44 +@ActionRegistration(displayName = "#CTL_fileExecution")
   17.45 +@ActionReference(path = "Shortcuts", name = "AS-E")
   17.46  public class PlsqlExecuteAction extends AbstractAction implements ContextAwareAction, Presenter.Toolbar {
   17.47  
   17.48      private static final PlsqlFileValidatorService validator = Lookup.getDefault().lookup(PlsqlFileValidatorService.class);
   17.49 @@ -281,6 +289,11 @@
   17.50                      return;
   17.51                  }
   17.52              }
   17.53 +        } else {
   17.54 +            //to reconnect if the connection is gone. 
   17.55 +            if (connection.getJDBCConnection() == null) {
   17.56 +                connectionProvider.connect(connection);
   17.57 +            }
   17.58          }
   17.59  
   17.60          //if the user has selected any text in the window, create exec block using selected text only
   17.61 @@ -415,4 +428,4 @@
   17.62              }
   17.63          }
   17.64      }
   17.65 -}
   17.66 +}
   17.67 \ No newline at end of file
    18.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryAction.java	Wed Dec 07 13:36:21 2011 +0100
    18.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryAction.java	Tue Feb 14 17:31:28 2012 +0100
    18.3 @@ -41,8 +41,6 @@
    18.4   */
    18.5  package org.netbeans.modules.plsql.execution;
    18.6  
    18.7 -import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
    18.8 -import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
    18.9  import java.awt.Component;
   18.10  import java.awt.event.ActionEvent;
   18.11  import java.awt.event.ActionListener;
   18.12 @@ -51,6 +49,7 @@
   18.13  import java.awt.image.BufferedImage;
   18.14  import java.util.ArrayList;
   18.15  import java.util.List;
   18.16 +
   18.17  import javax.swing.AbstractAction;
   18.18  import javax.swing.Action;
   18.19  import javax.swing.ImageIcon;
   18.20 @@ -60,6 +59,11 @@
   18.21  import javax.swing.event.PopupMenuEvent;
   18.22  import javax.swing.text.BadLocationException;
   18.23  import javax.swing.text.StyledDocument;
   18.24 +
   18.25 +import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
   18.26 +import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   18.27 +import org.openide.awt.ActionID;
   18.28 +import org.openide.awt.ActionRegistration;
   18.29  import org.openide.awt.DropDownButtonFactory;
   18.30  import org.openide.cookies.EditorCookie;
   18.31  import org.openide.loaders.DataObject;
   18.32 @@ -75,6 +79,8 @@
   18.33  import org.openide.windows.InputOutput;
   18.34  import org.openide.windows.OutputWriter;
   18.35  
   18.36 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlExecutionHistoryAction", category = "PLSQL")
   18.37 +@ActionRegistration(displayName = "#CTL_PlsqlExecutionHistoryAction")
   18.38  public final class PlsqlExecutionHistoryAction extends AbstractAction implements ContextAwareAction, Presenter.Toolbar {
   18.39  
   18.40      private JPopupMenu popup;
   18.41 @@ -95,6 +101,7 @@
   18.42          setEnabled(dataObject != null && dataObject.getPrimaryFile().getNameExt().startsWith(SQLCommandWindow.SQL_EXECUTION_FILE_PREFIX));
   18.43      }
   18.44  
   18.45 +    @Override
   18.46      public Action createContextAwareInstance(Lookup context) {
   18.47          return new PlsqlExecutionHistoryAction(context);
   18.48      }
   18.49 @@ -113,9 +120,10 @@
   18.50  
   18.51      @Override
   18.52      public Component getToolbarPresenter() {
   18.53 -        if (!isEnabled())
   18.54 +        if (!isEnabled()) {
   18.55              return null;
   18.56 -        
   18.57 +        }
   18.58 +
   18.59          popup = new JPopupMenu();
   18.60          populatePopupMenu();
   18.61  
   18.62 @@ -124,6 +132,7 @@
   18.63          button.setAction(this);
   18.64          button.addItemListener(new ItemListener() {
   18.65  
   18.66 +            @Override
   18.67              public void itemStateChanged(ItemEvent e) {
   18.68                  if (e.getStateChange() == ItemEvent.SELECTED) {
   18.69                      popup.show(button, 0, button.getHeight());
   18.70 @@ -133,14 +142,17 @@
   18.71  
   18.72          popup.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
   18.73  
   18.74 +            @Override
   18.75              public void popupMenuCanceled(PopupMenuEvent e) {
   18.76                  button.setSelected(false);
   18.77              }
   18.78  
   18.79 +            @Override
   18.80              public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
   18.81                  button.setSelected(false);
   18.82              }
   18.83  
   18.84 +            @Override
   18.85              public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
   18.86                  populatePopupMenu();
   18.87              }
   18.88 @@ -169,6 +181,7 @@
   18.89          }
   18.90      }
   18.91  
   18.92 +    @Override
   18.93      public void actionPerformed(ActionEvent e) {
   18.94          StatementExecutionHistory history = dataObject.getLookup().lookup(StatementExecutionHistory.class);
   18.95          List<String> statements = history != null ? history.getStatementHistory() : new ArrayList<String>();
   18.96 @@ -186,9 +199,7 @@
   18.97  
   18.98      private class ButtonListener implements ActionListener {
   18.99  
  18.100 -        public ButtonListener() {
  18.101 -        }
  18.102 -
  18.103 +        @Override
  18.104          public void actionPerformed(ActionEvent e) {
  18.105              JMenuItem item = (JMenuItem) e.getSource();
  18.106              String statement = (String) item.getClientProperty("STATEMENT");
    19.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryNextAction.java	Wed Dec 07 13:36:21 2011 +0100
    19.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryNextAction.java	Tue Feb 14 17:31:28 2012 +0100
    19.3 @@ -1,7 +1,7 @@
    19.4  /*
    19.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    19.6   *
    19.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    19.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    19.9   *
   19.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   19.11   * Other names may be trademarks of their respective owners.
   19.12 @@ -41,60 +41,65 @@
   19.13   */
   19.14  package org.netbeans.modules.plsql.execution;
   19.15  
   19.16 -import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
   19.17 -import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   19.18  import java.awt.event.ActionEvent;
   19.19  import javax.swing.AbstractAction;
   19.20  import javax.swing.Action;
   19.21  import javax.swing.text.BadLocationException;
   19.22  import javax.swing.text.StyledDocument;
   19.23 +import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
   19.24 +import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   19.25 +import org.openide.awt.ActionID;
   19.26 +import org.openide.awt.ActionReference;
   19.27 +import org.openide.awt.ActionRegistration;
   19.28  import org.openide.cookies.EditorCookie;
   19.29  import org.openide.loaders.DataObject;
   19.30 -import org.openide.util.ContextAwareAction;
   19.31 -import org.openide.util.Exceptions;
   19.32 -import org.openide.util.HelpCtx;
   19.33 -import org.openide.util.Lookup;
   19.34 -import org.openide.util.NbBundle;
   19.35 -import org.openide.util.Utilities;
   19.36 +import org.openide.util.*;
   19.37  
   19.38 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlExecutionHistoryNextAction", category = "PLSQL")
   19.39 +@ActionRegistration(displayName = "#CTL_PlsqlExecutionHistoryNextAction")
   19.40 +@ActionReference(path = "Shortcuts", name = "AS-N")
   19.41  public final class PlsqlExecutionHistoryNextAction extends AbstractAction implements ContextAwareAction {
   19.42 -   private DataObject dataObject;
   19.43  
   19.44 -   public PlsqlExecutionHistoryNextAction() {
   19.45 -      this(Utilities.actionsGlobalContext());
   19.46 -   }
   19.47 +    private DataObject dataObject;
   19.48  
   19.49 -   public PlsqlExecutionHistoryNextAction(Lookup context) {
   19.50 -      putValue(NAME,getName());
   19.51 -      putValue(SHORT_DESCRIPTION, getName());
   19.52 -      dataObject = context.lookup(DataObject.class);
   19.53 -      setEnabled(dataObject != null && dataObject.getPrimaryFile().getNameExt().startsWith(SQLCommandWindow.SQL_EXECUTION_FILE_PREFIX));
   19.54 -   }
   19.55 +    public PlsqlExecutionHistoryNextAction() {
   19.56 +        this(Utilities.actionsGlobalContext());
   19.57 +    }
   19.58  
   19.59 -   public Action createContextAwareInstance(Lookup context) {
   19.60 -      return new PlsqlExecutionHistoryNextAction(context);
   19.61 -   }
   19.62 +    public PlsqlExecutionHistoryNextAction(Lookup context) {
   19.63 +        putValue(NAME, getName());
   19.64 +        putValue(SHORT_DESCRIPTION, getName());
   19.65 +        dataObject = context.lookup(DataObject.class);
   19.66 +        setEnabled(dataObject != null && dataObject.getPrimaryFile().getNameExt().startsWith(SQLCommandWindow.SQL_EXECUTION_FILE_PREFIX));
   19.67 +    }
   19.68  
   19.69 -   private String getName() {
   19.70 -      return NbBundle.getMessage(PlsqlExecutionHistoryNextAction.class, "CTL_PlsqlExecutionHistoryNextAction");
   19.71 -   }
   19.72 +    @Override
   19.73 +    public Action createContextAwareInstance(Lookup context) {
   19.74 +        return new PlsqlExecutionHistoryNextAction(context);
   19.75 +    }
   19.76  
   19.77 -   public HelpCtx getHelpCtx() {
   19.78 -      return HelpCtx.DEFAULT_HELP;
   19.79 -   }
   19.80 +    private String getName() {
   19.81 +        return NbBundle.getMessage(PlsqlExecutionHistoryNextAction.class, "CTL_PlsqlExecutionHistoryNextAction");
   19.82 +    }
   19.83  
   19.84 -   public void actionPerformed(ActionEvent e) {
   19.85 -      StatementExecutionHistory history = dataObject.getLookup().lookup(StatementExecutionHistory.class);
   19.86 -      if(history!=null) {
   19.87 -         boolean moveOk = history.moveNext();
   19.88 -         StyledDocument document = dataObject.getLookup().lookup(EditorCookie.class).getDocument();
   19.89 -         try {
   19.90 -            document.remove(0, document.getLength());
   19.91 -            if(moveOk)
   19.92 -               document.insertString(0, history.getSelectedEntry(), null);
   19.93 -         } catch (BadLocationException ex) {
   19.94 -            Exceptions.printStackTrace(ex);
   19.95 -         }
   19.96 -      }
   19.97 -   }
   19.98 +    public HelpCtx getHelpCtx() {
   19.99 +        return HelpCtx.DEFAULT_HELP;
  19.100 +    }
  19.101 +
  19.102 +    @Override
  19.103 +    public void actionPerformed(ActionEvent e) {
  19.104 +        StatementExecutionHistory history = dataObject.getLookup().lookup(StatementExecutionHistory.class);
  19.105 +        if (history != null) {
  19.106 +            boolean moveOk = history.moveNext();
  19.107 +            StyledDocument document = dataObject.getLookup().lookup(EditorCookie.class).getDocument();
  19.108 +            try {
  19.109 +                document.remove(0, document.getLength());
  19.110 +                if (moveOk) {
  19.111 +                    document.insertString(0, history.getSelectedEntry(), null);
  19.112 +                }
  19.113 +            } catch (BadLocationException ex) {
  19.114 +                Exceptions.printStackTrace(ex);
  19.115 +            }
  19.116 +        }
  19.117 +    }
  19.118  }
    20.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryPreviousAction.java	Wed Dec 07 13:36:21 2011 +0100
    20.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecutionHistoryPreviousAction.java	Tue Feb 14 17:31:28 2012 +0100
    20.3 @@ -1,7 +1,7 @@
    20.4  /*
    20.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    20.6   *
    20.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    20.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    20.9   *
   20.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   20.11   * Other names may be trademarks of their respective owners.
   20.12 @@ -41,61 +41,65 @@
   20.13   */
   20.14  package org.netbeans.modules.plsql.execution;
   20.15  
   20.16 -import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
   20.17 -import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   20.18  import java.awt.event.ActionEvent;
   20.19  import javax.swing.AbstractAction;
   20.20  import javax.swing.Action;
   20.21  import javax.swing.text.BadLocationException;
   20.22  import javax.swing.text.StyledDocument;
   20.23 +import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
   20.24 +import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   20.25 +import org.openide.awt.ActionID;
   20.26 +import org.openide.awt.ActionReference;
   20.27 +import org.openide.awt.ActionRegistration;
   20.28  import org.openide.cookies.EditorCookie;
   20.29  import org.openide.loaders.DataObject;
   20.30 -import org.openide.util.ContextAwareAction;
   20.31 -import org.openide.util.Exceptions;
   20.32 -import org.openide.util.HelpCtx;
   20.33 -import org.openide.util.Lookup;
   20.34 -import org.openide.util.NbBundle;
   20.35 -import org.openide.util.Utilities;
   20.36 +import org.openide.util.*;
   20.37  
   20.38 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlExecutionHistoryPreviousAction", category = "PLSQL")
   20.39 +@ActionRegistration(displayName = "#CTL_PlsqlExecutionHistoryPreviousAction")
   20.40 +@ActionReference(path = "Shortcuts", name = "AS-P")
   20.41  public final class PlsqlExecutionHistoryPreviousAction extends AbstractAction implements ContextAwareAction {
   20.42 -   private DataObject dataObject;
   20.43  
   20.44 -   public PlsqlExecutionHistoryPreviousAction() {
   20.45 -      this(Utilities.actionsGlobalContext());
   20.46 -   }
   20.47 +    private DataObject dataObject;
   20.48  
   20.49 -   public PlsqlExecutionHistoryPreviousAction(Lookup context) {
   20.50 -      putValue(NAME, getName());
   20.51 -      putValue(SHORT_DESCRIPTION, getName());
   20.52 -      dataObject = context.lookup(DataObject.class);
   20.53 -      setEnabled(dataObject != null && dataObject.getPrimaryFile().getNameExt().startsWith(SQLCommandWindow.SQL_EXECUTION_FILE_PREFIX));
   20.54 -   }
   20.55 +    public PlsqlExecutionHistoryPreviousAction() {
   20.56 +        this(Utilities.actionsGlobalContext());
   20.57 +    }
   20.58  
   20.59 -   public Action createContextAwareInstance(Lookup context) {
   20.60 -      return new PlsqlExecutionHistoryPreviousAction(context);
   20.61 -   }
   20.62 +    public PlsqlExecutionHistoryPreviousAction(Lookup context) {
   20.63 +        putValue(NAME, getName());
   20.64 +        putValue(SHORT_DESCRIPTION, getName());
   20.65 +        dataObject = context.lookup(DataObject.class);
   20.66 +        setEnabled(dataObject != null && dataObject.getPrimaryFile().getNameExt().startsWith(SQLCommandWindow.SQL_EXECUTION_FILE_PREFIX));
   20.67 +    }
   20.68  
   20.69 -   private String getName() {
   20.70 -      return NbBundle.getMessage(PlsqlExecutionHistoryPreviousAction.class, "CTL_PlsqlExecutionHistoryPreviousAction");
   20.71 -   }
   20.72 +    @Override
   20.73 +    public Action createContextAwareInstance(Lookup context) {
   20.74 +        return new PlsqlExecutionHistoryPreviousAction(context);
   20.75 +    }
   20.76  
   20.77 -   public HelpCtx getHelpCtx() {
   20.78 -      return HelpCtx.DEFAULT_HELP;
   20.79 -   }
   20.80 +    private String getName() {
   20.81 +        return NbBundle.getMessage(PlsqlExecutionHistoryPreviousAction.class, "CTL_PlsqlExecutionHistoryPreviousAction");
   20.82 +    }
   20.83  
   20.84 -   public void actionPerformed(ActionEvent e) {
   20.85 -      StatementExecutionHistory history = dataObject.getLookup().lookup(StatementExecutionHistory.class);
   20.86 -      if(history!=null && history.getSize() > 0) {
   20.87 -         boolean moveOk = history.movePrevious();
   20.88 -         StyledDocument document = dataObject.getLookup().lookup(EditorCookie.class).getDocument();
   20.89 -         try {
   20.90 -            if(moveOk) {
   20.91 -               document.remove(0, document.getLength());
   20.92 -               document.insertString(0, history.getSelectedEntry(), null);
   20.93 +    public HelpCtx getHelpCtx() {
   20.94 +        return HelpCtx.DEFAULT_HELP;
   20.95 +    }
   20.96 +
   20.97 +    @Override
   20.98 +    public void actionPerformed(ActionEvent e) {
   20.99 +        StatementExecutionHistory history = dataObject.getLookup().lookup(StatementExecutionHistory.class);
  20.100 +        if (history != null && history.getSize() > 0) {
  20.101 +            boolean moveOk = history.movePrevious();
  20.102 +            StyledDocument document = dataObject.getLookup().lookup(EditorCookie.class).getDocument();
  20.103 +            try {
  20.104 +                if (moveOk) {
  20.105 +                    document.remove(0, document.getLength());
  20.106 +                    document.insertString(0, history.getSelectedEntry(), null);
  20.107 +                }
  20.108 +            } catch (BadLocationException ex) {
  20.109 +                Exceptions.printStackTrace(ex);
  20.110              }
  20.111 -         } catch (BadLocationException ex) {
  20.112 -            Exceptions.printStackTrace(ex);
  20.113 -         }
  20.114 -      }
  20.115 -   }
  20.116 +        }
  20.117 +    }
  20.118  }
    21.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExplainPlanAction.java	Wed Dec 07 13:36:21 2011 +0100
    21.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExplainPlanAction.java	Tue Feb 14 17:31:28 2012 +0100
    21.3 @@ -41,22 +41,24 @@
    21.4   */
    21.5  package org.netbeans.modules.plsql.execution;
    21.6  
    21.7 -import org.netbeans.modules.plsqlsupport.db.ui.SQLExecutionAction;
    21.8 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
    21.9 -import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   21.10  import java.sql.Connection;
   21.11  import java.sql.ResultSet;
   21.12  import java.sql.SQLException;
   21.13  import java.sql.Statement;
   21.14 +
   21.15  import javax.swing.JOptionPane;
   21.16  import javax.swing.text.BadLocationException;
   21.17  import javax.swing.text.Document;
   21.18 +
   21.19  import org.netbeans.api.db.explorer.DatabaseConnection;
   21.20 -import org.netbeans.api.project.FileOwnerQuery;
   21.21 -import org.netbeans.api.project.Project;
   21.22 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   21.23 +import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   21.24 +import org.openide.awt.ActionID;
   21.25 +import org.openide.awt.ActionRegistration;
   21.26  import org.openide.cookies.EditorCookie;
   21.27  import org.openide.loaders.DataObject;
   21.28  import org.openide.nodes.Node;
   21.29 +import org.openide.util.Exceptions;
   21.30  import org.openide.util.HelpCtx;
   21.31  import org.openide.util.NbBundle;
   21.32  import org.openide.util.actions.CookieAction;
   21.33 @@ -64,8 +66,11 @@
   21.34  import org.openide.windows.InputOutput;
   21.35  import org.openide.windows.OutputWriter;
   21.36  
   21.37 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlExplainPlanAction", category = "PLSQL")
   21.38 +@ActionRegistration(displayName = "#CTL_PlsqlExplainPlanAction")
   21.39  public final class PlsqlExplainPlanAction extends CookieAction {
   21.40  
   21.41 +    @Override
   21.42     protected void performAction(Node[] activatedNodes) {
   21.43        EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
   21.44        DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
   21.45 @@ -87,19 +92,22 @@
   21.46                 dbConnectionManager.releaseDatabaseConnection(dbConnection);
   21.47              }
   21.48           } catch (BadLocationException ex) {
   21.49 -            ex.printStackTrace();
   21.50 +            Exceptions.printStackTrace(ex);
   21.51           }
   21.52        }
   21.53     }
   21.54  
   21.55 +    @Override
   21.56     protected int mode() {
   21.57        return CookieAction.MODE_EXACTLY_ONE;
   21.58     }
   21.59  
   21.60 +    @Override
   21.61     public String getName() {
   21.62        return NbBundle.getMessage(PlsqlExplainPlanAction.class, "CTL_PlsqlExplainPlanAction");
   21.63     }
   21.64  
   21.65 +    @Override
   21.66     protected Class[] cookieClasses() {
   21.67        return new Class[]{DataObject.class};
   21.68     }
   21.69 @@ -109,6 +117,7 @@
   21.70        return "org/netbeans/modules/plsql/execution/explain.png";
   21.71     }
   21.72  
   21.73 +    @Override
   21.74     public HelpCtx getHelpCtx() {
   21.75        return HelpCtx.DEFAULT_HELP;
   21.76     }
    22.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java	Wed Dec 07 13:36:21 2011 +0100
    22.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java	Tue Feb 14 17:31:28 2012 +0100
    22.3 @@ -1,7 +1,7 @@
    22.4  /*
    22.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    22.6   *
    22.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    22.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    22.9   *
   22.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   22.11   * Other names may be trademarks of their respective owners.
   22.12 @@ -41,32 +41,12 @@
   22.13   */
   22.14  package org.netbeans.modules.plsql.execution;
   22.15  
   22.16 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   22.17 -import org.netbeans.modules.plsqlsupport.db.DatabaseContentManager;
   22.18 -import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   22.19 -import org.netbeans.modules.plsql.filetype.PlsqlEditor;
   22.20 -import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
   22.21 -import org.netbeans.modules.plsql.lexer.PlsqlTokenId;
   22.22 -import org.netbeans.modules.plsql.utilities.PlsqlFileValidatorService;
   22.23  import java.awt.Component;
   22.24  import java.io.IOException;
   22.25  import java.lang.reflect.InvocationTargetException;
   22.26 -import java.sql.CallableStatement;
   22.27 -import java.sql.Connection;
   22.28 -import java.sql.ResultSet;
   22.29 -import java.sql.SQLException;
   22.30 -import java.sql.SQLWarning;
   22.31 -import java.sql.Savepoint;
   22.32 -import java.sql.Statement;
   22.33 -import java.sql.Timestamp;
   22.34 -import java.util.ArrayList;
   22.35 -import java.util.Collection;
   22.36 +import java.sql.*;
   22.37  import java.util.Date;
   22.38 -import java.util.HashMap;
   22.39 -import java.util.Iterator;
   22.40 -import java.util.List;
   22.41 -import java.util.Locale;
   22.42 -import java.util.StringTokenizer;
   22.43 +import java.util.*;
   22.44  import javax.swing.JOptionPane;
   22.45  import javax.swing.SwingUtilities;
   22.46  import javax.swing.text.BadLocationException;
   22.47 @@ -85,6 +65,13 @@
   22.48  import org.netbeans.modules.db.sql.execute.StatementInfo;
   22.49  import org.netbeans.modules.db.sql.history.SQLHistory;
   22.50  import org.netbeans.modules.db.sql.history.SQLHistoryManager;
   22.51 +import org.netbeans.modules.plsql.filetype.PlsqlEditor;
   22.52 +import org.netbeans.modules.plsql.filetype.StatementExecutionHistory;
   22.53 +import org.netbeans.modules.plsql.lexer.PlsqlTokenId;
   22.54 +import org.netbeans.modules.plsql.utilities.PlsqlFileValidatorService;
   22.55 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   22.56 +import org.netbeans.modules.plsqlsupport.db.DatabaseContentManager;
   22.57 +import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   22.58  import org.openide.DialogDisplayer;
   22.59  import org.openide.NotifyDescriptor;
   22.60  import org.openide.filesystems.FileObject;
   22.61 @@ -407,7 +394,7 @@
   22.62  
   22.63          //Defines and define
   22.64          HashMap<String, String> definesMap = new HashMap<String, String>();
   22.65 -        char define = '&';
   22.66 +        List<Character> define = Arrays.asList('&',':');
   22.67          DataObject dataObj = FileExecutionUtil.getDataObject(doc);
   22.68          plsqlEditor = getPlsqlEditor(dataObj);
   22.69          String endMsg = "Done deploying " + FileExecutionUtil.getActivatedFileName(dataObj);
   22.70 @@ -418,7 +405,7 @@
   22.71          if (fileName.endsWith(".tdb")) {
   22.72              endMsg = "Finished executing command ";
   22.73          }
   22.74 -        Connection con = null;
   22.75 +        Connection con;
   22.76          Statement stm = null;
   22.77          String firstWord = null;
   22.78          boolean commit = false;
   22.79 @@ -430,8 +417,6 @@
   22.80              if (executionObject.getType() == PlsqlExecutableObjectType.STATEMENT || executionObject.getType() == PlsqlExecutableObjectType.UNKNOWN) {
   22.81                  String plsqlText = executionObject.getPlsqlString();
   22.82                  try {
   22.83 -                    // String firstWord;
   22.84 -                    firstWord = null;
   22.85                      StringTokenizer tokenizer = new StringTokenizer(plsqlText, " \t\n");
   22.86                      if (tokenizer.hasMoreTokens()) {
   22.87                          firstWord = tokenizer.nextToken();
   22.88 @@ -446,7 +431,7 @@
   22.89                          if (!ignoreDefines) {
   22.90                              plsqlText = replaceAliases(plsqlText, definesMap, define, io);
   22.91                          }
   22.92 -                        moreRowsToBeFetched = executeSelect(plsqlText, connection, doc, null);
   22.93 +                        executeSelect(plsqlText, connection, doc, null);
   22.94                          return null;
   22.95                      } else if (firstWord.equalsIgnoreCase("DESC") || firstWord.equalsIgnoreCase("DESCRIBE")) {
   22.96                          describeObject(connection, doc, tokenizer, io);
   22.97 @@ -488,20 +473,6 @@
   22.98  
   22.99              stm = con.createStatement();
  22.100              stm.setEscapeProcessing(false);
  22.101 -            if (connectionProvider.isUsagesEnabled() && validator.isValidPackage(dataObj)) {
  22.102 -                String plsqlText = "ALTER SYSTEM SET PLSCOPE_SETTINGS = 'IDENTIFIERS:ALL' \t\n";
  22.103 -                try {
  22.104 -                    //io.getOut().println((new StringBuilder()).append("> Enabling Usages for ").append(fileName));
  22.105 -                    stm.execute(plsqlText);
  22.106 -                } catch (SQLException sqlEx) {
  22.107 -                    int errLine = getLineNumberFromMsg(sqlEx.getMessage());
  22.108 -                    int outLine = errLine - 1;
  22.109 -                    String msg = getmodifiedErorrMsg(sqlEx.getMessage(), outLine);
  22.110 -                    // io.getErr().println((new StringBuilder()).append("!!!Error Creating View ").append(exeObjName).toString());
  22.111 -                    io.getOut().println(plsqlText);
  22.112 -                    deploymentOk = false;
  22.113 -                }
  22.114 -            }
  22.115              boolean firstSelectStatement = true;
  22.116              for (int i = 0; i < executableObjs.size(); i++) {
  22.117                  if (cancel) {
  22.118 @@ -545,8 +516,6 @@
  22.119                  }
  22.120                  if (exeObj.getType() == PlsqlExecutableObjectType.STATEMENT) {
  22.121                      try {
  22.122 -                        // String firstWord;
  22.123 -                        firstWord = null;
  22.124                          StringTokenizer tokenizer = new StringTokenizer(plsqlText, " \t\n;");
  22.125                          if (tokenizer.hasMoreTokens()) {
  22.126                              firstWord = tokenizer.nextToken();
  22.127 @@ -745,7 +714,8 @@
  22.128                                              String token = tokenizer.nextToken();
  22.129                                              ignoreDefines = "OFF".equalsIgnoreCase(token);
  22.130                                              if (!ignoreDefines && token.length() == 1) {
  22.131 -                                                define = token.charAt(0);
  22.132 +                                                 define.clear();
  22.133 +		         define.add(token.charAt(0));
  22.134                                              }
  22.135                                          }
  22.136                                      }
  22.137 @@ -1118,7 +1088,7 @@
  22.138       * @param io
  22.139       * @return
  22.140       */
  22.141 -    private char getAliases(HashMap<String, String> definesMap, Document doc, int start, int end, char define, InputOutput io) {
  22.142 +    private List<Character> getAliases(HashMap<String, String> definesMap, Document doc, int start, int end, List<Character> define, InputOutput io) {
  22.143          TokenHierarchy tokenHierarchy = TokenHierarchy.get(doc);
  22.144          @SuppressWarnings("unchecked")
  22.145          TokenSequence<PlsqlTokenId> ts = tokenHierarchy.tokenSequence(PlsqlTokenId.language());
  22.146 @@ -1179,9 +1149,14 @@
  22.147                              value = value.substring(1, value.length() - 1);
  22.148                          }
  22.149                          
  22.150 -                        if (value.indexOf(define) >= 0) {
  22.151 -                            value = replaceAliases(value, definesMap, define, io);
  22.152 -                        }
  22.153 +	    Iterator<Character> itre = define.iterator();
  22.154 +	    while (itre.hasNext()) {
  22.155 +	        if (value.indexOf(itre.next()) >= 0) {
  22.156 +	            value = replaceAliases(value, definesMap, define, io);
  22.157 +	            break;
  22.158 +	        }
  22.159 +	    }
  22.160 +
  22.161                          definesMap.put(alias.toUpperCase(Locale.ENGLISH), value);
  22.162                      }
  22.163                  } else if (tokenTxt.toUpperCase(Locale.ENGLISH).startsWith("SET ")) {
  22.164 @@ -1199,7 +1174,8 @@
  22.165                      }
  22.166                      
  22.167                      if (alias.length() == 1) {
  22.168 -                        define = alias.charAt(0); //If define changed we catch it here
  22.169 +	    define.clear();
  22.170 +	    define.add(alias.charAt(0));//If define changed we catch it here
  22.171                      }
  22.172                  }
  22.173              }
  22.174 @@ -1218,50 +1194,88 @@
  22.175       * @param io
  22.176       * @return
  22.177       */
  22.178 -    public String replaceAliases(String plsqlString, HashMap<String, String> definesMap, char define, InputOutput io) {
  22.179 -        if (plsqlString.indexOf(define) < 0) {
  22.180 +    public String replaceAliases(String plsqlString, HashMap<String, String> definesMap, Collection<Character> define, InputOutput io) {
  22.181 +        boolean exists=false;
  22.182 +        Iterator<Character> iter = define.iterator();
  22.183 +        while(iter.hasNext()){
  22.184 +            if (plsqlString.indexOf(iter.next()) >= 0) {
  22.185 +                exists= true;
  22.186 +                break;               
  22.187 +            }         
  22.188 +        }
  22.189 +        if(!exists){
  22.190              return plsqlString;
  22.191          }
  22.192          
  22.193 +        boolean insideString = false;
  22.194 +        boolean insideComment = false;
  22.195 +        
  22.196          StringBuilder newString = new StringBuilder();
  22.197          for (int i = 0; i < plsqlString.length(); i++) {
  22.198              char c = plsqlString.charAt(i);
  22.199 -            if (c == define) {
  22.200 -                for (int j = i + 1; j < plsqlString.length(); j++) {
  22.201 -                    char nextChar = plsqlString.charAt(j);
  22.202 -                    if (Character.isJavaIdentifierPart(nextChar) && j == plsqlString.length() - 1) { //we have reached the end of the text
  22.203 +            char defineValue = 0;
  22.204 +            
  22.205 +            //check for - inside strings
  22.206 +            if (Character.toString(c).equals("'") || Character.toString(c).equals("\"")) {
  22.207 +                if (!insideString && !Character.toString(plsqlString.charAt(i + 1)).equals("'")) {
  22.208 +	insideString = !insideString;
  22.209 +                }
  22.210 +            }
  22.211 +          
  22.212 +            //Check for - Comments           
  22.213 +            if (!insideComment && Character.toString(c).equals("-") && Character.toString(plsqlString.charAt(i + 1)).equals("-")) {
  22.214 +                insideComment = true;
  22.215 +            } else if (insideComment && Character.toString(c).equals("\n")) {
  22.216 +                insideComment = false;
  22.217 +            }
  22.218 +           
  22.219 +              iter = define.iterator();
  22.220 +             while (iter.hasNext()) {
  22.221 +                if (c == iter.next()) {
  22.222 +	defineValue = c;
  22.223 +	break;
  22.224 +                }
  22.225 +            }                     
  22.226 +             if (defineValue != 0 && !insideComment) {
  22.227 +                if (insideString && !Character.toString(defineValue).equals("&")) {
  22.228 +	newString.append(c);
  22.229 +                } else {
  22.230 +	for (int j = i + 1; j < plsqlString.length(); j++) {
  22.231 +	    char nextChar = plsqlString.charAt(j);
  22.232 +	    if (Character.isJavaIdentifierPart(nextChar) && j == plsqlString.length() - 1) { //we have reached the end of the text
  22.233  
  22.234 -                        nextChar = '.'; //this will make sure that the correct sustitution is made below by emulating an additional character
  22.235 +	        nextChar = '.'; //this will make sure that the correct sustitution is made below by emulating an additional character
  22.236  
  22.237 -                        j = j + 1;
  22.238 -                    }
  22.239 -                    if (!Character.isJavaIdentifierPart(nextChar)) { //potential end of substitutionvariable
  22.240 +	        j = j + 1;
  22.241 +	    }
  22.242 +	    if (!Character.isJavaIdentifierPart(nextChar)) { //potential end of substitutionvariable
  22.243  
  22.244 -                        if (j > i + 1) { //substituion variable found
  22.245 +	        if (j > i + 1) { //substituion variable found
  22.246  
  22.247 -                            String name = plsqlString.substring(i + 1, j);
  22.248 -                            String value = definesMap.get(name.toUpperCase(Locale.ENGLISH));
  22.249 -                            if (value == null || value.startsWith(Character.toString(define))) {
  22.250 -                                PromptDialog prompt = new PromptDialog(null, name, true);
  22.251 -                                prompt.setVisible(true);
  22.252 -                                value = prompt.getValue();
  22.253 -                                definesMap.put(name.toUpperCase(Locale.ENGLISH), value);
  22.254 -                                if (io != null) {
  22.255 -                                    io.getOut().println((new StringBuilder()).append("> Variable ").append(name).append(" = \"").append(value).append("\"").toString());
  22.256 -                                }
  22.257 -                            }
  22.258 -                            value = replaceAliases(value, definesMap, define, io);
  22.259 -                            newString.append(value);
  22.260 -                            if (nextChar == '.') {
  22.261 -                                i = j;
  22.262 -                            } else {
  22.263 -                                i = j - 1;
  22.264 -                            }
  22.265 -                        } else {
  22.266 -                            newString.append(c);
  22.267 -                        }
  22.268 -                        break;
  22.269 -                    }
  22.270 +	            String name = plsqlString.substring(i + 1, j);
  22.271 +	            String value = definesMap.get(name.toUpperCase(Locale.ENGLISH));
  22.272 +	            if (value == null || value.startsWith(Character.toString(defineValue))) {
  22.273 +	                PromptDialog prompt = new PromptDialog(null, name, true);
  22.274 +	                prompt.setVisible(true);
  22.275 +	                value = prompt.getValue();
  22.276 +	                definesMap.put(name.toUpperCase(Locale.ENGLISH), value);
  22.277 +	                if (io != null) {
  22.278 +		io.getOut().println((new StringBuilder()).append("> Variable ").append(name).append(" = \"").append(value).append("\"").toString());
  22.279 +	                }
  22.280 +	            }
  22.281 +	            value = replaceAliases(value, definesMap, define, io);
  22.282 +	            newString.append(value);
  22.283 +	            if (nextChar == '.') {
  22.284 +	                i = j;
  22.285 +	            } else {
  22.286 +	                i = j - 1;
  22.287 +	            }
  22.288 +	        } else {
  22.289 +	            newString.append(c);
  22.290 +	        }
  22.291 +	        break;
  22.292 +	    }
  22.293 +	}
  22.294                  }
  22.295              } else {
  22.296                  newString.append(c);
    23.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlMultipleExecuteAction.java	Wed Dec 07 13:36:21 2011 +0100
    23.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlMultipleExecuteAction.java	Tue Feb 14 17:31:28 2012 +0100
    23.3 @@ -1,7 +1,7 @@
    23.4  /*
    23.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    23.6   *
    23.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    23.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    23.9   *
   23.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   23.11   * Other names may be trademarks of their respective owners.
   23.12 @@ -41,8 +41,6 @@
   23.13   */
   23.14  package org.netbeans.modules.plsql.execution;
   23.15  
   23.16 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   23.17 -import org.netbeans.modules.plsql.utilities.PlsqlExecutorService;
   23.18  import java.awt.event.ActionEvent;
   23.19  import java.awt.event.ActionListener;
   23.20  import java.io.IOException;
   23.21 @@ -59,316 +57,316 @@
   23.22  import org.netbeans.api.progress.ProgressHandleFactory;
   23.23  import org.netbeans.api.project.FileOwnerQuery;
   23.24  import org.netbeans.api.project.Project;
   23.25 +import org.netbeans.modules.plsql.utilities.PlsqlExecutorService;
   23.26 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   23.27  import org.netbeans.modules.plsqlsupport.options.OptionsUtilities;
   23.28 +import org.openide.awt.ActionID;
   23.29 +import org.openide.awt.ActionReference;
   23.30 +import org.openide.awt.ActionRegistration;
   23.31  import org.openide.cookies.EditorCookie;
   23.32  import org.openide.cookies.SaveCookie;
   23.33  import org.openide.loaders.DataObject;
   23.34  import org.openide.nodes.Node;
   23.35 -import org.openide.util.Cancellable;
   23.36 -import org.openide.util.Exceptions;
   23.37 -import org.openide.util.HelpCtx;
   23.38 -import org.openide.util.Lookup;
   23.39 -import org.openide.util.NbBundle;
   23.40 -import org.openide.util.RequestProcessor;
   23.41 -import org.openide.util.UserQuestionException;
   23.42 +import org.openide.util.*;
   23.43  import org.openide.util.actions.CookieAction;
   23.44  import org.openide.windows.IOProvider;
   23.45  import org.openide.windows.InputOutput;
   23.46  import org.openide.windows.OutputEvent;
   23.47  import org.openide.windows.OutputListener;
   23.48  
   23.49 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlMultipleExecuteAction", category = "PLSQL")
   23.50 +@ActionRegistration(displayName = "#CTL_PlsqlMultipleExecuteAction")
   23.51 +@ActionReference(path = "Loaders/text/x-plsql/Actions", position = 250)
   23.52  public final class PlsqlMultipleExecuteAction extends CookieAction {
   23.53  
   23.54 -   private static final List<String> INVALID_EXTENSIONS = Arrays.asList(new String[]{"dbl"});
   23.55 -   private static final String DATABASE_CONNECTION_KEY = "databaseConnection";
   23.56 -   private static final PlsqlExecutorService executorService = Lookup.getDefault().lookup(PlsqlExecutorService.class);
   23.57 -   private DatabaseConnection connection;
   23.58 -   private Node[] activatedNodes;
   23.59 -   private Project project;
   23.60 -   private DataObject dataObject;
   23.61 +    private static final List<String> INVALID_EXTENSIONS = Arrays.asList(new String[]{"dbl"});
   23.62 +    private static final String DATABASE_CONNECTION_KEY = "databaseConnection";
   23.63 +    private static final PlsqlExecutorService executorService = Lookup.getDefault().lookup(PlsqlExecutorService.class);
   23.64 +    private DatabaseConnection connection;
   23.65 +    private Node[] activatedNodes;
   23.66 +    private Project project;
   23.67 +    private DataObject dataObject;
   23.68  
   23.69 -   public PlsqlMultipleExecuteAction() {
   23.70 -   }
   23.71 +    @Override
   23.72 +    protected boolean enable(Node[] activatedNodes) {
   23.73 +        this.activatedNodes = activatedNodes;
   23.74 +        if (!super.enable(activatedNodes)) {
   23.75 +            return false;
   23.76 +        }
   23.77  
   23.78 -   @Override
   23.79 -   protected boolean enable(Node[] activatedNodes) {
   23.80 -      this.activatedNodes = activatedNodes;
   23.81 -      if (!super.enable(activatedNodes)) {
   23.82 -         return false;
   23.83 -      }
   23.84 +        for (Node node : activatedNodes) {
   23.85 +            if (INVALID_EXTENSIONS.contains(node.getLookup().lookup(DataObject.class).getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH))) {
   23.86 +                return false;
   23.87 +            }
   23.88 +        }
   23.89  
   23.90 -      for (Node node : activatedNodes) {
   23.91 -         if (INVALID_EXTENSIONS.contains(node.getLookup().lookup(DataObject.class).getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH))) {
   23.92 +        project = FileOwnerQuery.getOwner(activatedNodes[0].getLookup().lookup(DataObject.class).getPrimaryFile());
   23.93 +        dataObject = project == null && activatedNodes.length == 1 ? activatedNodes[0].getLookup().lookup(DataObject.class) : null;
   23.94 +        if (project == null && activatedNodes.length > 1) {
   23.95              return false;
   23.96 -         }
   23.97 -      }
   23.98 +        }
   23.99 +        if (project != null && project.getLookup().lookup(DatabaseConnectionManager.class) == null) {
  23.100 +            return false;
  23.101 +        }
  23.102 +        for (int i = 1; i < activatedNodes.length; i++) {
  23.103 +            Project p = FileOwnerQuery.getOwner(activatedNodes[i].getLookup().lookup(DataObject.class).getPrimaryFile());
  23.104 +            if (p != project) {
  23.105 +                return false;
  23.106 +            }
  23.107 +        }
  23.108  
  23.109 -      project = FileOwnerQuery.getOwner(activatedNodes[0].getLookup().lookup(DataObject.class).getPrimaryFile());
  23.110 -      dataObject = project == null && activatedNodes.length == 1 ? activatedNodes[0].getLookup().lookup(DataObject.class) : null;
  23.111 -      if (project == null && activatedNodes.length > 1) {
  23.112 -         return false;
  23.113 -      }
  23.114 -      if (project != null && project.getLookup().lookup(DatabaseConnectionManager.class) == null) {
  23.115 -         return false;
  23.116 -      }
  23.117 -      for (int i = 1; i < activatedNodes.length; i++) {
  23.118 -         Project p = FileOwnerQuery.getOwner(activatedNodes[i].getLookup().lookup(DataObject.class).getPrimaryFile());
  23.119 -         if (p != project) {
  23.120 -            return false;
  23.121 -         }
  23.122 -      }
  23.123 +        return true;
  23.124 +    }
  23.125  
  23.126 -      return true;
  23.127 -   }
  23.128 +    private void execute() {
  23.129 +        DatabaseConnectionManager connectionProvider = project != null
  23.130 +                ? DatabaseConnectionManager.getInstance(project)
  23.131 +                : DatabaseConnectionManager.getInstance(dataObject);
  23.132 +        connectionProvider.connect(connection);
  23.133 +        if (connection.getJDBCConnection() == null) {
  23.134 +            return;
  23.135 +        }
  23.136  
  23.137 -   private void execute() {
  23.138 -      DatabaseConnectionManager connectionProvider = project != null
  23.139 -              ? DatabaseConnectionManager.getInstance(project)
  23.140 -              : DatabaseConnectionManager.getInstance(dataObject);
  23.141 -      connectionProvider.connect(connection);
  23.142 -      if (connection.getJDBCConnection() == null) {
  23.143 -         return;
  23.144 -      }
  23.145 +        RequestProcessor processor = RequestProcessor.getDefault();
  23.146 +        processor.post(new ExecutionHandler(connectionProvider, connection, activatedNodes));
  23.147 +    }
  23.148  
  23.149 -      RequestProcessor processor = RequestProcessor.getDefault();
  23.150 -      processor.post(new ExecutionHandler(connectionProvider, connection, activatedNodes));
  23.151 -   }
  23.152 +    @Override
  23.153 +    protected void performAction(Node[] activatedNodes) {
  23.154 +        execute();
  23.155 +    }
  23.156  
  23.157 -   @Override
  23.158 -   protected void performAction(Node[] activatedNodes) {
  23.159 -      execute();
  23.160 -   }
  23.161 +    @Override
  23.162 +    protected int mode() {
  23.163 +        return CookieAction.MODE_ALL;
  23.164 +    }
  23.165  
  23.166 -   @Override
  23.167 -   protected int mode() {
  23.168 -      return CookieAction.MODE_ALL;
  23.169 -   }
  23.170 +    @Override
  23.171 +    public String getName() {
  23.172 +        return NbBundle.getMessage(PlsqlMultipleExecuteAction.class, "CTL_PlsqlMultipleExecuteAction");
  23.173 +    }
  23.174  
  23.175 -   @Override
  23.176 -   public String getName() {
  23.177 -      return NbBundle.getMessage(PlsqlMultipleExecuteAction.class, "CTL_PlsqlMultipleExecuteAction");
  23.178 -   }
  23.179 +    @Override
  23.180 +    protected Class[] cookieClasses() {
  23.181 +        return new Class[]{DataObject.class};
  23.182 +    }
  23.183  
  23.184 -   @Override
  23.185 -   protected Class[] cookieClasses() {
  23.186 -      return new Class[]{DataObject.class};
  23.187 -   }
  23.188 +    @Override
  23.189 +    protected void initialize() {
  23.190 +        super.initialize();
  23.191 +        putValue("noIconInMenu", Boolean.TRUE);
  23.192 +    }
  23.193  
  23.194 -   @Override
  23.195 -   protected void initialize() {
  23.196 -      super.initialize();
  23.197 -      putValue("noIconInMenu", Boolean.TRUE);
  23.198 -   }
  23.199 +    @Override
  23.200 +    public HelpCtx getHelpCtx() {
  23.201 +        return HelpCtx.DEFAULT_HELP;
  23.202 +    }
  23.203  
  23.204 -   @Override
  23.205 -   public HelpCtx getHelpCtx() {
  23.206 -      return HelpCtx.DEFAULT_HELP;
  23.207 -   }
  23.208 +    private String formatDbConnectionName(DatabaseConnection connection) {
  23.209 +        if (connection != null) {
  23.210 +            String url = connection.getDatabaseURL();
  23.211 +            String schema = connection.getUser();
  23.212 +            int pos = url.indexOf("@") + 1;
  23.213 +            if (pos > 0) {
  23.214 +                url = url.substring(pos);
  23.215 +            }
  23.216 +            url = schema + "@" + url;
  23.217 +            String alias = connection.getDisplayName();
  23.218 +            if (alias != null && !alias.equals(connection.getName())) {
  23.219 +                url = alias + " [" + url + "]";
  23.220 +            }
  23.221 +            return url;
  23.222 +        }
  23.223 +        return "Unknown database";
  23.224 +    }
  23.225  
  23.226 -   private String formatDbConnectionName(DatabaseConnection connection) {
  23.227 -      if (connection != null) {
  23.228 -         String url = connection.getDatabaseURL();
  23.229 -         String schema = connection.getUser();
  23.230 -         int pos = url.indexOf("@") + 1;
  23.231 -         if (pos > 0) {
  23.232 -            url = url.substring(pos);
  23.233 -         }
  23.234 -         url = schema + "@" + url;
  23.235 -         String alias = connection.getDisplayName();
  23.236 -         if (alias != null && !alias.equals(connection.getName())) {
  23.237 -            url = alias + " [" + url + "]";
  23.238 -         }
  23.239 -         return url;
  23.240 -      }
  23.241 -      return "Unknown database";
  23.242 -   }
  23.243 +    @Override
  23.244 +    public JMenuItem getPopupPresenter() {
  23.245 +        if (project == null) {
  23.246 +            return super.getPopupPresenter(); //NOPMD
  23.247 +        }
  23.248  
  23.249 -   @Override
  23.250 -   public JMenuItem getPopupPresenter() {
  23.251 -      if (project == null) {
  23.252 -         return super.getPopupPresenter(); //NOPMD
  23.253 -      }
  23.254 +        DatabaseConnectionManager connectionProvider = project.getLookup().lookup(DatabaseConnectionManager.class);
  23.255  
  23.256 -      DatabaseConnectionManager connectionProvider = project.getLookup().lookup(DatabaseConnectionManager.class);
  23.257 +        JMenu menu = new JMenu(getName());
  23.258 +        ActionListener buttonListener = new ButtonListener();
  23.259 +        DatabaseConnection[] databaseConnections = connectionProvider.getDatabaseConnections();
  23.260 +        for (int i = 0; i < databaseConnections.length; i++) {
  23.261 +            JMenuItem item = new JMenuItem(formatDbConnectionName(databaseConnections[i]));
  23.262 +            item.putClientProperty(DATABASE_CONNECTION_KEY, databaseConnections[i]);
  23.263 +            item.addActionListener(buttonListener);
  23.264 +            menu.add(item);
  23.265 +            if (i == 0 && databaseConnections.length > 1) {
  23.266 +                menu.add(new JSeparator());
  23.267 +            }
  23.268 +        }
  23.269 +        return menu;
  23.270 +    }
  23.271  
  23.272 -      JMenu menu = new JMenu(getName());
  23.273 -      ActionListener buttonListener = new ButtonListener();
  23.274 -      DatabaseConnection[] databaseConnections = connectionProvider.getDatabaseConnections();
  23.275 -      for (int i = 0; i < databaseConnections.length; i++) {
  23.276 -         JMenuItem item = new JMenuItem(formatDbConnectionName(databaseConnections[i]));
  23.277 -         item.putClientProperty(DATABASE_CONNECTION_KEY, databaseConnections[i]);
  23.278 -         item.addActionListener(buttonListener);
  23.279 -         menu.add(item);
  23.280 -         if (i == 0 && databaseConnections.length > 1) {
  23.281 -            menu.add(new JSeparator());
  23.282 -         }
  23.283 -      }
  23.284 -      return menu;
  23.285 -   }
  23.286 +    @Override
  23.287 +    protected boolean asynchronous() {
  23.288 +        return false;
  23.289 +    }
  23.290  
  23.291 -   @Override
  23.292 -   protected boolean asynchronous() {
  23.293 -      return false;
  23.294 -   }
  23.295 +    private class DeploymentError implements OutputListener {
  23.296  
  23.297 -   private class DeploymentError implements OutputListener {
  23.298 +        private InputOutput errorTab;
  23.299  
  23.300 -      private InputOutput errorTab;
  23.301 +        public DeploymentError(InputOutput errorTab) {
  23.302 +            this.errorTab = errorTab;
  23.303 +        }
  23.304  
  23.305 -      public DeploymentError(InputOutput errorTab) {
  23.306 -         this.errorTab = errorTab;
  23.307 -      }
  23.308 +        @Override
  23.309 +        public void outputLineSelected(OutputEvent arg0) {
  23.310 +            //do nothing
  23.311 +        }
  23.312  
  23.313 -      @Override
  23.314 -      public void outputLineSelected(OutputEvent arg0) {
  23.315 -         //do nothing
  23.316 -      }
  23.317 +        @Override
  23.318 +        public void outputLineAction(OutputEvent arg0) {
  23.319 +            if (errorTab != null && !errorTab.isClosed()) {
  23.320 +                errorTab.select();
  23.321 +            }
  23.322 +        }
  23.323  
  23.324 -      @Override
  23.325 -      public void outputLineAction(OutputEvent arg0) {
  23.326 -         if (errorTab != null && !errorTab.isClosed()) {
  23.327 -            errorTab.select();
  23.328 -         }
  23.329 -      }
  23.330 +        @Override
  23.331 +        public void outputLineCleared(OutputEvent arg0) {
  23.332 +            //do nothing
  23.333 +        }
  23.334 +    }
  23.335  
  23.336 -      @Override
  23.337 -      public void outputLineCleared(OutputEvent arg0) {
  23.338 -         //do nothing
  23.339 -      }
  23.340 -   }
  23.341 +    private class ExecutionHandler implements Runnable, Cancellable {
  23.342  
  23.343 -   private class ExecutionHandler implements Runnable, Cancellable {
  23.344 +        private DatabaseConnectionManager connectionProvider;
  23.345 +        private DatabaseConnection connection;
  23.346 +        private Node[] activatedNodes;
  23.347 +        private PlsqlFileExecutor executor;
  23.348 +        private boolean cancelDeployment = false;
  23.349  
  23.350 -      private DatabaseConnectionManager connectionProvider;
  23.351 -      private DatabaseConnection connection;
  23.352 -      private Node[] activatedNodes;
  23.353 -      private PlsqlFileExecutor executor;
  23.354 -      private boolean cancelDeployment = false;
  23.355 +        public ExecutionHandler(DatabaseConnectionManager connectionProvider, DatabaseConnection connection, Node[] activatedNodes) {
  23.356 +            this.connectionProvider = connectionProvider;
  23.357 +            this.connection = connection;
  23.358 +            this.activatedNodes = activatedNodes;
  23.359 +        }
  23.360  
  23.361 -      public ExecutionHandler(DatabaseConnectionManager connectionProvider, DatabaseConnection connection, Node[] activatedNodes) {
  23.362 -         this.connectionProvider = connectionProvider;
  23.363 -         this.connection = connection;
  23.364 -         this.activatedNodes = activatedNodes;
  23.365 -      }
  23.366 +        @Override
  23.367 +        public void run() {
  23.368 +            List<String> executionOrder = executorService.getExecutionOrder();
  23.369 +            ProgressHandle handle = ProgressHandleFactory.createHandle("Deploying files to database...", (Cancellable) this);
  23.370 +            cancelDeployment = false;
  23.371 +            try {
  23.372 +                if (connectionProvider != null && connectionProvider.isDefaultDatabase(connection)) { //only use pooled connections for the "main" database.
  23.373 +                    connection = connectionProvider.getPooledDatabaseConnection(false);
  23.374 +                } else {
  23.375 +                    if (!OptionsUtilities.isDeployNoPromptEnabled()) {
  23.376 +                        String msg = "You are now connecting to a secondary database.";
  23.377 +                        String title = "Connecting to a Secondary Database!";
  23.378 +                        if (JOptionPane.showOptionDialog(null,
  23.379 +                                msg,
  23.380 +                                title,
  23.381 +                                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
  23.382 +                                null, null, null) == JOptionPane.NO_OPTION) {
  23.383 +                            cancelDeployment = true;
  23.384 +                        }
  23.385 +                    }
  23.386 +                }
  23.387  
  23.388 -      @Override
  23.389 -      public void run() {
  23.390 -         List<String> executionOrder = executorService.getExecutionOrder();
  23.391 -         ProgressHandle handle = ProgressHandleFactory.createHandle("Deploying files to database...", (Cancellable) this);
  23.392 -         cancelDeployment = false;
  23.393 -         try {
  23.394 -            if (connectionProvider != null && connectionProvider.isDefaultDatabase(connection)) { //only use pooled connections for the "main" database.
  23.395 -               connection = connectionProvider.getPooledDatabaseConnection(false);
  23.396 -            } else {
  23.397 -               if (!OptionsUtilities.isDeployNoPromptEnabled()) {
  23.398 -                  String msg = "You are now connecting to a secondary database.";
  23.399 -                  String title = "Connecting to a Secondary Database!";
  23.400 -                  if (JOptionPane.showOptionDialog(null,
  23.401 -                          msg,
  23.402 -                          title,
  23.403 -                          JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
  23.404 -                          null, null, null) == JOptionPane.NO_OPTION) {
  23.405 -                     cancelDeployment = true;
  23.406 -                  }
  23.407 -               }
  23.408 +                handle.start();
  23.409 +                int count = 0;
  23.410 +                InputOutput io = IOProvider.getDefault().getIO("File deployment summary", false);
  23.411 +                io.getOut().reset();
  23.412 +                if (cancelDeployment) {
  23.413 +                    io.getOut().println("Canceled deploying database files");
  23.414 +                } else {
  23.415 +                    io.getOut().println("Deploying " + activatedNodes.length + " database files");
  23.416 +                    executor = new PlsqlFileExecutor(connectionProvider, connection);
  23.417 +                }
  23.418 +                for (int typeIndex = 0; !cancelDeployment && typeIndex < executionOrder.size(); typeIndex++) {
  23.419 +                    for (int i = 0; !cancelDeployment && i < activatedNodes.length; i++) {
  23.420 +                        DataObject obj = activatedNodes[i].getLookup().lookup(DataObject.class);
  23.421 +                        if (obj != null) {
  23.422 +                            String fileName = obj.getPrimaryFile().getNameExt();
  23.423 +                            if (fileName.toLowerCase(Locale.ENGLISH).endsWith(executionOrder.get(typeIndex))) {
  23.424 +                                //Load the editor cookier and allow parsing
  23.425 +                                EditorCookie ec = obj.getCookie(EditorCookie.class);
  23.426 +                                Document doc = null;
  23.427 +                                try {
  23.428 +                                    doc = ec.openDocument();
  23.429 +                                } catch (UserQuestionException uqe) {
  23.430 +                                    uqe.confirmed();
  23.431 +                                    doc = ec.openDocument();
  23.432 +                                }
  23.433 +                                saveIfModified(obj);
  23.434 +                                PlsqlExecutableBlocksMaker blockMaker = new PlsqlExecutableBlocksMaker(doc);
  23.435 +                                final List exeBlocks = blockMaker.makeExceutableObjects();
  23.436 +                                io.getOut().print("> Deploying " + fileName + "...");
  23.437 +                                handle.setDisplayName("Deploying files to database (" + (++count) + "/" + activatedNodes.length + ")");
  23.438 +                                InputOutput errorTab = executor.executePLSQL(exeBlocks, doc, true, true);
  23.439 +                                if (errorTab == null) {
  23.440 +                                    io.getOut().println("Ok");
  23.441 +                                } else {
  23.442 +                                    io.getOut().println("Failed");
  23.443 +                                    try {
  23.444 +                                        io.getErr().println("!!!Error deploying file " + fileName, new DeploymentError(errorTab));
  23.445 +                                    } catch (IOException ex) {
  23.446 +                                        Exceptions.printStackTrace(ex);
  23.447 +                                    }
  23.448 +                                    cancelDeployment = true;
  23.449 +                                }
  23.450 +                            }
  23.451 +                        }
  23.452 +                    }
  23.453 +                }
  23.454 +                io.getOut().close();
  23.455 +                io.getErr().close();
  23.456 +                io.select();
  23.457 +            } catch (IOException ex) {
  23.458 +                Exceptions.printStackTrace(ex);
  23.459 +            } finally {
  23.460 +                handle.finish();
  23.461 +                if (connectionProvider != null) {
  23.462 +                    connectionProvider.releaseDatabaseConnection(connection);
  23.463 +                }
  23.464              }
  23.465 +        }
  23.466  
  23.467 -            handle.start();
  23.468 -            int count = 0;
  23.469 -            InputOutput io = IOProvider.getDefault().getIO("File deployment summary", false);
  23.470 -            io.getOut().reset();
  23.471 -            if (cancelDeployment) {
  23.472 -               io.getOut().println("Canceled deploying database files");
  23.473 -            } else {
  23.474 -               io.getOut().println("Deploying " + activatedNodes.length + " database files");
  23.475 -               executor = new PlsqlFileExecutor(connectionProvider, connection);
  23.476 +        /**
  23.477 +         * Check whether this data object is modified if so save the object
  23.478 +         *
  23.479 +         * @param dataObj
  23.480 +         */
  23.481 +        private void saveIfModified(DataObject dataObj) {
  23.482 +            if (dataObj instanceof DataObject) {
  23.483 +                try {
  23.484 +                    SaveCookie saveCookie = dataObj.getCookie(SaveCookie.class);
  23.485 +                    if (saveCookie != null) {
  23.486 +                        saveCookie.save();
  23.487 +                    }
  23.488 +                } catch (IOException ex) {
  23.489 +                    Exceptions.printStackTrace(ex);
  23.490 +                }
  23.491              }
  23.492 -            for (int typeIndex = 0; !cancelDeployment && typeIndex < executionOrder.size(); typeIndex++) {
  23.493 -               for (int i = 0; !cancelDeployment && i < activatedNodes.length; i++) {
  23.494 -                  DataObject obj = activatedNodes[i].getLookup().lookup(DataObject.class);
  23.495 -                  if (obj != null) {
  23.496 -                     String fileName = obj.getPrimaryFile().getNameExt();
  23.497 -                     if (fileName.toLowerCase(Locale.ENGLISH).endsWith(executionOrder.get(typeIndex))) {
  23.498 -                        //Load the editor cookier and allow parsing
  23.499 -                        EditorCookie ec = obj.getCookie(EditorCookie.class);
  23.500 -                        Document doc = null;
  23.501 -                        try {
  23.502 -                           doc = ec.openDocument();
  23.503 -                        } catch (UserQuestionException uqe) {
  23.504 -                           uqe.confirmed();
  23.505 -                           doc = ec.openDocument();
  23.506 -                        }
  23.507 -                        saveIfModified(obj);
  23.508 -                        PlsqlExecutableBlocksMaker blockMaker = new PlsqlExecutableBlocksMaker(doc);
  23.509 -                        final List exeBlocks = blockMaker.makeExceutableObjects();
  23.510 -                        io.getOut().print("> Deploying " + fileName + "...");
  23.511 -                        handle.setDisplayName("Deploying files to database (" + (++count) + "/" + activatedNodes.length + ")");
  23.512 -                        InputOutput errorTab = executor.executePLSQL(exeBlocks, doc, true, true);
  23.513 -                        if (errorTab == null) {
  23.514 -                           io.getOut().println("Ok");
  23.515 -                        } else {
  23.516 -                           io.getOut().println("Failed");
  23.517 -                           try {
  23.518 -                              io.getErr().println("!!!Error deploying file " + fileName, new DeploymentError(errorTab));
  23.519 -                           } catch (IOException ex) {
  23.520 -                              Exceptions.printStackTrace(ex);
  23.521 -                           }
  23.522 -                           cancelDeployment = true;
  23.523 -                        }
  23.524 -                     }
  23.525 -                  }
  23.526 -               }
  23.527 +        }
  23.528 +
  23.529 +        @Override
  23.530 +        public boolean cancel() {
  23.531 +            if (executor != null) {
  23.532 +                executor.cancel();
  23.533 +                cancelDeployment = true;
  23.534              }
  23.535 -            io.getOut().close();
  23.536 -            io.getErr().close();
  23.537 -            io.select();
  23.538 -         } catch (IOException ex) {
  23.539 -            Exceptions.printStackTrace(ex);
  23.540 -         } finally {
  23.541 -            handle.finish();
  23.542 -            if (connectionProvider != null) {
  23.543 -               connectionProvider.releaseDatabaseConnection(connection);
  23.544 -            }
  23.545 -         }
  23.546 -      }
  23.547 +            return true;
  23.548 +        }
  23.549 +    }
  23.550  
  23.551 -      /**
  23.552 -       * Check whether this data object is modified if so save the object
  23.553 -       * @param dataObj
  23.554 -       */
  23.555 -      private void saveIfModified(DataObject dataObj) {
  23.556 -         if (dataObj instanceof DataObject) {
  23.557 -            try {
  23.558 -               SaveCookie saveCookie = dataObj.getCookie(SaveCookie.class);
  23.559 -               if (saveCookie != null) {
  23.560 -                  saveCookie.save();
  23.561 -               }
  23.562 -            } catch (IOException ex) {
  23.563 -               Exceptions.printStackTrace(ex);
  23.564 -            }
  23.565 -         }
  23.566 -      }
  23.567 +    private class ButtonListener implements ActionListener {
  23.568  
  23.569 -      @Override
  23.570 -      public boolean cancel() {
  23.571 -         if (executor != null) {
  23.572 -            executor.cancel();
  23.573 -            cancelDeployment = true;
  23.574 -         }
  23.575 -         return true;
  23.576 -      }
  23.577 -   }
  23.578 +        public ButtonListener() {
  23.579 +        }
  23.580  
  23.581 -   private class ButtonListener implements ActionListener {
  23.582 -
  23.583 -      public ButtonListener() {
  23.584 -      }
  23.585 -
  23.586 -      @Override
  23.587 -      public void actionPerformed(ActionEvent e) {
  23.588 -         JMenuItem item = (JMenuItem) e.getSource();
  23.589 -         connection = (DatabaseConnection) item.getClientProperty(DATABASE_CONNECTION_KEY);
  23.590 -         execute();
  23.591 -      }
  23.592 -   }
  23.593 +        @Override
  23.594 +        public void actionPerformed(ActionEvent e) {
  23.595 +            JMenuItem item = (JMenuItem) e.getSource();
  23.596 +            connection = (DatabaseConnection) item.getClientProperty(DATABASE_CONNECTION_KEY);
  23.597 +            execute();
  23.598 +        }
  23.599 +    }
  23.600  }
    24.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlRollbackAction.java	Wed Dec 07 13:36:21 2011 +0100
    24.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlRollbackAction.java	Tue Feb 14 17:31:28 2012 +0100
    24.3 @@ -1,7 +1,7 @@
    24.4  /*
    24.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    24.6   *
    24.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    24.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    24.9   *
   24.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   24.11   * Other names may be trademarks of their respective owners.
   24.12 @@ -41,7 +41,6 @@
   24.13   */
   24.14  package org.netbeans.modules.plsql.execution;
   24.15  
   24.16 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   24.17  import java.awt.Component;
   24.18  import java.awt.event.ActionEvent;
   24.19  import java.awt.image.BufferedImage;
   24.20 @@ -57,69 +56,69 @@
   24.21  import org.netbeans.api.db.explorer.DatabaseConnection;
   24.22  import org.netbeans.api.progress.ProgressHandle;
   24.23  import org.netbeans.api.progress.ProgressHandleFactory;
   24.24 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   24.25  import org.netbeans.modules.plsqlsupport.options.OptionsUtilities;
   24.26 +import org.openide.awt.ActionID;
   24.27 +import org.openide.awt.ActionRegistration;
   24.28  import org.openide.awt.DropDownButtonFactory;
   24.29  import org.openide.cookies.EditorCookie;
   24.30  import org.openide.cookies.SaveCookie;
   24.31  import org.openide.loaders.DataObject;
   24.32 -import org.openide.util.ContextAwareAction;
   24.33 -import org.openide.util.Exceptions;
   24.34 -import org.openide.util.ImageUtilities;
   24.35 -import org.openide.util.Lookup;
   24.36 -import org.openide.util.NbBundle;
   24.37 -import org.openide.util.Utilities;
   24.38 +import org.openide.util.*;
   24.39  import org.openide.util.actions.Presenter;
   24.40  import org.openide.windows.IOProvider;
   24.41  import org.openide.windows.InputOutput;
   24.42  
   24.43 -
   24.44 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlRollbackAction", category = "PLSQL")
   24.45 +@ActionRegistration(displayName = "#CTL_PlsqlRollback")
   24.46  public class PlsqlRollbackAction extends AbstractAction implements ContextAwareAction, Presenter.Toolbar {
   24.47  
   24.48 -   private static final List<String> EXTENSIONS = Arrays.asList(new String[]{"tdb"});
   24.49 -   private DataObject dataObject;
   24.50 -   private DatabaseConnectionManager connectionProvider;
   24.51 -   private JButton button;
   24.52 -   public boolean autoCommit = true;
   24.53 -   private DatabaseConnection connection;
   24.54 +    private static final List<String> EXTENSIONS = Arrays.asList(new String[]{"tdb"});
   24.55 +    private DataObject dataObject;
   24.56 +    private DatabaseConnectionManager connectionProvider;
   24.57 +    private JButton button;
   24.58 +    public boolean autoCommit = true;
   24.59 +    private DatabaseConnection connection;
   24.60  
   24.61 -   public PlsqlRollbackAction() {
   24.62 -      this(Utilities.actionsGlobalContext());
   24.63 +    public PlsqlRollbackAction() {
   24.64 +        this(Utilities.actionsGlobalContext());
   24.65  
   24.66 -   }
   24.67 +    }
   24.68  
   24.69 -   public PlsqlRollbackAction(Lookup context) {
   24.70 -      putValue(SHORT_DESCRIPTION, NbBundle.getMessage(PlsqlRollbackAction.class, "CTL_PlsqlRollback"));
   24.71 -      putValue(SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/plsql/execution/database_rollback.png")));
   24.72 +    public PlsqlRollbackAction(Lookup context) {
   24.73 +        putValue(SHORT_DESCRIPTION, NbBundle.getMessage(PlsqlRollbackAction.class, "CTL_PlsqlRollback"));
   24.74 +        putValue(SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/plsql/execution/database_rollback.png")));
   24.75  
   24.76 -     dataObject = context.lookup(DataObject.class);
   24.77 +        dataObject = context.lookup(DataObject.class);
   24.78  
   24.79 -      //Enable execution for .spec .body files in workspace (copied using 'Copy to Workspace Folder')
   24.80 -      if (dataObject != null && (dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH).equals("spec")
   24.81 -              || dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH).equals("body")
   24.82 -              || dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH).equals("db"))) {
   24.83 -         if (!dataObject.getPrimaryFile().canWrite()) {
   24.84 +        //Enable execution for .spec .body files in workspace (copied using 'Copy to Workspace Folder')
   24.85 +        if (dataObject != null && (dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH).equals("spec")
   24.86 +                || dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH).equals("body")
   24.87 +                || dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH).equals("db"))) {
   24.88 +            if (!dataObject.getPrimaryFile().canWrite()) {
   24.89 +                dataObject = null;
   24.90 +            }
   24.91 +        } else if (dataObject != null && !EXTENSIONS.contains(dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH))) {
   24.92              dataObject = null;
   24.93 -         }
   24.94 -      } else if (dataObject != null && !EXTENSIONS.contains(dataObject.getPrimaryFile().getExt().toLowerCase(Locale.ENGLISH))) {
   24.95 -         dataObject = null;
   24.96 -      }
   24.97 +        }
   24.98  
   24.99 -      if (dataObject != null && dataObject.getLookup().lookup(EditorCookie.class) == null) {
  24.100 -         dataObject = null;
  24.101 -      }
  24.102 +        if (dataObject != null && dataObject.getLookup().lookup(EditorCookie.class) == null) {
  24.103 +            dataObject = null;
  24.104 +        }
  24.105  
  24.106 -      if (dataObject != null) {
  24.107 -         setEnabled(true);
  24.108 -         autoCommit = OptionsUtilities.isCommandWindowAutoCommitEnabled();
  24.109 -      } else {
  24.110 -         setEnabled(false);
  24.111 -      }
  24.112 -   }
  24.113 +        if (dataObject != null) {
  24.114 +            setEnabled(true);
  24.115 +            autoCommit = OptionsUtilities.isCommandWindowAutoCommitEnabled();
  24.116 +        } else {
  24.117 +            setEnabled(false);
  24.118 +        }
  24.119 +    }
  24.120  
  24.121 -   public Action createContextAwareInstance(Lookup context) {
  24.122 -      return new PlsqlRollbackAction(context);
  24.123 +    @Override
  24.124 +    public Action createContextAwareInstance(Lookup context) {
  24.125 +        return new PlsqlRollbackAction(context);
  24.126  
  24.127 -   }
  24.128 +    }
  24.129  
  24.130      private void prepareConnection() {
  24.131          if (dataObject != null) {
  24.132 @@ -128,14 +127,17 @@
  24.133          connection = dataObject.getLookup().lookup(DatabaseConnection.class);
  24.134      }
  24.135  
  24.136 +    @Override
  24.137      public void actionPerformed(ActionEvent event) {
  24.138  
  24.139          prepareConnection();
  24.140 -        if (connectionProvider == null || connection == null)
  24.141 +        if (connectionProvider == null || connection == null) {
  24.142              return;
  24.143 +        }
  24.144  
  24.145 -        if (!connectionProvider.hasDataToCommit(connection))
  24.146 +        if (!connectionProvider.hasDataToCommit(connection)) {
  24.147              return;
  24.148 +        }
  24.149  
  24.150          EditorCookie edCookie = dataObject.getLookup().lookup(EditorCookie.class);
  24.151          Document document = edCookie.getDocument();
  24.152 @@ -164,6 +166,7 @@
  24.153          }
  24.154      }
  24.155  
  24.156 +    @Override
  24.157      public Component getToolbarPresenter() {
  24.158          if (!isEnabled()) {
  24.159              return null;
  24.160 @@ -177,14 +180,14 @@
  24.161          return button;
  24.162      }
  24.163  
  24.164 -   private void saveIfModified(DataObject dataObj) {
  24.165 -      try {
  24.166 -         SaveCookie saveCookie = dataObj.getCookie(SaveCookie.class);
  24.167 -         if (saveCookie != null) {
  24.168 -            saveCookie.save();
  24.169 -         }
  24.170 -      } catch (IOException ex) {
  24.171 -         Exceptions.printStackTrace(ex);
  24.172 -      }
  24.173 -   }
  24.174 +    private void saveIfModified(DataObject dataObj) {
  24.175 +        try {
  24.176 +            SaveCookie saveCookie = dataObj.getCookie(SaveCookie.class);
  24.177 +            if (saveCookie != null) {
  24.178 +                saveCookie.save();
  24.179 +            }
  24.180 +        } catch (IOException ex) {
  24.181 +            Exceptions.printStackTrace(ex);
  24.182 +        }
  24.183 +    }
  24.184  }
    25.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlSaveCommandAction.java	Wed Dec 07 13:36:21 2011 +0100
    25.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlSaveCommandAction.java	Tue Feb 14 17:31:28 2012 +0100
    25.3 @@ -49,6 +49,8 @@
    25.4  import javax.swing.JFileChooser;
    25.5  import javax.swing.text.BadLocationException;
    25.6  import javax.swing.text.Document;
    25.7 +import org.openide.awt.ActionID;
    25.8 +import org.openide.awt.ActionRegistration;
    25.9  import org.openide.filesystems.FileObject;
   25.10  import org.openide.filesystems.FileUtil;
   25.11  import org.openide.loaders.DataObject;
   25.12 @@ -58,84 +60,90 @@
   25.13  import org.openide.util.NbBundle;
   25.14  import org.openide.util.actions.CookieAction;
   25.15  
   25.16 +@ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlSaveCommandAction", category = "PLSQL")
   25.17 +@ActionRegistration(displayName = "#CTL_PlsqlSaveAsAction")
   25.18  public final class PlsqlSaveCommandAction extends CookieAction {
   25.19  
   25.20 -   protected void performAction(Node[] activatedNodes) {
   25.21 -      try {
   25.22 -         DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
   25.23 -         if (dataObject == null) {
   25.24 -            return;
   25.25 -         }
   25.26 +    @Override
   25.27 +    protected void performAction(Node[] activatedNodes) {
   25.28 +        try {
   25.29 +            DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
   25.30 +            if (dataObject == null) {
   25.31 +                return;
   25.32 +            }
   25.33  
   25.34 -         PlsqlEditorSupport editorSupport = dataObject.getCookie(PlsqlEditorSupport.class);
   25.35 -         if (editorSupport == null) {
   25.36 -            return;
   25.37 -         }
   25.38 +            PlsqlEditorSupport editorSupport = dataObject.getCookie(PlsqlEditorSupport.class);
   25.39 +            if (editorSupport == null) {
   25.40 +                return;
   25.41 +            }
   25.42  
   25.43 -         //Select folder
   25.44 -         JFileChooser fc = new JFileChooser();
   25.45 -         fc.setMultiSelectionEnabled(false);
   25.46 -         fc.setDialogTitle(NbBundle.getMessage(PlsqlSaveCommandAction.class, "CTL_PlsqlSaveAsAction"));
   25.47 -         fc.setApproveButtonText("Save");
   25.48 -         fc.setSelectedFile(new File("Command.sql"));
   25.49 -         File selected = null;
   25.50 -         int returnVal = fc.showOpenDialog(null);
   25.51 +            //Select folder
   25.52 +            JFileChooser fc = new JFileChooser();
   25.53 +            fc.setMultiSelectionEnabled(false);
   25.54 +            fc.setDialogTitle(NbBundle.getMessage(PlsqlSaveCommandAction.class, "CTL_PlsqlSaveAsAction"));
   25.55 +            fc.setApproveButtonText("Save");
   25.56 +            fc.setSelectedFile(new File("Command.sql"));
   25.57 +            File selected = null;
   25.58 +            int returnVal = fc.showOpenDialog(null);
   25.59  
   25.60 -         if (returnVal == JFileChooser.APPROVE_OPTION) {
   25.61 -            selected = fc.getSelectedFile();
   25.62 -         } else {
   25.63 -            return;
   25.64 -         }
   25.65 +            if (returnVal == JFileChooser.APPROVE_OPTION) {
   25.66 +                selected = fc.getSelectedFile();
   25.67 +            } else {
   25.68 +                return;
   25.69 +            }
   25.70  
   25.71 -         //Write the contents to the new file
   25.72 -         FileObject newFile = FileUtil.createData(selected);
   25.73 -         Document doc = editorSupport.getDocument();
   25.74 -         String txt = doc.getText(doc.getStartPosition().getOffset(), doc.getLength());
   25.75 -         OutputStream output = newFile.getOutputStream();
   25.76 -         OutputStreamWriter osWriter = new OutputStreamWriter(output);
   25.77 -         osWriter.write(txt, 0, txt.length());
   25.78 -         osWriter.flush();
   25.79 -         osWriter.close();
   25.80 -         output.close();
   25.81 -      } catch (BadLocationException ex) {
   25.82 -         Exceptions.printStackTrace(ex);
   25.83 -      } catch (IOException ex) {
   25.84 -         Exceptions.printStackTrace(ex);
   25.85 -      }
   25.86 -   }
   25.87 +            //Write the contents to the new file
   25.88 +            FileObject newFile = FileUtil.createData(selected);
   25.89 +            Document doc = editorSupport.getDocument();
   25.90 +            String txt = doc.getText(doc.getStartPosition().getOffset(), doc.getLength());
   25.91 +            OutputStream output = newFile.getOutputStream();
   25.92 +            OutputStreamWriter osWriter = new OutputStreamWriter(output);
   25.93 +            osWriter.write(txt, 0, txt.length());
   25.94 +            osWriter.flush();
   25.95 +            osWriter.close();
   25.96 +            output.close();
   25.97 +        } catch (BadLocationException ex) {
   25.98 +            Exceptions.printStackTrace(ex);
   25.99 +        } catch (IOException ex) {
  25.100 +            Exceptions.printStackTrace(ex);
  25.101 +        }
  25.102 +    }
  25.103  
  25.104 -   protected int mode() {
  25.105 -      return CookieAction.MODE_EXACTLY_ONE;
  25.106 -   }
  25.107 +    @Override
  25.108 +    protected int mode() {
  25.109 +        return CookieAction.MODE_EXACTLY_ONE;
  25.110 +    }
  25.111  
  25.112 -   public String getName() {
  25.113 -      return NbBundle.getMessage(PlsqlSaveCommandAction.class, "CTL_PlsqlSaveAsAction");
  25.114 -   }
  25.115 +    @Override
  25.116 +    public String getName() {
  25.117 +        return NbBundle.getMessage(PlsqlSaveCommandAction.class, "CTL_PlsqlSaveAsAction");
  25.118 +    }
  25.119  
  25.120 -   protected Class[] cookieClasses() {
  25.121 -      return new Class[]{DataObject.class};
  25.122 -   }
  25.123 +    @Override
  25.124 +    protected Class[] cookieClasses() {
  25.125 +        return new Class[]{DataObject.class};
  25.126 +    }
  25.127  
  25.128 -   @Override
  25.129 -   protected String iconResource() {
  25.130 -      return "org/netbeans/modules/plsql/execution/saveAs.png";
  25.131 -   }
  25.132 +    @Override
  25.133 +    protected String iconResource() {
  25.134 +        return "org/netbeans/modules/plsql/execution/saveAs.png";
  25.135 +    }
  25.136  
  25.137 -   public HelpCtx getHelpCtx() {
  25.138 -      return HelpCtx.DEFAULT_HELP;
  25.139 -   }
  25.140 +    @Override
  25.141 +    public HelpCtx getHelpCtx() {
  25.142 +        return HelpCtx.DEFAULT_HELP;
  25.143 +    }
  25.144  
  25.145 -   @Override
  25.146 -   protected boolean asynchronous() {
  25.147 -      return false;
  25.148 -   }
  25.149 +    @Override
  25.150 +    protected boolean asynchronous() {
  25.151 +        return false;
  25.152 +    }
  25.153  
  25.154 -   @Override
  25.155 -   protected boolean enable(Node[] activatedNodes) {
  25.156 -      if (!super.enable(activatedNodes)) {
  25.157 -         return false;
  25.158 -      }
  25.159 -      return activatedNodes[0].getLookup().lookup(DataObject.class).getPrimaryFile().getNameExt().endsWith(".tdb");  //Temp database file
  25.160 -   }
  25.161 +    @Override
  25.162 +    protected boolean enable(Node[] activatedNodes) {
  25.163 +        if (!super.enable(activatedNodes)) {
  25.164 +            return false;
  25.165 +        }
  25.166 +        return activatedNodes[0].getLookup().lookup(DataObject.class).getPrimaryFile().getNameExt().endsWith(".tdb");  //Temp database file
  25.167 +    }
  25.168  }
  25.169 -
    26.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/ViewDataAction.java	Wed Dec 07 13:36:21 2011 +0100
    26.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/ViewDataAction.java	Tue Feb 14 17:31:28 2012 +0100
    26.3 @@ -1,7 +1,7 @@
    26.4  /*
    26.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    26.6   *
    26.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    26.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    26.9   *
   26.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   26.11   * Other names may be trademarks of their respective owners.
   26.12 @@ -41,13 +41,15 @@
   26.13   */
   26.14  package org.netbeans.modules.plsql.execution;
   26.15  
   26.16 +
   26.17 +import javax.swing.JEditorPane;
   26.18 +import org.netbeans.api.db.explorer.DatabaseConnection;
   26.19  import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   26.20  import org.netbeans.modules.plsqlsupport.db.DatabaseContentManager;
   26.21  import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
   26.22 -import javax.swing.JEditorPane;
   26.23 -import org.netbeans.api.db.explorer.DatabaseConnection;
   26.24 -import org.netbeans.api.project.FileOwnerQuery;
   26.25 -import org.netbeans.api.project.Project;
   26.26 +import org.openide.awt.ActionID;
   26.27 +import org.openide.awt.ActionReference;
   26.28 +import org.openide.awt.ActionRegistration;
   26.29  import org.openide.cookies.EditorCookie;
   26.30  import org.openide.loaders.DataObject;
   26.31  import org.openide.nodes.Node;
   26.32 @@ -55,25 +57,32 @@
   26.33  import org.openide.util.NbBundle;
   26.34  import org.openide.util.actions.CookieAction;
   26.35  
   26.36 +@ActionID(id = "org.netbeans.modules.plsql.execution.ViewDataAction", category = "PLSQL")
   26.37 +@ActionRegistration(displayName = "#CTL_ViewDataAction")
   26.38 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 282)
   26.39  public final class ViewDataAction extends CookieAction {
   26.40  
   26.41      /**
   26.42       * Create a sql execution window for the selected methoad
   26.43       * @param activatedNodes
   26.44       */
   26.45 +    @Override
   26.46      protected void performAction(Node[] activatedNodes) {
   26.47          String selectStatement = "SELECT ${*} FROM " + getSelectedViewOrTable(activatedNodes) + ";\n${cursor}";
   26.48          SQLCommandWindow.createSQLCommandWindow(activatedNodes, selectStatement, null);
   26.49      }
   26.50  
   26.51 +    @Override
   26.52      protected int mode() {
   26.53          return CookieAction.MODE_EXACTLY_ONE;
   26.54      }
   26.55  
   26.56 +    @Override
   26.57      public String getName() {
   26.58          return NbBundle.getMessage(ViewDataAction.class, "CTL_ViewDataAction");
   26.59      }
   26.60  
   26.61 +    @Override
   26.62      protected Class[] cookieClasses() {
   26.63          return new Class[]{DataObject.class, EditorCookie.class};
   26.64      }
   26.65 @@ -85,6 +94,7 @@
   26.66          putValue("noIconInMenu", Boolean.TRUE);
   26.67      }
   26.68  
   26.69 +    @Override
   26.70      public HelpCtx getHelpCtx() {
   26.71          return HelpCtx.DEFAULT_HELP;
   26.72      }
   26.73 @@ -101,7 +111,6 @@
   26.74       */
   26.75      @Override
   26.76      protected boolean enable(Node[] activatedNodes) {
   26.77 -        Project project = null;
   26.78          if (!super.enable(activatedNodes)) {
   26.79              return false;
   26.80          }
    27.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/actions/DeploySelectedCodeAction.java	Wed Dec 07 13:36:21 2011 +0100
    27.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/actions/DeploySelectedCodeAction.java	Tue Feb 14 17:31:28 2012 +0100
    27.3 @@ -41,13 +41,12 @@
    27.4   */
    27.5  package org.netbeans.modules.plsql.execution.actions;
    27.6  
    27.7 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
    27.8 -import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
    27.9  import java.awt.event.ActionEvent;
   27.10  import java.awt.event.ActionListener;
   27.11  import java.io.File;
   27.12  import java.io.FileWriter;
   27.13  import java.io.IOException;
   27.14 +
   27.15  import javax.swing.JEditorPane;
   27.16  import javax.swing.JMenu;
   27.17  import javax.swing.JMenuItem;
   27.18 @@ -55,10 +54,16 @@
   27.19  import javax.swing.text.BadLocationException;
   27.20  import javax.swing.text.Caret;
   27.21  import javax.swing.text.Document;
   27.22 +
   27.23  import org.netbeans.api.db.explorer.DatabaseConnection;
   27.24  import org.netbeans.api.project.FileOwnerQuery;
   27.25  import org.netbeans.api.project.Project;
   27.26 +import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
   27.27 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   27.28  import org.netbeans.spi.project.CacheDirectoryProvider;
   27.29 +import org.openide.awt.ActionID;
   27.30 +import org.openide.awt.ActionReference;
   27.31 +import org.openide.awt.ActionRegistration;
   27.32  import org.openide.cookies.EditorCookie;
   27.33  import org.openide.filesystems.FileUtil;
   27.34  import org.openide.loaders.DataObject;
   27.35 @@ -68,203 +73,208 @@
   27.36  import org.openide.util.NbBundle;
   27.37  import org.openide.util.actions.CookieAction;
   27.38  
   27.39 +@ActionID(id = "org.netbeans.modules.plsql.execution.actions.DeploySelectedCodeAction", category = "PLSQL")
   27.40 +@ActionRegistration(displayName = "#CTL_DeploySelectedCodeAction")
   27.41 +@ActionReference(path = "Editors/text/x-plsql/Popup", name = "org-netbeans-modules-plsql-execution-action-DeploySelectedCodeAction", position = 280)
   27.42  public final class DeploySelectedCodeAction extends CookieAction {
   27.43  
   27.44 -   private Node[] activatedNodes;
   27.45 -   private DataObject dataObject = null;
   27.46 -   private Project project = null;
   27.47 -   private DatabaseConnection connection = null;
   27.48 -   private static final String DATABASE_CONNECTION_KEY = "databaseConnection";
   27.49 -   private final String TEMP_SQL_FILE_PREFIX = "Tempory";
   27.50 +    private Node[] activatedNodes;
   27.51 +    private DataObject dataObject = null;
   27.52 +    private Project project = null;
   27.53 +    private DatabaseConnection connection = null;
   27.54 +    private static final String DATABASE_CONNECTION_KEY = "databaseConnection";
   27.55 +    private final String TEMP_SQL_FILE_PREFIX = "Tempory";
   27.56  
   27.57 -   /**
   27.58 -    * Create a sql execution window for the selected methoad
   27.59 -    * @param activatedNodes
   27.60 -    */
   27.61 -   protected void performAction(Node[] activatedNodes) {
   27.62 -   }
   27.63 +    /**
   27.64 +     * Create a sql execution window for the selected methoad
   27.65 +     * @param activatedNodes
   27.66 +     */
   27.67 +    @Override
   27.68 +    protected void performAction(Node[] activatedNodes) {
   27.69 +    }
   27.70  
   27.71 -   protected int mode() {
   27.72 -      return CookieAction.MODE_EXACTLY_ONE;
   27.73 -   }
   27.74 +    @Override
   27.75 +    protected int mode() {
   27.76 +        return CookieAction.MODE_EXACTLY_ONE;
   27.77 +    }
   27.78  
   27.79 -   public String getName() {
   27.80 -      return NbBundle.getMessage(DeploySelectedCodeAction.class, "CTL_DeploySelectedCodeAction");
   27.81 -   }
   27.82 +    @Override
   27.83 +    public String getName() {
   27.84 +        return NbBundle.getMessage(DeploySelectedCodeAction.class, "CTL_DeploySelectedCodeAction");
   27.85 +    }
   27.86  
   27.87 -   protected Class[] cookieClasses() {
   27.88 -      return new Class[]{DataObject.class, EditorCookie.class};
   27.89 -   }
   27.90 +    @Override
   27.91 +    protected Class[] cookieClasses() {
   27.92 +        return new Class[]{DataObject.class, EditorCookie.class};
   27.93 +    }
   27.94  
   27.95 -   @Override
   27.96 -   protected void initialize() {
   27.97 -      super.initialize();
   27.98 -      // see org.openide.util.actions.SystemAction.iconResource() Javadoc for more details
   27.99 -      putValue("noIconInMenu", Boolean.TRUE);
  27.100 -   }
  27.101 +    @Override
  27.102 +    protected void initialize() {
  27.103 +        super.initialize();
  27.104 +        // see org.openide.util.actions.SystemAction.iconResource() Javadoc for more details
  27.105 +        putValue("noIconInMenu", Boolean.TRUE);
  27.106 +    }
  27.107  
  27.108 -   public HelpCtx getHelpCtx() {
  27.109 -      return HelpCtx.DEFAULT_HELP;
  27.110 -   }
  27.111 +    @Override
  27.112 +    public HelpCtx getHelpCtx() {
  27.113 +        return HelpCtx.DEFAULT_HELP;
  27.114 +    }
  27.115  
  27.116 -   @Override
  27.117 -   protected boolean asynchronous() {
  27.118 -      return false;
  27.119 -   }
  27.120 +    @Override
  27.121 +    protected boolean asynchronous() {
  27.122 +        return false;
  27.123 +    }
  27.124  
  27.125 -   /**
  27.126 -    * Enable this action when right clicked on procedures or functions
  27.127 -    * @param arg0
  27.128 -    * @return
  27.129 -    */
  27.130 -   @Override
  27.131 -   protected boolean enable(Node[] activatedNodes) {
  27.132 -      this.activatedNodes = activatedNodes;
  27.133 -      if (!super.enable(activatedNodes)) {
  27.134 -         return false;
  27.135 -      }
  27.136 +    /**
  27.137 +     * Enable this action when right clicked on procedures or functions
  27.138 +     * @param arg0
  27.139 +     * @return
  27.140 +     */
  27.141 +    @Override
  27.142 +    protected boolean enable(Node[] activatedNodes) {
  27.143 +        this.activatedNodes = activatedNodes;
  27.144 +        if (!super.enable(activatedNodes)) {
  27.145 +            return false;
  27.146 +        }
  27.147  
  27.148 -      EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
  27.149 -      if (editorCookie == null) {
  27.150 -         return false;
  27.151 -      }
  27.152 +        EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
  27.153 +        if (editorCookie == null) {
  27.154 +            return false;
  27.155 +        }
  27.156  
  27.157 -      int offset = -1;
  27.158 -      int start = -1;
  27.159 -      int end = -1;
  27.160 +        int offset = -1;
  27.161 +        int start = -1;
  27.162 +        int end = -1;
  27.163  
  27.164 -      JEditorPane[] panes = editorCookie.getOpenedPanes();
  27.165 -      if ((panes != null) && (panes.length != 0)) {
  27.166 -         Caret caret = panes[0].getCaret();
  27.167 -         offset = caret.getDot();
  27.168 -         start = Math.min(caret.getDot(), caret.getMark());
  27.169 -         end = Math.max(caret.getDot(), caret.getMark());
  27.170 -      }
  27.171 +        JEditorPane[] panes = editorCookie.getOpenedPanes();
  27.172 +        if ((panes != null) && (panes.length != 0)) {
  27.173 +            Caret caret = panes[0].getCaret();
  27.174 +            offset = caret.getDot();
  27.175 +            start = Math.min(caret.getDot(), caret.getMark());
  27.176 +            end = Math.max(caret.getDot(), caret.getMark());
  27.177 +        }
  27.178  
  27.179 -      //If we are able to take the selected position get data object and get the block factory
  27.180 -      if (offset != -1) {
  27.181 -         dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
  27.182 -         if (dataObject != null) {
  27.183 -            project = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
  27.184 -            if (project == null || DatabaseConnectionManager.getInstance(project) == null) {
  27.185 -               return false;
  27.186 +        //If we are able to take the selected position get data object and get the block factory
  27.187 +        if (offset != -1) {
  27.188 +            dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
  27.189 +            if (dataObject != null) {
  27.190 +                project = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
  27.191 +                if (project == null || DatabaseConnectionManager.getInstance(project) == null) {
  27.192 +                    return false;
  27.193 +                }
  27.194 +                if ((end - start) > 0) {
  27.195 +                    return true;
  27.196 +                }
  27.197              }
  27.198 -            if ((end - start) > 0) {
  27.199 -               return true;
  27.200 +        }
  27.201 +        return false;
  27.202 +    }
  27.203 +
  27.204 +    @Override
  27.205 +    public JMenuItem getPopupPresenter() {
  27.206 +        if (project == null) {
  27.207 +            return super.getPopupPresenter();
  27.208 +        }
  27.209 +
  27.210 +        DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(dataObject);
  27.211 +
  27.212 +        JMenu menu = new JMenu(getName());
  27.213 +        ActionListener buttonListener = new ButtonListener();
  27.214 +        DatabaseConnection[] databaseConnections = connectionProvider.getDatabaseConnections();
  27.215 +        for (int i = 0; i < databaseConnections.length; i++) {
  27.216 +            JMenuItem item = new JMenuItem(databaseConnections[i].getName());
  27.217 +            item.putClientProperty(DATABASE_CONNECTION_KEY, databaseConnections[i]);
  27.218 +            item.addActionListener(buttonListener);
  27.219 +            menu.add(item);
  27.220 +            if (i == 0 && databaseConnections.length > 1) {
  27.221 +                menu.add(new JSeparator());
  27.222              }
  27.223 -         }
  27.224 -      }
  27.225 -      return false;
  27.226 -   }
  27.227 +        }
  27.228 +        return menu;
  27.229 +    }
  27.230  
  27.231 -   @Override
  27.232 -   public JMenuItem getPopupPresenter() {
  27.233 -      if (project == null) {
  27.234 -         return super.getPopupPresenter();
  27.235 -      }
  27.236 +    private class ButtonListener implements ActionListener {
  27.237  
  27.238 -      DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(dataObject);
  27.239 +        @Override
  27.240 +        public void actionPerformed(ActionEvent e) {
  27.241 +            JMenuItem item = (JMenuItem) e.getSource();
  27.242 +            String output = "";
  27.243 +            connection = (DatabaseConnection) item.getClientProperty(DATABASE_CONNECTION_KEY);
  27.244 +            DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(project);
  27.245 +            EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
  27.246 +            try {
  27.247 +                output = replaceAliases(getSelection(editorCookie), dataObject.getLookup().lookup(PlsqlBlockFactory.class), '&');
  27.248 +            } catch (BadLocationException ex) {
  27.249 +                Exceptions.printStackTrace(ex);
  27.250 +            }
  27.251 +            File tmpFile = null;
  27.252 +            try {
  27.253 +                tmpFile = File.createTempFile(TEMP_SQL_FILE_PREFIX, ".sql",
  27.254 +                        FileUtil.toFile(project.getLookup().lookup(CacheDirectoryProvider.class).getCacheDirectory()));
  27.255 +                tmpFile.deleteOnExit();
  27.256 +                FileWriter writer = new FileWriter(tmpFile);
  27.257 +                writer.write(output);
  27.258 +                writer.close();
  27.259 +            } catch (IOException ex) {
  27.260 +                Exceptions.printStackTrace(ex);
  27.261 +            }
  27.262 +            File[] files = {tmpFile};
  27.263 +            try {
  27.264 +                DeployFilesAction.execute(connection, connectionProvider, files, true);
  27.265 +            } catch (IOException ex) {
  27.266 +                Exceptions.printStackTrace(ex);
  27.267 +            }
  27.268 +        }
  27.269  
  27.270 -      JMenu menu = new JMenu(getName());
  27.271 -      ActionListener buttonListener = new ButtonListener();
  27.272 -      DatabaseConnection[] databaseConnections = connectionProvider.getDatabaseConnections();
  27.273 -      for (int i = 0; i < databaseConnections.length; i++) {
  27.274 -         JMenuItem item = new JMenuItem(databaseConnections[i].getName());
  27.275 -         item.putClientProperty(DATABASE_CONNECTION_KEY, databaseConnections[i]);
  27.276 -         item.addActionListener(buttonListener);
  27.277 -         menu.add(item);
  27.278 -         if (i == 0 && databaseConnections.length > 1) {
  27.279 -            menu.add(new JSeparator());
  27.280 -         }
  27.281 -      }
  27.282 -      return menu;
  27.283 -   }
  27.284 +        private String getSelection(EditorCookie editorCookie) throws BadLocationException {
  27.285 +            JEditorPane[] panes = editorCookie.getOpenedPanes();
  27.286 +            Document document = editorCookie.getDocument();
  27.287 +            String selection = "";
  27.288 +            if ((panes != null) && (panes.length != 0)) {
  27.289 +                Caret caret = panes[0].getCaret();
  27.290 +                int start = Math.min(caret.getDot(), caret.getMark());
  27.291 +                int end = Math.max(caret.getDot(), caret.getMark());
  27.292 +                selection = document.getText(start, (end - start));
  27.293 +            }
  27.294 +            return selection;
  27.295 +        }
  27.296  
  27.297 -   private class ButtonListener implements ActionListener {
  27.298 +        private String replaceAliases(String plsqlString, PlsqlBlockFactory blockFac, char define) {
  27.299 +            if (plsqlString.indexOf(define) < 0) {
  27.300 +                return plsqlString;
  27.301 +            }
  27.302  
  27.303 -      public ButtonListener() {
  27.304 -      }
  27.305 -
  27.306 -      public void actionPerformed(ActionEvent e) {
  27.307 -         JMenuItem item = (JMenuItem) e.getSource();
  27.308 -         String output = "";
  27.309 -         connection = (DatabaseConnection) item.getClientProperty(DATABASE_CONNECTION_KEY);
  27.310 -         DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(project);
  27.311 -         EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
  27.312 -         try {
  27.313 -            output = replaceAliases(getSelection(editorCookie), dataObject.getLookup().lookup(PlsqlBlockFactory.class), '&');
  27.314 -         } catch (BadLocationException ex) {
  27.315 -            Exceptions.printStackTrace(ex);
  27.316 -         }
  27.317 -         File tmpFile = null;
  27.318 -         try {
  27.319 -            tmpFile = File.createTempFile(TEMP_SQL_FILE_PREFIX, ".sql",
  27.320 -                    FileUtil.toFile(project.getLookup().lookup(CacheDirectoryProvider.class).getCacheDirectory()));
  27.321 -            tmpFile.deleteOnExit();
  27.322 -            FileWriter writer = new FileWriter(tmpFile);
  27.323 -            writer.write(output);
  27.324 -            writer.close();            
  27.325 -         } catch (IOException ex) {
  27.326 -            Exceptions.printStackTrace(ex);
  27.327 -         }
  27.328 -         File[] files = {tmpFile};
  27.329 -         try {
  27.330 -            DeployFilesAction.execute(connection, connectionProvider, files, true);
  27.331 -         } catch (IOException ex) {
  27.332 -            Exceptions.printStackTrace(ex);
  27.333 -         }         
  27.334 -      }
  27.335 -
  27.336 -      private String getSelection(EditorCookie editorCookie) throws BadLocationException {
  27.337 -         JEditorPane[] panes = editorCookie.getOpenedPanes();
  27.338 -         Document document = editorCookie.getDocument();
  27.339 -         String selection = "";
  27.340 -         if ((panes != null) && (panes.length != 0)) {
  27.341 -            Caret caret = panes[0].getCaret();
  27.342 -            int start = Math.min(caret.getDot(), caret.getMark());
  27.343 -            int end = Math.max(caret.getDot(), caret.getMark());
  27.344 -            selection = document.getText(start, (end - start));
  27.345 -         }
  27.346 -         return selection;
  27.347 -      }
  27.348 -
  27.349 -      private String replaceAliases(String plsqlString, PlsqlBlockFactory blockFac, char define) {
  27.350 -      if (plsqlString.indexOf(define) < 0) {
  27.351 -         return plsqlString;
  27.352 -      }
  27.353 -
  27.354 -      StringBuilder newString = new StringBuilder();
  27.355 -      for (int i = 0; i < plsqlString.length(); i++) {
  27.356 -         char c = plsqlString.charAt(i);
  27.357 -         if (c == define) {
  27.358 -            for (int j = i + 1; j < plsqlString.length(); j++) {
  27.359 -               char nextChar = plsqlString.charAt(j);
  27.360 -               if (Character.isJavaIdentifierPart(nextChar) && j == plsqlString.length() - 1) { //we have reached the end of the text
  27.361 -                  nextChar = '.'; //this will make sure that the correct sustitution is made below by emulating an additional character
  27.362 -                  j = j + 1;
  27.363 -               }
  27.364 -               if (!Character.isJavaIdentifierPart(nextChar)) { //potential end of substitutionvariable
  27.365 -                  if (j > i + 1) { //substituion variable found
  27.366 -                     String name = plsqlString.substring(i, j);
  27.367 -                     String value = blockFac.getDefine(name);
  27.368 -                     newString.append(value);
  27.369 -                     if (nextChar == '.') {
  27.370 -                        i = j;
  27.371 -                     } else {
  27.372 -                        i = j - 1;
  27.373 -                     }
  27.374 -                  } else {
  27.375 -                     newString.append(c);
  27.376 -                  }
  27.377 -                  break;
  27.378 -               }
  27.379 +            StringBuilder newString = new StringBuilder();
  27.380 +            for (int i = 0; i < plsqlString.length(); i++) {
  27.381 +                char c = plsqlString.charAt(i);
  27.382 +                if (c == define) {
  27.383 +                    for (int j = i + 1; j < plsqlString.length(); j++) {
  27.384 +                        char nextChar = plsqlString.charAt(j);
  27.385 +                        if (Character.isJavaIdentifierPart(nextChar) && j == plsqlString.length() - 1) { //we have reached the end of the text
  27.386 +                            nextChar = '.'; //this will make sure that the correct sustitution is made below by emulating an additional character
  27.387 +                            j = j + 1;
  27.388 +                        }
  27.389 +                        if (!Character.isJavaIdentifierPart(nextChar)) { //potential end of substitutionvariable
  27.390 +                            if (j > i + 1) { //substituion variable found
  27.391 +                                String name = plsqlString.substring(i, j);
  27.392 +                                String value = blockFac.getDefine(name);
  27.393 +                                newString.append(value);
  27.394 +                                if (nextChar == '.') {
  27.395 +                                    i = j;
  27.396 +                                } else {
  27.397 +                                    i = j - 1;
  27.398 +                                }
  27.399 +                            } else {
  27.400 +                                newString.append(c);
  27.401 +                            }
  27.402 +                            break;
  27.403 +                        }
  27.404 +                    }
  27.405 +                } else {
  27.406 +                    newString.append(c);
  27.407 +                }
  27.408              }
  27.409 -         } else {
  27.410 -            newString.append(c);
  27.411 -         }
  27.412 -      }
  27.413 -      return newString.toString();
  27.414 -   }
  27.415 -   }
  27.416 +            return newString.toString();
  27.417 +        }
  27.418 +    }
  27.419  }
  27.420 -
    28.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/layer.xml	Wed Dec 07 13:36:21 2011 +0100
    28.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/layer.xml	Tue Feb 14 17:31:28 2012 +0100
    28.3 @@ -1,32 +1,6 @@
    28.4  <?xml version="1.0" encoding="UTF-8"?>
    28.5  <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
    28.6  <filesystem>
    28.7 -    <folder name="Actions">
    28.8 -        <folder name="PLSQL">
    28.9 -            <file name="org-netbeans-modules-plsql-execution-ViewDataAction.instance"/>
   28.10 -            <file name="org-netbeans-modules-plsql-execution-DescribeAction.instance"/>
   28.11 -            <file name="org-netbeans-modules-plsql-execution-CreateTestBlockAction.instance"/>
   28.12 -            <file name="org-netbeans-modules-plsql-execution-CopyAsJavaStringAction.instance"/>
   28.13 -            <file name="org-netbeans-modules-plsql-execution-PasteAsSqlCommandAction.instance"/>
   28.14 -            <file name="org-netbeans-modules-plsql-execution-PlsqlExecuteAction.instance">
   28.15 -                <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.execution.PlsqlExecuteAction"/>
   28.16 -            </file>
   28.17 -            <file name="org-netbeans-modules-plsql-execution-PlsqlCommitAction.instance">
   28.18 -                <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.execution.PlsqlCommitAction"/>
   28.19 -            </file>
   28.20 -            <file name="org-netbeans-modules-plsql-execution-PlsqlRollbackAction.instance">
   28.21 -                <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.execution.PlsqlRollbackAction"/>
   28.22 -            </file>
   28.23 -            <file name="org-netbeans-modules-plsql-execution-PlsqlExecutionHistoryAction.instance"/>
   28.24 -            <file name="org-netbeans-modules-plsql-execution-PlsqlExecutionHistoryNextAction.instance"/>
   28.25 -            <file name="org-netbeans-modules-plsql-execution-PlsqlExecutionHistoryPreviousAction.instance"/>
   28.26 -            <file name="org-netbeans-modules-plsql-execution-PlsqlExplainPlanAction.instance"/>
   28.27 -            <file name="org-netbeans-modules-plsql-execution-PlsqlMultipleExecuteAction.instance"/>
   28.28 -            <file name="org-netbeans-modules-plsql-execution-SQLExecutionAction.instance"/>
   28.29 -            <file name="org-netbeans-modules-plsql-execution-actions-DeploySelectedCodeAction.instance"/>
   28.30 -            <file name="org-netbeans-modules-plsql-execution-PlsqlSaveCommandAction.instance"/>
   28.31 -        </folder>
   28.32 -    </folder>
   28.33      <folder name="Databases">
   28.34          <folder name="Nodes">
   28.35              <folder name="Oracle">
   28.36 @@ -44,32 +18,10 @@
   28.37                          <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
   28.38                          <attr name="position" intvalue="225"/>
   28.39                      </file>
   28.40 -                    <file name="org-netbeans-modules-plsql-execution-PlsqlMultipleExecuteAction.shadow">
   28.41 -                        <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-PlsqlMultipleExecuteAction.instance"/>
   28.42 -                        <attr name="position" intvalue="250"/>
   28.43 -                    </file>
   28.44                  </folder>
   28.45              </folder>
   28.46          </folder>
   28.47      </folder>
   28.48 -    <folder name="Shortcuts">
   28.49 -        <file name="AS-B.shadow">
   28.50 -            <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-CreateTestBlockAction.instance"/>
   28.51 -          <!--  <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.execution.CreateTestBlockAction"/> -->
   28.52 -        </file>
   28.53 -        <file name="AS-N.shadow">
   28.54 -            <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-PlsqlExecutionHistoryNextAction.instance"/>
   28.55 -          <!--  <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.execution.PlsqlExecutionHistoryNextAction"/> -->
   28.56 -        </file>
   28.57 -        <file name="AS-P.shadow">
   28.58 -            <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-PlsqlExecutionHistoryPreviousAction.instance"/>
   28.59 -         <!--   <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.execution.PlsqlExecutionHistoryPreviousAction"/> -->
   28.60 -        </file>
   28.61 -      <file name="AS-E.shadow">
   28.62 -          <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-PlsqlExecuteAction.instance"/>
   28.63 -      <!--   <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.execution.PlsqlExecuteAction"/> -->
   28.64 -      </file>
   28.65 -    </folder>
   28.66      <folder name="Editors">
   28.67          <folder name="text">
   28.68              <folder name="x-plsql">
   28.69 @@ -78,33 +30,9 @@
   28.70                          <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
   28.71                          <attr name="position" intvalue="273"/>
   28.72                      </file>     
   28.73 -                    <file name="org-netbeans-modules-plsql-execution-action-DeploySelectedCodeAction.shadow">
   28.74 -                        <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-actions-DeploySelectedCodeAction.instance"/>
   28.75 -                        <attr name="position" intvalue="280"/>
   28.76 -                    </file>
   28.77 -                    <file name="org-netbeans-modules-plsql-execution-CreateTestBlockAction.shadow">
   28.78 -                        <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-CreateTestBlockAction.instance"/>
   28.79 -                        <attr name="position" intvalue="281"/>
   28.80 -                    </file>
   28.81 -                    <file name="org-netbeans-modules-plsql-execution-ViewDataAction.shadow">
   28.82 -                        <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-ViewDataAction.instance"/>
   28.83 -                        <attr name="position" intvalue="282"/>
   28.84 -                    </file>
   28.85 -                    <file name="org-netbeans-modules-plsql-execution-DescribeAction.shadow">
   28.86 -                        <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-DescribeAction.instance"/>
   28.87 -                        <attr name="position" intvalue="283"/>
   28.88 -                    </file>  
   28.89                      <file name="org-netbeans-modules-plsql-execution-separatorBefore.instance">
   28.90                          <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
   28.91                          <attr name="position" intvalue="284"/>
   28.92 -                    </file>
   28.93 -                    <file name="org-netbeans-modules-plsql-execution-CopyAsJavaStringAction.shadow">
   28.94 -                        <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-CopyAsJavaStringAction.instance"/>
   28.95 -                        <attr name="position" intvalue="285"/>
   28.96 -                    </file>  
   28.97 -                    <file name="org-netbeans-modules-plsql-execution-PasteAsSqlCommandAction.shadow">
   28.98 -                        <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-execution-PasteAsSqlCommandAction.instance"/>
   28.99 -                        <attr name="position" intvalue="286"/>
  28.100                      </file>  
  28.101                      <file name="org-netbeans-modules-plsql-execution-separatorAfter.instance">
  28.102                          <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
    29.1 --- a/PLSQL/FileType/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    29.2 +++ b/PLSQL/FileType/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    29.3 @@ -3,9 +3,9 @@
    29.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    29.5  OpenIDE-Module: org.netbeans.modules.plsql.filetype
    29.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/filetype/layer.xml
    29.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/filetype/Bundle.pro
    29.8 - perties
    29.9 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/filetype/
   29.10 + Bundle.properties
   29.11  OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help
   29.12 -OpenIDE-Module-Specification-Version: 1.8.4
   29.13 +OpenIDE-Module-Specification-Version: 1.8.10
   29.14  AutoUpdate-Show-In-Client: false
   29.15  
    30.1 --- a/PLSQL/FileType/nbproject/project.xml	Wed Dec 07 13:36:21 2011 +0100
    30.2 +++ b/PLSQL/FileType/nbproject/project.xml	Tue Feb 14 17:31:28 2012 +0100
    30.3 @@ -130,7 +130,7 @@
    30.4                      <build-prerequisite/>
    30.5                      <compile-dependency/>
    30.6                      <run-dependency>
    30.7 -                        <specification-version>7.29</specification-version>
    30.8 +                        <specification-version>7.2.1</specification-version>
    30.9                      </run-dependency>
   30.10                  </dependency>
   30.11                  <dependency>
    31.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties	Wed Dec 07 13:36:21 2011 +0100
    31.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties	Tue Feb 14 17:31:28 2012 +0100
    31.3 @@ -3,8 +3,8 @@
    31.4  LBL_Plsql_loader_name=PL/SQL Files
    31.5  Services/MIMEResolver/PlsqlResolver.xml=PL/SQL Files
    31.6  Templates/PLSQL=PL/SQL
    31.7 -Templates/PLSQL/LogicalUnit.apy=Logical Unit Implementation
    31.8 -Templates/PLSQL/LogicalUnit.api=Logical Unit Specification
    31.9 +Templates/PLSQL/LogicalUnit.apy=Utility LU Implementation
   31.10 +Templates/PLSQL/LogicalUnit.api=Utility LU Specification
   31.11  Templates/PLSQL/Report.rdf=Report Definition
   31.12  Templates/PLSQL/Script.upg=Database Upgrade Script
   31.13  Templates/PLSQL/Script.cdb=Database Change Script
    32.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/api.html	Wed Dec 07 13:36:21 2011 +0100
    32.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/api.html	Tue Feb 14 17:31:28 2012 +0100
    32.3 @@ -2,6 +2,6 @@
    32.4  <html xmlns="http://www.w3.org/1999/xhtml">
    32.5    <head><title/></head>
    32.6    <body>
    32.7 -     <div>Creates a new logical unit specification (API file).</div>
    32.8 +     <div>Creates a new utility logical unit specification (API file).</div>
    32.9    </body>
   32.10  </html>
   32.11 \ No newline at end of file
    33.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/apy.html	Wed Dec 07 13:36:21 2011 +0100
    33.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/apy.html	Tue Feb 14 17:31:28 2012 +0100
    33.3 @@ -2,6 +2,6 @@
    33.4  <html xmlns="http://www.w3.org/1999/xhtml">
    33.5    <head><title/></head>
    33.6    <body>
    33.7 -     <div>Creates a new logical unit implementation (APY file).</div>
    33.8 +     <div>Creates a new utility logical unit implementation (APY file).</div>
    33.9    </body>
   33.10  </html>
   33.11 \ No newline at end of file
    34.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.api	Wed Dec 07 13:36:21 2011 +0100
    34.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.api	Tue Feb 14 17:31:28 2012 +0100
    34.3 @@ -1,152 +1,24 @@
    34.4  -----------------------------------------------------------------------------
    34.5  --
    34.6 ---  Logical unit: <<<LU:   Put your LU name here>>>
    34.7 +--  Logical unit: <<<LU: Put your LU name here>>>
    34.8  --
    34.9 ---  IFS/Design Template Version 2.3
   34.10 +--  IFS Developer Studio Template Version 2.5
   34.11  --
   34.12 ---  Date    Sign  History
   34.13 ---  ------  ----  -----------------------------------------------------------
   34.14 +--  Date    Sign    History
   34.15 +--  ------  ------  ---------------------------------------------------------
   34.16  -----------------------------------------------------------------------------
   34.17  
   34.18 -define MODULE        = <<<MODULE:   Put your module name here>>>
   34.19 -define LU            = <<<LU:       Put your lu name here>>>
   34.20 -define SERVICE       = <<<SERVICE:  Put your system service name here>>>
   34.21 -define PKG           = <<<PKG:      Put your package name here>>>
   34.22 -define DOMAIN        = <<<DOMAIN:   Put your domain name here>>>
   34.23 -
   34.24 +DEFINE MODULE        = <<<MODULE:   Put your module name here>>>
   34.25 +DEFINE LU            = <<<LU:       Put your lu name here>>>
   34.26 +DEFINE PKG           = <<<PKG:      Put your package name here>>>
   34.27  
   34.28  PROMPT Creating &PKG specification
   34.29  
   34.30  CREATE OR REPLACE PACKAGE &PKG IS
   34.31  
   34.32 -module_  CONSTANT VARCHAR2(25) := '&MODULE';
   34.33 -lu_name_ CONSTANT VARCHAR2(25) := '&LU';
   34.34 -domain_  CONSTANT VARCHAR2(25) := '&DOMAIN';
   34.35 -service_ CONSTANT VARCHAR2(25) := '&SERVICE';
   34.36 -
   34.37 -<<<PUBREC: public record definition>>>
   34.38 -
   34.39 ------------------------------------------------------------------------------
   34.40 --------------- STATEPACKAGE: PRIVATE FINITE STATE MACHINE -------------------
   34.41 ------------------------------------------------------------------------------
   34.42 -
   34.43 -FUNCTION Finite_State_Decode__ (
   34.44 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
   34.45 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
   34.46 -
   34.47 -FUNCTION Finite_State_Encode__ (
   34.48 -   client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
   34.49 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
   34.50 -
   34.51 -PROCEDURE Enumerate_States__ (
   34.52 -   client_values_ OUT VARCHAR2 );
   34.53 -
   34.54 -FUNCTION Finite_State_Events__ (
   34.55 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
   34.56 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
   34.57 -
   34.58 -PROCEDURE Enumerate_Events__ (
   34.59 -   db_events_ OUT VARCHAR2 );
   34.60 -
   34.61 ------------------------------------------------------------------------------
   34.62 --------------------- PRIVATE FINITE STATE MACHINE ---------------------------
   34.63 ------------------------------------------------------------------------------
   34.64 -
   34.65 -FUNCTION Finite_State_Decode__ (
   34.66 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
   34.67 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
   34.68 -
   34.69 -FUNCTION Finite_State_Encode__ (
   34.70 -   client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
   34.71 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
   34.72 -
   34.73 -PROCEDURE Enumerate_States__ (
   34.74 -   client_values_ OUT VARCHAR2 );
   34.75 -
   34.76 -FUNCTION Finite_State_Events__ (
   34.77 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
   34.78 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
   34.79 -
   34.80 -PROCEDURE Enumerate_Events__ (
   34.81 -   db_events_ OUT VARCHAR2 );
   34.82 -
   34.83 ------------------------------------------------------------------------------
   34.84 --------------------- PRIVATE BASE METHODS -----------------------------------
   34.85 ------------------------------------------------------------------------------
   34.86 -
   34.87 -PROCEDURE Lock__ (
   34.88 -   info_       OUT VARCHAR2,
   34.89 -   objid_      IN  VARCHAR2,
   34.90 -   objversion_ IN  VARCHAR2 );
   34.91 -
   34.92 -PROCEDURE New__ (
   34.93 -   info_       OUT    VARCHAR2,
   34.94 -   objid_      OUT    VARCHAR2,
   34.95 -   objversion_ OUT    VARCHAR2,
   34.96 -   attr_       IN OUT VARCHAR2,
   34.97 -   action_     IN     VARCHAR2 );
   34.98 -
   34.99 -PROCEDURE Modify__ (
  34.100 -   info_       OUT    VARCHAR2,
  34.101 -   objid_      IN     VARCHAR2,
  34.102 -   objversion_ IN OUT VARCHAR2,
  34.103 -   attr_       IN OUT VARCHAR2,
  34.104 -   action_     IN     VARCHAR2 );
  34.105 -
  34.106 -PROCEDURE Remove__ (
  34.107 -   info_       OUT VARCHAR2,
  34.108 -   objid_      IN  VARCHAR2,
  34.109 -   objversion_ IN  VARCHAR2,
  34.110 -   action_     IN  VARCHAR2 );
  34.111 -
  34.112 ------------------------------------------------------------------------------
  34.113 --------------------- PUBLIC BASE METHODS ------------------------------------
  34.114 ------------------------------------------------------------------------------
  34.115 -
  34.116 -PROCEDURE Exist (
  34.117 -   <<<KEYARG: Put your primary key parameters here>>> );
  34.118 -
  34.119 -PROCEDURE Exist_Db (
  34.120 -   <<<DBKARG: Put your primary key parameters here>>> );
  34.121 -
  34.122 ------------------------------------------------------------------------------
  34.123 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
  34.124 ------------------------------------------------------------------------------
  34.125 -
  34.126 -PROCEDURE Exist (
  34.127 -   client_value_ IN VARCHAR2 );
  34.128 -
  34.129 -PROCEDURE Enumerate (
  34.130 -   client_values_ OUT VARCHAR2 );
  34.131 -
  34.132 -PROCEDURE Exist_Db (
  34.133 -   db_value_ IN VARCHAR2 );
  34.134 -
  34.135 ------------------------------------------------------------------------------
  34.136 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
  34.137 ------------------------------------------------------------------------------
  34.138 -
  34.139 -FUNCTION Encode (
  34.140 -   client_value_ IN VARCHAR2 ) RETURN VARCHAR2;
  34.141 -PRAGMA restrict_references(Encode, WNDS);
  34.142 -
  34.143 -FUNCTION Decode (
  34.144 -   db_value_ IN VARCHAR2 ) RETURN VARCHAR2;
  34.145 -PRAGMA restrict_references(Decode, WNDS);
  34.146 -
  34.147 -FUNCTION Get_Db_Value (
  34.148 -   index_ IN NUMBER ) RETURN VARCHAR2;
  34.149 -PRAGMA restrict_references(Get_Db_Value, WNDS);
  34.150 -
  34.151 -FUNCTION Get_Client_Value (
  34.152 -   index_ IN NUMBER ) RETURN VARCHAR2;
  34.153 -PRAGMA restrict_references(Get_Client_Value, WNDS);
  34.154 -
  34.155 ------------------------------------------------------------------------------
  34.156 --------------------- PUBLIC TRANSLATION METHODS -----------------------------
  34.157 ------------------------------------------------------------------------------
  34.158 -
  34.159 -PROCEDURE Language_Refreshed;
  34.160 +module_  CONSTANT VARCHAR2(25) := '&MODULE'; 
  34.161 +lu_name_ CONSTANT VARCHAR2(25) := '&LU'; 
  34.162 +lu_type_ CONSTANT VARCHAR2(15) := 'Utility';
  34.163  
  34.164  -----------------------------------------------------------------------------
  34.165  -------------------- LU SPECIFIC PRIVATE METHODS ----------------------------
  34.166 @@ -164,124 +36,15 @@
  34.167  
  34.168  
  34.169  -----------------------------------------------------------------------------
  34.170 --------------------- SERVICE SPECIFIC PRIVATE METHODS -----------------------
  34.171 ------------------------------------------------------------------------------
  34.172 -
  34.173 -
  34.174 ------------------------------------------------------------------------------
  34.175 --------------------- SERVICE SPECIFIC PROTECTED METHODS ---------------------
  34.176 ------------------------------------------------------------------------------
  34.177 -
  34.178 -
  34.179 ------------------------------------------------------------------------------
  34.180 --------------------- SERVICE SPECIFIC PUBLIC METHODS ------------------------
  34.181 ------------------------------------------------------------------------------
  34.182 -
  34.183 -
  34.184 ------------------------------------------------------------------------------
  34.185  -------------------- FOUNDATION1 METHODS ------------------------------------
  34.186  -----------------------------------------------------------------------------
  34.187  
  34.188  PROCEDURE Init;
  34.189  
  34.190 -
  34.191  END &PKG;
  34.192  /
  34.193  SHOW ERROR
  34.194  
  34.195 -undefine MODULE
  34.196 -undefine LU
  34.197 -undefine SERVICE
  34.198 -undefine PKG
  34.199 -undefine DOMAIN
  34.200 -
  34.201 ------------------------------------------------------------------------------
  34.202 ------------------------------ STATEPACKAGE ----------------------------------
  34.203 ------------------------------------------------------------------------------
  34.204 --- Separate Finite State Machine Package
  34.205 ------------------------------------------------------------------------------
  34.206 -
  34.207 -define VIEW          = <<<VIEW:     Put your view name here>>>
  34.208 -define STATEPKG      = <<<STATEPKG: Put your statepackage name here>>>
  34.209 -
  34.210 -define OBJID         = <<<OBJID:    Put your object key (or rowid) here>>>
  34.211 -define OBJVERSION    = <<<OBJVER:   Put your objversion column (or list) here>>>
  34.212 -define OBJSTATE      = <<<OBJSTA:   Put your object state column here>>>
  34.213 -define OBJEVENTS     = <<<OBJEVE:   Put your object events column here>>>
  34.214 -define STATE         = <<<STATE:    Put your encoded object state column here>>>
  34.215 -
  34.216 -
  34.217 -PROMPT Creating &VIEW view
  34.218 -
  34.219 -CREATE OR REPLACE VIEW &VIEW AS
  34.220 -SELECT <<<VIEWCOL: Put your view column here>>>
  34.221 -FROM   <<<VIEWTAB: Put your view table(s) here>>>
  34.222 -WHERE  <<<VIEWSEC: Put your security restrictions on rows here>>>
  34.223 -WITH   read only;
  34.224 -
  34.225 -
  34.226 -
  34.227 -PROMPT Creating &STATEPKG specification
  34.228 -
  34.229 -CREATE OR REPLACE PACKAGE &STATEPKG IS
  34.230 -
  34.231 -module_  CONSTANT VARCHAR2(25) := '&MODULE';
  34.232 -lu_name_ CONSTANT VARCHAR2(25) := '&LU';
  34.233 -
  34.234 ------------------------------------------------------------------------------
  34.235 ----------------- STATEPACKAGE IMPLEMENTATION METHODS ------------------------
  34.236 ------------------------------------------------------------------------------
  34.237 -
  34.238 -PROCEDURE Finite_State_Machine___ (
  34.239 -   rec_   IN OUT &VIEW%ROWTYPE,
  34.240 -   event_ IN     VARCHAR2,
  34.241 -   attr_  IN OUT VARCHAR2 );
  34.242 -
  34.243 ------------------------------------------------------------------------------
  34.244 --------------------- STATEPACKAGE PRIVATE METHODS ---------------------------
  34.245 ------------------------------------------------------------------------------
  34.246 -
  34.247 -FUNCTION Finite_State_Decode__ (
  34.248 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
  34.249 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
  34.250 -
  34.251 -FUNCTION Finite_State_Encode__ (
  34.252 -   client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
  34.253 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
  34.254 -
  34.255 -PROCEDURE Enumerate_States__ (
  34.256 -   client_values_ OUT VARCHAR2);
  34.257 -
  34.258 -FUNCTION Finite_State_Events__ (
  34.259 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
  34.260 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
  34.261 -
  34.262 -PROCEDURE Enumerate_Events__ (
  34.263 -   db_events_ OUT VARCHAR2 );
  34.264 -
  34.265 ------------------------------------------------------------------------------
  34.266 ------------------- STATEPACKAGE TRANSLATION METHODS -------------------------
  34.267 ------------------------------------------------------------------------------
  34.268 -
  34.269 -PROCEDURE Language_Refreshed;
  34.270 -
  34.271 ------------------------------------------------------------------------------
  34.272 -------------------- STATEPACKAGE FOUNDATION1 METHODS ------------------------
  34.273 ------------------------------------------------------------------------------
  34.274 -
  34.275 -PROCEDURE Init;
  34.276 -
  34.277 -
  34.278 -END &STATEPKG;
  34.279 -/
  34.280 -SHOW ERROR
  34.281 -
  34.282 -undefine VIEW
  34.283 -undefine STATEPKG
  34.284 -
  34.285 -undefine OBJID
  34.286 -undefine OBJVERSION
  34.287 -undefine OBJSTATE
  34.288 -undefine OBJEVENTS
  34.289 -undefine STATE
  34.290 -
  34.291 +UNDEFINE MODULE
  34.292 +UNDEFINE LU
  34.293 +UNDEFINE PKG
    35.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.apy	Wed Dec 07 13:36:21 2011 +0100
    35.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.apy	Tue Feb 14 17:31:28 2012 +0100
    35.3 @@ -2,869 +2,21 @@
    35.4  --
    35.5  --  Logical unit: <<<LU: Put your LU name here>>>
    35.6  --
    35.7 ---  Purpose:
    35.8 +--  IFS Developer Studio Template Version 2.5
    35.9  --
   35.10 ---  IFS/Design Template Version 2.3
   35.11 ---
   35.12 ---  Date    Sign  History
   35.13 ---  ------  ----  -----------------------------------------------------------
   35.14 +--  Date    Sign    History
   35.15 +--  ------  ------  ---------------------------------------------------------
   35.16  -----------------------------------------------------------------------------
   35.17  
   35.18 -define MODULE        = <<<MODULE:   Put your module name here>>>
   35.19 -define LU            = <<<LU:       Put your lu name here>>>
   35.20 -define SERVICE       = <<<SERVICE:  Put your system service name here>>>
   35.21 -define TABLE         = <<<TABLE:    Put your TABLE name here>>>
   35.22 -define VIEW          = <<<VIEW:     Put your view name here>>>
   35.23 -define PKG           = <<<PKG:      Put your package name here>>>
   35.24 -define STATEPKG      = <<<STATEPKG: Put your statepackage name here>>>
   35.25 -define DOMAIN        = <<<DOMAIN:   Put your domain name here>>>
   35.26 +DEFINE MODULE        = <<<MODULE:   Put your module name here>>>
   35.27 +DEFINE LU            = <<<LU:       Put your lu name here>>>
   35.28 +DEFINE PKG           = <<<PKG:      Put your package name here>>>
   35.29  
   35.30 -define OBJID         = <<<OBJID:    Put your object key (or rowid) here>>>
   35.31 -define OBJVERSION    = <<<OBJVER:   Put your objversion column (or list) here>>>
   35.32 -define OBJSTATE      = <<<OBJSTA:   Put your object state column here>>>
   35.33 -define OBJEVENTS     = <<<OBJEVE:   Put your object events column here>>>
   35.34 -define STATE         = <<<STATE:    Put your encoded object state column here>>>
   35.35 -define DB_VALUES     = <<<DBVAL:    Put your database stored domain values here>>>
   35.36 -define CLIENT_VALUES = <<<PROGVAL:  Put your client PROG domain values here>>>
   35.37 -
   35.38 ------------------------------------------------------------------------------
   35.39 --------------------- VIEWS FOR SELECTS --------------------------------------
   35.40 ------------------------------------------------------------------------------
   35.41 -
   35.42 -PROMPT Creating &VIEW view
   35.43 -
   35.44 -CREATE OR REPLACE VIEW &VIEW AS
   35.45 -SELECT <<<VIEWCOL: Put your view column here>>>
   35.46 -FROM   <<<VIEWTAB: Put your view table(s) here>>>
   35.47 -WHERE  <<<VIEWSEC: Put your security restrictions on rows here>>>
   35.48 -WITH   read only;
   35.49 -
   35.50 ------------------------------------------------------------------------------
   35.51 --------------------- PACKAGES FOR METHODS -----------------------------------
   35.52 ------------------------------------------------------------------------------
   35.53 -
   35.54 -PROMPT Creating &PKG implementation
   35.55 +PROMPT Creating &PKG specification
   35.56  
   35.57  CREATE OR REPLACE PACKAGE BODY &PKG IS
   35.58  
   35.59  -----------------------------------------------------------------------------
   35.60 --------------------- DOMAIN DECLARATIONS ------------------------------------
   35.61 ------------------------------------------------------------------------------
   35.62 -
   35.63 -db_value_list_     CONSTANT VARCHAR2(<<<DBLENGTH: Length of db_value_list_>>>) := '&DB_VALUES';
   35.64 -client_value_list_ CONSTANT VARCHAR2(<<<CLENGTH: Length of client_value_list_>>>) := '&CLIENT_VALUES';
   35.65 -active_value_list_          VARCHAR2(<<<ALENGTH: Length of active_value_list_>>>) := Language_SYS.Translate_Iid_(lu_name_, client_value_list_);
   35.66 -
   35.67 ------------------------------------------------------------------------------
   35.68 --------------------- FINITE STATE DECLARATIONS ------------------------------
   35.69 ------------------------------------------------------------------------------
   35.70 -
   35.71 -db_state_list_     CONSTANT VARCHAR2(<<<DBSTATEL: Length of db_state_list_>>>) := '&DB_STATES';
   35.72 -client_state_list_ CONSTANT VARCHAR2(<<<CSTATEL: Length of client_state_list_>>>) := '&CLIENT_STATES';
   35.73 -active_state_list_          VARCHAR2(<<<ASTATEL: Length of active_state_list_>>>) := Language_SYS.Translate_State_(lu_name_, client_state_list_);
   35.74 -state_separator_   CONSTANT VARCHAR2(1)     := Client_SYS.field_separator_;
   35.75 -
   35.76 ------------------------------------------------------------------------------
   35.77 --------------------- LU SPECIFIC IMPLEMENTATION METHOD DECLARATIONS ---------
   35.78 ------------------------------------------------------------------------------
   35.79 -
   35.80 -
   35.81 ------------------------------------------------------------------------------
   35.82 --------------------- SERVICE SPECIFIC IMPLEMENTATION METHOD DECLARATIONS ----
   35.83 ------------------------------------------------------------------------------
   35.84 -
   35.85 -
   35.86 ------------------------------------------------------------------------------
   35.87 --------------------- IMPLEMENTATION BASE METHODS ----------------------------
   35.88 ------------------------------------------------------------------------------
   35.89 --- Lock_By_Id___
   35.90 ---    Client-support to lock a specific instance of the logical unit.
   35.91 ---
   35.92 --- Lock_By_Keys___
   35.93 ---    Server support to lock a specific instance of the logical unit.
   35.94 ---
   35.95 --- Get_Object_By_Id___
   35.96 ---    Get LU-record from the database with a specified object identity.
   35.97 ---
   35.98 --- Get_Object_By_Keys___
   35.99 ---    Get LU-record from the database with specified key columns.
  35.100 ---
  35.101 --- Check_Exist___
  35.102 ---    Check if a specific LU-instance already exist in the database.
  35.103 ---
  35.104 --- Get_Id_Version_By_Keys___
  35.105 ---    Get the current OBJID and OBJVERSION for a specific LU-instance.
  35.106 ------------------------------------------------------------------------------
  35.107 -
  35.108 -FUNCTION Lock_By_Id___ (
  35.109 -   objid_      IN  VARCHAR2,
  35.110 -   objversion_ IN  VARCHAR2 ) RETURN &TABLE%ROWTYPE
  35.111 -IS
  35.112 -   row_changed EXCEPTION;
  35.113 -   row_deleted EXCEPTION;
  35.114 -   row_locked  EXCEPTION;
  35.115 -   PRAGMA      exception_init(row_locked, -0054);
  35.116 -   rec_        &TABLE%ROWTYPE;
  35.117 -   dummy_      NUMBER;
  35.118 -   CURSOR lock_control IS
  35.119 -      SELECT *
  35.120 -      FROM   &TABLE
  35.121 -      WHERE  &OBJID = objid_
  35.122 -      AND    &OBJVERSION = objversion_
  35.123 -      FOR UPDATE NOWAIT;
  35.124 -   CURSOR exist_control IS
  35.125 -      SELECT 1
  35.126 -      FROM   &TABLE
  35.127 -      WHERE  &OBJID = objid_;
  35.128 -BEGIN
  35.129 -   OPEN lock_control;
  35.130 -   FETCH lock_control INTO rec_;
  35.131 -   IF (lock_control%FOUND) THEN
  35.132 -      CLOSE lock_control;
  35.133 -      RETURN rec_;
  35.134 -   END IF;
  35.135 -   CLOSE lock_control;
  35.136 -   OPEN exist_control;
  35.137 -   FETCH exist_control INTO dummy_;
  35.138 -   IF (exist_control%FOUND) THEN
  35.139 -      CLOSE exist_control;
  35.140 -      RAISE row_changed;
  35.141 -   ELSE
  35.142 -      CLOSE exist_control;
  35.143 -      RAISE row_deleted;
  35.144 -   END IF;
  35.145 -EXCEPTION
  35.146 -   WHEN row_locked THEN
  35.147 -      Error_SYS.Record_Locked(lu_name_);
  35.148 -   WHEN row_changed THEN
  35.149 -      Error_SYS.Record_Modified(lu_name_);
  35.150 -   WHEN row_deleted THEN
  35.151 -      Error_SYS.Record_Removed(lu_name_);
  35.152 -END Lock_By_Id___;
  35.153 -
  35.154 -FUNCTION Lock_By_Keys___ (
  35.155 -   <<<DBKARG: Put your primary key parameters here>>> ) RETURN &TABLE%ROWTYPE
  35.156 -IS
  35.157 -   row_deleted EXCEPTION;
  35.158 -   rec_        &TABLE%ROWTYPE;
  35.159 -   CURSOR lock_control IS
  35.160 -      SELECT *
  35.161 -      FROM  &TABLE
  35.162 -      WHERE <<<KEYWH2: Put your primary key condition here>>>
  35.163 -      FOR UPDATE;
  35.164 -BEGIN
  35.165 -   OPEN lock_control;
  35.166 -   FETCH lock_control INTO rec_;
  35.167 -   IF (lock_control%FOUND) THEN
  35.168 -      CLOSE lock_control;
  35.169 -      RETURN rec_;
  35.170 -   ELSE
  35.171 -      CLOSE lock_control;
  35.172 -      RAISE row_deleted;
  35.173 -   END IF;
  35.174 -EXCEPTION
  35.175 -   WHEN row_deleted THEN
  35.176 -      Error_SYS.Record_Removed(lu_name_);
  35.177 -END Lock_By_Keys___;
  35.178 -
  35.179 -FUNCTION Get_Object_By_Id___ (
  35.180 -   objid_ IN VARCHAR2 ) RETURN &TABLE%ROWTYPE
  35.181 -IS
  35.182 -   lu_rec_ &TABLE%ROWTYPE;
  35.183 -   CURSOR getrec IS
  35.184 -      SELECT *
  35.185 -      FROM   &TABLE
  35.186 -      WHERE  &OBJID = objid_;
  35.187 -BEGIN
  35.188 -   OPEN getrec;
  35.189 -   FETCH getrec INTO lu_rec_;
  35.190 -   IF (getrec%NOTFOUND) THEN
  35.191 -      CLOSE getrec;
  35.192 -      Error_SYS.Record_Removed(lu_name_);
  35.193 -   END IF;
  35.194 -   CLOSE getrec;
  35.195 -   RETURN(lu_rec_);
  35.196 -END Get_Object_By_Id___;
  35.197 -
  35.198 -
  35.199 -FUNCTION Get_Object_By_Keys___ (
  35.200 -   <<<DBKARG: Put your primary key parameters here>>> ) RETURN &TABLE%ROWTYPE
  35.201 -IS
  35.202 -   lu_rec_ &TABLE%ROWTYPE;
  35.203 -   CURSOR getrec IS
  35.204 -      SELECT *
  35.205 -      FROM  &TABLE
  35.206 -      WHERE <<<KEYWH2: Put your primary key condition here>>>;
  35.207 -BEGIN
  35.208 -   OPEN getrec;
  35.209 -   FETCH getrec INTO lu_rec_;
  35.210 -   CLOSE getrec;
  35.211 -   RETURN(lu_rec_);
  35.212 -END Get_Object_By_Keys___;
  35.213 -
  35.214 -FUNCTION Check_Exist___ (
  35.215 -   <<<DBKARG: Put your primary key parameters here>>> ) RETURN BOOLEAN
  35.216 -IS
  35.217 -   dummy_ NUMBER;
  35.218 -   CURSOR exist_control IS
  35.219 -      SELECT 1
  35.220 -      FROM   &TABLE
  35.221 -      WHERE <<<KEYWH2: Put your primary key condition here>>>;
  35.222 -BEGIN
  35.223 -   OPEN exist_control;
  35.224 -   FETCH exist_control INTO dummy_;
  35.225 -   IF (exist_control%FOUND) THEN
  35.226 -      CLOSE exist_control;
  35.227 -      RETURN(TRUE);
  35.228 -   END IF;
  35.229 -   CLOSE exist_control;
  35.230 -   RETURN(FALSE);
  35.231 -END Check_Exist___;
  35.232 -
  35.233 -PROCEDURE Get_Id_Version_By_Keys___ (
  35.234 -   objid_      IN OUT VARCHAR2,
  35.235 -   objversion_ IN OUT VARCHAR2,
  35.236 -   <<<DBKARG: Put your primary key parameters here>>>)
  35.237 -IS
  35.238 -   CURSOR get_version IS
  35.239 -   SELECT &OBJID, &OBJVERSION
  35.240 -      FROM  &TABLE
  35.241 -      WHERE <<<KEYWH2: Put your primary key condition here>>>;
  35.242 -BEGIN
  35.243 -   OPEN get_version;
  35.244 -   FETCH get_version INTO objid_, objversion_;
  35.245 -   CLOSE get_version;
  35.246 -END Get_Id_Version_By_Keys___;
  35.247 -
  35.248 ------------------------------------------------------------------------------
  35.249 ------------- STATEPACKAGE: IMPLEMENTATION FINITE STATE MACHINE --------------
  35.250 ------------------------------------------------------------------------------
  35.251 --- This set of Implementation Finite State Machine methods should be used if
  35.252 --- a separate package is used for the Finite State Machine implementation.
  35.253 ---
  35.254 --- Finite_State_Machine___
  35.255 ---    Redirect call to separate Finite State Machine Package
  35.256 ---
  35.257 --- Finite_State_Add_To_Attr___
  35.258 ---    Adds the current state and allowed events to the attribute string.
  35.259 ---
  35.260 --- Finite_State_Init___
  35.261 ---    Sets the initial finite state indicator for an existing LU-instance
  35.262 ---    and processes any automatic events.
  35.263 ------------------------------------------------------------------------------
  35.264 -
  35.265 -PROCEDURE Finite_State_Machine___ (
  35.266 -   rec_   IN OUT &TABLE%ROWTYPE,
  35.267 -   event_ IN     VARCHAR2,
  35.268 -   attr_  IN OUT VARCHAR2 )
  35.269 -IS
  35.270 -BEGIN
  35.271 -   &STATEPKG..Finite_State_Machine___(rec_, event_, attr_);
  35.272 -END Finite_State_Machine___;
  35.273 -
  35.274 -
  35.275 -PROCEDURE Finite_State_Add_To_Attr___ (
  35.276 -   rec_   IN     &TABLE%ROWTYPE,
  35.277 -   attr_  IN OUT VARCHAR2 )
  35.278 -IS
  35.279 -   state_ VARCHAR2(30);
  35.280 -BEGIN
  35.281 -   <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
  35.282 -   Client_SYS.Add_To_Attr('__OBJSTATE', state_, attr_);
  35.283 -   Client_SYS.Add_To_Attr('__OBJEVENTS', Finite_State_Events__(state_), attr_);
  35.284 -   Client_SYS.Add_To_Attr('STATE', Finite_State_Decode__(state_), attr_);
  35.285 -END Finite_State_Add_To_Attr___;
  35.286 -
  35.287 -
  35.288 -PROCEDURE Finite_State_Init___ (
  35.289 -   rec_  IN OUT &TABLE%ROWTYPE,
  35.290 -   attr_ IN OUT VARCHAR2 )
  35.291 -IS
  35.292 -   state_ VARCHAR2(30);
  35.293 -BEGIN
  35.294 -   Finite_State_Machine___(rec_, NULL, attr_);
  35.295 -   Finite_State_Add_To_Attr___(rec_, attr_);
  35.296 -END Finite_State_Init___;
  35.297 -
  35.298 ------------------------------------------------------------------------------
  35.299 --------------------- IMPLEMENTATION FINITE STATE MACHINE --------------------
  35.300 ------------------------------------------------------------------------------
  35.301 --- Finite_State_Set___
  35.302 ---    Updates the finite state indicator for an existing LU-instance.
  35.303 ---
  35.304 --- Finite_State_Machine___
  35.305 ---    Processes an event by:
  35.306 ---    1. Fetching the current state
  35.307 ---    2. Evaluating any conditions for given event at current state
  35.308 ---    3. executing any exit code for the old state
  35.309 ---    4. Performing any action associated with given event
  35.310 ---    5. update the database to the new state
  35.311 ---    6. execute any entry code for the new state
  35.312 ---    7. Executing a state change to the new state
  35.313 ---
  35.314 --- Finite_State_Add_To_Attr___
  35.315 ---    Adds the current state and allowed events to the attribute string.
  35.316 ---
  35.317 --- Finite_State_Init___
  35.318 ---    Sets the initial finite state indicator for an existing LU-instance
  35.319 ---    and processes any automatic events.
  35.320 ------------------------------------------------------------------------------
  35.321 -
  35.322 -PROCEDURE Finite_State_Set___ (
  35.323 -   rec_   IN OUT &TABLE%ROWTYPE,
  35.324 -   state_ IN     VARCHAR2 )
  35.325 -IS
  35.326 -BEGIN
  35.327 -   <<<FSUPDATE: Put your own SQL-statement here to set the new state>>>;
  35.328 -END Finite_State_Set___;
  35.329 -
  35.330 -
  35.331 -PROCEDURE Finite_State_Machine___ (
  35.332 -   rec_   IN OUT &TABLE%ROWTYPE,
  35.333 -   event_ IN     VARCHAR2,
  35.334 -   attr_  IN OUT VARCHAR2 )
  35.335 -IS
  35.336 -   state_ VARCHAR2(30);
  35.337 -BEGIN
  35.338 -   <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
  35.339 -   <<<FSEVENT: Code for processing of events>>>;
  35.340 -END Finite_State_Machine___;
  35.341 -
  35.342 -
  35.343 -PROCEDURE Finite_State_Add_To_Attr___ (
  35.344 -   rec_   IN     &TABLE%ROWTYPE,
  35.345 -   attr_  IN OUT VARCHAR2 )
  35.346 -IS
  35.347 -   state_ VARCHAR2(30);
  35.348 -BEGIN
  35.349 -   <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
  35.350 -   Client_SYS.Add_To_Attr('__OBJSTATE', state_, attr_);
  35.351 -   Client_SYS.Add_To_Attr('__OBJEVENTS', Finite_State_Events__(state_), attr_);
  35.352 -   Client_SYS.Add_To_Attr('STATE', Finite_State_Decode__(state_), attr_);
  35.353 -END Finite_State_Add_To_Attr___;
  35.354 -
  35.355 -
  35.356 -PROCEDURE Finite_State_Init___ (
  35.357 -   rec_  IN OUT &TABLE%ROWTYPE,
  35.358 -   attr_ IN OUT VARCHAR2 )
  35.359 -IS
  35.360 -   state_ VARCHAR2(30);
  35.361 -BEGIN
  35.362 -   Finite_State_Machine___(rec_, NULL, attr_);
  35.363 -   Finite_State_Add_To_Attr___(rec_, attr_);
  35.364 -END Finite_State_Init___;
  35.365 -
  35.366 ------------------------------------------------------------------------------
  35.367 --------------- STATEPACKAGE: PRIVATE FINITE STATE MACHINE -------------------
  35.368 ------------------------------------------------------------------------------
  35.369 --- This set of Private Finite State Machine methods should be used if a
  35.370 --- separate package is used for the Finite State Machine implementation.
  35.371 ---
  35.372 --- Finite_State_Decode__
  35.373 ---    Redirect call to separate Finite State Machine Package
  35.374 ---
  35.375 --- Finite_State_Encode__
  35.376 ---    Redirect call to separate Finite State Machine Package
  35.377 ---
  35.378 --- Enumerate_States__
  35.379 ---    Redirect call to separate Finite State Machine Package
  35.380 ---
  35.381 --- Finite_State_Events__
  35.382 ---    Redirect call to separate Finite State Machine Package
  35.383 ---
  35.384 --- Enumerate_Events__
  35.385 ---    Redirect call to separate Finite State Machine Package
  35.386 ------------------------------------------------------------------------------
  35.387 -
  35.388 -FUNCTION Finite_State_Decode__ (
  35.389 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2
  35.390 -IS
  35.391 -BEGIN
  35.392 -   RETURN(&STATEPKG..Finite_State_Decode__(db_state_));
  35.393 -END Finite_State_Decode__;
  35.394 -
  35.395 -
  35.396 -FUNCTION Finite_State_Encode__ (
  35.397 -   client_state_ IN VARCHAR2 ) RETURN VARCHAR2
  35.398 -IS
  35.399 -BEGIN
  35.400 -   RETURN(&STATEPKG..Finite_State_Encode__(client_state_));
  35.401 -END Finite_State_Encode__;
  35.402 -
  35.403 -
  35.404 -PROCEDURE Enumerate_States__ (
  35.405 -   client_values_ OUT VARCHAR2 )
  35.406 -IS
  35.407 -BEGIN
  35.408 -   &STATEPKG..Enumerate_States__(client_values_);
  35.409 -END Enumerate_States__;
  35.410 -
  35.411 -
  35.412 -FUNCTION Finite_State_Events__ (
  35.413 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2
  35.414 -IS
  35.415 -BEGIN
  35.416 -   RETURN(&STATEPKG..Finite_State_Events__(db_state_));
  35.417 -END Finite_State_Events__;
  35.418 -
  35.419 -
  35.420 -PROCEDURE Enumerate_Events__ (
  35.421 -   db_events_ OUT VARCHAR2 )
  35.422 -IS
  35.423 -BEGIN
  35.424 -   &STATEPKG..Enumerate_Events__(db_events_);
  35.425 -END Enumerate_Events__;
  35.426 -
  35.427 ------------------------------------------------------------------------------
  35.428 --------------------- PRIVATE FINITE STATE MACHINE ---------------------------
  35.429 ------------------------------------------------------------------------------
  35.430 --- Finite_State_Decode__
  35.431 ---   Returns the client equivalent for any database representation of
  35.432 ---   a state name = objstate.
  35.433 ---
  35.434 --- Finite_State_Encode__
  35.435 ---   Returns the database equivalent for any client representation of
  35.436 ---   a state name = state.
  35.437 ---
  35.438 --- Enumerate_States__
  35.439 ---   Returns a list of all possible finite states in client terminology.
  35.440 ---
  35.441 --- Finite_State_Events__
  35.442 ---   Returns a list of allowed events for a given state
  35.443 ---   NOTE! Regardless of conditions if not otherwize encoded
  35.444 ---
  35.445 --- Enumerate_Events__
  35.446 ---   Returns a list of all possible events.
  35.447 ------------------------------------------------------------------------------
  35.448 -
  35.449 -FUNCTION Finite_State_Decode__ (
  35.450 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2
  35.451 -IS
  35.452 -BEGIN
  35.453 -   RETURN(Domain_SYS.Decode_(active_state_list_, db_state_list_, db_state_));
  35.454 -END Finite_State_Decode__;
  35.455 -
  35.456 -
  35.457 -FUNCTION Finite_State_Encode__ (
  35.458 -   client_state_ IN VARCHAR2 ) RETURN VARCHAR2
  35.459 -IS
  35.460 -BEGIN
  35.461 -   RETURN(Domain_SYS.Encode_(active_state_list_, db_state_list_, client_state_));
  35.462 -END Finite_State_Encode__;
  35.463 -
  35.464 -
  35.465 -PROCEDURE Enumerate_States__ (
  35.466 -   client_values_ OUT VARCHAR2)
  35.467 -IS
  35.468 -BEGIN
  35.469 -   client_values_ := Domain_SYS.Enumerate_(active_state_list_);
  35.470 -END Enumerate_States__;
  35.471 -
  35.472 -
  35.473 -FUNCTION Finite_State_Events__ (
  35.474 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2
  35.475 -IS
  35.476 -BEGIN
  35.477 -   <<<FSEVALID: Put your code for returning valid event list here>>>;
  35.478 -END Finite_State_Events__;
  35.479 -
  35.480 -
  35.481 -PROCEDURE Enumerate_Events__ (
  35.482 -   db_events_ OUT VARCHAR2 )
  35.483 -IS
  35.484 -BEGIN
  35.485 -   db_events_ := '<<<FSELIST: Put your code for returning complete event list here>>>';
  35.486 -END Enumerate_Events__;
  35.487 -
  35.488 ------------------------------------------------------------------------------
  35.489 --------------------- IMPLEMENTATION BASE METHODS FOR INSERT -----------------
  35.490 ------------------------------------------------------------------------------
  35.491 --- Prepare_Insert___
  35.492 ---    Set all default values for a new instance (ON-NEW-RECORD) of this
  35.493 ---    logical unit by calling procedure Add_Attr.
  35.494 ---
  35.495 --- Unpack_Check_Insert___
  35.496 ---    Unpack the attribute list, check all attributes from the client
  35.497 ---    and generate all default values before creation of the new object.
  35.498 ---
  35.499 --- Insert___
  35.500 ---    Insert a new LU-instance into the database and return the values
  35.501 ---    for OBJID and OBJVERSION.
  35.502 ------------------------------------------------------------------------------
  35.503 -
  35.504 -PROCEDURE Prepare_Insert___ (
  35.505 -   attr_ IN OUT VARCHAR2 )
  35.506 -IS<<<PRPBD1: Declare a temp variable if needed>>>
  35.507 -BEGIN
  35.508 -   <<<PRPBDY: Put the call to the superclass here>>>;
  35.509 -END Prepare_Insert___;
  35.510 -
  35.511 -
  35.512 -PROCEDURE Unpack_Check_Insert___ (
  35.513 -   attr_   IN OUT VARCHAR2,
  35.514 -   newrec_ IN OUT &TABLE%ROWTYPE )
  35.515 -IS
  35.516 -   ptr_   NUMBER;
  35.517 -   name_  VARCHAR2(30);
  35.518 -   value_ VARCHAR2(2000);
  35.519 -BEGIN
  35.520 -   <<<UCIBDY: Put your code here to unpack and do all checkings needed before insert>>>;
  35.521 -EXCEPTION
  35.522 -   WHEN value_error THEN
  35.523 -      Error_SYS.Item_Format(lu_name_, name_, value_);
  35.524 -END Unpack_Check_Insert___;
  35.525 -
  35.526 -
  35.527 -PROCEDURE Insert___ (
  35.528 -   objid_      OUT    VARCHAR2,
  35.529 -   objversion_ OUT    VARCHAR2,
  35.530 -   newrec_     IN OUT &TABLE%ROWTYPE,
  35.531 -   attr_       IN OUT VARCHAR2 )
  35.532 -IS
  35.533 -BEGIN
  35.534 -   <<<SETVER2: Code for setting the rowversion>>>
  35.535 -   <<<INSERT: Put your own SQL-statement here to insert the new record>>>;
  35.536 -   Finite_State_Init___(newrec_, attr_);
  35.537 -EXCEPTION
  35.538 -   WHEN dup_val_on_index THEN
  35.539 -      Error_SYS.Record_Exist(lu_name_);
  35.540 -END Insert___;
  35.541 -
  35.542 ------------------------------------------------------------------------------
  35.543 --------------------- IMPLEMENTATION BASE METHODS FOR UPDATE -----------------
  35.544 ------------------------------------------------------------------------------
  35.545 --- Unpack_Check_Update___
  35.546 ---    Unpack the attribute list, check all attributes from the client
  35.547 ---    and generate all default values before modifying the object.
  35.548 ---
  35.549 --- Update___
  35.550 ---    Update an existing LU-instance in the database and return the
  35.551 ---    the new OBJVERSION.
  35.552 ------------------------------------------------------------------------------
  35.553 -
  35.554 -PROCEDURE Unpack_Check_Update___ (
  35.555 -   attr_   IN OUT VARCHAR2,
  35.556 -   newrec_ IN OUT &TABLE%ROWTYPE,
  35.557 -   objid_  IN     VARCHAR2 )
  35.558 -IS
  35.559 -   ptr_   NUMBER;
  35.560 -   name_  VARCHAR2(30);
  35.561 -   value_ VARCHAR2(2000);
  35.562 -BEGIN
  35.563 -   <<<UCUBDY: Put your code here to unpack and do all checkings needed before update>>>;
  35.564 -EXCEPTION
  35.565 -   WHEN value_error THEN
  35.566 -      Error_SYS.Item_Format(lu_name_, name_, value_);
  35.567 -END Unpack_Check_Update___;
  35.568 -
  35.569 -
  35.570 -PROCEDURE Update___ (
  35.571 -   objid_      IN     VARCHAR2,
  35.572 -   oldrec_     IN     &TABLE%ROWTYPE,
  35.573 -   newrec_     IN OUT &TABLE%ROWTYPE,
  35.574 -   attr_       IN OUT VARCHAR2,
  35.575 -   objversion_ IN OUT VARCHAR2,
  35.576 -   by_keys_    IN BOOLEAN DEFAULT FALSE )
  35.577 -IS
  35.578 -BEGIN
  35.579 -   <<<SETVER: Code for setting the rowversion>>>
  35.580 -   IF by_keys_ THEN
  35.581 -      <<<UPDATE: Put your own SQL-statement here to update the new record>>>
  35.582 -      WHERE <<<RECWHR: Put your primary key condition here>>>;
  35.583 -   ELSE
  35.584 -      <<<UPDATE: Put your own SQL-statement here to update the new record>>>
  35.585 -      WHERE &OBJID = objid_;
  35.586 -   END IF;
  35.587 -EXCEPTION
  35.588 -   WHEN dup_val_on_index THEN
  35.589 -      Error_SYS.Record_Exist(lu_name_);
  35.590 -END Update___;
  35.591 -
  35.592 ------------------------------------------------------------------------------
  35.593 --------------------- IMPLEMENTATION BASE METHODS FOR DELETE -----------------
  35.594 ------------------------------------------------------------------------------
  35.595 --- Check_Delete___
  35.596 ---    Checks whether a specific LU-record may be removed or not.
  35.597 ---    The procedure should check business rules like attribute values
  35.598 ---    as well as database constraints (defined or not).
  35.599 ---
  35.600 --- Delete___
  35.601 ---    Deletion of the specific LU-object from the database.
  35.602 ------------------------------------------------------------------------------
  35.603 -
  35.604 -PROCEDURE Check_Delete___ (
  35.605 -   remrec_ IN &TABLE%ROWTYPE )
  35.606 -IS
  35.607 -   key_ VARCHAR2(2000);
  35.608 -BEGIN
  35.609 -   key_ := <<<KEYCAT: Put your primary keys here>>>;
  35.610 -   Reference_SYS.Check_Restricted_Delete(lu_name_, key_);
  35.611 -END Check_Delete___;
  35.612 -
  35.613 -
  35.614 -PROCEDURE Delete___ (
  35.615 -   objid_  IN VARCHAR2,
  35.616 -   remrec_ IN &TABLE%ROWTYPE )
  35.617 -IS
  35.618 -   key_ VARCHAR2(2000);
  35.619 -BEGIN
  35.620 -   key_ := <<<KEYCAT: Put your primary keys here>>>;
  35.621 -   Reference_SYS.Do_Cascade_Delete(lu_name_, key_);
  35.622 -   <<<DELETE: Put your own SQL-statement here to delete the old record>>>;
  35.623 -END Delete___;
  35.624 -
  35.625 ------------------------------------------------------------------------------
  35.626 --------------------- PRIVATE BASE METHODS -----------------------------------
  35.627 ------------------------------------------------------------------------------
  35.628 --- Lock__
  35.629 ---    Client-support to lock a specific instance of the logical unit.
  35.630 ---
  35.631 --- New__
  35.632 ---    Client-support interface to create LU instances.
  35.633 ---       action_ = 'PREPARE'
  35.634 ---          Default values and handle of information to client.
  35.635 ---          The default values are set in procedure Prepare_Insert___.
  35.636 ---       action_ = 'CHECK'
  35.637 ---          Check all attributes before creating new object and handle of
  35.638 ---          information to client. The attribute list is unpacked, checked
  35.639 ---          and prepared (defaults) in procedure Unpack_Check_Insert___.
  35.640 ---       action_ = 'DO'
  35.641 ---          Creation of new instances of the logical unit and handle of
  35.642 ---          information to client. The attribute list is unpacked, checked
  35.643 ---          and prepared (defaults) in procedure Unpack_Check_Insert___
  35.644 ---          before calling procedure Insert___.
  35.645 ---
  35.646 --- Modify__
  35.647 ---    Client-support interface to modify attributes for LU instances.
  35.648 ---       action_ = 'CHECK'
  35.649 ---          Check all attributes before modifying an existing object and
  35.650 ---          handle of information to client. The attribute list is unpacked,
  35.651 ---          checked and prepared(defaults) in procedure Unpack_Check_Update___.
  35.652 ---       action_ = 'DO'
  35.653 ---          Modification of an existing instance of the logical unit. The
  35.654 ---          procedure unpacks the attributes, checks all values before
  35.655 ---          procedure Update___ is called.
  35.656 ---
  35.657 --- Remove__
  35.658 ---    Client-support interface to remove LU instances.
  35.659 ---       action_ = 'CHECK'
  35.660 ---          Check whether a specific LU-instance may be removed or not.
  35.661 ---          The procedure fetches the complete record by calling procedure
  35.662 ---          Get_Object_By_Id___. Then the check is made by calling procedure
  35.663 ---          Check_Delete___.
  35.664 ---       action_ = 'DO'
  35.665 ---          Remove an existing instance of the logical unit. The procedure
  35.666 ---          fetches the complete LU-record, checks for a delete and then
  35.667 ---          deletes the record by calling procedure Delete___.
  35.668 ------------------------------------------------------------------------------
  35.669 -
  35.670 -PROCEDURE Lock__ (
  35.671 -   info_       OUT VARCHAR2,
  35.672 -   objid_      IN  VARCHAR2,
  35.673 -   objversion_ IN  VARCHAR2 )
  35.674 -IS
  35.675 -   dummy_ &TABLE%ROWTYPE;
  35.676 -BEGIN
  35.677 -   General_SYS.Init_Method(lu_name_, '&PKG', 'Lock__');
  35.678 -   dummy_ := Lock_By_Id___(objid_, objversion_);
  35.679 -   info_ := Client_SYS.Get_All_Info;
  35.680 -END Lock__;
  35.681 -
  35.682 -
  35.683 -PROCEDURE New__ (
  35.684 -   info_       OUT    VARCHAR2,
  35.685 -   objid_      OUT    VARCHAR2,
  35.686 -   objversion_ OUT    VARCHAR2,
  35.687 -   attr_       IN OUT VARCHAR2,
  35.688 -   action_     IN     VARCHAR2 )
  35.689 -IS
  35.690 -   newrec_ &TABLE%ROWTYPE;
  35.691 -BEGIN
  35.692 -   General_SYS.Init_Method(lu_name_, '&PKG', 'New__');
  35.693 -   IF (action_ = 'PREPARE') THEN
  35.694 -      Prepare_Insert___(attr_);
  35.695 -   ELSIF (action_ = 'CHECK') THEN
  35.696 -      Unpack_Check_Insert___(attr_, newrec_);
  35.697 -   ELSIF (action_ = 'DO') THEN
  35.698 -      Unpack_Check_Insert___(attr_, newrec_);
  35.699 -      Insert___(objid_, objversion_, newrec_, attr_);
  35.700 -   END IF;
  35.701 -   info_ := Client_SYS.Get_All_Info;
  35.702 -END New__;
  35.703 -
  35.704 -
  35.705 -PROCEDURE Modify__ (
  35.706 -   info_       OUT    VARCHAR2,
  35.707 -   objid_      IN     VARCHAR2,
  35.708 -   objversion_ IN OUT VARCHAR2,
  35.709 -   attr_       IN OUT VARCHAR2,
  35.710 -   action_     IN     VARCHAR2 )
  35.711 -IS
  35.712 -   oldrec_ &TABLE%ROWTYPE;
  35.713 -   newrec_ &TABLE%ROWTYPE;
  35.714 -BEGIN
  35.715 -   General_SYS.Init_Method(lu_name_, '&PKG', 'Modify__');
  35.716 -   IF (action_ = 'CHECK') THEN
  35.717 -      newrec_ := Get_Object_By_Id___(objid_);
  35.718 -      Unpack_Check_Update___(attr_, newrec_, objid_);
  35.719 -   ELSIF (action_ = 'DO') THEN
  35.720 -      oldrec_ := Lock_By_Id___(objid_, objversion_);
  35.721 -      newrec_ := oldrec_;
  35.722 -      Unpack_Check_Update___(attr_, newrec_, objid_);
  35.723 -      Update___(objid_, oldrec_, newrec_, attr_, objversion_);
  35.724 -   END IF;
  35.725 -   info_ := Client_SYS.Get_All_Info;
  35.726 -END Modify__;
  35.727 -
  35.728 -
  35.729 -PROCEDURE Remove__ (
  35.730 -   info_       OUT VARCHAR2,
  35.731 -   objid_      IN  VARCHAR2,
  35.732 -   objversion_ IN  VARCHAR2,
  35.733 -   action_     IN  VARCHAR2 )
  35.734 -IS
  35.735 -   remrec_ &TABLE%ROWTYPE;
  35.736 -BEGIN
  35.737 -   General_SYS.Init_Method(lu_name_, '&PKG', 'Remove__');
  35.738 -   IF (action_ = 'CHECK') THEN
  35.739 -      remrec_ := Get_Object_By_Id___(objid_);
  35.740 -      Check_Delete___(remrec_);
  35.741 -   ELSIF (action_ = 'DO') THEN
  35.742 -      remrec_ := Lock_By_Id___(objid_, objversion_);
  35.743 -      Check_Delete___(remrec_);
  35.744 -      Delete___(objid_, remrec_);
  35.745 -   END IF;
  35.746 -   info_ := Client_SYS.Get_All_Info;
  35.747 -END Remove__;
  35.748 -
  35.749 ------------------------------------------------------------------------------
  35.750 --------------------- PUBLIC BASE METHODS ------------------------------------
  35.751 ------------------------------------------------------------------------------
  35.752 --- Exist
  35.753 ---   Checks if given pointer (e.g. primary key) to an instance of this
  35.754 ---   logical unit exists. If not an exception will be raised.
  35.755 ------------------------------------------------------------------------------
  35.756 -
  35.757 -PROCEDURE Exist (
  35.758 -   <<<KEYARG: Put your primary key parameters here>>> )
  35.759 -IS
  35.760 -BEGIN
  35.761 -   General_SYS.Init_Method(lu_name_, '&PKG', 'Exist', TRUE);
  35.762 -   IF (NOT Check_Exist___(<<<KEYLS2: Put your parameters here>>>)) THEN
  35.763 -      Error_SYS.Record_Not_Exist(lu_name_);
  35.764 -   END IF;
  35.765 -END Exist;
  35.766 -
  35.767 -PROCEDURE Exist_Db (
  35.768 -   <<<DBKARG: Put your primary key parameters here>>> )
  35.769 -IS
  35.770 -BEGIN
  35.771 -   General_SYS.Init_Method(lu_name_, '&PKG', 'Exist', TRUE);
  35.772 -   IF (NOT Check_Exist___(<<<KEYLDB: Put your parameters here>>>)) THEN
  35.773 -      Error_SYS.Record_Not_Exist(lu_name_);
  35.774 -   END IF;
  35.775 -END Exist_Db;
  35.776 -
  35.777 ------------------------------------------------------------------------------
  35.778 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
  35.779 ------------------------------------------------------------------------------
  35.780 --- Exist
  35.781 ---   Checks if given pointer (e.g. domain value) to an instance of this
  35.782 ---   logical unit exists. If not an exception will be raised.
  35.783 ---
  35.784 --- Enumerate
  35.785 ---   Returns a list of all domain values.
  35.786 ---
  35.787 --- Exist_Db
  35.788 ---   Checks if an instance corresponding to a given database value exists.
  35.789 ---   If not an exception will be raised.
  35.790 ------------------------------------------------------------------------------
  35.791 -
  35.792 -PROCEDURE Exist (
  35.793 -   client_value_ IN VARCHAR2 )
  35.794 -IS
  35.795 -BEGIN
  35.796 -   General_SYS.Init_Method('&LU', '&PKG', 'Exist', TRUE);
  35.797 -   Domain_SYS.Exist_(lu_name_, active_value_list_, client_value_);
  35.798 -END Exist;
  35.799 -
  35.800 -
  35.801 -PROCEDURE Enumerate (
  35.802 -   client_values_ OUT VARCHAR2)
  35.803 -IS
  35.804 -BEGIN
  35.805 -   client_values_ := Domain_SYS.Enumerate_(active_value_list_);
  35.806 -END Enumerate;
  35.807 -
  35.808 -PROCEDURE Exist_Db (
  35.809 -   db_value_ IN VARCHAR2 )
  35.810 -IS
  35.811 -BEGIN
  35.812 -   General_SYS.Init_Method('&LU', '&PKG', 'Exist_Db', TRUE);
  35.813 -   Domain_SYS.Exist_(lu_name_, db_value_list_, db_value_);
  35.814 -END Exist_Db;
  35.815 -
  35.816 ------------------------------------------------------------------------------
  35.817 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
  35.818 ------------------------------------------------------------------------------
  35.819 --- Encode
  35.820 ---   Returns the stored database representation of a domain value given the
  35.821 ---   client value in current language.
  35.822 ---
  35.823 --- Decode
  35.824 ---   Returns the client representation of a domain value in the
  35.825 ---   current client language.
  35.826 ---
  35.827 --- Get_Db_Value
  35.828 ---   Returns the database representation a domain value given its index.
  35.829 ---
  35.830 --- Get_Client_Value
  35.831 ---   Returns the client representation a domain value given its index.
  35.832 ------------------------------------------------------------------------------
  35.833 -
  35.834 -FUNCTION Encode (
  35.835 -   client_value_ IN VARCHAR2 ) RETURN VARCHAR2
  35.836 -IS
  35.837 -BEGIN
  35.838 -   RETURN(Domain_SYS.Encode_(active_value_list_, db_value_list_, client_value_));
  35.839 -END Encode;
  35.840 -
  35.841 -
  35.842 -FUNCTION Decode (
  35.843 -   db_value_ IN VARCHAR2 ) RETURN VARCHAR2
  35.844 -IS
  35.845 -BEGIN
  35.846 -   RETURN(Domain_SYS.Decode_(active_value_list_, db_value_list_, db_value_));
  35.847 -END Decode;
  35.848 -
  35.849 -
  35.850 -FUNCTION Get_Db_Value (
  35.851 -   index_ IN NUMBER ) RETURN VARCHAR2
  35.852 -IS
  35.853 -BEGIN
  35.854 -   RETURN(Domain_SYS.Get_Db_Value_(db_value_list_, index_));
  35.855 -END Get_Db_Value;
  35.856 -
  35.857 -
  35.858 -FUNCTION Get_Client_Value (
  35.859 -   index_ IN NUMBER ) RETURN VARCHAR2
  35.860 -IS
  35.861 -BEGIN
  35.862 -   RETURN(Domain_SYS.Get_Client_Value_(active_value_list_, index_));
  35.863 -END Get_Client_Value;
  35.864 -
  35.865 ------------------------------------------------------------------------------
  35.866 --------------------- PUBLIC TRANSLATION METHODS -----------------------------
  35.867 ------------------------------------------------------------------------------
  35.868 -
  35.869 -PROCEDURE Language_Refreshed
  35.870 -IS
  35.871 -BEGIN
  35.872 -   active_value_list_ := Language_SYS.Translate_Iid_(lu_name_, client_value_list_);
  35.873 -   active_state_list_ := Language_SYS.Translate_State_(lu_name_, client_state_list_);
  35.874 -END Language_Refreshed;
  35.875 -
  35.876 ------------------------------------------------------------------------------
  35.877  -------------------- LU SPECIFIC IMPLEMENTATION METHODS ---------------------
  35.878  -----------------------------------------------------------------------------
  35.879  
  35.880 @@ -885,219 +37,15 @@
  35.881  
  35.882  
  35.883  -----------------------------------------------------------------------------
  35.884 --------------------- SERVICE SPECIFIC IMPLEMENTATION METHODS ----------------
  35.885 +-------------------- FOUNDATION1 METHODS ------------------------------------
  35.886  -----------------------------------------------------------------------------
  35.887  
  35.888 -
  35.889 ------------------------------------------------------------------------------
  35.890 --------------------- SERVICE SPECIFIC PRIVATE METHODS -----------------------
  35.891 ------------------------------------------------------------------------------
  35.892 -
  35.893 -
  35.894 ------------------------------------------------------------------------------
  35.895 --------------------- SERVICE SPECIFIC PROTECTED METHODS ---------------------
  35.896 ------------------------------------------------------------------------------
  35.897 -
  35.898 -
  35.899 ------------------------------------------------------------------------------
  35.900 --------------------- SERVICE SPECIFIC PUBLIC METHODS ------------------------
  35.901 ------------------------------------------------------------------------------
  35.902 -
  35.903 -
  35.904 ------------------------------------------------------------------------------
  35.905 --------------------- FOUNDATION1 METHODS ------------------------------------
  35.906 ------------------------------------------------------------------------------
  35.907 --- Init
  35.908 ---   Dummy procedure that can be called at database startup to ensure that
  35.909 ---   this package is loaded into memory for performance reasons only.
  35.910 ------------------------------------------------------------------------------
  35.911 -
  35.912 -PROCEDURE Init
  35.913 -IS
  35.914 -BEGIN
  35.915 -   NULL;
  35.916 -END Init;
  35.917 -
  35.918 +PROCEDURE Init;
  35.919  
  35.920  END &PKG;
  35.921  /
  35.922  SHOW ERROR
  35.923  
  35.924 -undefine MODULE
  35.925 -undefine LU
  35.926 -undefine SERVICE
  35.927 -undefine TABLE
  35.928 -undefine VIEW
  35.929 -undefine PKG
  35.930 -undefine STATEPKG
  35.931 -undefine DOMAIN
  35.932 -
  35.933 -undefine OBJID
  35.934 -undefine OBJVERSION
  35.935 -undefine OBJSTATE
  35.936 -undefine OBJEVENTS
  35.937 -undefine STATE
  35.938 -undefine DB_VALUES
  35.939 -undefine CLIENT_VALUES
  35.940 -
  35.941 ------------------------------------------------------------------------------
  35.942 -------------------------------- STATEPACKAGE --------------------------------
  35.943 ------------------------------------------------------------------------------
  35.944 --- Separate Finite State Machine Package.
  35.945 ------------------------------------------------------------------------------
  35.946 -
  35.947 -PROMPT Creating &STATEPKG implementation
  35.948 -
  35.949 -CREATE OR REPLACE PACKAGE BODY &STATEPKG IS
  35.950 -
  35.951 ------------------------------------------------------------------------------
  35.952 ------------------------ STATEPACKAGE DECLARATIONS ---------------------------
  35.953 ------------------------------------------------------------------------------
  35.954 -
  35.955 -db_state_list_     CONSTANT VARCHAR2(32000) := '&DB_STATES';
  35.956 -client_state_list_ CONSTANT VARCHAR2(32000) := '&CLIENT_STATES';
  35.957 -active_state_list_          VARCHAR2(32000) := Language_SYS.Translate_State_(lu_name_, client_state_list_);
  35.958 -state_separator_   CONSTANT VARCHAR2(1)     := Client_SYS.field_separator_;
  35.959 -
  35.960 ------------------------------------------------------------------------------
  35.961 ---------------- LU SPECIFIC STATEPACKAGE ACTION DECLARATIONS ----------------
  35.962 ------------------------------------------------------------------------------
  35.963 -
  35.964 ------------------------------------------------------------------------------
  35.965 -------------- LU SPECIFIC STATEPACKAGE CONDITION DECLARATIONS ---------------
  35.966 ------------------------------------------------------------------------------
  35.967 -
  35.968 ------------------------------------------------------------------------------
  35.969 --------------------- IMPLEMENTATION STATEPACKAGE METHODS --------------------
  35.970 ------------------------------------------------------------------------------
  35.971 --- Finite_State_Set___
  35.972 ---    Updates the finite state indicator for an existing LU-instance.
  35.973 ---
  35.974 --- Finite_State_Machine___
  35.975 ---    Processes an event by:
  35.976 ---    1. Fetching the current state
  35.977 ---    2. Evaluating any conditions for given event at current state
  35.978 ---    3. executing any exit code for the old state
  35.979 ---    4. Performing any action associated with given event
  35.980 ---    5. update the database to the new state
  35.981 ---    6. execute any entry code for the new state
  35.982 ---    7. Executing a state change to the new state
  35.983 ------------------------------------------------------------------------------
  35.984 -
  35.985 -PROCEDURE Finite_State_Set___ (
  35.986 -   rec_   IN OUT &TABLE%ROWTYPE,
  35.987 -   state_ IN     VARCHAR2 )
  35.988 -IS
  35.989 -BEGIN
  35.990 -   <<<FSUPDATE: Put your own SQL-statement here to set the new state>>>;
  35.991 -END Finite_State_Set___;
  35.992 -
  35.993 -
  35.994 -PROCEDURE Finite_State_Machine___ (
  35.995 -   rec_   IN OUT &TABLE%ROWTYPE,
  35.996 -   event_ IN     VARCHAR2,
  35.997 -   attr_  IN OUT VARCHAR2 )
  35.998 -IS
  35.999 -   state_ VARCHAR2(30);
 35.1000 -BEGIN
 35.1001 -   <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
 35.1002 -   <<<FSEVENT: Code for processing of events>>>;
 35.1003 -END Finite_State_Machine___;
 35.1004 -
 35.1005 ------------------------------------------------------------------------------
 35.1006 --------------------- PRIVATE STATEPACKAGE METHODS ---------------------------
 35.1007 ------------------------------------------------------------------------------
 35.1008 --- Finite_State_Decode__
 35.1009 ---   Returns the client equivalent for any database representation of
 35.1010 ---   a state name = objstate.
 35.1011 ---
 35.1012 --- Finite_State_Encode__
 35.1013 ---   Returns the database equivalent for any client representation of
 35.1014 ---   a state name = state.
 35.1015 ---
 35.1016 --- Enumerate_States__
 35.1017 ---   Returns a list of all possible finite states in client terminology.
 35.1018 ---
 35.1019 --- Finite_State_Events__
 35.1020 ---   Returns a list of allowed events for a given state
 35.1021 ---   NOTE! Regardless of conditions if not otherwize encoded
 35.1022 ---
 35.1023 --- Enumerate_Events__
 35.1024 ---   Returns a list of all possible events.
 35.1025 ------------------------------------------------------------------------------
 35.1026 -
 35.1027 -FUNCTION Finite_State_Decode__ (
 35.1028 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2
 35.1029 -IS
 35.1030 -BEGIN
 35.1031 -   RETURN(Domain_SYS.Decode_(active_state_list_, db_state_list_, db_state_));
 35.1032 -END Finite_State_Decode__;
 35.1033 -
 35.1034 -
 35.1035 -FUNCTION Finite_State_Encode__ (
 35.1036 -   client_state_ IN VARCHAR2 ) RETURN VARCHAR2
 35.1037 -IS
 35.1038 -BEGIN
 35.1039 -   RETURN(Domain_SYS.Encode_(active_state_list_, db_state_list_, client_state_));
 35.1040 -END Finite_State_Encode__;
 35.1041 -
 35.1042 -
 35.1043 -PROCEDURE Enumerate_States__ (
 35.1044 -   client_values_ OUT VARCHAR2)
 35.1045 -IS
 35.1046 -BEGIN
 35.1047 -   client_values_ := Domain_SYS.Enumerate_(active_state_list_);
 35.1048 -END Enumerate_States__;
 35.1049 -
 35.1050 -
 35.1051 -FUNCTION Finite_State_Events__ (
 35.1052 -   db_state_ IN VARCHAR2 ) RETURN VARCHAR2
 35.1053 -IS
 35.1054 -BEGIN
 35.1055 -   <<<FSEVALID: Put your code for returning valid event list here>>>;
 35.1056 -END Finite_State_Events__;
 35.1057 -
 35.1058 -
 35.1059 -PROCEDURE Enumerate_Events__ (
 35.1060 -   db_events_ OUT VARCHAR2 )
 35.1061 -IS
 35.1062 -BEGIN
 35.1063 -   db_events_ := '<<<FSELIST: Put your code for returning complete event list here>>>';
 35.1064 -END Enumerate_Events__;
 35.1065 -
 35.1066 ------------------------------------------------------------------------------
 35.1067 ------------------ STATEPACKAGE PUBLIC TRANSLATION METHODS -------------------
 35.1068 ------------------------------------------------------------------------------
 35.1069 -
 35.1070 -PROCEDURE Language_Refreshed
 35.1071 -IS
 35.1072 -BEGIN
 35.1073 -   active_state_list_ := Language_SYS.Translate_State_(lu_name_, client_state_list_);
 35.1074 -END Language_Refreshed;
 35.1075 -
 35.1076 ------------------------------------------------------------------------------
 35.1077 -------------------- LU SPECIFIC STATEPACKAGE ACTIONS ------------------------
 35.1078 ------------------------------------------------------------------------------
 35.1079 -
 35.1080 ------------------------------------------------------------------------------
 35.1081 ------------------- LU SPECIFIC STATEPACKAGE CONDITIONS ----------------------
 35.1082 ------------------------------------------------------------------------------
 35.1083 -
 35.1084 ------------------------------------------------------------------------------
 35.1085 --------------------- STATEPACKAGE FOUNDATION1 METHODS -----------------------
 35.1086 ------------------------------------------------------------------------------
 35.1087 --- Init
 35.1088 ---   Dummy procedure that can be called at database startup to ensure that
 35.1089 ---   this package is loaded into memory for performance reasons only.
 35.1090 ------------------------------------------------------------------------------
 35.1091 -
 35.1092 -PROCEDURE Init
 35.1093 -IS
 35.1094 -BEGIN
 35.1095 -   NULL;
 35.1096 -END Init;
 35.1097 -
 35.1098 -
 35.1099 -END &STATEPKG;
 35.1100 -/
 35.1101 -SHOW ERROR
 35.1102 +UNDEFINE MODULE
 35.1103 +UNDEFINE LU
 35.1104 +UNDEFINE PKG
    36.1 --- a/PLSQL/Folding/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    36.2 +++ b/PLSQL/Folding/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    36.3 @@ -3,8 +3,8 @@
    36.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    36.5  OpenIDE-Module: org.netbeans.modules.plsql.fold
    36.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/fold/layer.xml
    36.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/fold/Bundle.propert
    36.8 - ies
    36.9 -OpenIDE-Module-Specification-Version: 1.8.0
   36.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/fold/Bund
   36.11 + le.properties
   36.12 +OpenIDE-Module-Specification-Version: 1.8.2
   36.13  AutoUpdate-Show-In-Client: false
   36.14  
    37.1 --- a/PLSQL/Formatter/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    37.2 +++ b/PLSQL/Formatter/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    37.3 @@ -3,8 +3,8 @@
    37.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    37.5  OpenIDE-Module: org.netbeans.modules.plsql.format
    37.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/format/layer.xml
    37.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/format/Bundle.prope
    37.8 - rties
    37.9 -OpenIDE-Module-Specification-Version: 1.9.6
   37.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/format/Bu
   37.11 + ndle.properties
   37.12 +OpenIDE-Module-Specification-Version: 1.9.14
   37.13  AutoUpdate-Show-In-Client: false
   37.14  
    38.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/Bundle.properties	Wed Dec 07 13:36:21 2011 +0100
    38.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/Bundle.properties	Tue Feb 14 17:31:28 2012 +0100
    38.3 @@ -61,5 +61,5 @@
    38.4    EXCEPTION_INIT,FALSE,FETCH,FOR,FORM,GENERIC,GOTO,IF,INTERFACE,LIMITED,LOOP,NEXTVAL,\
    38.5    PRAGMA,RAISE,RECORD,RELEASE,ROWTYPE,SIGNTYPE,SPACE,SQL,STATEMENT,SUBTYPE,TASK,\
    38.6    TERMINATE,TRUE,VIEWS,WHILE,ASCENDING,OTHERS,DESCENDING,NOCOPY,NATURAL,\
    38.7 -  JAVA,SOURCE,NAMED,BULK,COLLECT,\
    38.8 +  JAVA,SOURCE,NAMED,BULK,COLLECT,$IF,$ELSE,$THEN,$ELSIF,$END,$ERROR,\
    38.9  
    39.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java	Wed Dec 07 13:36:21 2011 +0100
    39.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java	Tue Feb 14 17:31:28 2012 +0100
    39.3 @@ -1,7 +1,7 @@
    39.4  /*
    39.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    39.6   *
    39.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    39.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    39.9   *
   39.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   39.11   * Other names may be trademarks of their respective owners.
   39.12 @@ -41,7 +41,6 @@
   39.13   */
   39.14  package org.netbeans.modules.plsql.format;
   39.15  
   39.16 -import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
   39.17  import java.io.IOException;
   39.18  import java.util.Arrays;
   39.19  import java.util.HashSet;
   39.20 @@ -55,19 +54,10 @@
   39.21  import javax.swing.text.Element;
   39.22  import javax.swing.text.JTextComponent;
   39.23  import org.netbeans.api.editor.mimelookup.MimeLookup;
   39.24 -import org.netbeans.editor.BaseDocument;
   39.25 -import org.netbeans.editor.GuardedException;
   39.26 -import org.netbeans.editor.TokenContextPath;
   39.27 -import org.netbeans.editor.TokenID;
   39.28 -import org.netbeans.editor.TokenItem;
   39.29 -import org.netbeans.editor.Utilities;
   39.30 -import org.netbeans.editor.ext.AbstractFormatLayer;
   39.31 -import org.netbeans.editor.ext.ExtFormatSupport;
   39.32 -import org.netbeans.editor.ext.ExtFormatter;
   39.33 -import org.netbeans.editor.ext.FormatSupport;
   39.34 -import org.netbeans.editor.ext.FormatTokenPosition;
   39.35 -import org.netbeans.editor.ext.FormatWriter;
   39.36 +import org.netbeans.editor.*;
   39.37 +import org.netbeans.editor.ext.*;
   39.38  import org.netbeans.modules.editor.NbEditorUtilities;
   39.39 +import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
   39.40  import org.openide.cookies.EditorCookie;
   39.41  import org.openide.loaders.DataObject;
   39.42  import org.openide.util.NbBundle;
   39.43 @@ -85,6 +75,7 @@
   39.44          super(kitClass);
   39.45      }
   39.46  
   39.47 +    @Override
   39.48      protected void initFormatLayers() {
   39.49          addFormatLayer(new PlsqlLayer());
   39.50      }
   39.51 @@ -123,12 +114,14 @@
   39.52      }
   39.53  
   39.54      /**
   39.55 -     * Implements the base class's abstract method.
   39.56 -     * Inserts new line at given position and indents the new line with spaces.
   39.57 +     * Implements the base class's abstract method. Inserts new line at given
   39.58 +     * position and indents the new line with spaces.
   39.59 +     *
   39.60       * @param doc the document to work on
   39.61       * @param offset the offset of a character on the line
   39.62       * @return new offset to place the cursor
   39.63       */
   39.64 +    @Override
   39.65      public int indentNewLine(Document doc, int offset) {
   39.66          try {
   39.67              Element rootElem = doc.getDefaultRootElement();
   39.68 @@ -172,6 +165,12 @@
   39.69                      || (lineText.startsWith("IF"))
   39.70                      || (lineText.startsWith("ELSIF"))
   39.71                      || (lineText.startsWith("ELSE"))
   39.72 +                    || (lineText.startsWith("$IF"))
   39.73 +                    || (lineText.startsWith("$ELSIF"))
   39.74 +                    || (lineText.startsWith("$ELSE"))
   39.75 +                    || (lineText.startsWith("$THEN"))
   39.76 +                    || (lineText.startsWith("$END"))
   39.77 +                    || (lineText.startsWith("$ERROR"))
   39.78                      || (lineText.startsWith("CASE"))
   39.79                      || (lineText.startsWith("WHEN"))
   39.80                      || (lineText.startsWith("MATCHED"))
   39.81 @@ -199,6 +198,7 @@
   39.82  
   39.83      /**
   39.84       * Format characters when entered
   39.85 +     *
   39.86       * @param arg0
   39.87       * @param arg1
   39.88       * @return
   39.89 @@ -226,10 +226,12 @@
   39.90              super("plsql-layer");
   39.91          }
   39.92  
   39.93 +        @Override
   39.94          protected FormatSupport createFormatSupport(FormatWriter fw) {
   39.95              return new PlsqlFormatSupport(fw);
   39.96          }
   39.97  
   39.98 +        @Override
   39.99          public void format(FormatWriter fw) {
  39.100              Document doc = fw.getDocument();
  39.101              DataObject dataObj = null;
  39.102 @@ -257,11 +259,10 @@
  39.103                      final EditorCookie cookie = dataObj.getCookie(EditorCookie.class);
  39.104                      JEditorPane pane = getEditorPane(cookie);
  39.105                      int startOffset = -1;
  39.106 -                    int lineNo = -1;
  39.107                      int colStart = -1;
  39.108                      if (pane != null) {
  39.109                          startOffset = pane.getCaretPosition();
  39.110 -                        lineNo = NbEditorUtilities.getLine(pane.getDocument(), startOffset, false).getLineNumber();
  39.111 +                        int lineNo = NbEditorUtilities.getLine(pane.getDocument(), startOffset, false).getLineNumber();
  39.112                          colStart = Utilities.getRowStartFromLineOffset((BaseDocument) pane.getDocument(), lineNo);
  39.113                      }
  39.114  
  39.115 @@ -353,17 +354,20 @@
  39.116              return PlsqlTokenContext.WHITESPACE;
  39.117          }
  39.118  
  39.119 +        @Override
  39.120          public TokenContextPath getWhitespaceTokenContextPath() {
  39.121              return PlsqlTokenContext.contextPath;
  39.122          }
  39.123  
  39.124          /**
  39.125 -         * Method that will perform the indentation of the line containing the given position
  39.126 +         * Method that will perform the indentation of the line containing the
  39.127 +         * given position
  39.128 +         *
  39.129           * @param pos
  39.130           * @return
  39.131           */
  39.132          public FormatTokenPosition indentLine(FormatTokenPosition pos) {
  39.133 -            int indent = 0; // Desired indent
  39.134 +            int indent; // Desired indent
  39.135  
  39.136              // Get the first non-whitespace position on the line
  39.137              FormatTokenPosition firstNWS = findLineFirstNonWhitespace(pos);
  39.138 @@ -395,6 +399,7 @@
  39.139  
  39.140          /**
  39.141           * Format the just the keyword to uppercase
  39.142 +         *
  39.143           * @param plsqlFormatSup
  39.144           * @param pos
  39.145           * @param blockFactory
  39.146 @@ -484,6 +489,7 @@
  39.147  
  39.148          /**
  39.149           * Format the keywords to uppercase only
  39.150 +         *
  39.151           * @param plsqlFormatSup
  39.152           * @param pos
  39.153           */
  39.154 @@ -555,17 +561,20 @@
  39.155  
  39.156          private boolean checkUpperCaseAllowed(TokenItem token) {
  39.157              TokenItem previousToken = getPreviousNonWhiteSpaceToken(token);
  39.158 -            if (previousToken != null && (previousToken.getImage().trim().equalsIgnoreCase("PROCEDURE") || previousToken.getImage().trim().equalsIgnoreCase("FUNCTION") || (previousToken.getImage().trim().equalsIgnoreCase("END") && !(token.getImage().trim().equalsIgnoreCase("IF") || token.getImage().trim().equalsIgnoreCase("LOOP") || token.getImage().trim().equalsIgnoreCase("CASE"))))) {
  39.159 +            if (previousToken != null && (previousToken.getImage().trim().equalsIgnoreCase("PROCEDURE") || previousToken.getImage().trim().equalsIgnoreCase("FUNCTION") || (previousToken.getImage().trim().equalsIgnoreCase("END") && !(token.getImage().trim().equalsIgnoreCase("IF") || token.getImage().trim().equalsIgnoreCase("$IF") || token.getImage().trim().equalsIgnoreCase("LOOP") || token.getImage().trim().equalsIgnoreCase("CASE"))))) {
  39.160                  return false;
  39.161              } else {
  39.162                  return true;
  39.163              }
  39.164          }
  39.165  
  39.166 -        /** Find the indentation for the first token on the line.
  39.167 -         * The given token is also examined in some cases.
  39.168 +        /**
  39.169 +         * Find the indentation for the first token on the line. The given token
  39.170 +         * is also examined in some cases.
  39.171           */
  39.172 -        public int findIndent(TokenItem token/*FormatTokenPosition pos*/) {
  39.173 +        public int findIndent(TokenItem token/*
  39.174 +                 * FormatTokenPosition pos
  39.175 +                 */) {
  39.176              int indent = 0; // assign invalid indent
  39.177  
  39.178              TokenItem previousNWS = token;//pos.getToken();
  39.179 @@ -573,8 +582,10 @@
  39.180              do {
  39.181                  previousNWS = getPreviousToken(previousNWS);
  39.182                  if ((previousNWS != null) && (previousNWS.getTokenID() != PlsqlTokenContext.WHITESPACE)) {
  39.183 -                    /*if the previousNWS is a line comment or a block comment, we should get previous non-whitespace token to
  39.184 -                     * indent correctly.
  39.185 +                    /*
  39.186 +                     * if the previousNWS is a line comment or a block comment,
  39.187 +                     * we should get previous non-whitespace token to indent
  39.188 +                     * correctly.
  39.189                       */
  39.190                      if (previousNWS.getTokenID() == PlsqlTokenContext.LINE_COMMENT || previousNWS.getTokenID() == PlsqlTokenContext.BLOCK_COMMENT) {
  39.191                          previousNWS = findLineFirstNonWhitespace(getPosition(previousNWS, 0)).getToken();
  39.192 @@ -585,13 +596,18 @@
  39.193  
  39.194              if (previousNWS != null) {
  39.195                  //Check whether there is a backward indentation
  39.196 -                int parentIndent = getIndentDiffOnCurrent(previousNWS, token/*pos.getToken()*/);
  39.197 +                int parentIndent = getIndentDiffOnCurrent(previousNWS, token/*
  39.198 +                         * pos.getToken()
  39.199 +                         */);
  39.200                  if (parentIndent == -9999) {
  39.201                      //Get forward indentation difference
  39.202 -                    parentIndent = getIndentDiffOnPrevious(previousNWS, token/*pos.getToken()*/);
  39.203 +                    parentIndent = getIndentDiffOnPrevious(previousNWS, token/*
  39.204 +                             * pos.getToken()
  39.205 +                             */);
  39.206                  }
  39.207 -
  39.208 -                indent = getLineIndent(getPosition(previousNWS, 0), true);
  39.209 +                if (!previousNWS.getImage().equals("/")) {
  39.210 +                    indent = getLineIndent(getPosition(previousNWS, 0), true);
  39.211 +                }
  39.212                  indent = indent + parentIndent;
  39.213              }
  39.214  
  39.215 @@ -604,9 +620,11 @@
  39.216  
  39.217          /**
  39.218           * If the token is a PLSQLToken allow modification of whitespaces
  39.219 +         *
  39.220           * @param inToken
  39.221           * @return
  39.222           */
  39.223 +        @Override
  39.224          public boolean canModifyWhitespace(TokenItem inToken) {
  39.225              if (inToken.getTokenContextPath() == PlsqlTokenContext.contextPath) {
  39.226                  return true;
  39.227 @@ -617,6 +635,7 @@
  39.228  
  39.229          /**
  39.230           * Get IS or DECLARE if there is before a BEGIN
  39.231 +         *
  39.232           * @param previous
  39.233           * @return
  39.234           */
  39.235 @@ -645,16 +664,19 @@
  39.236                                      || (tmpCursorItem.getImage().trim().equalsIgnoreCase("TYPE"))) {
  39.237                                  tokenTemp = getPreviousToken(tokenTemp);
  39.238                              } else { // still it's not the 'CURSOR', and it's 'IS' or "PROCEDURE" or "FUNCTION", it's the parent
  39.239 -                                if (tmp.getImage().trim().equalsIgnoreCase("IS") || tmp.getImage().trim().equalsIgnoreCase("PROCEDURE") || tmp.getImage().trim().equalsIgnoreCase("FUNCTION")) {
  39.240 +                                if (tmp.getImage().trim().equalsIgnoreCase("IS")) {
  39.241                                      tokenParent = tokenTemp;
  39.242                                      break;
  39.243 +                                } else if (tmp.getImage().trim().equalsIgnoreCase("PROCEDURE") || tmp.getImage().trim().equalsIgnoreCase("FUNCTION")) {
  39.244 +                                    tokenParent = tmp;
  39.245 +                                    break;
  39.246                                  } else {
  39.247                                      tokenTemp = getPreviousToken(tokenTemp);
  39.248                                  }
  39.249                              }
  39.250                          } else { // if the token is 'IS' or "PROCEDURE" or "FUNCTION", it should be the parent line
  39.251                              if (tmp.getImage().trim().equalsIgnoreCase("IS") || tmp.getImage().trim().equalsIgnoreCase("PROCEDURE") || tmp.getImage().trim().equalsIgnoreCase("FUNCTION")) {
  39.252 -                                tokenParent = tokenTemp;
  39.253 +                                tokenParent = tmp;
  39.254                                  break;
  39.255                              } else {
  39.256                                  tokenTemp = getPreviousToken(tokenTemp);
  39.257 @@ -695,6 +717,7 @@
  39.258  
  39.259          /**
  39.260           * Get the parent of the END
  39.261 +         *
  39.262           * @param previous
  39.263           * @return
  39.264           */
  39.265 @@ -713,10 +736,15 @@
  39.266                          && (!imageTmpPre.equalsIgnoreCase(";")))
  39.267                          || (imageTmp.equalsIgnoreCase("EXCEPTION")
  39.268                          && (!imageTmpPre.equalsIgnoreCase(";")))
  39.269 +                        || (imageTmp.equalsIgnoreCase("$IF")
  39.270 +                        && (!imageTmpPre.equalsIgnoreCase(";")))
  39.271 +                        || (imageTmp.equalsIgnoreCase("$ERROR")
  39.272 +                        && (!imageTmpPre.equalsIgnoreCase(";")))
  39.273                          || (imageTmp.equalsIgnoreCase("LOOP")
  39.274                          && (!imageTmpPre.equalsIgnoreCase(";")))
  39.275 +                        || (imageTmp.equalsIgnoreCase("CASE")
  39.276 +                        && (!imageTmpPre.equalsIgnoreCase(";")))
  39.277                          || (imageTmp.equalsIgnoreCase("BEGIN"))
  39.278 -                        || (imageTmp.equalsIgnoreCase("CASE"))
  39.279                          || (imageTmp.equalsIgnoreCase("PACKAGE"))) {
  39.280                      isParent = true;
  39.281                  }
  39.282 @@ -727,12 +755,14 @@
  39.283                      break;
  39.284                  } else {
  39.285                      //If we have reached a parent note that
  39.286 -                    if ((isParent) && (!imageTmp.equalsIgnoreCase("EXCEPTION"))) /*Since EXCEPTION block will  come only after BEGIN
  39.287 -                     * Anyway it was here because of the exception block template*/ {
  39.288 +                    if ((isParent) && (!imageTmp.equalsIgnoreCase("EXCEPTION"))) /*
  39.289 +                     * Since EXCEPTION block will come only after BEGIN Anyway
  39.290 +                     * it was here because of the exception block template
  39.291 +                     */ {
  39.292                          --endNo;
  39.293                      }
  39.294                      //If we have reached another end note that
  39.295 -                    if (imageTmp.equalsIgnoreCase("END")) {
  39.296 +                    if (imageTmp.equalsIgnoreCase("END") || imageTmp.equalsIgnoreCase("$END")) {
  39.297                          ++endNo;
  39.298                      }
  39.299  
  39.300 @@ -745,8 +775,9 @@
  39.301          }
  39.302  
  39.303          /**
  39.304 -         * Get the backward indentation for the current token
  39.305 -         * based on the previous token and the current token.
  39.306 +         * Get the backward indentation for the current token based on the
  39.307 +         * previous token and the current token.
  39.308 +         *
  39.309           * @param previousNWS
  39.310           * @param token
  39.311           * @return indentaion difference
  39.312 @@ -765,7 +796,7 @@
  39.313                      if (previousWhen != null) {
  39.314                          indent = getIndentationDiff(previousWhen, previousNWS);
  39.315                      }
  39.316 -                } else if (currentImage.equalsIgnoreCase("END")) {
  39.317 +                } else if (currentImage.equalsIgnoreCase("END") || currentImage.equalsIgnoreCase("$END")) {
  39.318                      //END can be ending BEGIN, EXCEPTION, LOOP, IF
  39.319                      //need the corresponding one
  39.320                      TokenItem endParent = getEndParent(previousNWS);
  39.321 @@ -783,14 +814,14 @@
  39.322                          indent = getTabSize();
  39.323                          //Check whether previous line is a COMMENT declaration
  39.324                      }
  39.325 -                } else if (currentImage.equalsIgnoreCase("ELSIF")) {
  39.326 +                } else if (currentImage.equalsIgnoreCase("ELSIF") || currentImage.equalsIgnoreCase("$ELSIF")) {
  39.327                      //will come after a IF, get the corresponding IF
  39.328                      TokenItem parentIf = getParentIf(previousNWS);
  39.329  
  39.330                      if (parentIf != null) {
  39.331                          indent = getIndentationDiff(parentIf, previousNWS);
  39.332                      }
  39.333 -                } else if (currentImage.equalsIgnoreCase("ELSE")) {
  39.334 +                } else if (currentImage.equalsIgnoreCase("ELSE") || currentImage.equalsIgnoreCase("$ELSE")) {
  39.335                      //will come after a IF, get the corresponding IF
  39.336                      TokenItem parent = getParentIf(previousNWS);
  39.337  
  39.338 @@ -802,8 +833,10 @@
  39.339                      }
  39.340                  } else if (currentImage.equalsIgnoreCase("EXCEPTION")) {
  39.341                      //Assumed that an EXCEPTION block will be declared only after BEGIN
  39.342 -               /* Since there can be other BEGIN blocks have to get the corresponding 
  39.343 -                     * block, which is similar to looking for the parent of an END
  39.344 +               /*
  39.345 +                     * Since there can be other BEGIN blocks have to get the
  39.346 +                     * corresponding block, which is similar to looking for the
  39.347 +                     * parent of an END
  39.348                       */
  39.349                      TokenItem endParent = getEndParent(previousNWS);
  39.350  
  39.351 @@ -812,9 +845,11 @@
  39.352                      }
  39.353                  } else if (currentImage.equalsIgnoreCase("BEGIN")) {
  39.354                      //Can have a IS/DECLARE
  39.355 -               /*It would be enough to look for a IS/DECLARE before the previous 
  39.356 -                     * BEGIN - to ignore BEGIN in side a BEGIN
  39.357 -                     * END - means inside a code block*/
  39.358 +               /*
  39.359 +                     * It would be enough to look for a IS/DECLARE before the
  39.360 +                     * previous BEGIN - to ignore BEGIN in side a BEGIN END -
  39.361 +                     * means inside a code block
  39.362 +                     */
  39.363                      TokenItem beginParent = getBeginParent(previousNWS);
  39.364  
  39.365                      if (beginParent != null) {
  39.366 @@ -938,6 +973,7 @@
  39.367  
  39.368          /**
  39.369           * Get the indent for the current token based on the previous token.
  39.370 +         *
  39.371           * @param previousNWS
  39.372           * @param token
  39.373           * @return
  39.374 @@ -961,6 +997,11 @@
  39.375                          || (tokenImage.equalsIgnoreCase("IF"))
  39.376                          || (tokenImage.equalsIgnoreCase("ELSIF"))
  39.377                          || (tokenImage.equalsIgnoreCase("ELSE"))
  39.378 +                        || (tokenImage.startsWith("$IF"))
  39.379 +                        || (tokenImage.startsWith("$THEN"))
  39.380 +                        || (tokenImage.startsWith("$ELSIF"))
  39.381 +                        || (tokenImage.startsWith("$ELSE"))
  39.382 +                        || (tokenImage.startsWith("$ERROR"))
  39.383                          || (tokenImage.equalsIgnoreCase("CASE"))
  39.384                          || (tokenImage.equalsIgnoreCase("WHEN"))
  39.385                          || (tokenImage.equalsIgnoreCase("MATCHED"))
  39.386 @@ -970,8 +1011,18 @@
  39.387                      return getTabSize();
  39.388                  } else {
  39.389                      if (tokenImage.equalsIgnoreCase("IS")) {
  39.390 +                        /*
  39.391 +                         * for select statements in side cursors
  39.392 +                         */
  39.393 +                        if (token.getImage().equalsIgnoreCase("SELECT")) {
  39.394 +                            return getTabSize();
  39.395 +                        }
  39.396                          TokenItem preKey = getPreviousKeyword(previousNWS.getPrevious());
  39.397                          if (preKey != null) {
  39.398 +                            TokenItem firstToken = findLineFirstNonWhitespace(getPosition(previousNWS, 0)).getToken();
  39.399 +                            if (token.getTokenID() != PlsqlTokenContext.KEYWORD && firstToken != previousNWS) {
  39.400 +                                return 0;
  39.401 +                            }
  39.402                              String image = preKey.getImage().trim();
  39.403                              if ((!token.getImage().trim().equalsIgnoreCase("BEGIN"))
  39.404                                      && (!((image.equalsIgnoreCase("PACKAGE")) || (image.equalsIgnoreCase("BODY"))))) {
  39.405 @@ -980,21 +1031,31 @@
  39.406                          }
  39.407                      }
  39.408                  }
  39.409 +                if (tokenImage.equalsIgnoreCase("DISTINCT")) {
  39.410 +                    return getIndentForSelect(previousNWS);
  39.411 +                }
  39.412              } else if (tokenID == PlsqlTokenContext.LPAREN_ID) {
  39.413                  //keep tab after '(' e.x in procedure and function declarations
  39.414                  return getTabSize();
  39.415 -            } else if (tokenID == PlsqlTokenContext.RPAREN_ID /*&& ((token.getImage().trim().equalsIgnoreCase("VALUES"))
  39.416 -                    || (token.getImage().trim().equalsIgnoreCase("RETURNING")))*/) {
  39.417 +            } else if (tokenID == PlsqlTokenContext.RPAREN_ID /*
  39.418 +                     * && ((token.getImage().trim().equalsIgnoreCase("VALUES"))
  39.419 +                     * || (token.getImage().trim().equalsIgnoreCase("RETURNING")))
  39.420 +                     */) {
  39.421                  return getParenthesesStartIndent(previousNWS);
  39.422                  //reduce tab after ')' e.x in '<columns>)' in 'INSERT INTO'
  39.423                  // return (-getTabSize());
  39.424              } else if (tokenID == PlsqlTokenContext.OPERATOR_ID) {
  39.425                  if (previousNWS.getImage().trim().equalsIgnoreCase(";")) {
  39.426 -                    /*When a statement is ended by ';' in some statements
  39.427 -                     * if the statement is multi-lined we need to go to the beginning to
  39.428 -                     * get the indentation for the next*/
  39.429 +                    /*
  39.430 +                     * When a statement is ended by ';' in some statements if
  39.431 +                     * the statement is multi-lined we need to go to the
  39.432 +                     * beginning to get the indentation for the next
  39.433 +                     */
  39.434                      TokenItem previousToken = getPreviousNonWhiteSpaceToken(previousNWS);
  39.435 -                    /* if the previous Token is a ')' then we should find the begining of the statement */
  39.436 +                    /*
  39.437 +                     * if the previous Token is a ')' then we should find the
  39.438 +                     * begining of the statement
  39.439 +                     */
  39.440                      if (previousToken != null && previousToken.getTokenID().getNumericID() == PlsqlTokenContext.RPAREN_ID) {
  39.441                          int multiLineIndent = getMethodIndent(previousToken);
  39.442                          if (multiLineIndent != -1 && multiLineIndent != 0 && getLineIndent(getPosition(previousNWS, 0), true) != multiLineIndent) {
  39.443 @@ -1058,11 +1119,19 @@
  39.444                      //This will be useful for SELECT , UPDATE , INTO variables
  39.445                      TokenItem first = findLineFirstNonWhitespace(getPosition(previousNWS, 0)).getToken();
  39.446                      String previousKeyword = first.getImage().trim();
  39.447 +                    TokenItem findStatementStart = findStatementStart(first);
  39.448 +                    if (findStatementStart != null) {
  39.449 +                        previousKeyword = findStatementStart.getImage().trim();
  39.450 +                    }
  39.451  
  39.452 -                    if ((previousKeyword.equalsIgnoreCase("SELECT"))
  39.453 -                            || (previousKeyword.equalsIgnoreCase("INTO"))
  39.454 -                            || (previousKeyword.equalsIgnoreCase("FROM"))
  39.455 -                            || (previousKeyword.equalsIgnoreCase("SET"))) {
  39.456 +                    if (previousKeyword.equalsIgnoreCase("SELECT") || (previousKeyword.equalsIgnoreCase("FROM"))) {
  39.457 +                        return getIndentForSelect(previousNWS);
  39.458 +                    }
  39.459 +
  39.460 +                    if ((previousKeyword.equalsIgnoreCase("INTO"))
  39.461 +                            || (previousKeyword.equalsIgnoreCase("SET"))
  39.462 +                            || (previousKeyword.equalsIgnoreCase("CURSOR"))
  39.463 +                            || (previousKeyword.equalsIgnoreCase("IS"))) {
  39.464                          return getTabSize();
  39.465                      }
  39.466                  } else if (previousNWS.getImage().trim().equalsIgnoreCase("*")) {
  39.467 @@ -1077,6 +1146,7 @@
  39.468  
  39.469          /**
  39.470           * Get the previous non-whitespace token
  39.471 +         *
  39.472           * @param token
  39.473           * @return TokenItem.
  39.474           */
  39.475 @@ -1093,6 +1163,7 @@
  39.476  
  39.477          /**
  39.478           * Get the next non-whitespace token
  39.479 +         *
  39.480           * @param token
  39.481           * @return TokenItem.
  39.482           */
  39.483 @@ -1109,6 +1180,7 @@
  39.484  
  39.485          /**
  39.486           * Get the previous token Item which is not a character literal
  39.487 +         *
  39.488           * @param token
  39.489           * @return TokenItem which is not a character literal.
  39.490           */
  39.491 @@ -1124,10 +1196,13 @@
  39.492          }
  39.493  
  39.494          /**
  39.495 -         * Get the indentation of a method which has multiple lines, it will simply matches
  39.496 -         * brace count and return indentation of the method's first line.
  39.497 +         * Get the indentation of a method which has multiple lines, it will
  39.498 +         * simply matches brace count and return indentation of the method's
  39.499 +         * first line.
  39.500 +         *
  39.501           * @param token, which has image of ')'
  39.502 -         * @return indentation, indentation of the line that consist the method's starting '(' if a match found else 0.
  39.503 +         * @return indentation, indentation of the line that consist the
  39.504 +         * method's starting '(' if a match found else 0.
  39.505           */
  39.506          private int getMethodIndent(TokenItem token) {
  39.507              TokenItem tempToken = getPreviousNonWhiteSpaceToken(token);
  39.508 @@ -1156,6 +1231,7 @@
  39.509  
  39.510          /**
  39.511           * Method to get the indentation of the previous statement
  39.512 +         *
  39.513           * @param previousNWS
  39.514           * @param diff
  39.515           * @return
  39.516 @@ -1171,7 +1247,9 @@
  39.517                          || (image.equalsIgnoreCase("BEGIN"))
  39.518                          || (image.equalsIgnoreCase("LOOP"))
  39.519                          || (image.equalsIgnoreCase("ELSE"))
  39.520 +                        || (image.equalsIgnoreCase("$ELSE"))
  39.521                          || (image.equalsIgnoreCase("THEN"))
  39.522 +                        || (image.equalsIgnoreCase("$THEN"))
  39.523                          || (image.equalsIgnoreCase("CURSOR"))) {
  39.524                      //METHOD declarations inside a
  39.525                      break;
  39.526 @@ -1202,10 +1280,13 @@
  39.527          }
  39.528  
  39.529          /**
  39.530 -         * Get the starting line position of a method which has multiple lines, it will simply matches
  39.531 -         * brace count and return the position of the matching token.
  39.532 +         * Get the starting line position of a method which has multiple lines,
  39.533 +         * it will simply matches brace count and return the position of the
  39.534 +         * matching token.
  39.535 +         *
  39.536           * @param token, which has image of ')'
  39.537 -         * @return format token Position, position of '(' if a match found else null.
  39.538 +         * @return format token Position, position of '(' if a match found else
  39.539 +         * null.
  39.540           */
  39.541          private FormatTokenPosition getMethodStartPosition(TokenItem token) {
  39.542              TokenItem tempToken = getPreviousNonWhiteSpaceToken(token);
  39.543 @@ -1234,6 +1315,7 @@
  39.544  
  39.545          /**
  39.546           * Get the parent of the IS, can be FUNCTION/ PROCEDURE/PACKAGE/CURSOR
  39.547 +         *
  39.548           * @param previous
  39.549           * @return
  39.550           */
  39.551 @@ -1261,6 +1343,7 @@
  39.552  
  39.553          /**
  39.554           * Get parent IF of the given ELSE/ELSIF
  39.555 +         *
  39.556           * @param previous
  39.557           * @return
  39.558           */
  39.559 @@ -1276,7 +1359,7 @@
  39.560                  boolean isParent = false;
  39.561  
  39.562                  //Ignore END IF;
  39.563 -                if (imageTmp.equalsIgnoreCase("IF")
  39.564 +                if ((imageTmp.equalsIgnoreCase("IF") || imageTmp.equalsIgnoreCase("$IF"))
  39.565                          && (!imageTmpPre.equalsIgnoreCase(";"))) {
  39.566                      isParent = true;
  39.567                  }
  39.568 @@ -1292,7 +1375,7 @@
  39.569                      }
  39.570  
  39.571                      //If we have reached another END IF that
  39.572 -                    if (imageTmp.equalsIgnoreCase("END") && imageTmpPre.equalsIgnoreCase("IF")) {
  39.573 +                    if (imageTmp.equalsIgnoreCase("END") && (imageTmpPre.equalsIgnoreCase("IF") || imageTmpPre.equalsIgnoreCase("$IF"))) {
  39.574                          ++endNo;
  39.575                      }
  39.576  
  39.577 @@ -1309,6 +1392,7 @@
  39.578  
  39.579          /**
  39.580           * Method to get the begining key word of the previous statement
  39.581 +         *
  39.582           * @param previousNWS
  39.583           * @param diff
  39.584           * @return
  39.585 @@ -1324,7 +1408,9 @@
  39.586                          || (image.equalsIgnoreCase("BEGIN"))
  39.587                          || (image.equalsIgnoreCase("LOOP"))
  39.588                          || (image.equalsIgnoreCase("ELSE"))
  39.589 +                        || (image.equalsIgnoreCase("$ELSE"))
  39.590                          || (image.equalsIgnoreCase("THEN"))
  39.591 +                        || (image.equalsIgnoreCase("$THEN"))
  39.592                          || (image.equalsIgnoreCase("CURSOR"))) {
  39.593                      if (image.equalsIgnoreCase("CURSOR")) {
  39.594                          tokenTempPre = tokenTemp;
  39.595 @@ -1357,6 +1443,7 @@
  39.596  
  39.597          /**
  39.598           * Get the keyword token before this token and retuen the image
  39.599 +         *
  39.600           * @param previousNWS
  39.601           * @return
  39.602           */
  39.603 @@ -1378,7 +1465,9 @@
  39.604          }
  39.605  
  39.606          /**
  39.607 -         * Get previous token with the given image id before the image id endImage
  39.608 +         * Get previous token with the given image id before the image id
  39.609 +         * endImage
  39.610 +         *
  39.611           * @param token
  39.612           * @param imageId
  39.613           * @param endImage
  39.614 @@ -1401,8 +1490,37 @@
  39.615          }
  39.616  
  39.617          /**
  39.618 +         * Get the correct indent for Select statements
  39.619 +         *
  39.620 +         * @param previousNWS
  39.621 +         * @return token item, null if not found
  39.622 +         */
  39.623 +        private int getIndentForSelect(TokenItem previousNWS) {
  39.624 +
  39.625 +            int indent = getTabSize();
  39.626 +            TokenItem first = findLineFirstNonWhitespace(getPosition(previousNWS, 0)).getToken();
  39.627 +
  39.628 +            int parent = getLineIndent(getPosition(previousNWS, 0), true);
  39.629 +            TokenItem findStatementStart = findStatementStart(first);
  39.630 +
  39.631 +            if (findStatementStart != null) {
  39.632 +                first = findStatementStart;
  39.633 +            }
  39.634 +
  39.635 +            do {
  39.636 +                first = first.getNext();
  39.637 +                if ((first != null) && (first.getTokenID() != PlsqlTokenContext.WHITESPACE) && (first.getTokenID() != PlsqlTokenContext.BLOCK_COMMENT)
  39.638 +                        && (first.getTokenID() != PlsqlTokenContext.LINE_COMMENT)) {
  39.639 +                    return getVisualColumnOffset(getPosition(first, 0)) - parent;
  39.640 +                }
  39.641 +            } while (first != null);
  39.642 +            return indent;
  39.643 +        }
  39.644 +
  39.645 +        /**
  39.646           * Method to calculate indentation difference between two token items
  39.647           * belonging to multiple lines
  39.648 +         *
  39.649           * @param token1
  39.650           * @param token2
  39.651           * @return
  39.652 @@ -1422,6 +1540,7 @@
  39.653  
  39.654          /**
  39.655           * Method to get the previous when then block in the same level
  39.656 +         *
  39.657           * @param previous
  39.658           * @return
  39.659           */
  39.660 @@ -1434,12 +1553,10 @@
  39.661                  String imageTmp = tokenTemp.getImage().trim();
  39.662  
  39.663                  //If we have reached the beginning of a block stop
  39.664 -                if ((imageTmp.equalsIgnoreCase("IF"))
  39.665 -                        || (imageTmp.equalsIgnoreCase("ELSE"))
  39.666 +                if ((imageTmp.equalsIgnoreCase("$ERROR"))
  39.667                          || (imageTmp.equalsIgnoreCase("BEGIN"))
  39.668                          || (imageTmp.equalsIgnoreCase("EXCEPTION"))
  39.669 -                        || (imageTmp.equalsIgnoreCase("LOOP"))
  39.670 -                        || (imageTmp.equalsIgnoreCase("ELSIF"))) {
  39.671 +                        || (imageTmp.equalsIgnoreCase("LOOP"))) {
  39.672                      break;
  39.673                  } else if ((imageTmp.equalsIgnoreCase(";"))
  39.674                          && (tokenThen != null)) {
  39.675 @@ -1450,7 +1567,7 @@
  39.676                      tokenWhen = tokenTemp;
  39.677                      break;
  39.678                  } else {
  39.679 -                    if ((imageTmp.equalsIgnoreCase("THEN"))
  39.680 +                    if ((imageTmp.equalsIgnoreCase("THEN") || imageTmp.equalsIgnoreCase("$THEN"))
  39.681                              && (tokenWhen == null)) {
  39.682                          //Get previous "THEN"
  39.683                          tokenThen = tokenTemp;
  39.684 @@ -1463,8 +1580,9 @@
  39.685          }
  39.686  
  39.687          /**
  39.688 -         * Method to check whether the given statement which ends by ';'
  39.689 -         * is the first element in a package declaration/ implementation
  39.690 +         * Method to check whether the given statement which ends by ';' is the
  39.691 +         * first element in a package declaration/ implementation
  39.692 +         *
  39.693           * @param previous
  39.694           * @return
  39.695           */
  39.696 @@ -1512,8 +1630,8 @@
  39.697      }
  39.698  
  39.699      /**
  39.700 -     * populates the hashset of keywords from the property in the
  39.701 -     * resource bundle
  39.702 +     * populates the hashset of keywords from the property in the resource
  39.703 +     * bundle
  39.704       */
  39.705      private static void pupulateSQLPlus() {
  39.706          String fullList = NbBundle.getBundle(PlsqlFormatter.class).getString("LIST_SQLPLUS");
    40.1 --- a/PLSQL/FormattingOptions/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    40.2 +++ b/PLSQL/FormattingOptions/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    40.3 @@ -2,7 +2,10 @@
    40.4  Ant-Version: Apache Ant 1.7.1
    40.5  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    40.6  OpenIDE-Module: org.netbeans.modules.plsql.format.options
    40.7 -OpenIDE-Module-Layer: org/netbeans/modules/plsql/format/options/layer.xml
    40.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/format/options/Bundle.properties
    40.9 -OpenIDE-Module-Specification-Version: 1.7.6
   40.10 +OpenIDE-Module-Layer: org/netbeans/modules/plsql/format/options/layer.
   40.11 + xml
   40.12 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/format/op
   40.13 + tions/Bundle.properties
   40.14 +OpenIDE-Module-Specification-Version: 1.7.7
   40.15  AutoUpdate-Show-In-Client: false
   40.16 +
    41.1 --- a/PLSQL/Hyperlink/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    41.2 +++ b/PLSQL/Hyperlink/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    41.3 @@ -3,8 +3,8 @@
    41.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    41.5  OpenIDE-Module: org.netbeans.modules.plsql.hyperlink
    41.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/hyperlink/layer.xml
    41.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/hyperlink/Bundle.pr
    41.8 - operties
    41.9 -OpenIDE-Module-Specification-Version: 1.8.6
   41.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/hyperlink
   41.11 + /Bundle.properties
   41.12 +OpenIDE-Module-Specification-Version: 1.8.9
   41.13  AutoUpdate-Show-In-Client: false
   41.14  
    42.1 --- a/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/PlsqlHyperlinkProvider.java	Wed Dec 07 13:36:21 2011 +0100
    42.2 +++ b/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/PlsqlHyperlinkProvider.java	Tue Feb 14 17:31:28 2012 +0100
    42.3 @@ -72,6 +72,9 @@
    42.4  import org.netbeans.api.lexer.TokenSequence;
    42.5  import org.netbeans.api.project.FileOwnerQuery;
    42.6  import org.netbeans.api.project.Project;
    42.7 +import org.netbeans.editor.JumpList;
    42.8 +import org.netbeans.modules.plsql.hyperlink.target.PlsqlGotoTarget;
    42.9 +import org.netbeans.modules.plsql.hyperlink.target.PlsqlGotoTargetFactory;
   42.10  import org.openide.cookies.EditorCookie;
   42.11  import org.openide.cookies.OpenCookie;
   42.12  import org.openide.filesystems.FileObject;
   42.13 @@ -238,7 +241,7 @@
   42.14           target.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   42.15           boolean isBody = true;
   42.16           if (object instanceof DataObject) {
   42.17 -            isBody = !globalFileValidator.isValidPackageSpec((DataObject) object);
   42.18 +            isBody = globalFileValidator.isValidPackageBody((DataObject) object);
   42.19           }
   42.20           String child = tokenImage;
   42.21           //Can be a define
   42.22 @@ -1116,7 +1119,23 @@
   42.23              return true;
   42.24           }
   42.25        }
   42.26 +      
   42.27 +       if (packageName.equals("")) {
   42.28 +           Object obj = doc.getProperty(Document.StreamDescriptionProperty);
   42.29 +           Lookup lookup = null;
   42.30 +           if (obj instanceof Lookup.Provider) {
   42.31 +               lookup = ((Lookup.Provider) obj).getLookup();
   42.32 +           }
   42.33 +           final PlsqlGotoTarget target = PlsqlGotoTargetFactory.instance.getTargetForDb(lookup);
   42.34  
   42.35 +           //Add to jump list
   42.36 +           final EditorCookie editorCookie = ((Lookup.Provider) obj).getLookup().lookup(EditorCookie.class);
   42.37 +           JumpList.addEntry(Utilities.getFocusedComponent(), PlsqlHyperlinkUtil.getCaretPosition(editorCookie));
   42.38 +           //if(target instanceof PlsqlPackageBodyTarget || target instanceof PlsqlTableTarget || target instanceof PlsqlViewTarget){
   42.39 +              target.gotoDbBody();
   42.40 +           //}
   42.41 +           return true;
   42.42 +       }
   42.43        return false;
   42.44     }
   42.45  
    43.1 --- a/PLSQL/Lexer/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    43.2 +++ b/PLSQL/Lexer/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    43.3 @@ -3,8 +3,8 @@
    43.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    43.5  OpenIDE-Module: org.netbeans.modules.plsql.lexer
    43.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/lexer/layer.xml
    43.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/lexer/Bundle.proper
    43.8 - ties
    43.9 -OpenIDE-Module-Specification-Version: 1.8.5
   43.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/lexer/Bun
   43.11 + dle.properties
   43.12 +OpenIDE-Module-Specification-Version: 1.8.8
   43.13  AutoUpdate-Show-In-Client: false
   43.14  
    44.1 --- a/PLSQL/Lexer/src/org/netbeans/modules/plsql/lexer/Bundle.properties	Wed Dec 07 13:36:21 2011 +0100
    44.2 +++ b/PLSQL/Lexer/src/org/netbeans/modules/plsql/lexer/Bundle.properties	Tue Feb 14 17:31:28 2012 +0100
    44.3 @@ -71,4 +71,4 @@
    44.4    EXCEPTION_INIT,FALSE,FETCH,FOR,FORM,GENERIC,GOTO,IF,INTERFACE,LIMITED,LOOP,NEXTVAL,\
    44.5    PRAGMA,RAISE,RECORD,RELEASE,ROWTYPE,SIGNTYPE,SPACE,SQL,STATEMENT,SUBTYPE,TASK,\
    44.6    TERMINATE,TRUE,VIEWS,WHILE,ASCENDING,OTHERS,DESCENDING,NOCOPY,NATURAL,\
    44.7 -  JAVA,SOURCE,NAMED,BULK,COLLECT,\
    44.8 +  JAVA,SOURCE,NAMED,BULK,COLLECT,$IF,$ELSE,$THEN,$ELSIF,$END,$ERROR,\
    45.1 --- a/PLSQL/Lexer/src/org/netbeans/modules/plsql/lexer/PlsqlBlockFactory.java	Wed Dec 07 13:36:21 2011 +0100
    45.2 +++ b/PLSQL/Lexer/src/org/netbeans/modules/plsql/lexer/PlsqlBlockFactory.java	Tue Feb 14 17:31:28 2012 +0100
    45.3 @@ -2907,6 +2907,9 @@
    45.4        if (packageName.indexOf('&') != -1) {
    45.5           alias = packageName;
    45.6        }
    45.7 +      else if(hasDefineKey(packageName)){
    45.8 +         alias =  '&'+getDefineKey(packageName);
    45.9 +      }
   45.10  
   45.11        packageName = getDefine(packageName);
   45.12        Token<PlsqlTokenId> customStartToken = null;
   45.13 @@ -4016,7 +4019,7 @@
   45.14     }
   45.15  
   45.16     /**
   45.17 -    * Get the name defined by &Name
   45.18 +    * Check &Name is in map as a key
   45.19      * @param inputName
   45.20      * @return
   45.21      */
   45.22 @@ -4029,6 +4032,29 @@
   45.23  
   45.24        return false;
   45.25     }
   45.26 +   
   45.27 +   /**
   45.28 +    * Check &Name is in map as a value
   45.29 +    * @param inputName
   45.30 +    * @return
   45.31 +    */
   45.32 +   public boolean hasDefineKey(String inputName) {
   45.33 +      String name = inputName;
   45.34 +      return definesMap.containsValue(name.toUpperCase(Locale.ENGLISH));
   45.35 +   }
   45.36 +   
   45.37 +   /**
   45.38 +    * Get the key of &Name
   45.39 +    * @param inputName
   45.40 +    * @return
   45.41 +    */
   45.42 +    public String getDefineKey(String inputName) {       
   45.43 +        for(Object o:definesMap.keySet()){
   45.44 +            if(definesMap.get(o).equals(inputName))
   45.45 +                return o.toString();                
   45.46 +        }       
   45.47 +        return null;
   45.48 +   }
   45.49  
   45.50     public Map<String, String> getDefines() {
   45.51        return Collections.unmodifiableMap(definesMap);
    46.1 --- a/PLSQL/Lexer/src/org/netbeans/modules/plsql/lexer/PlsqlLexer.java	Wed Dec 07 13:36:21 2011 +0100
    46.2 +++ b/PLSQL/Lexer/src/org/netbeans/modules/plsql/lexer/PlsqlLexer.java	Tue Feb 14 17:31:28 2012 +0100
    46.3 @@ -98,8 +98,7 @@
    46.4  
    46.5           switch (c) {
    46.6              case '_':
    46.7 -            case '&':
    46.8 -            case '$':
    46.9 +            case '&':           
   46.10              case '#':
   46.11                 return finishIdentifier();
   46.12  
   46.13 @@ -173,7 +172,7 @@
   46.14                       input.backup(1);
   46.15                       return token(PlsqlTokenId.OPERATOR);
   46.16                 }
   46.17 -
   46.18 +            case '$':
   46.19              case 'a':
   46.20              case 'b':
   46.21              case 'c':
    47.1 --- a/PLSQL/Navigator/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    47.2 +++ b/PLSQL/Navigator/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    47.3 @@ -3,8 +3,8 @@
    47.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    47.5  OpenIDE-Module: org.netbeans.modules.plsql.navigator
    47.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/navigator/layer.xml
    47.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/navigator/Bundle.pr
    47.8 - operties
    47.9 -OpenIDE-Module-Specification-Version: 1.8.0
   47.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/navigator
   47.11 + /Bundle.properties
   47.12 +OpenIDE-Module-Specification-Version: 1.8.1
   47.13  AutoUpdate-Show-In-Client: false
   47.14  
    48.1 --- a/PLSQL/Palette/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    48.2 +++ b/PLSQL/Palette/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    48.3 @@ -2,10 +2,11 @@
    48.4  Ant-Version: Apache Ant 1.7.1
    48.5  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    48.6  OpenIDE-Module: org.netbeans.modules.plsql.palette
    48.7 -OpenIDE-Module-Install: org/netbeans/modules/plsql/palette/Installer.class
    48.8 +OpenIDE-Module-Install: org/netbeans/modules/plsql/palette/Installer.c
    48.9 + lass
   48.10  OpenIDE-Module-Layer: org/netbeans/modules/plsql/palette/layer.xml
   48.11 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/palette/Bundle.prop
   48.12 - erties
   48.13 -OpenIDE-Module-Specification-Version: 1.8.4
   48.14 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/palette/B
   48.15 + undle.properties
   48.16 +OpenIDE-Module-Specification-Version: 1.8.9
   48.17  AutoUpdate-Show-In-Client: false
   48.18  
    49.1 --- a/PLSQL/Palette/nbproject/project.xml	Wed Dec 07 13:36:21 2011 +0100
    49.2 +++ b/PLSQL/Palette/nbproject/project.xml	Tue Feb 14 17:31:28 2012 +0100
    49.3 @@ -91,7 +91,9 @@
    49.4                      </test-dependency>
    49.5                  </test-type>
    49.6              </test-dependencies>
    49.7 -            <public-packages/>
    49.8 +            <public-packages>
    49.9 +                <package>org.netbeans.modules.plsql.palette</package>
   49.10 +            </public-packages>
   49.11          </data>
   49.12      </configuration>
   49.13  </project>
    50.1 Binary file PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/ddlstmt/resource/statement.gif has changed
    51.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/IFSItemGeneral.java	Wed Dec 07 13:36:21 2011 +0100
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,61 +0,0 @@
    51.4 -/*
    51.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    51.6 - *
    51.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    51.8 - *
    51.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   51.10 - * Other names may be trademarks of their respective owners.
   51.11 - *
   51.12 - * The contents of this file are subject to the terms of either the GNU
   51.13 - * General Public License Version 2 only ("GPL") or the Common
   51.14 - * Development and Distribution License("CDDL") (collectively, the
   51.15 - * "License"). You may not use this file except in compliance with the
   51.16 - * License. You can obtain a copy of the License at
   51.17 - * http://www.netbeans.org/cddl-gplv2.html
   51.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   51.19 - * specific language governing permissions and limitations under the
   51.20 - * License.  When distributing the software, include this License Header
   51.21 - * Notice in each file and include the License file at
   51.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   51.23 - * particular file as subject to the "Classpath" exception as provided
   51.24 - * by Oracle in the GPL Version 2 section of the License file that
   51.25 - * accompanied this code. If applicable, add the following below the
   51.26 - * License Header, with the fields enclosed by brackets [] replaced by
   51.27 - * your own identifying information:
   51.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   51.29 - *
   51.30 - * If you wish your version of this file to be governed by only the CDDL
   51.31 - * or only the GPL Version 2, indicate your decision by adding
   51.32 - * "[Contributor] elects to include this software in this distribution
   51.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   51.34 - * single choice of license, a recipient has the option to distribute
   51.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   51.36 - * to extend the choice of license to its licensees as provided above.
   51.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   51.38 - * Version 2 license, then the option applies only if the new code is
   51.39 - * made subject to such option by the copyright holder.
   51.40 - *
   51.41 - * Contributor(s):
   51.42 - *
   51.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
   51.44 - */
   51.45 -package org.netbeans.modules.plsql.palette.item.errorhandling;
   51.46 -
   51.47 -import org.netbeans.modules.plsql.palette.PaletteItem;
   51.48 -
   51.49 -/**
   51.50 - * Class for adding IFS item general code template
   51.51 - * @author IFS
   51.52 - */
   51.53 -public class IFSItemGeneral extends PaletteItem{
   51.54 -    
   51.55 -    /** Creates a new instance of IFSItemGeneral */
   51.56 -    public IFSItemGeneral() {        
   51.57 -    }
   51.58 -        
   51.59 -    public String createBody(){
   51.60 -        String exe;
   51.61 -        exe = "Error_SYS.Item_General(lu_name_,'${<attribute>}', '${<errorID>}: ${<text>}');\n${cursor}";        
   51.62 -        return exe;
   51.63 -    }
   51.64 -}
    52.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/IFSRecordGeneral.java	Wed Dec 07 13:36:21 2011 +0100
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,60 +0,0 @@
    52.4 -/*
    52.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    52.6 - *
    52.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    52.8 - *
    52.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   52.10 - * Other names may be trademarks of their respective owners.
   52.11 - *
   52.12 - * The contents of this file are subject to the terms of either the GNU
   52.13 - * General Public License Version 2 only ("GPL") or the Common
   52.14 - * Development and Distribution License("CDDL") (collectively, the
   52.15 - * "License"). You may not use this file except in compliance with the
   52.16 - * License. You can obtain a copy of the License at
   52.17 - * http://www.netbeans.org/cddl-gplv2.html
   52.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   52.19 - * specific language governing permissions and limitations under the
   52.20 - * License.  When distributing the software, include this License Header
   52.21 - * Notice in each file and include the License file at
   52.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   52.23 - * particular file as subject to the "Classpath" exception as provided
   52.24 - * by Oracle in the GPL Version 2 section of the License file that
   52.25 - * accompanied this code. If applicable, add the following below the
   52.26 - * License Header, with the fields enclosed by brackets [] replaced by
   52.27 - * your own identifying information:
   52.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   52.29 - *
   52.30 - * If you wish your version of this file to be governed by only the CDDL
   52.31 - * or only the GPL Version 2, indicate your decision by adding
   52.32 - * "[Contributor] elects to include this software in this distribution
   52.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   52.34 - * single choice of license, a recipient has the option to distribute
   52.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   52.36 - * to extend the choice of license to its licensees as provided above.
   52.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   52.38 - * Version 2 license, then the option applies only if the new code is
   52.39 - * made subject to such option by the copyright holder.
   52.40 - *
   52.41 - * Contributor(s):
   52.42 - *
   52.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
   52.44 - */
   52.45 -package org.netbeans.modules.plsql.palette.item.errorhandling;
   52.46 -
   52.47 -import org.netbeans.modules.plsql.palette.PaletteItem;
   52.48 -/**
   52.49 - * Class for adding IFS record general code template
   52.50 - * @author IFS
   52.51 - */
   52.52 -public class IFSRecordGeneral extends PaletteItem{
   52.53 -    
   52.54 -    /** Creates a new instance of IFSRecordGeneral */
   52.55 -    public IFSRecordGeneral() {        
   52.56 -    }
   52.57 -    
   52.58 -    public String createBody(){
   52.59 -        String exe;         
   52.60 -        exe = "Error_SYS.Record_General(lu_name_, '${<errorID>}: ${<text>}');\n${cursor}";        
   52.61 -        return exe;
   52.62 -    }
   52.63 -}
    53.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/resource/Bundle.properties	Wed Dec 07 13:36:21 2011 +0100
    53.2 +++ b/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/resource/Bundle.properties	Tue Feb 14 17:31:28 2012 +0100
    53.3 @@ -12,11 +12,3 @@
    53.4  HINT_PLSQL-ExceptionInit=\
    53.5   <Exception_name> EXCEPTION;\
    53.6   PRAGMA EXCEPTION_INIT(<exception_name>, -<number>);
    53.7 -
    53.8 -NAME_PLSQL-IFSItemGeneral = IFS Item General
    53.9 -HINT_PLSQL-IFSItemGeneral=\
   53.10 -Error_SYS.Item_General(lu_name_,'<attribute>', '<errorID>: <text>');
   53.11 -
   53.12 -NAME_PLSQL-IFSRecordGeneral = IFS Record General
   53.13 -HINT_PLSQL-IFSRecordGeneral=\
   53.14 -Error_SYS.Record_General(lu_name_, '<errorID>: <text>');
   53.15 \ No newline at end of file
    54.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/resource/IFSItemGeneral.xml	Wed Dec 07 13:36:21 2011 +0100
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,10 +0,0 @@
    54.4 -<?xml version="1.0" encoding="UTF-8"?>
    54.5 -<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
    54.6 -<editor_palette_item version="1.0">
    54.7 -   <class name="org.netbeans.modules.plsql.palette.item.errorhandling.IFSItemGeneral"/>
    54.8 -   <icon16 urlvalue = "org/netbeans/modules/plsql/palette/item/errorhandling/resource/error.png"/>
    54.9 -   <icon32 urlvalue = "org/netbeans/modules/plsql/palette/item/loop/errorhandling/error.png"/>
   54.10 -   <description localizing-bundle="org.netbeans.modules.plsql.palette.item.errorhandling.resource.Bundle"
   54.11 -                display-name-key="NAME_PLSQL-IFSItemGeneral"
   54.12 -                tooltip-key="HINT_PLSQL-IFSItemGeneral" />
   54.13 -</editor_palette_item>
   54.14 \ No newline at end of file
    55.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/errorhandling/resource/IFSRecordGeneral.xml	Wed Dec 07 13:36:21 2011 +0100
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,10 +0,0 @@
    55.4 -<?xml version="1.0" encoding="UTF-8"?>
    55.5 -<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
    55.6 -<editor_palette_item version="1.0">
    55.7 -   <class name="org.netbeans.modules.plsql.palette.item.errorhandling.IFSRecordGeneral"/>
    55.8 -   <icon16 urlvalue = "org/netbeans/modules/plsql/palette/item/errorhandling/resource/error.png"/>
    55.9 -   <icon32 urlvalue = "org/netbeans/modules/plsql/palette/item/loop/errorhandling/error.png"/>
   55.10 -   <description localizing-bundle="org.netbeans.modules.plsql.palette.item.errorhandling.resource.Bundle"
   55.11 -                display-name-key="NAME_PLSQL-IFSRecordGeneral"
   55.12 -                tooltip-key="HINT_PLSQL-IFSRecordGeneral" />
   55.13 -</editor_palette_item>
   55.14 \ No newline at end of file
    56.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/reports/resource/Bundle.properties	Wed Dec 07 13:36:21 2011 +0100
    56.2 +++ b/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/reports/resource/Bundle.properties	Tue Feb 14 17:31:28 2012 +0100
    56.3 @@ -11,8 +11,4 @@
    56.4  NAME_List_Tablespaces = List Tablespaces
    56.5  HINT_List_Tablespaces = List Tablespaces
    56.6  NAME_Remove_Debug_Info = Remove Debug Information From All Debug Compiled Packages
    56.7 -HINT_Remove_Debug_Info = Remove Debug Information From All Debug Compiled Packages
    56.8 -NAME_Refresh_Dictionary = Refresh Dictionary Cache
    56.9 -HINT_Refresh_Dictionary = Refresh Dictionary Cache
   56.10 -NAME_Grant_Ifssys = Grant IFSSYS
   56.11 -HINT_Grant_Ifssys = Grant database objects needed by Extended Server
   56.12 \ No newline at end of file
   56.13 +HINT_Remove_Debug_Info = Remove Debug Information From All Debug Compiled Packages
   56.14 \ No newline at end of file
    57.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/reports/resource/GrantIfssys.xml	Wed Dec 07 13:36:21 2011 +0100
    57.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.3 @@ -1,17 +0,0 @@
    57.4 -<?xml version="1.0" encoding="UTF-8"?>
    57.5 -<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
    57.6 -<editor_palette_item version="1.0">
    57.7 -    <body>
    57.8 -        <![CDATA[
    57.9 -BEGIN
   57.10 -   Installation_SYS.Grant_Privileged_Grantee('IFSSYS', TRUE);
   57.11 -END;
   57.12 -/
   57.13 -        ]]>
   57.14 -    </body>
   57.15 -    <icon16 urlvalue="org/netbeans/modules/palette/resources/unknown16.gif" />
   57.16 -    <icon32 urlvalue="org/netbeans/modules/palette/resources/unknown32.gif" />
   57.17 -    <description localizing-bundle="org.netbeans.modules.plsql.palette.item.reports.resource.Bundle"
   57.18 -                 display-name-key="NAME_Grant_Ifssys"
   57.19 -                 tooltip-key="HINT_Grant_Ifssys" />
   57.20 -</editor_palette_item>
   57.21 \ No newline at end of file
    58.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/item/reports/resource/RefreshDictionary.xml	Wed Dec 07 13:36:21 2011 +0100
    58.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.3 @@ -1,17 +0,0 @@
    58.4 -<?xml version="1.0" encoding="UTF-8"?>
    58.5 -<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
    58.6 -<editor_palette_item version="1.0">
    58.7 -     <body>
    58.8 -        <![CDATA[
    58.9 -BEGIN
   58.10 -    Dictionary_SYS.Rebuild_Dictionary_Storage_(0);
   58.11 -END;
   58.12 -/
   58.13 -]]>
   58.14 -    </body>
   58.15 -    <icon16 urlvalue="org/netbeans/modules/palette/resources/unknown16.gif" />
   58.16 -    <icon32 urlvalue="org/netbeans/modules/palette/resources/unknown32.gif" />
   58.17 -    <description localizing-bundle="org.netbeans.modules.plsql.palette.item.reports.resource.Bundle"
   58.18 -                 display-name-key="NAME_Refresh_Dictionary"
   58.19 -                 tooltip-key="HINT_Refresh_Dictionary" />
   58.20 -</editor_palette_item>
   58.21 \ No newline at end of file
    59.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/layer.xml	Wed Dec 07 13:36:21 2011 +0100
    59.2 +++ b/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/layer.xml	Tue Feb 14 17:31:28 2012 +0100
    59.3 @@ -54,9 +54,7 @@
    59.4        </folder>
    59.5        <folder name="Error Handling">
    59.6           <file name="ExceptionBlock.xml" url="item/errorhandling/resource/ExceptionBlock.xml"/>
    59.7 -         <file name="ExceptionInit.xml" url="item/errorhandling/resource/ExceptionInit.xml"/>
    59.8 -         <file name="IFSItemGeneral.xml" url="item/errorhandling/resource/IFSItemGeneral.xml"/>
    59.9 -         <file name="IFSRecordGeneral.xml" url="item/errorhandling/resource/IFSRecordGeneral.xml"/>
   59.10 +         <file name="ExceptionInit.xml" url="item/errorhandling/resource/ExceptionInit.xml"/>         
   59.11        </folder>
   59.12        <folder name="Package elements">
   59.13           <file name="FunctionDeclaration.xml" url="item/packageelements/resource/FunctionDeclaration.xml"/>
   59.14 @@ -182,9 +180,7 @@
   59.15           <file name="CompileInvalidObjects.xml" url="item/reports/resource/CompileInvalidObjects.xml"/>
   59.16           <file name="DebugCompilePackages.xml" url="item/reports/resource/DebugCompilePackages.xml"/>
   59.17           <file name="ListDebugCompiledPkgs.xml" url="item/reports/resource/ListDebugCompiledPkgs.xml"/>      
   59.18 -         <file name="RemoveDebugInfo.xml" url="item/reports/resource/RemoveDebugInfo.xml"/>
   59.19 -         <file name="RefreshDictionary.xml" url="item/reports/resource/RefreshDictionary.xml"/>
   59.20 -         <file name="GrantIfssys.xml" url="item/reports/resource/GrantIfssys.xml"/>
   59.21 +         <file name="RemoveDebugInfo.xml" url="item/reports/resource/RemoveDebugInfo.xml"/>         
   59.22        </folder>
   59.23     </folder>
   59.24  </filesystem>
    60.1 --- a/PLSQL/Project/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    60.2 +++ b/PLSQL/Project/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    60.3 @@ -1,6 +1,9 @@
    60.4  Manifest-Version: 1.0
    60.5 +Ant-Version: Apache Ant 1.8.1
    60.6 +Created-By: 1.6.0_22-b22 (Sun Microsystems Inc.)
    60.7  AutoUpdate-Show-In-Client: false
    60.8  OpenIDE-Module: org.netbeans.modules.plsqlsupport.db.project
    60.9 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsqlsupport/db/project/Bundle.properties
   60.10 -OpenIDE-Module-Specification-Version: 1.0
   60.11 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsqlsupport/db
   60.12 + /project/Bundle.properties
   60.13 +OpenIDE-Module-Specification-Version: 1.0.1
   60.14  
    61.1 --- a/PLSQL/Usage/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    61.2 +++ b/PLSQL/Usage/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    61.3 @@ -4,7 +4,7 @@
    61.4  AutoUpdate-Show-In-Client: false
    61.5  OpenIDE-Module: org.netbeans.modules.plsql.usage
    61.6  OpenIDE-Module-Layer: org/netbeans/modules/plsql/usage/layer.xml
    61.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/usage/Bundle.proper
    61.8 - ties
    61.9 -OpenIDE-Module-Specification-Version: 1.8.3
   61.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/usage/Bun
   61.11 + dle.properties
   61.12 +OpenIDE-Module-Specification-Version: 1.8.5
   61.13  
    62.1 --- a/PLSQL/Usage/src/org/netbeans/modules/plsql/usage/FindUsagesAction.java	Wed Dec 07 13:36:21 2011 +0100
    62.2 +++ b/PLSQL/Usage/src/org/netbeans/modules/plsql/usage/FindUsagesAction.java	Tue Feb 14 17:31:28 2012 +0100
    62.3 @@ -110,53 +110,54 @@
    62.4        RP.post(this);
    62.5     }
    62.6  
    62.7 -   @Override
    62.8 -   public void run() {
    62.9 -//      final EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
   62.10 -      final DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
   62.11 +    @Override
   62.12 +    public void run() {
   62.13 +        final DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
   62.14  
   62.15 -      final ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Searching for usages...");
   62.16 +        final ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Searching for usages...");
   62.17  
   62.18 -      if (dataObject != null) {
   62.19 +        if (dataObject != null) {
   62.20  
   62.21 -         final Project project = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());//activatedNodes[0].getLookup().lookup(Project.class);
   62.22 -         if (project != null) {
   62.23 -            final DatabaseConnectionManager provider = DatabaseConnectionManager.getInstance(dataObject);
   62.24 -            final DatabaseConnection connection = provider.getPooledDatabaseConnection(false, true);
   62.25 +            final Project project = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
   62.26 +            if (project != null) {
   62.27 +                final DatabaseConnectionManager provider = DatabaseConnectionManager.getInstance(dataObject);
   62.28 +                final DatabaseConnection connection = provider.getPooledDatabaseConnection(false, true);
   62.29  
   62.30 -            if (connection == null || connection.getJDBCConnection() == null) {
   62.31 -               return;
   62.32 +                if (connection == null || connection.getJDBCConnection() == null) {
   62.33 +                    return;
   62.34 +                }
   62.35 +
   62.36 +                    try {
   62.37 +                        progressHandle.start();
   62.38 +
   62.39 +                        signature = getSignature(connection, packageName, object_type, context, false);
   62.40 +
   62.41 +                        final List<PlsqlElement> list = getUsageList(connection, project);
   62.42 +                        SwingUtilities.invokeLater(new Runnable() {
   62.43 +
   62.44 +                            @Override
   62.45 +                            public void run() {
   62.46 +                                PlsqlUsagePanel up = new PlsqlUsagePanel(list, selectedName, usageCount, project);
   62.47 +                            }
   62.48 +                        });
   62.49 +
   62.50 +                    } catch (SQLException ex) {
   62.51 +                        if (provider.testConnection(connection)) {
   62.52 +                            final NotifyDescriptor d = new NotifyDescriptor.Message("Find usages not supported in this database. Please refer to the documentation for details.",
   62.53 +                                    NotifyDescriptor.INFORMATION_MESSAGE);
   62.54 +                            DialogDisplayer.getDefault().notify(d);
   62.55 +                        } else {
   62.56 +                            final NotifyDescriptor d = new NotifyDescriptor.Message("You are not connected to a database.",
   62.57 +                                    NotifyDescriptor.INFORMATION_MESSAGE);
   62.58 +                            DialogDisplayer.getDefault().notify(d);
   62.59 +                        }
   62.60 +                    } finally {
   62.61 +                        provider.releaseDatabaseConnection(connection);
   62.62 +                        progressHandle.finish();
   62.63 +                    }
   62.64              }
   62.65 -            try {
   62.66 -               progressHandle.start();
   62.67 -               signature = getSignature(connection, packageName, object_type, context, false);
   62.68 -
   62.69 -               final List<PlsqlElement> list = getUsageList(connection, project);
   62.70 -               SwingUtilities.invokeLater(new Runnable() {
   62.71 -
   62.72 -                  @Override
   62.73 -                  public void run() {
   62.74 -                     PlsqlUsagePanel up = new PlsqlUsagePanel(list, selectedName, usageCount, project);
   62.75 -                  }
   62.76 -               });
   62.77 -
   62.78 -            } catch (SQLException ex) {
   62.79 -               if (provider.testConnection(connection)) {
   62.80 -                  final NotifyDescriptor d = new NotifyDescriptor.Message("Find usages not supported in this database. Please refer to the documentation for details.",
   62.81 -                          NotifyDescriptor.INFORMATION_MESSAGE);
   62.82 -                  DialogDisplayer.getDefault().notify(d);
   62.83 -               } else {
   62.84 -                  final NotifyDescriptor d = new NotifyDescriptor.Message("You are not connected to a database.",
   62.85 -                          NotifyDescriptor.INFORMATION_MESSAGE);
   62.86 -                  DialogDisplayer.getDefault().notify(d);
   62.87 -               }
   62.88 -            } finally {
   62.89 -               provider.releaseDatabaseConnection(connection);
   62.90 -               progressHandle.finish();
   62.91 -            }
   62.92 -         }
   62.93 -      }
   62.94 -   }
   62.95 +        }
   62.96 +    }
   62.97  
   62.98     @Override
   62.99     protected int mode() {
  62.100 @@ -365,33 +366,67 @@
  62.101        return list;
  62.102     }
  62.103  
  62.104 -   protected String getSignature(final DatabaseConnection connection, final String packageName, final String object_type, final String context, final boolean typeKnown) throws SQLException {
  62.105 -      ResultSet rs = null;
  62.106 -      PreparedStatement stmt = null;
  62.107 -      String sqlSelect = null;
  62.108 -      try {
  62.109 -         sqlSelect = "select a.signature, a.type from all_identifiers a, all_identifiers b "
  62.110 -                 + "where a.USAGE_CONTEXT_ID = b.USAGE_ID "
  62.111 -                 + "AND a.name='" + selectedName.toUpperCase(Locale.ENGLISH) + "' "
  62.112 -                 + "AND a.Object_Name='" + packageName.toUpperCase(Locale.ENGLISH) + "' "
  62.113 -                 + "AND a.OBJECT_NAME = b.OBJECT_NAME "
  62.114 -                 + "AND a.object_type='" + object_type.toUpperCase(Locale.ENGLISH) + "' "
  62.115 -                 + "AND a.OBJECT_TYPE =  b.OBJECT_TYPE "
  62.116 -                 + "AND (b.usage = 'DEFINITION' OR b.usage = 'DECLARATION') "
  62.117 -                 + ((isFunctionOrProcedure) ? "AND (a.type ='FUNCTION' OR a.type='PROCEDURE')" : "AND b.name = '" + context.toUpperCase(Locale.ENGLISH) + "'");
  62.118 +    protected String getSignature(final DatabaseConnection connection, final String packageName, final String object_type, final String context, final boolean typeKnown) throws SQLException {
  62.119 +        ResultSet rs = null;
  62.120 +        PreparedStatement stmt = null;
  62.121 +        String sqlSelect = null;
  62.122 +        try {
  62.123 +            sqlSelect = "select a.signature, a.type from all_identifiers a, all_identifiers b "
  62.124 +                    + "where a.USAGE_CONTEXT_ID = b.USAGE_ID "
  62.125 +                    + "AND a.name='" + selectedName.toUpperCase(Locale.ENGLISH) + "' "
  62.126 +                    + "AND a.Object_Name='" + packageName.toUpperCase(Locale.ENGLISH) + "' "
  62.127 +                    + "AND a.OBJECT_NAME = b.OBJECT_NAME "
  62.128 +                    + "AND a.object_type='" + object_type.toUpperCase(Locale.ENGLISH) + "' "
  62.129 +                    + "AND a.OBJECT_TYPE =  b.OBJECT_TYPE "
  62.130 +                    + "AND (b.usage = 'DEFINITION' OR b.usage = 'DECLARATION') "
  62.131 +                    + ((isFunctionOrProcedure) ? "AND (a.type ='FUNCTION' OR a.type='PROCEDURE')" : "AND b.name = '" + context.toUpperCase(Locale.ENGLISH) + "'");
  62.132  
  62.133 -         stmt = connection.getJDBCConnection().prepareStatement(sqlSelect);
  62.134 -         rs = stmt.executeQuery();
  62.135 -         if (rs.next()) {
  62.136 -            return rs.getString("SIGNATURE");
  62.137 -         }
  62.138 -      } finally {
  62.139 -         if (stmt != null) {
  62.140 -            stmt.close();
  62.141 -         }
  62.142 -      }
  62.143 -      return null;
  62.144 -   }
  62.145 +            stmt = connection.getJDBCConnection().prepareStatement(sqlSelect);
  62.146 +            rs = stmt.executeQuery();
  62.147 +            if (rs.next()) {
  62.148 +                return rs.getString("SIGNATURE");
  62.149 +            } else if (!isFindUsagesEnabled(connection)) {
  62.150 +                final NotifyDescriptor d = new NotifyDescriptor.Message("Find usages disabled. The database setting PLSCOPE_SETTINGS must be set to 'IDENTIFIERS:ALL' to enable the functionality.",
  62.151 +                        NotifyDescriptor.INFORMATION_MESSAGE);
  62.152 +                DialogDisplayer.getDefault().notify(d);
  62.153 +            }
  62.154 +        } finally {
  62.155 +            if (stmt != null) {
  62.156 +                stmt.close();
  62.157 +            }
  62.158 +        }
  62.159 +        return null;
  62.160 +    }
  62.161 +   
  62.162 +    private boolean isFindUsagesEnabled(DatabaseConnection connection) {
  62.163 +        ResultSet rs = null;
  62.164 +        PreparedStatement stmt = null;
  62.165 +        String setting = null;
  62.166 +
  62.167 +        try {
  62.168 +            String sqlSelect = "SELECT PLSCOPE_SETTINGS FROM ALL_PLSQL_OBJECT_SETTINGS WHERE NAME = \'SECURITY_SYS\' AND TYPE = \'PACKAGE\'";
  62.169 +            stmt = connection.getJDBCConnection().prepareStatement(sqlSelect);
  62.170 +            rs = stmt.executeQuery();
  62.171 +            if (rs.next()) {
  62.172 +                setting = rs.getString(1);
  62.173 +            }
  62.174 +
  62.175 +            if (setting != null && setting.equalsIgnoreCase("IDENTIFIERS:ALL")) {
  62.176 +                return true;
  62.177 +            }
  62.178 +        } catch (SQLException ex) {
  62.179 +            // do nothing
  62.180 +        } finally {
  62.181 +            if (stmt != null) {
  62.182 +                try {
  62.183 +                    stmt.close();
  62.184 +                } catch (SQLException ex) {
  62.185 +                       // do nothing
  62.186 +                }
  62.187 +            }
  62.188 +        }
  62.189 +        return false;
  62.190 +    }
  62.191  
  62.192     private String getPackageName(final DataObject dataObject) {
  62.193        String packName = "";
    63.1 --- a/PLSQL/Utilities/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    63.2 +++ b/PLSQL/Utilities/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    63.3 @@ -3,7 +3,7 @@
    63.4  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    63.5  AutoUpdate-Show-In-Client: false
    63.6  OpenIDE-Module: org.netbeans.modules.plsql.utilities
    63.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/utilities/Bundle.pr
    63.8 - operties
    63.9 -OpenIDE-Module-Specification-Version: 1.7.17
   63.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/utilities
   63.11 + /Bundle.properties
   63.12 +OpenIDE-Module-Specification-Version: 1.7.20
   63.13  
    64.1 --- a/PLSQL/Utilities/nbproject/project.xml	Wed Dec 07 13:36:21 2011 +0100
    64.2 +++ b/PLSQL/Utilities/nbproject/project.xml	Tue Feb 14 17:31:28 2012 +0100
    64.3 @@ -15,15 +15,6 @@
    64.4                      </run-dependency>
    64.5                  </dependency>
    64.6                  <dependency>
    64.7 -                    <code-name-base>org.jdesktop.layout</code-name-base>
    64.8 -                    <build-prerequisite/>
    64.9 -                    <compile-dependency/>
   64.10 -                    <run-dependency>
   64.11 -                        <release-version>1</release-version>
   64.12 -                        <specification-version>1.16.1</specification-version>
   64.13 -                    </run-dependency>
   64.14 -                </dependency>
   64.15 -                <dependency>
   64.16                      <code-name-base>org.netbeans.api.progress</code-name-base>
   64.17                      <build-prerequisite/>
   64.18                      <compile-dependency/>
   64.19 @@ -85,6 +76,14 @@
   64.20                      </run-dependency>
   64.21                  </dependency>
   64.22                  <dependency>
   64.23 +                    <code-name-base>org.openide.awt</code-name-base>
   64.24 +                    <build-prerequisite/>
   64.25 +                    <compile-dependency/>
   64.26 +                    <run-dependency>
   64.27 +                        <specification-version>7.31.1</specification-version>
   64.28 +                    </run-dependency>
   64.29 +                </dependency>
   64.30 +                <dependency>
   64.31                      <code-name-base>org.openide.filesystems</code-name-base>
   64.32                      <build-prerequisite/>
   64.33                      <compile-dependency/>
    65.1 --- a/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/LogInWarningDialog.form	Wed Dec 07 13:36:21 2011 +0100
    65.2 +++ b/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/LogInWarningDialog.form	Tue Feb 14 17:31:28 2012 +0100
    65.3 @@ -14,7 +14,7 @@
    65.4      <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
    65.5      <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
    65.6      <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
    65.7 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
    65.8 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
    65.9      <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   65.10      <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   65.11      <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
    66.1 --- a/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/LogInWarningDialog.java	Wed Dec 07 13:36:21 2011 +0100
    66.2 +++ b/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/LogInWarningDialog.java	Tue Feb 14 17:31:28 2012 +0100
    66.3 @@ -60,74 +60,74 @@
    66.4      * WARNING: Do NOT modify this code. The content of this method is
    66.5      * always regenerated by the Form Editor.
    66.6      */
    66.7 -   // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    66.8 -   private void initComponents() {
    66.9 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   66.10 +    private void initComponents() {
   66.11  
   66.12 -      jPanel1 = new javax.swing.JPanel();
   66.13 -      jLabel1 = new javax.swing.JLabel();
   66.14 -      jLabel2 = new javax.swing.JLabel();
   66.15 -      jButton1 = new javax.swing.JButton();
   66.16 +        jPanel1 = new javax.swing.JPanel();
   66.17 +        jLabel1 = new javax.swing.JLabel();
   66.18 +        jLabel2 = new javax.swing.JLabel();
   66.19 +        jButton1 = new javax.swing.JButton();
   66.20  
   66.21 -      setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
   66.22 -      setResizable(false);
   66.23 +        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
   66.24 +        setResizable(false);
   66.25  
   66.26 -      jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
   66.27 +        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
   66.28  
   66.29 -      jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/plsql/utilities/LogInWarning.gif"))); // NOI18N
   66.30 +        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/plsql/utilities/LogInWarning.gif"))); // NOI18N
   66.31  
   66.32 -      jLabel2.setFont(new java.awt.Font("Arial", 0, 12));
   66.33 -      jLabel2.setText("Please Connect to the DataBase");
   66.34 +        jLabel2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
   66.35 +        jLabel2.setText("Please Connect to the DataBase");
   66.36  
   66.37 -      jButton1.setText("OK");
   66.38 -      jButton1.addActionListener(new java.awt.event.ActionListener() {
   66.39 -         public void actionPerformed(java.awt.event.ActionEvent evt) {
   66.40 -            jButton1ActionPerformed(evt);
   66.41 -         }
   66.42 -      });
   66.43 +        jButton1.setText("OK");
   66.44 +        jButton1.addActionListener(new java.awt.event.ActionListener() {
   66.45 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
   66.46 +                jButton1ActionPerformed(evt);
   66.47 +            }
   66.48 +        });
   66.49  
   66.50 -      org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
   66.51 -      jPanel1.setLayout(jPanel1Layout);
   66.52 -      jPanel1Layout.setHorizontalGroup(
   66.53 -         jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   66.54 -         .add(jPanel1Layout.createSequentialGroup()
   66.55 -            .add(jLabel1)
   66.56 -            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   66.57 -               .add(jPanel1Layout.createSequentialGroup()
   66.58 -                  .add(46, 46, 46)
   66.59 -                  .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
   66.60 -               .add(jPanel1Layout.createSequentialGroup()
   66.61 -                  .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
   66.62 -                  .add(jLabel2))))
   66.63 -      );
   66.64 -      jPanel1Layout.setVerticalGroup(
   66.65 -         jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   66.66 -         .add(jPanel1Layout.createSequentialGroup()
   66.67 -            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
   66.68 -               .add(jLabel1)
   66.69 -               .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
   66.70 -            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
   66.71 -            .add(jButton1))
   66.72 -      );
   66.73 +        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
   66.74 +        jPanel1.setLayout(jPanel1Layout);
   66.75 +        jPanel1Layout.setHorizontalGroup(
   66.76 +            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
   66.77 +            .addGroup(jPanel1Layout.createSequentialGroup()
   66.78 +                .addComponent(jLabel1)
   66.79 +                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
   66.80 +                    .addGroup(jPanel1Layout.createSequentialGroup()
   66.81 +                        .addGap(46, 46, 46)
   66.82 +                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
   66.83 +                    .addGroup(jPanel1Layout.createSequentialGroup()
   66.84 +                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
   66.85 +                        .addComponent(jLabel2))))
   66.86 +        );
   66.87 +        jPanel1Layout.setVerticalGroup(
   66.88 +            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
   66.89 +            .addGroup(jPanel1Layout.createSequentialGroup()
   66.90 +                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
   66.91 +                    .addComponent(jLabel1)
   66.92 +                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
   66.93 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
   66.94 +                .addComponent(jButton1))
   66.95 +        );
   66.96  
   66.97 -      org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
   66.98 -      getContentPane().setLayout(layout);
   66.99 -      layout.setHorizontalGroup(
  66.100 -         layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  66.101 -         .add(layout.createSequentialGroup()
  66.102 -            .addContainerGap()
  66.103 -            .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  66.104 -            .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  66.105 -      );
  66.106 -      layout.setVerticalGroup(
  66.107 -         layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  66.108 -         .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
  66.109 -            .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  66.110 -            .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  66.111 -            .addContainerGap())
  66.112 -      );
  66.113 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  66.114 +        getContentPane().setLayout(layout);
  66.115 +        layout.setHorizontalGroup(
  66.116 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  66.117 +            .addGroup(layout.createSequentialGroup()
  66.118 +                .addContainerGap()
  66.119 +                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  66.120 +                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  66.121 +        );
  66.122 +        layout.setVerticalGroup(
  66.123 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  66.124 +            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  66.125 +                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  66.126 +                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  66.127 +                .addContainerGap())
  66.128 +        );
  66.129  
  66.130 -      pack();
  66.131 -   }// </editor-fold>//GEN-END:initComponents
  66.132 +        pack();
  66.133 +    }// </editor-fold>//GEN-END:initComponents
  66.134      private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
  66.135         // TODO add your handling code here:
  66.136         this.setVisible(false);
  66.137 @@ -145,10 +145,10 @@
  66.138           }
  66.139        });
  66.140     }
  66.141 -   // Variables declaration - do not modify//GEN-BEGIN:variables
  66.142 -   private javax.swing.JButton jButton1;
  66.143 -   private javax.swing.JLabel jLabel1;
  66.144 -   private javax.swing.JLabel jLabel2;
  66.145 -   private javax.swing.JPanel jPanel1;
  66.146 -   // End of variables declaration//GEN-END:variables
  66.147 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  66.148 +    private javax.swing.JButton jButton1;
  66.149 +    private javax.swing.JLabel jLabel1;
  66.150 +    private javax.swing.JLabel jLabel2;
  66.151 +    private javax.swing.JPanel jPanel1;
  66.152 +    // End of variables declaration//GEN-END:variables
  66.153  }
    67.1 --- a/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/localization/PlsqlFileFinder.java	Wed Dec 07 13:36:21 2011 +0100
    67.2 +++ b/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/localization/PlsqlFileFinder.java	Tue Feb 14 17:31:28 2012 +0100
    67.3 @@ -1,7 +1,7 @@
    67.4  /*
    67.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    67.6   *
    67.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    67.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    67.9   *
   67.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   67.11   * Other names may be trademarks of their respective owners.
   67.12 @@ -41,14 +41,8 @@
   67.13   */
   67.14  package org.netbeans.modules.plsql.utilities.localization;
   67.15  
   67.16 -import org.netbeans.modules.plsql.utilities.PlsqlFileValidator;
   67.17  import java.io.File;
   67.18 -import java.util.ArrayList;
   67.19 -import java.util.Arrays;
   67.20 -import java.util.Calendar;
   67.21 -import java.util.Collection;
   67.22 -import java.util.Date;
   67.23 -import java.util.List;
   67.24 +import java.util.*;
   67.25  import java.util.logging.Level;
   67.26  import java.util.logging.Logger;
   67.27  import org.apache.commons.io.FileUtils;
   67.28 @@ -57,6 +51,7 @@
   67.29  import org.apache.commons.io.filefilter.IOFileFilter;
   67.30  import org.apache.commons.io.filefilter.PrefixFileFilter;
   67.31  import org.apache.commons.io.filefilter.SuffixFileFilter;
   67.32 +import org.netbeans.modules.plsql.utilities.PlsqlFileValidator;
   67.33  import org.openide.util.Lookup;
   67.34  
   67.35  /**
    68.1 --- a/Utilities/Oracle/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    68.2 +++ b/Utilities/Oracle/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    68.3 @@ -2,8 +2,9 @@
    68.4  Ant-Version: Apache Ant 1.7.1
    68.5  Created-By: 14.3-b01 (Sun Microsystems Inc.)
    68.6  OpenIDE-Module: org.netbeans.modules.plsqlsupport.db
    68.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsqlsupport/db/Bundle.properties
    68.8 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsqlsupport/db
    68.9 + /Bundle.properties
   68.10  OpenIDE-Module-Layer: org/netbeans/modules/plsqlsupport/db/layer.xml
   68.11 -OpenIDE-Module-Specification-Version: 1.8.14
   68.12 +OpenIDE-Module-Specification-Version: 1.8.18
   68.13  AutoUpdate-Show-In-Client: false
   68.14  
    69.1 --- a/Utilities/Oracle/src/org/netbeans/modules/plsqlsupport/db/ui/Bundle.properties	Wed Dec 07 13:36:21 2011 +0100
    69.2 +++ b/Utilities/Oracle/src/org/netbeans/modules/plsqlsupport/db/ui/Bundle.properties	Tue Feb 14 17:31:28 2012 +0100
    69.3 @@ -1,7 +1,7 @@
    69.4  LBL_DatabaseNodeName=Database
    69.5  CTL_SQLExecutionAction=Execute Command...
    69.6 -CTL_RebuildCacheAction=Clear and Refresh Cache of Main Database
    69.7 -CTL_UpdateCacheAction=Refresh Cache of Main Database
    69.8 +CTL_RebuildCacheAction=Clear and Refresh Code Completion Cache
    69.9 +CTL_UpdateCacheAction=Refresh Code Completion Cache
   69.10  CTL_OracleOnlineAction=Work Online
   69.11  CTL_ShowAllDbPackagesAction=List PL/SQL Packages
   69.12  CTL_ShowAllDbTablesAction=List Tables
    70.1 --- a/Utilities/Oracle/src/org/netbeans/modules/plsqlsupport/db/ui/SQLExecutionAction.java	Wed Dec 07 13:36:21 2011 +0100
    70.2 +++ b/Utilities/Oracle/src/org/netbeans/modules/plsqlsupport/db/ui/SQLExecutionAction.java	Tue Feb 14 17:31:28 2012 +0100
    70.3 @@ -1,7 +1,7 @@
    70.4  /*
    70.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    70.6   *
    70.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    70.8 + * Copyright 2011-2012 Oracle and/or its affiliates. All rights reserved.
    70.9   *
   70.10   * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   70.11   * Other names may be trademarks of their respective owners.
   70.12 @@ -41,8 +41,8 @@
   70.13   */
   70.14  package org.netbeans.modules.plsqlsupport.db.ui;
   70.15  
   70.16 +import org.netbeans.api.project.Project;
   70.17  import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
   70.18 -import org.netbeans.api.project.Project;
   70.19  import org.openide.nodes.Node;
   70.20  import org.openide.util.HelpCtx;
   70.21  import org.openide.util.NbBundle;
   70.22 @@ -50,10 +50,12 @@
   70.23  
   70.24  public final class SQLExecutionAction extends CookieAction {
   70.25  
   70.26 +    @Override
   70.27      protected void performAction(Node[] activatedNodes) {
   70.28          SQLCommandWindow.createSQLCommandWindow(activatedNodes, null, null);
   70.29      }
   70.30  
   70.31 +    @Override
   70.32      public String getName() {
   70.33          return NbBundle.getMessage(SQLExecutionAction.class, "CTL_SQLExecutionAction");
   70.34      }
   70.35 @@ -65,6 +67,7 @@
   70.36          putValue("noIconInMenu", Boolean.TRUE);
   70.37      }
   70.38  
   70.39 +    @Override
   70.40      public HelpCtx getHelpCtx() {
   70.41          return HelpCtx.DEFAULT_HELP;
   70.42      }
    71.1 --- a/build.xml	Wed Dec 07 13:36:21 2011 +0100
    71.2 +++ b/build.xml	Tue Feb 14 17:31:28 2012 +0100
    71.3 @@ -56,7 +56,7 @@
    71.4      <target name="check-harness">
    71.5          <echo>nbplatform.default.netbeans.dest.dir resolved to ${nbplatform.default.netbeans.dest.dir}</echo>
    71.6          <echo>nbplatform.default.harness.dir resolved to ${nbplatform.default.harness.dir}</echo>
    71.7 -        <fail message="Harness is missing. Specify nbplatform.default.netbeans.dest.dir={path-to-your-sources-root}/ide/netbeans in nbproject/private/platform-private.propetries">
    71.8 +        <fail message="Harness is missing. Specify nbplatform.default.netbeans.dest.dir={path-to-your-sources-root}/ide/netbeans in nbproject/private/platform-private.properties">
    71.9              <condition>
   71.10                  <not>
   71.11                      <available file="${nbplatform.default.harness.dir}" type="dir"/>
   71.12 @@ -110,4 +110,172 @@
   71.13          </zip>
   71.14      </target>
   71.15  
   71.16 +   <property name="ant.contrib.jar" value="${basedir}/Libraries/ThirdParty/ant/ant-contrib-1.0b3.jar" />
   71.17 +   <taskdef resource="net/sf/antcontrib/antcontrib.properties">
   71.18 +      <classpath>
   71.19 +         <pathelement location="${ant.contrib.jar}"/>
   71.20 +      </classpath>
   71.21 +   </taskdef>
   71.22 +
   71.23 +   <path id="manifest.file.paths">
   71.24 +      <fileset dir="${basedir}">
   71.25 +         <include name="**/manifest.mf"/>
   71.26 +<!--            <exclude name="**/Libraries/ThirdParty/**"/>-->
   71.27 +      </fileset>
   71.28 +   </path>
   71.29 +
   71.30 +   <target name="-find-modules-for-update" description="find all modules in suite that has changes since last release" >
   71.31 +      <loadproperties srcfile="nbproject/project.properties" />
   71.32 +      <mkdir dir="build"/>
   71.33 +      <delete file="build/nbms_update.properties" />
   71.34 +
   71.35 +      <echo level="verbose">${modules}</echo>
   71.36 +
   71.37 +      <foreach param="module.path" target="-vcs-log" list="${modules}" delimiter=":"/>
   71.38 +      <propertyfile  file="build/nbms_update.properties">
   71.39 +         <entry key="selected.modules" default="" operation="+" value="plsql-support.kit/manifest.mf:"/>
   71.40 +      </propertyfile>
   71.41 +<!--        <echoproperties srcfile="build/nbms_update.properties" />-->
   71.42 +   </target>
   71.43 +
   71.44 +   <target name="-vcs-log" description="use mercurial to check if the last commit was a release commit">
   71.45 +      <echo level="info">module.path: ${module.path}</echo>
   71.46 +
   71.47 +        <!-- find out revision number of HEAD, need svn.exe installed on local machine -->
   71.48 +      <exec executable="hg" outputproperty="hglog.out" >
   71.49 +         <arg line="log -l 1 --style compact '${module.path}'"/>
   71.50 +      </exec>
   71.51 +      <echo level="verbose">${hglog.out}</echo>
   71.52 +
   71.53 +      <echo level="verbose">${force.increment}</echo>
   71.54 +      <condition property="nbm.update.needed">
   71.55 +         <or>
   71.56 +            <not>
   71.57 +               <contains string="${hglog.out}" substring="automated commit from "/>
   71.58 +            </not>
   71.59 +            <istrue value="${force.increment}" />
   71.60 +         </or>
   71.61 +      </condition>
   71.62 +      <echo level="verbose">nbm.update.needed=${nbm.update.needed}</echo>
   71.63 +      <antcall target="-concat-modules"  inheritall="true" />
   71.64 +   </target>
   71.65 +
   71.66 +   <target name="-concat-modules" if="nbm.update.needed" description="Concatinate the selected module paths and put in .properties file">
   71.67 +      <echo>Module needs to be updated: ${nbm.update.needed}</echo>
   71.68 +      <echo level="info">module.path: ${module.path}</echo>
   71.69 +      <propertyfile  file="build/nbms_update.properties">
   71.70 +         <entry key="selected.modules" default="" operation="+" value="${module.path}/manifest.mf:"/>
   71.71 +      </propertyfile>
   71.72 +   </target>
   71.73 +
   71.74 +   <target name="show-current-versions" description="show current specification versions for all modules">
   71.75 +      <foreach param="manifest.file" target="current-version" >
   71.76 +         <path refid="manifest.file.paths"/>
   71.77 +      </foreach>
   71.78 +   </target>
   71.79 +
   71.80 +   <target name="current-version" depends="-read-version" description="show current specification.version">
   71.81 +   </target>
   71.82 +
   71.83 +   <target name="incr-major" description="increment major version for modules with changes" depends="-find-modules-for-update">
   71.84 +      <loadproperties srcfile="build/nbms_update.properties" />
   71.85 +      <echo>selected.modules=${selected.modules}</echo>
   71.86 +      <foreach param="manifest.file" target="-major" >
   71.87 +         <path path="${selected.modules}"/>
   71.88 +      </foreach>
   71.89 +      <delete file="build_info.properties" />
   71.90 +   </target>
   71.91 +
   71.92 +   <target name="incr-minor" description="increment minor version for modules with changes" depends="-find-modules-for-update">
   71.93 +      <loadproperties srcfile="build/nbms_update.properties" />
   71.94 +      <echo>selected.modules=${selected.modules}</echo>
   71.95 +      <foreach param="manifest.file" target="-minor" >
   71.96 +         <path path="${selected.modules}"/>
   71.97 +      </foreach>
   71.98 +      <delete file="build_info.properties" />
   71.99 +   </target>
  71.100 +
  71.101 +   <target name="incr-revision" description="increment revision version for modules with changes" depends="-find-modules-for-update">
  71.102 +      <loadproperties srcfile="build/nbms_update.properties" />
  71.103 +      <echo>selected.modules=${selected.modules}</echo>
  71.104 +      <foreach param="manifest.file" target="-revision" >
  71.105 +         <path path="${selected.modules}"/>
  71.106 +      </foreach>
  71.107 +      <delete file="build_info.properties" />
  71.108 +   </target>
  71.109 +
  71.110 +   <target name="-read-version">
  71.111 +      <echo level="verbose">manifest.file: ${manifest.file}</echo>
  71.112 +      <property file="${manifest.file}"></property>
  71.113 +      <property name="specification.version" value="${OpenIDE-Module-Specification-Version}"/>
  71.114 +      <echo>OpenIDE-Module: ${OpenIDE-Module}</echo>
  71.115 +      <echo>Current build number:${specification.version}</echo>
  71.116 +      <propertyregex property="major.version" input="${specification.version}"  regexp="(\d+)\.(\d+)\.(\d+)$" select="\1" />
  71.117 +      <echo level="verbose">major: ${major.version}</echo>
  71.118 +      <propertyregex property="minor.version" input="${specification.version}"  regexp="(\d+)\.(\d+)\.(\d+)$" select="\2" />
  71.119 +      <echo level="verbose">minor: ${minor.version}</echo>
  71.120 +      <propertyregex property="revision.version" input="${specification.version}"  regexp="(\d+)\.(\d+)\.(\d+)$" select="\3" />
  71.121 +      <echo level="verbose">revision: ${revision.version}</echo>
  71.122 +      <propertyfile file="build_info.properties">
  71.123 +         <entry key="build.major.number" type="int" value="${major.version}" />
  71.124 +         <entry key="build.minor.number" type="int" value="${minor.version}" />
  71.125 +         <entry key="build.revision.number" type="int" value="${revision.version}" />
  71.126 +      </propertyfile>
  71.127 +   </target>
  71.128 +
  71.129 +   <target name="-revision" depends="-read-version">
  71.130 +      <propertyfile  file="build_info.properties">
  71.131 +         <entry key="build.revision.number" type="int" operation="+" value="1"/>
  71.132 +      </propertyfile>
  71.133 +
  71.134 +      <loadproperties srcfile="build_info.properties" />
  71.135 +      <manifest file="${manifest.file}" mode="update">
  71.136 +         <attribute name="OpenIDE-Module-Specification-Version" value="${build.major.number}.${build.minor.number}.${build.revision.number}" />
  71.137 +      </manifest>
  71.138 +      <replaceregexp match="(dependency\D*code-name-base\W${OpenIDE-Module}\W/\D*)(\d+\.\d+\.\d+)" byline="false"
  71.139 +      file="plsql-support.kit/nbproject/project.xml" replace="\1${build.major.number}.${build.minor.number}.${build.revision.number}"/>
  71.140 +   </target>
  71.141 +
  71.142 +   <target name="-minor" depends="-read-version">
  71.143 +      <propertyfile  file="build_info.properties">
  71.144 +         <entry key="build.minor.number" type="int" operation="+" value="1" />
  71.145 +         <entry key="build.revision.number" type="int" value="0" />
  71.146 +      </propertyfile>
  71.147 +      <loadproperties srcfile="build_info.properties" />
  71.148 +
  71.149 +      <manifest file="${manifest.file}" mode="update">
  71.150 +         <attribute name="OpenIDE-Module-Specification-Version" value="${build.major.number}.${build.minor.number}.${build.revision.number}" />
  71.151 +      </manifest>
  71.152 +      <replaceregexp match="(dependency\D*code-name-base\W${OpenIDE-Module}\W/\D*)(\d+\.\d+\.\d+)" byline="false"
  71.153 +      file="plsql-support.kit/nbproject/project.xml" replace="\1${build.major.number}.${build.minor.number}.${build.revision.number}"/>
  71.154 +   </target>
  71.155 +
  71.156 +   <target name="-major" depends="-read-version">
  71.157 +      <propertyfile  file="build_info.properties">
  71.158 +         <entry key="build.major.number" type="int" operation="+" value="1" />
  71.159 +         <entry key="build.minor.number" type="int" value="0" />
  71.160 +         <entry key="build.revision.number" type="int" value="0" />
  71.161 +      </propertyfile>
  71.162 +      <!--<echoproperties srcfile="build_info.properties" />-->
  71.163 +      <loadproperties srcfile="build_info.properties" />
  71.164 +
  71.165 +      <manifest file="${manifest.file}" mode="update" >
  71.166 +         <attribute name="OpenIDE-Module-Specification-Version" value="${build.major.number}.${build.minor.number}.${build.revision.number}" />
  71.167 +      </manifest>
  71.168 +      <replaceregexp match="(dependency\D*code-name-base\W${OpenIDE-Module}\W/\D*)(\d+\.\d+\.\d+)" byline="false"
  71.169 +      file="plsql-support.kit/nbproject/project.xml" replace="\1${build.major.number}.${build.minor.number}.${build.revision.number}"/>
  71.170 +   </target>
  71.171 +
  71.172 +   <target name="all">
  71.173 +      <propertyfile  file="build_info.properties">
  71.174 +         <entry key="build.major.number" type="int" operation="+" value="1" />
  71.175 +         <entry key="build.minor.number" type="int" operation="+" value="1" />
  71.176 +         <entry key="build.revision.number" type="int" operation="+" value="1" />
  71.177 +      </propertyfile>
  71.178 +   </target>
  71.179 +
  71.180 +   <target name="echo-manifest" description="echo kit version that is found in manifest. Used by hudson" >
  71.181 +      <echoproperties srcfile="plsql-support.kit/manifest.mf"/>
  71.182 +   </target>
  71.183 +
  71.184  </project>
    72.1 --- a/nbproject/genfiles.properties	Wed Dec 07 13:36:21 2011 +0100
    72.2 +++ b/nbproject/genfiles.properties	Tue Feb 14 17:31:28 2012 +0100
    72.3 @@ -6,3 +6,6 @@
    72.4  nbproject/build-impl.xml.data.CRC32=fd65edd3
    72.5  nbproject/build-impl.xml.script.CRC32=0393aba7
    72.6  nbproject/build-impl.xml.stylesheet.CRC32=196c7090
    72.7 +nbproject/platform.xml.data.CRC32=fd65edd3
    72.8 +nbproject/platform.xml.script.CRC32=db9e1f43
    72.9 +nbproject/platform.xml.stylesheet.CRC32=df8ac4dd@2.47.1
    73.1 --- a/nbproject/platform.properties	Wed Dec 07 13:36:21 2011 +0100
    73.2 +++ b/nbproject/platform.properties	Tue Feb 14 17:31:28 2012 +0100
    73.3 @@ -1,7 +1,6 @@
    73.4  nbplatform.default.netbeans.dest.dir=/hudson/workdir/jobs/plsql-support/workspace/ide/netbeans
    73.5  nbplatform.default.harness.dir=${nbplatform.default.netbeans.dest.dir}/harness
    73.6  cluster.path=\
    73.7 -    ${nbplatform.active.dir}/enterprise:\
    73.8      ${nbplatform.active.dir}/harness:\
    73.9      ${nbplatform.active.dir}/ide:\
   73.10      ${nbplatform.active.dir}/java:\
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/nbproject/platform.xml	Tue Feb 14 17:31:28 2012 +0100
    74.3 @@ -0,0 +1,34 @@
    74.4 +<?xml version="1.0" encoding="UTF-8"?>
    74.5 +<project name="platform" default="download" basedir="..">
    74.6 +    <condition property="download.required">
    74.7 +        <and>
    74.8 +            <not>
    74.9 +                <available file="${harness.dir}/suite.xml"/>
   74.10 +            </not>
   74.11 +            <isset property="bootstrap.url"/>
   74.12 +            <isset property="autoupdate.catalog.url"/>
   74.13 +        </and>
   74.14 +    </condition>
   74.15 +    <target name="download" if="download.required">
   74.16 +        <mkdir dir="${harness.dir}"/>
   74.17 +        <pathconvert pathsep="|" property="download.clusters">
   74.18 +            <mapper type="flatten"/>
   74.19 +            <path path="${cluster.path}"/>
   74.20 +        </pathconvert>
   74.21 +        <property name="disabled.modules" value=""/>
   74.22 +        <pathconvert property="module.includes" pathsep="">
   74.23 +            <mapper type="glob" from="${basedir}${file.separator}*" to="(?!\Q*\E)"/>
   74.24 +            <path>
   74.25 +                <filelist files="${disabled.modules}" dir="."/>
   74.26 +            </path>
   74.27 +        </pathconvert>
   74.28 +        <echo message="Downloading clusters ${download.clusters}"/>
   74.29 +        <property name="tasks.jar" location="${java.io.tmpdir}/tasks.jar"/>
   74.30 +        <get src="${bootstrap.url}" dest="${tasks.jar}" usetimestamp="true" verbose="true"/>
   74.31 +        <taskdef name="autoupdate" classname="org.netbeans.nbbuild.AutoUpdate" classpath="${tasks.jar}"/>
   74.32 +        <autoupdate installdir="${nbplatform.active.dir}" updatecenter="${autoupdate.catalog.url}">
   74.33 +            <modules includes="${module.includes}.*" clusters="${download.clusters}"/>
   74.34 +            <modules includes="org[.]netbeans[.]modules[.]apisupport[.]harness" clusters="harness"/>
   74.35 +        </autoupdate>
   74.36 +    </target>
   74.37 +</project>
    75.1 --- a/plsql-support.kit/manifest.mf	Wed Dec 07 13:36:21 2011 +0100
    75.2 +++ b/plsql-support.kit/manifest.mf	Tue Feb 14 17:31:28 2012 +0100
    75.3 @@ -1,5 +1,8 @@
    75.4  Manifest-Version: 1.0
    75.5 +Ant-Version: Apache Ant 1.8.1
    75.6 +Created-By: 1.6.0_22-b22 (Sun Microsystems Inc.)
    75.7  OpenIDE-Module: org.netbeans.modules.plsql.kit
    75.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/kit/Bundle.properties
    75.9 -OpenIDE-Module-Specification-Version: 1.0
   75.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/plsql/kit/Bundl
   75.11 + e.properties
   75.12 +OpenIDE-Module-Specification-Version: 1.0.58
   75.13  
    76.1 --- a/plsql-support.kit/nbproject/genfiles.properties	Wed Dec 07 13:36:21 2011 +0100
    76.2 +++ b/plsql-support.kit/nbproject/genfiles.properties	Tue Feb 14 17:31:28 2012 +0100
    76.3 @@ -1,8 +1,8 @@
    76.4 -build.xml.data.CRC32=435d126f
    76.5 +build.xml.data.CRC32=b60269e8
    76.6  build.xml.script.CRC32=8894d7fe
    76.7 -build.xml.stylesheet.CRC32=a56c6a5b@1.46.1
    76.8 +build.xml.stylesheet.CRC32=a56c6a5b@1.46.2
    76.9  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   76.10  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   76.11 -nbproject/build-impl.xml.data.CRC32=435d126f
   76.12 +nbproject/build-impl.xml.data.CRC32=b60269e8
   76.13  nbproject/build-impl.xml.script.CRC32=4cc852db
   76.14 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.1
   76.15 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.2
    77.1 --- a/plsql-support.kit/nbproject/project.xml	Wed Dec 07 13:36:21 2011 +0100
    77.2 +++ b/plsql-support.kit/nbproject/project.xml	Tue Feb 14 17:31:28 2012 +0100
    77.3 @@ -11,7 +11,7 @@
    77.4                      <build-prerequisite/>
    77.5                      <compile-dependency/>
    77.6                      <run-dependency>
    77.7 -                        <specification-version>1.8.8</specification-version>
    77.8 +                        <specification-version>1.8.12</specification-version>
    77.9                      </run-dependency>
   77.10                  </dependency>
   77.11                  <dependency>
   77.12 @@ -19,13 +19,13 @@
   77.13                      <build-prerequisite/>
   77.14                      <compile-dependency/>
   77.15                      <run-dependency>
   77.16 -                        <specification-version>1.8.4</specification-version>
   77.17 +                        <specification-version>1.8.5</specification-version>
   77.18                      </run-dependency>
   77.19                  </dependency>
   77.20                  <dependency>
   77.21                      <code-name-base>org.netbeans.modules.plsql.debug</code-name-base>
   77.22                      <run-dependency>
   77.23 -                        <specification-version>1.7.18</specification-version>
   77.24 +                        <specification-version>1.7.19</specification-version>
   77.25                      </run-dependency>
   77.26                  </dependency>
   77.27                  <dependency>
   77.28 @@ -33,7 +33,7 @@
   77.29                      <build-prerequisite/>
   77.30                      <compile-dependency/>
   77.31                      <run-dependency>
   77.32 -                        <specification-version>1.8.8</specification-version>
   77.33 +                        <specification-version>1.8.19</specification-version>
   77.34                      </run-dependency>
   77.35                  </dependency>
   77.36                  <dependency>
   77.37 @@ -41,25 +41,25 @@
   77.38                      <build-prerequisite/>
   77.39                      <compile-dependency/>
   77.40                      <run-dependency>
   77.41 -                        <specification-version>1.8.4</specification-version>
   77.42 +                        <specification-version>1.8.10</specification-version>
   77.43                      </run-dependency>
   77.44                  </dependency>
   77.45                  <dependency>
   77.46                      <code-name-base>org.netbeans.modules.plsql.fold</code-name-base>
   77.47                      <run-dependency>
   77.48 -                        <specification-version>1.8.0</specification-version>
   77.49 +                        <specification-version>1.8.2</specification-version>
   77.50                      </run-dependency>
   77.51                  </dependency>
   77.52                  <dependency>
   77.53                      <code-name-base>org.netbeans.modules.plsql.format</code-name-base>
   77.54                      <run-dependency>
   77.55 -                        <specification-version>1.9.6</specification-version>
   77.56 +                        <specification-version>1.9.14</specification-version>
   77.57                      </run-dependency>
   77.58                  </dependency>
   77.59                  <dependency>
   77.60                      <code-name-base>org.netbeans.modules.plsql.format.options</code-name-base>
   77.61                      <run-dependency>
   77.62 -                        <specification-version>1.7.6</specification-version>
   77.63 +                        <specification-version>1.7.7</specification-version>
   77.64                      </run-dependency>
   77.65                  </dependency>
   77.66                  <dependency>
   77.67 @@ -67,7 +67,7 @@
   77.68                      <build-prerequisite/>
   77.69                      <compile-dependency/>
   77.70                      <run-dependency>
   77.71 -                        <specification-version>1.8.6</specification-version>
   77.72 +                        <specification-version>1.8.9</specification-version>
   77.73                      </run-dependency>
   77.74                  </dependency>
   77.75                  <dependency>
   77.76 @@ -75,25 +75,25 @@
   77.77                      <build-prerequisite/>
   77.78                      <compile-dependency/>
   77.79                      <run-dependency>
   77.80 -                        <specification-version>1.8.5</specification-version>
   77.81 +                        <specification-version>1.8.8</specification-version>
   77.82                      </run-dependency>
   77.83                  </dependency>
   77.84                  <dependency>
   77.85                      <code-name-base>org.netbeans.modules.plsql.navigator</code-name-base>
   77.86                      <run-dependency>
   77.87 -                        <specification-version>1.8.0</specification-version>
   77.88 +                        <specification-version>1.8.1</specification-version>
   77.89                      </run-dependency>
   77.90                  </dependency>
   77.91                  <dependency>
   77.92                      <code-name-base>org.netbeans.modules.plsql.palette</code-name-base>
   77.93                      <run-dependency>
   77.94 -                        <specification-version>1.8.4</specification-version>
   77.95 +                        <specification-version>1.8.9</specification-version>
   77.96                      </run-dependency>
   77.97                  </dependency>
   77.98                  <dependency>
   77.99                      <code-name-base>org.netbeans.modules.plsql.usage</code-name-base>
  77.100                      <run-dependency>
  77.101 -                        <specification-version>1.8.3</specification-version>
  77.102 +                        <specification-version>1.8.5</specification-version>
  77.103                      </run-dependency>
  77.104                  </dependency>
  77.105                  <dependency>
  77.106 @@ -101,7 +101,7 @@
  77.107                      <build-prerequisite/>
  77.108                      <compile-dependency/>
  77.109                      <run-dependency>
  77.110 -                        <specification-version>1.7.17</specification-version>
  77.111 +                        <specification-version>1.7.20</specification-version>
  77.112                      </run-dependency>
  77.113                  </dependency>
  77.114                  <dependency>
  77.115 @@ -109,13 +109,13 @@
  77.116                      <build-prerequisite/>
  77.117                      <compile-dependency/>
  77.118                      <run-dependency>
  77.119 -                        <specification-version>1.8.14</specification-version>
  77.120 +                        <specification-version>1.8.18</specification-version>
  77.121                      </run-dependency>
  77.122                  </dependency>
  77.123                  <dependency>
  77.124                      <code-name-base>org.netbeans.modules.plsqlsupport.db.project</code-name-base>
  77.125                      <run-dependency>
  77.126 -                        <specification-version>1.0</specification-version>
  77.127 +                        <specification-version>1.0.1</specification-version>
  77.128                      </run-dependency>
  77.129                  </dependency>
  77.130              </module-dependencies>