1.1 --- a/PLSQL/Debugging/nbproject/project.xml Mon Jun 18 17:05:11 2012 +0530
1.2 +++ b/PLSQL/Debugging/nbproject/project.xml Tue Jun 19 14:47:18 2012 +0200
1.3 @@ -7,46 +7,6 @@
1.4 <suite-component/>
1.5 <module-dependencies>
1.6 <dependency>
1.7 - <code-name-base>org.netbeans.modules.plsqlsupport.db</code-name-base>
1.8 - <build-prerequisite/>
1.9 - <compile-dependency/>
1.10 - <run-dependency>
1.11 - <specification-version>1.0</specification-version>
1.12 - </run-dependency>
1.13 - </dependency>
1.14 - <dependency>
1.15 - <code-name-base>org.netbeans.modules.plsql.execution</code-name-base>
1.16 - <build-prerequisite/>
1.17 - <compile-dependency/>
1.18 - <run-dependency>
1.19 - <specification-version>1.0.2</specification-version>
1.20 - </run-dependency>
1.21 - </dependency>
1.22 - <dependency>
1.23 - <code-name-base>org.netbeans.modules.plsql.hyperlink</code-name-base>
1.24 - <build-prerequisite/>
1.25 - <compile-dependency/>
1.26 - <run-dependency>
1.27 - <specification-version>1.0</specification-version>
1.28 - </run-dependency>
1.29 - </dependency>
1.30 - <dependency>
1.31 - <code-name-base>org.netbeans.modules.plsql.lexer</code-name-base>
1.32 - <build-prerequisite/>
1.33 - <compile-dependency/>
1.34 - <run-dependency>
1.35 - <specification-version>1.0</specification-version>
1.36 - </run-dependency>
1.37 - </dependency>
1.38 - <dependency>
1.39 - <code-name-base>org.netbeans.modules.plsql.utilities</code-name-base>
1.40 - <build-prerequisite/>
1.41 - <compile-dependency/>
1.42 - <run-dependency>
1.43 - <specification-version>1.0.15</specification-version>
1.44 - </run-dependency>
1.45 - </dependency>
1.46 - <dependency>
1.47 <code-name-base>org.netbeans.api.debugger</code-name-base>
1.48 <build-prerequisite/>
1.49 <compile-dependency/>
1.50 @@ -83,6 +43,46 @@
1.51 </run-dependency>
1.52 </dependency>
1.53 <dependency>
1.54 + <code-name-base>org.netbeans.modules.plsql.execution</code-name-base>
1.55 + <build-prerequisite/>
1.56 + <compile-dependency/>
1.57 + <run-dependency>
1.58 + <specification-version>1.0.2</specification-version>
1.59 + </run-dependency>
1.60 + </dependency>
1.61 + <dependency>
1.62 + <code-name-base>org.netbeans.modules.plsql.hyperlink</code-name-base>
1.63 + <build-prerequisite/>
1.64 + <compile-dependency/>
1.65 + <run-dependency>
1.66 + <specification-version>1.0</specification-version>
1.67 + </run-dependency>
1.68 + </dependency>
1.69 + <dependency>
1.70 + <code-name-base>org.netbeans.modules.plsql.lexer</code-name-base>
1.71 + <build-prerequisite/>
1.72 + <compile-dependency/>
1.73 + <run-dependency>
1.74 + <specification-version>1.0</specification-version>
1.75 + </run-dependency>
1.76 + </dependency>
1.77 + <dependency>
1.78 + <code-name-base>org.netbeans.modules.plsql.utilities</code-name-base>
1.79 + <build-prerequisite/>
1.80 + <compile-dependency/>
1.81 + <run-dependency>
1.82 + <specification-version>1.0.15</specification-version>
1.83 + </run-dependency>
1.84 + </dependency>
1.85 + <dependency>
1.86 + <code-name-base>org.netbeans.modules.plsqlsupport.db</code-name-base>
1.87 + <build-prerequisite/>
1.88 + <compile-dependency/>
1.89 + <run-dependency>
1.90 + <specification-version>1.0</specification-version>
1.91 + </run-dependency>
1.92 + </dependency>
1.93 + <dependency>
1.94 <code-name-base>org.netbeans.modules.projectapi</code-name-base>
1.95 <build-prerequisite/>
1.96 <compile-dependency/>
1.97 @@ -101,6 +101,14 @@
1.98 </run-dependency>
1.99 </dependency>
1.100 <dependency>
1.101 + <code-name-base>org.openide.awt</code-name-base>
1.102 + <build-prerequisite/>
1.103 + <compile-dependency/>
1.104 + <run-dependency>
1.105 + <specification-version>7.31.2</specification-version>
1.106 + </run-dependency>
1.107 + </dependency>
1.108 + <dependency>
1.109 <code-name-base>org.openide.dialogs</code-name-base>
1.110 <build-prerequisite/>
1.111 <compile-dependency/>
2.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlDebugAction.java Mon Jun 18 17:05:11 2012 +0530
2.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlDebugAction.java Tue Jun 19 14:47:18 2012 +0200
2.3 @@ -41,15 +41,6 @@
2.4 */
2.5 package org.netbeans.modules.plsql.debug;
2.6
2.7 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
2.8 -import org.netbeans.modules.plsqlsupport.db.DatabaseContentUtilities;
2.9 -import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
2.10 -import org.netbeans.modules.plsql.execution.PlsqlExecutableBlocksMaker;
2.11 -import org.netbeans.modules.plsql.execution.PlsqlExecutableObject;
2.12 -import org.netbeans.modules.plsql.execution.PlsqlFileExecutor;
2.13 -import org.netbeans.modules.plsql.lexer.PlsqlBlock;
2.14 -import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
2.15 -import org.netbeans.modules.plsql.lexer.PlsqlBlockUtilities;
2.16 import java.io.File;
2.17 import java.io.IOException;
2.18 import java.io.UnsupportedEncodingException;
2.19 @@ -66,32 +57,53 @@
2.20 import javax.swing.text.Document;
2.21 import javax.swing.text.StyledDocument;
2.22 import org.netbeans.api.db.explorer.DatabaseConnection;
2.23 -import org.netbeans.api.project.FileOwnerQuery;
2.24 -import org.netbeans.api.project.Project;
2.25 -import org.openide.cookies.EditorCookie;
2.26 -import org.openide.loaders.DataObject;
2.27 -import org.openide.loaders.DataObjectNotFoundException;
2.28 -import org.openide.nodes.Node;
2.29 -import org.openide.util.Exceptions;
2.30 -import org.openide.util.HelpCtx;
2.31 -import org.openide.util.NbBundle;
2.32 -import org.openide.util.actions.CookieAction;
2.33 -import org.openide.windows.IOProvider;
2.34 -import org.openide.windows.InputOutput;
2.35 -import org.openide.windows.OutputWriter;
2.36 import org.netbeans.api.debugger.Breakpoint;
2.37 import org.netbeans.api.debugger.DebuggerInfo;
2.38 import org.netbeans.api.debugger.DebuggerManager;
2.39 import org.netbeans.api.debugger.Session;
2.40 import org.netbeans.api.debugger.jpda.LineBreakpoint;
2.41 import org.netbeans.api.debugger.jpda.ListeningDICookie;
2.42 +import org.netbeans.api.project.FileOwnerQuery;
2.43 +import org.netbeans.api.project.Project;
2.44 +import org.netbeans.modules.plsql.execution.PlsqlExecutableBlocksMaker;
2.45 +import org.netbeans.modules.plsql.execution.PlsqlExecutableObject;
2.46 +import org.netbeans.modules.plsql.execution.PlsqlFileExecutor;
2.47 +import org.netbeans.modules.plsql.lexer.PlsqlBlock;
2.48 +import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
2.49 +import org.netbeans.modules.plsql.lexer.PlsqlBlockUtilities;
2.50 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
2.51 +import org.netbeans.modules.plsqlsupport.db.DatabaseContentUtilities;
2.52 +import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
2.53 +import org.openide.awt.ActionID;
2.54 +import org.openide.awt.ActionReference;
2.55 +import org.openide.awt.ActionReferences;
2.56 +import org.openide.awt.ActionRegistration;
2.57 +import org.openide.cookies.EditorCookie;
2.58 import org.openide.filesystems.FileObject;
2.59 import org.openide.filesystems.FileUtil;
2.60 import org.openide.loaders.DataFolder;
2.61 +import org.openide.loaders.DataObject;
2.62 +import org.openide.loaders.DataObjectNotFoundException;
2.63 +import org.openide.nodes.Node;
2.64 import org.openide.text.NbDocument;
2.65 +import org.openide.util.Exceptions;
2.66 +import org.openide.util.HelpCtx;
2.67 +import org.openide.util.NbBundle;
2.68 import org.openide.util.RequestProcessor;
2.69 import org.openide.util.RequestProcessor.Task;
2.70 +import org.openide.util.actions.CookieAction;
2.71 +import org.openide.windows.IOProvider;
2.72 +import org.openide.windows.InputOutput;
2.73 +import org.openide.windows.OutputWriter;
2.74
2.75 +@ActionID(id = "org.netbeans.modules.plsql.debug.PlsqlDebugAction", category = "PLSQL")
2.76 +@ActionRegistration(displayName = "#CTL_PlsqlDebugAction", iconBase = "org/netbeans/modules/plsql/debug/debug.png")
2.77 +@ActionReferences({
2.78 +// @ActionReference(path = "Shortcuts", name = "DS-D"),
2.79 + @ActionReference(path = "Shortcuts", name = "OS-D"),
2.80 + @ActionReference(path = "Editors/text/x-plsql/Popup", name = "org-netbeans-modules-plsql-debug-PlsqlDebugAction",
2.81 + position = 1020, separatorAfter = 1050)
2.82 +})
2.83 public final class PlsqlDebugAction extends CookieAction {
2.84
2.85 private static final RequestProcessor RP = new RequestProcessor(PlsqlDebugAction.class.getName());
2.86 @@ -152,6 +164,7 @@
2.87
2.88 /**
2.89 * Enable this action only for the SQL execution window
2.90 + *
2.91 * @param nodes
2.92 * @return
2.93 */
3.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlDebugCompileAction.java Mon Jun 18 17:05:11 2012 +0530
3.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlDebugCompileAction.java Tue Jun 19 14:47:18 2012 +0200
3.3 @@ -41,47 +41,48 @@
3.4 */
3.5 package org.netbeans.modules.plsql.debug;
3.6
3.7 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
3.8 -import org.netbeans.modules.plsqlsupport.db.DatabaseContentManager;
3.9 -import org.netbeans.modules.plsqlsupport.db.DatabaseContentUtilities;
3.10 -import org.netbeans.modules.plsql.lexer.PlsqlBlock;
3.11 -import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
3.12 -import org.netbeans.modules.plsql.utilities.PlsqlParserUtil;
3.13 import java.sql.Connection;
3.14 import java.sql.PreparedStatement;
3.15 import java.sql.ResultSet;
3.16 import java.sql.SQLException;
3.17 -import java.sql.Statement;
3.18 -import java.util.List;
3.19 import java.util.Locale;
3.20 import javax.swing.JEditorPane;
3.21 import javax.swing.text.Caret;
3.22 import org.netbeans.api.db.explorer.DatabaseConnection;
3.23 +import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
3.24 +import org.netbeans.modules.plsql.utilities.PlsqlParserUtil;
3.25 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
3.26 +import org.netbeans.modules.plsqlsupport.db.DatabaseContentUtilities;
3.27 +import org.openide.awt.ActionID;
3.28 +import org.openide.awt.ActionReference;
3.29 +import org.openide.awt.ActionRegistration;
3.30 import org.openide.cookies.EditorCookie;
3.31 import org.openide.loaders.DataObject;
3.32 import org.openide.nodes.Node;
3.33 import org.openide.util.Exceptions;
3.34 import org.openide.util.HelpCtx;
3.35 import org.openide.util.NbBundle;
3.36 -import org.openide.util.RequestProcessor;
3.37 import org.openide.util.actions.CookieAction;
3.38 import org.openide.windows.IOProvider;
3.39 import org.openide.windows.InputOutput;
3.40 import org.openide.windows.OutputWriter;
3.41
3.42 -
3.43 +@ActionID(id = "org.netbeans.modules.plsql.debug.PlsqlDebugCompileAction", category = "PLSQL")
3.44 +@ActionRegistration(displayName = "#CTL_PlsqlDebugCompileAction")
3.45 +@ActionReference(path = "Editors/text/x-plsql/Popup", name = "org-netbeans-modules-plsql-debug-DebugCompileAction", position = 1000)
3.46 public final class PlsqlDebugCompileAction extends CookieAction {
3.47
3.48 String objectName;
3.49 - @Override
3.50 - protected int mode() {
3.51 - return CookieAction.MODE_EXACTLY_ONE;
3.52 - }
3.53
3.54 - @Override
3.55 - protected Class<?>[] cookieClasses() {
3.56 - return new Class[]{EditorCookie.class};
3.57 - }
3.58 + @Override
3.59 + protected int mode() {
3.60 + return CookieAction.MODE_EXACTLY_ONE;
3.61 + }
3.62 +
3.63 + @Override
3.64 + protected Class<?>[] cookieClasses() {
3.65 + return new Class[]{EditorCookie.class};
3.66 + }
3.67
3.68 @Override
3.69 protected boolean asynchronous() {
3.70 @@ -136,20 +137,20 @@
3.71 }
3.72 }
3.73
3.74 - @Override
3.75 - public String getName() {
3.76 - return NbBundle.getMessage(PlsqlDebugCompileAction.class, "CTL_PlsqlDebugCompileAction");
3.77 - }
3.78 + @Override
3.79 + public String getName() {
3.80 + return NbBundle.getMessage(PlsqlDebugCompileAction.class, "CTL_PlsqlDebugCompileAction");
3.81 + }
3.82
3.83 - @Override
3.84 - public HelpCtx getHelpCtx() {
3.85 - return HelpCtx.DEFAULT_HELP;
3.86 - }
3.87 + @Override
3.88 + public HelpCtx getHelpCtx() {
3.89 + return HelpCtx.DEFAULT_HELP;
3.90 + }
3.91
3.92 - @Override
3.93 + @Override
3.94 protected boolean enable(Node[] activatedNodes) {
3.95 - objectName = getObjectName(activatedNodes);
3.96 - return objectName!=null;
3.97 + objectName = getObjectName(activatedNodes);
3.98 + return objectName != null;
3.99 }
3.100
3.101 private String getObjectName(Node[] activatedNodes) {
3.102 @@ -166,12 +167,12 @@
3.103 return null;
3.104 }
3.105 String selection = panes[0].getSelectedText();
3.106 - if(selection!=null) { //check that this is a valid oracle identifier
3.107 - if(selection.startsWith("\"") && selection.endsWith("\"")) {
3.108 + if (selection != null) { //check that this is a valid oracle identifier
3.109 + if (selection.startsWith("\"") && selection.endsWith("\"")) {
3.110 return selection;
3.111 }
3.112 String upper = selection.toUpperCase(Locale.ENGLISH);
3.113 - if(DatabaseContentUtilities.isValidOracleUppercaseIdentifier(upper)) {
3.114 + if (DatabaseContentUtilities.isValidOracleUppercaseIdentifier(upper)) {
3.115 return upper;
3.116 }
3.117 return null;
3.118 @@ -181,16 +182,15 @@
3.119 //go through the parse tree and find the "top" node. This is the object we should debug complie
3.120 DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
3.121 PlsqlBlockFactory fac = dataObject.getLookup().lookup(PlsqlBlockFactory.class);
3.122 - List<PlsqlBlock> blockHierarchy = fac.getBlockHierarchy();
3.123 - String objectName = PlsqlParserUtil.getPackageName(fac, position);
3.124 - if(objectName==null || objectName.length()==0) {
3.125 - objectName = PlsqlParserUtil.getMethodName(fac, position);
3.126 + String packageName = PlsqlParserUtil.getPackageName(fac, position);
3.127 + if (packageName == null || packageName.length() == 0) {
3.128 + packageName = PlsqlParserUtil.getMethodName(fac, position);
3.129 }
3.130 - if(objectName!=null && objectName.length()>0) {
3.131 - if(objectName.startsWith("\"")) {
3.132 - return objectName;
3.133 + if (packageName != null && packageName.length() > 0) {
3.134 + if (packageName.startsWith("\"")) {
3.135 + return packageName;
3.136 } else {
3.137 - return objectName.toUpperCase(Locale.ENGLISH);
3.138 + return packageName.toUpperCase(Locale.ENGLISH);
3.139 }
3.140 }
3.141 return null;
4.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlDebugListenAction.java Mon Jun 18 17:05:11 2012 +0530
4.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlDebugListenAction.java Tue Jun 19 14:47:18 2012 +0200
4.3 @@ -41,20 +41,24 @@
4.4 */
4.5 package org.netbeans.modules.plsql.debug;
4.6
4.7 +import org.netbeans.api.debugger.DebuggerInfo;
4.8 +import org.netbeans.api.debugger.DebuggerManager;
4.9 +import org.netbeans.api.debugger.Session;
4.10 +import org.netbeans.api.debugger.jpda.ListeningDICookie;
4.11 import org.netbeans.api.project.Project;
4.12 +import org.openide.awt.ActionID;
4.13 +import org.openide.awt.ActionRegistration;
4.14 import org.openide.loaders.DataObject;
4.15 import org.openide.nodes.Node;
4.16 import org.openide.util.Exceptions;
4.17 import org.openide.util.HelpCtx;
4.18 import org.openide.util.NbBundle;
4.19 -import org.openide.util.actions.CookieAction;
4.20 -import org.netbeans.api.debugger.DebuggerInfo;
4.21 -import org.netbeans.api.debugger.DebuggerManager;
4.22 -import org.netbeans.api.debugger.Session;
4.23 -import org.netbeans.api.debugger.jpda.ListeningDICookie;
4.24 import org.openide.util.RequestProcessor;
4.25 import org.openide.util.RequestProcessor.Task;
4.26 +import org.openide.util.actions.CookieAction;
4.27
4.28 +@ActionID(id = "org.netbeans.modules.plsql.debug.PlsqlDebugListenAction", category = "Project/Node")
4.29 +@ActionRegistration(displayName = "#CTL_PlsqlDebugListenAction")
4.30 public final class PlsqlDebugListenAction extends CookieAction {
4.31
4.32 private static final int DEBUG_PORT = 13406;
5.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlToggleBreakpointActionProvider.java Mon Jun 18 17:05:11 2012 +0530
5.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlToggleBreakpointActionProvider.java Tue Jun 19 14:47:18 2012 +0200
5.3 @@ -77,16 +77,15 @@
5.4 import org.netbeans.api.project.FileOwnerQuery;
5.5 import org.netbeans.api.project.ProjectUtils;
5.6
5.7 -public class PlsqlToggleBreakpointActionProvider extends ActionsProviderSupport
5.8 - implements PropertyChangeListener {
5.9 +public class PlsqlToggleBreakpointActionProvider extends ActionsProviderSupport implements PropertyChangeListener {
5.10
5.11 private final static Set<Object> ACTIONS = Collections.singleton(ActionsManager.ACTION_TOGGLE_BREAKPOINT);
5.12 - private static Project project=null;
5.13 + private static Project project = null;
5.14
5.15 public PlsqlToggleBreakpointActionProvider() {
5.16 setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, true);
5.17 TopComponent.getRegistry().addPropertyChangeListener(
5.18 - WeakListeners.propertyChange(this, TopComponent.getRegistry()));
5.19 + WeakListeners.propertyChange(this, TopComponent.getRegistry()));
5.20 }
5.21
5.22 public static Project getProject() {
5.23 @@ -98,9 +97,9 @@
5.24 //enable all breakpoints in this project, disable all other breakpoints
5.25 Breakpoint[] breakpoints = DebuggerManager.getDebuggerManager().getBreakpoints();
5.26 String projectName = ProjectUtils.getInformation(project).getName();
5.27 - for(int i=0; i<breakpoints.length; i++) {
5.28 + for (int i = 0; i < breakpoints.length; i++) {
5.29 Breakpoint breakpoint = breakpoints[i];
5.30 - if(breakpoint.getGroupName()!=null && breakpoint.getGroupName().equals(projectName)) {
5.31 + if (breakpoint.getGroupName() != null && breakpoint.getGroupName().equals(projectName)) {
5.32 breakpoint.enable();
5.33 } else {
5.34 breakpoint.disable();
5.35 @@ -110,26 +109,32 @@
5.36
5.37 public void doAction(Object action) {
5.38 Node node = getActivatedPlsqlNode();
5.39 - if (node == null)
5.40 + if (node == null) {
5.41 return;
5.42 + }
5.43
5.44 DataObject dataObject = node.getLookup().lookup(DataObject.class);
5.45 EditorCookie editorCookie = node.getLookup().lookup(EditorCookie.class);
5.46 - if (dataObject == null || editorCookie == null)
5.47 + if (dataObject == null || editorCookie == null) {
5.48 return;
5.49 + }
5.50 project = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
5.51 - if(project==null) //don't allow debugging outside of projects...
5.52 + if (project == null) //don't allow debugging outside of projects...
5.53 + {
5.54 return;
5.55 + }
5.56
5.57 JEditorPane editorPane = getEditorPane(editorCookie);
5.58 StyledDocument document = editorCookie.getDocument();
5.59 - if (editorPane == null || document == null)
5.60 + if (editorPane == null || document == null) {
5.61 return;
5.62 + }
5.63
5.64 int caretDot = editorPane.getCaret().getDot();
5.65 int lineNumber = NbDocument.findLineNumber(document, caretDot);
5.66 - if (lineNumber == -1)
5.67 + if (lineNumber == -1) {
5.68 return;
5.69 + }
5.70
5.71 FileObject fileObject = node.getLookup().lookup(FileObject.class);
5.72 String url;
5.73 @@ -144,54 +149,59 @@
5.74 String methodName = null;
5.75 PlsqlBlock block = PlsqlBlockUtilities.getCurrentBlock(caretDot, dataObject.getLookup().lookup(PlsqlBlockFactory.class).getBlockHierarchy());
5.76 if (block != null && lineNumber == NbDocument.findLineNumber(document, block.getStartOffset())) {
5.77 - if (block.getType() == PlsqlBlockType.PROCEDURE_DEF || block.getType() == PlsqlBlockType.PROCEDURE_IMPL)
5.78 + if (block.getType() == PlsqlBlockType.PROCEDURE_DEF || block.getType() == PlsqlBlockType.PROCEDURE_IMPL) {
5.79 methodName = block.getName().toUpperCase(Locale.ENGLISH);
5.80 - else if (block.getType() == PlsqlBlockType.FUNCTION_DEF || block.getType() == PlsqlBlockType.FUNCTION_IMPL)
5.81 + } else if (block.getType() == PlsqlBlockType.FUNCTION_DEF || block.getType() == PlsqlBlockType.FUNCTION_IMPL) {
5.82 methodName = block.getName().toUpperCase(Locale.ENGLISH);
5.83 - else if (block.getType() == PlsqlBlockType.PACKAGE || block.getType() == PlsqlBlockType.PACKAGE_BODY)
5.84 + } else if (block.getType() == PlsqlBlockType.PACKAGE || block.getType() == PlsqlBlockType.PACKAGE_BODY) {
5.85 methodName = ""; // All methods
5.86 -
5.87 + }
5.88 if (methodName != null) {
5.89 DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(dataObject);
5.90 - if (connectionProvider == null)
5.91 + if (connectionProvider == null) {
5.92 return;
5.93 + }
5.94 DatabaseConnection databaseConnection = connectionProvider.getTemplateConnection();
5.95 - if (databaseConnection == null)
5.96 + if (databaseConnection == null) {
5.97 return;
5.98 + }
5.99
5.100 className = PlsqlDebuggerUtilities.getClassName(block, databaseConnection);
5.101 - if (className.startsWith("$Oracle.Procedure"))
5.102 + if (className.startsWith("$Oracle.Procedure")) {
5.103 methodName = ""; // All methods
5.104 + }
5.105 }
5.106 }
5.107
5.108 Breakpoint oldBreakpoint = null;
5.109 - String[] classNames = new String[] {className};
5.110 - for (Breakpoint point : DebuggerManager.getDebuggerManager().getBreakpoints())
5.111 + String[] classNames = new String[]{className};
5.112 + for (Breakpoint point : DebuggerManager.getDebuggerManager().getBreakpoints()) {
5.113 if (className != null && point instanceof MethodBreakpoint) {
5.114 - MethodBreakpoint methodBreakpoint = (MethodBreakpoint)point;
5.115 + MethodBreakpoint methodBreakpoint = (MethodBreakpoint) point;
5.116 if (methodName.equals(methodBreakpoint.getMethodName())
5.117 - && Arrays.deepEquals(classNames, methodBreakpoint.getClassFilters())) {
5.118 + && Arrays.deepEquals(classNames, methodBreakpoint.getClassFilters())) {
5.119 oldBreakpoint = methodBreakpoint;
5.120 break;
5.121 }
5.122 } else if (point instanceof LineBreakpoint) {
5.123 - LineBreakpoint lineBreakpoint = (LineBreakpoint)point;
5.124 - if (lineBreakpoint.getURL().equals(url) &&
5.125 - lineBreakpoint.getLineNumber() == lineNumber + 1) {
5.126 + LineBreakpoint lineBreakpoint = (LineBreakpoint) point;
5.127 + if (lineBreakpoint.getURL().equals(url)
5.128 + && lineBreakpoint.getLineNumber() == lineNumber + 1) {
5.129 oldBreakpoint = lineBreakpoint;
5.130 break;
5.131 }
5.132 }
5.133 + }
5.134
5.135 - if (oldBreakpoint != null)
5.136 + if (oldBreakpoint != null) {
5.137 DebuggerManager.getDebuggerManager().removeBreakpoint(oldBreakpoint);
5.138 - else {
5.139 + } else {
5.140 Breakpoint breakpoint = null;
5.141 - if (className != null)
5.142 + if (className != null) {
5.143 breakpoint = MethodBreakpoint.create(className, methodName);
5.144 - else
5.145 + } else {
5.146 breakpoint = LineBreakpoint.create(url, lineNumber + 1);
5.147 + }
5.148 breakpoint.setGroupName(ProjectUtils.getInformation(project).getName());
5.149 DebuggerManager.getDebuggerManager().addBreakpoint(breakpoint);
5.150 }
5.151 @@ -209,8 +219,9 @@
5.152 Node[] nodes = TopComponent.getRegistry().getCurrentNodes();
5.153 if (nodes != null && nodes.length == 1) {
5.154 FileObject file = nodes[0].getLookup().lookup(FileObject.class);
5.155 - if (file != null && file.getMIMEType().equals("text/x-plsql"))
5.156 + if (file != null && file.getMIMEType().equals("text/x-plsql")) {
5.157 return nodes[0];
5.158 + }
5.159 }
5.160 return null;
5.161 }
5.162 @@ -223,6 +234,7 @@
5.163 final JEditorPane[] paneArray = new JEditorPane[1];
5.164 try {
5.165 EventQueue.invokeAndWait(new Runnable() {
5.166 +
5.167 public void run() {
5.168 JEditorPane[] panes = editorCookie.getOpenedPanes();
5.169 paneArray[0] = panes != null && panes.length == 1 ? panes[0] : null;
6.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/layer.xml Mon Jun 18 17:05:11 2012 +0530
6.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/layer.xml Tue Jun 19 14:47:18 2012 +0200
6.3 @@ -1,28 +1,6 @@
6.4 <?xml version="1.0" encoding="UTF-8"?>
6.5 <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
6.6 <filesystem>
6.7 - <folder name="Actions">
6.8 - <folder name="PLSQL">
6.9 - <file name="org-netbeans-modules-plsql-debug-PlsqlDebugAction.instance">
6.10 - <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.debug.PlsqlDebugAction"/>
6.11 - </file>
6.12 - <file name="org-netbeans-modules-plsql-debug-PlsqlDebugCompileAction.instance">
6.13 - <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.debug.PlsqlDebugCompileAction"/>
6.14 - </file>
6.15 - </folder>
6.16 - <folder name="Project">
6.17 - <folder name="Node">
6.18 - <file name="org-netbeans-modules-plsql-debug-PlsqlDebugListenAction-separatorBefore.instance">
6.19 - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
6.20 - <attr name="position" intvalue="700"/>
6.21 - </file>
6.22 - <file name="org-netbeans-modules-plsql-debug-PlsqlDebugListenAction.instance">
6.23 - <attr name="instanceClass" stringvalue="org.netbeans.modules.plsql.debug.PlsqlDebugListenAction"/>
6.24 - <attr name="position" intvalue="710"/>
6.25 - </file>
6.26 - </folder>
6.27 - </folder>
6.28 - </folder>
6.29 <folder name="Editors">
6.30 <folder name="text">
6.31 <folder name="x-plsql">
6.32 @@ -33,22 +11,15 @@
6.33 </file>
6.34 </folder>
6.35 <folder name="Popup">
6.36 - <file name="org-netbeans-modules-plsql-debug-DebugCompileAction.shadow">
6.37 - <attr name="originalFile" stringvalue="Actions/PLSQL/org-netbeans-modules-plsql-debug-PlsqlDebugCompileAction.instance"/>
6.38 - <attr name="position" intvalue="695"/>
6.39 - </file>
6.40 - <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
6.41 - <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
6.42 - <attr name="position" intvalue="1005"/>
6.43 - </file>
6.44 - <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance">
6.45 - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
6.46 - <attr name="position" intvalue="1010"/>
6.47 - </file>
6.48 + <file name="org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.shadow">
6.49 + <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ToggleBreakpointAction.instance"/>
6.50 + <attr name="position" intvalue="1005"/>
6.51 + </file>
6.52 </folder>
6.53 <folder name="Toolbars">
6.54 <folder name="Default">
6.55 <file name="org-netbeans-modules-plsql-debug-PlsqlDebugAction.instance">
6.56 + <attr bundlevalue="org.netbeans.modules.plsql.debug.Bundle#CTL_PlsqlDebugAction" name="displayName"/>
6.57 <attr name="position" intvalue="19600"/>
6.58 </file>
6.59 </folder>
7.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/Bundle.properties Mon Jun 18 17:05:11 2012 +0530
7.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/Bundle.properties Tue Jun 19 14:47:18 2012 +0200
7.3 @@ -6,7 +6,8 @@
7.4 CTL_DescribeAction=Describe
7.5 CTL_CopyAsJavaStringAction=Copy as Java String
7.6 CTL_PasteAsSqlCommandAction=Paste as SQL Command
7.7 -CTL_fileExecution=Execute (Alt+Shift+E)
7.8 +CTL_Execution=Execute
7.9 +CTL_ExecutionDescription=Execute (Ctrl+Shift+E)
7.10 CTL_fileCommit=Auto Commit ON
7.11 CTL_PlsqlExecutionHistoryAction=Execution History
7.12 CTL_PlsqlExecutionHistoryNextAction=Next Entry in Execution History
8.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CopyAsJavaStringAction.java Mon Jun 18 17:05:11 2012 +0530
8.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CopyAsJavaStringAction.java Tue Jun 19 14:47:18 2012 +0200
8.3 @@ -61,7 +61,7 @@
8.4
8.5 @ActionID(id = "org.netbeans.modules.plsql.execution.CopyAsJavaStringAction", category = "PLSQL")
8.6 @ActionRegistration(displayName = "#CTL_CopyAsJavaStringAction")
8.7 -@ActionReference(path = "Editors/text/x-plsql/Popup", position = 285)
8.8 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 4000)
8.9 public class CopyAsJavaStringAction extends CookieAction {
8.10
8.11 @Override
8.12 @@ -84,7 +84,7 @@
8.13
8.14 //first check if the user has selected some text
8.15 if ((panes != null) && (panes.length != 0)) {
8.16 - selectedText = panes[0].getSelectedText();
8.17 + selectedText = panes[0].getSelectedText();
8.18 }
8.19 //if no selection then consider the contents of the whole document
8.20 if (selectedText == null || selectedText.equals("")) {
8.21 @@ -102,16 +102,16 @@
8.22 String[] lines = selectedText.trim().split("\n");
8.23 for (int i = 0; i < lines.length; i++) {
8.24 String line = lines[i].replaceAll("\"", "\\\\\""); //escape any " found in the SQL command
8.25 - if(i==0){ //first line
8.26 - if (i==lines.length-1) //single line SQL command
8.27 - sb.append("String dbStmt = \"" ).append(line.replaceAll("\\s+$", "")).append("\";");
8.28 - else
8.29 - sb.append("String dbStmt = \"" ).append(line.replaceAll("\\s+$", "")).append(" \"\n\t\t");
8.30 - }
8.31 - else if(i == lines.length - 1) { //last line when multiple lines exist
8.32 + if (i == 0) { //first line
8.33 + if (i == lines.length - 1) //single line SQL command
8.34 + {
8.35 + sb.append("String dbStmt = \"").append(line.replaceAll("\\s+$", "")).append("\";");
8.36 + } else {
8.37 + sb.append("String dbStmt = \"").append(line.replaceAll("\\s+$", "")).append(" \"\n\t\t");
8.38 + }
8.39 + } else if (i == lines.length - 1) { //last line when multiple lines exist
8.40 sb.append(" +\"").append(line.replaceAll("\\s+$", "")).append("\";");
8.41 - }
8.42 - else {
8.43 + } else {
8.44 sb.append(" +\"").append(line.replaceAll("\\s+$", "")).append(" \"\n\t\t");
8.45 }
8.46 }
8.47 @@ -119,14 +119,14 @@
8.48 String formattedText = sb.toString();
8.49 Clipboard clipboard = Lookup.getDefault().lookup(ExClipboard.class);
8.50 //should we check for system clipboard as well?
8.51 - if (clipboard != null) {
8.52 + if (clipboard != null) {
8.53 clipboard.setContents(new StringSelection(formattedText), null);
8.54 }
8.55 }
8.56 }
8.57
8.58 @Override
8.59 - public String getName() {
8.60 + public String getName() {
8.61 return NbBundle.getMessage(CopyAsJavaStringAction.class, "CTL_CopyAsJavaStringAction");
8.62 }
8.63
9.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CreateTestBlockAction.java Mon Jun 18 17:05:11 2012 +0530
9.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/CreateTestBlockAction.java Tue Jun 19 14:47:18 2012 +0200
9.3 @@ -41,17 +41,6 @@
9.4 */
9.5 package org.netbeans.modules.plsql.execution;
9.6
9.7 -import static org.netbeans.modules.plsql.lexer.PlsqlBlockType.*;
9.8 -import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
9.9 -import org.netbeans.modules.plsqlsupport.db.DatabaseContentManager;
9.10 -import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
9.11 -import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
9.12 -import org.netbeans.modules.plsql.lexer.PlsqlBlock;
9.13 -import org.netbeans.modules.plsql.lexer.PlsqlTokenId;
9.14 -import org.netbeans.modules.plsql.utilities.NotConnectedToDbException;
9.15 -import org.netbeans.modules.plsql.utilities.PlsqlFileUtil;
9.16 -import org.netbeans.modules.plsql.utilities.PlsqlFileValidatorService;
9.17 -import org.netbeans.modules.plsql.utilities.PlsqlParserUtil;
9.18 import java.util.ArrayList;
9.19 import java.util.List;
9.20 import java.util.StringTokenizer;
9.21 @@ -66,6 +55,17 @@
9.22 import org.netbeans.api.lexer.TokenSequence;
9.23 import org.netbeans.api.project.FileOwnerQuery;
9.24 import org.netbeans.api.project.Project;
9.25 +import org.netbeans.modules.plsql.lexer.PlsqlBlock;
9.26 +import org.netbeans.modules.plsql.lexer.PlsqlBlockFactory;
9.27 +import static org.netbeans.modules.plsql.lexer.PlsqlBlockType.*;
9.28 +import org.netbeans.modules.plsql.lexer.PlsqlTokenId;
9.29 +import org.netbeans.modules.plsql.utilities.NotConnectedToDbException;
9.30 +import org.netbeans.modules.plsql.utilities.PlsqlFileUtil;
9.31 +import org.netbeans.modules.plsql.utilities.PlsqlFileValidatorService;
9.32 +import org.netbeans.modules.plsql.utilities.PlsqlParserUtil;
9.33 +import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
9.34 +import org.netbeans.modules.plsqlsupport.db.DatabaseContentManager;
9.35 +import org.netbeans.modules.plsqlsupport.db.ui.SQLCommandWindow;
9.36 import org.openide.awt.ActionID;
9.37 import org.openide.awt.ActionReference;
9.38 import org.openide.awt.ActionReferences;
9.39 @@ -84,7 +84,7 @@
9.40 @ActionRegistration(displayName = "#CTL_CreateTestBlockAction")
9.41 @ActionReferences(value = {
9.42 @ActionReference(path = "Shortcuts", name = "AS-B"),
9.43 - @ActionReference(path = "Editors/text/x-plsql/Popup", position = 281)})
9.44 + @ActionReference(path = "Editors/text/x-plsql/Popup", position = 1010)})
9.45 public final class CreateTestBlockAction extends CookieAction {
9.46
9.47 private static final PlsqlFileValidatorService validator = Lookup.getDefault().lookup(PlsqlFileValidatorService.class);
10.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/DescribeAction.java Mon Jun 18 17:05:11 2012 +0530
10.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/DescribeAction.java Tue Jun 19 14:47:18 2012 +0200
10.3 @@ -64,7 +64,7 @@
10.4 */
10.5 @ActionID(id = "org.netbeans.modules.plsql.execution.DescribeAction", category = "PLSQL")
10.6 @ActionRegistration(displayName = "#CTL_DescribeAction")
10.7 -@ActionReference(path = "Editors/text/x-plsql/Popup", position = 283)
10.8 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 430, separatorAfter = 440)
10.9 public class DescribeAction extends CookieAction {
10.10
10.11 private static final RequestProcessor RP = new RequestProcessor(DescribeAction.class);
11.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PasteAsSqlCommandAction.java Mon Jun 18 17:05:11 2012 +0530
11.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PasteAsSqlCommandAction.java Tue Jun 19 14:47:18 2012 +0200
11.3 @@ -67,7 +67,7 @@
11.4
11.5 @ActionID(id = "org.netbeans.modules.plsql.execution.PasteAsSqlCommandAction", category = "PLSQL")
11.6 @ActionRegistration(displayName = "#CTL_PasteAsSqlCommandAction")
11.7 -@ActionReference(path = "Editors/text/x-plsql/Popup", position = 286)
11.8 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 4010)
11.9 public class PasteAsSqlCommandAction extends CookieAction {
11.10
11.11 @Override
11.12 @@ -88,62 +88,62 @@
11.13 Clipboard clipboard = Lookup.getDefault().lookup(ExClipboard.class);
11.14 Transferable trn = clipboard.getContents(null);
11.15 if (trn != null) {
11.16 - try {
11.17 - String contents = (String) trn.getTransferData(DataFlavor.stringFlavor);
11.18 - StringBuilder sb = new StringBuilder();
11.19 - String[] lines = contents.trim().split("\n");
11.20 - int paramCount = 0; //counter for '?' in SQL
11.21 - for (int i = 0; i < lines.length; i++) {
11.22 - String line = lines[i].replaceAll("\\s+$", ""); //remove trailing space
11.23 - line = line.replace("\\\"" , "\""); // remove java escape (i.e. \) for double quotes used for column aliases in selects
11.24 - line = line.replaceFirst("^\\s*\\+?\\s*\"", ""); // remove lines starting with " or +"
11.25 - line = line.replaceAll("\"\\s*\\+?$", ""); // remove " and "+ from eol
11.26 - line = line.replaceAll("\"\\s*;+$", ""); // remove "; from eol
11.27 - //replace ? with code template place holders
11.28 - for (;line.indexOf("?")>0;++paramCount){
11.29 - line = line.replaceFirst("\\?", "\\${<value_"+paramCount+">}");
11.30 - }
11.31 -
11.32 - if (line.trim().startsWith("\"")) {
11.33 - line = line.replaceFirst("\"", ""); //preserves spaces at begining
11.34 - }
11.35 -
11.36 - //finally append line to string builder
11.37 - if (i == lines.length - 1) {
11.38 - sb.append(line);
11.39 - } else {
11.40 - sb.append(line).append("\n");
11.41 - }
11.42 - }
11.43 - JEditorPane[] panes = ec.getOpenedPanes();
11.44 - if (panes != null && panes.length > 0) {
11.45 - insert(sb.toString(), panes[0], doc);
11.46 + try {
11.47 + String contents = (String) trn.getTransferData(DataFlavor.stringFlavor);
11.48 + StringBuilder sb = new StringBuilder();
11.49 + String[] lines = contents.trim().split("\n");
11.50 + int paramCount = 0; //counter for '?' in SQL
11.51 + for (int i = 0; i < lines.length; i++) {
11.52 + String line = lines[i].replaceAll("\\s+$", ""); //remove trailing space
11.53 + line = line.replace("\\\"", "\""); // remove java escape (i.e. \) for double quotes used for column aliases in selects
11.54 + line = line.replaceFirst("^\\s*\\+?\\s*\"", ""); // remove lines starting with " or +"
11.55 + line = line.replaceAll("\"\\s*\\+?$", ""); // remove " and "+ from eol
11.56 + line = line.replaceAll("\"\\s*;+$", ""); // remove "; from eol
11.57 + //replace ? with code template place holders
11.58 + for (; line.indexOf("?") > 0; ++paramCount) {
11.59 + line = line.replaceFirst("\\?", "\\${<value_" + paramCount + ">}");
11.60 }
11.61
11.62 - } catch (UnsupportedFlavorException ex) {
11.63 - Exceptions.printStackTrace(ex);
11.64 - } catch (Exception ex) {
11.65 - Exceptions.printStackTrace(ex);
11.66 + if (line.trim().startsWith("\"")) {
11.67 + line = line.replaceFirst("\"", ""); //preserves spaces at begining
11.68 + }
11.69 +
11.70 + //finally append line to string builder
11.71 + if (i == lines.length - 1) {
11.72 + sb.append(line);
11.73 + } else {
11.74 + sb.append(line).append("\n");
11.75 + }
11.76 }
11.77 + JEditorPane[] panes = ec.getOpenedPanes();
11.78 + if (panes != null && panes.length > 0) {
11.79 + insert(sb.toString(), panes[0], doc);
11.80 + }
11.81 +
11.82 + } catch (UnsupportedFlavorException ex) {
11.83 + Exceptions.printStackTrace(ex);
11.84 + } catch (Exception ex) {
11.85 + Exceptions.printStackTrace(ex);
11.86 + }
11.87 }
11.88 }
11.89 -
11.90 - private static void insert(String s, final JTextComponent target, final Document doc) {
11.91 +
11.92 + private static void insert(String s, final JTextComponent target, final Document doc) {
11.93 try {
11.94 //at first, find selected text range
11.95 Caret caret = target.getCaret();
11.96 int p0 = Math.min(caret.getDot(), caret.getMark());
11.97 int p1 = Math.max(caret.getDot(), caret.getMark());
11.98 - doc.remove(p0, p1 - p0);
11.99 + doc.remove(p0, p1 - p0);
11.100 CodeTemplate ct = CodeTemplateManager.get(target.getDocument()).createTemporary(s);
11.101 - ct.insert(target);
11.102 + ct.insert(target);
11.103 } catch (BadLocationException ble) {
11.104 Exceptions.printStackTrace(ble);
11.105 - }
11.106 + }
11.107 }
11.108
11.109 @Override
11.110 - public String getName() {
11.111 + public String getName() {
11.112 return NbBundle.getMessage(PasteAsSqlCommandAction.class, "CTL_PasteAsSqlCommandAction");
11.113 }
11.114
12.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlCommitAction.java Mon Jun 18 17:05:11 2012 +0530
12.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlCommitAction.java Tue Jun 19 14:47:18 2012 +0200
12.3 @@ -50,16 +50,11 @@
12.4 import java.util.Arrays;
12.5 import java.util.List;
12.6 import java.util.Locale;
12.7 -
12.8 import javax.swing.AbstractAction;
12.9 import javax.swing.Action;
12.10 import javax.swing.ImageIcon;
12.11 import javax.swing.JButton;
12.12 -import javax.swing.text.Document;
12.13 -
12.14 import org.netbeans.api.db.explorer.DatabaseConnection;
12.15 -import org.netbeans.api.progress.ProgressHandle;
12.16 -import org.netbeans.api.progress.ProgressHandleFactory;
12.17 import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
12.18 import org.netbeans.modules.plsqlsupport.options.OptionsUtilities;
12.19 import org.openide.awt.ActionID;
12.20 @@ -68,15 +63,8 @@
12.21 import org.openide.cookies.EditorCookie;
12.22 import org.openide.cookies.SaveCookie;
12.23 import org.openide.loaders.DataObject;
12.24 -import org.openide.util.ContextAwareAction;
12.25 -import org.openide.util.Exceptions;
12.26 -import org.openide.util.ImageUtilities;
12.27 -import org.openide.util.Lookup;
12.28 -import org.openide.util.NbBundle;
12.29 -import org.openide.util.Utilities;
12.30 +import org.openide.util.*;
12.31 import org.openide.util.actions.Presenter;
12.32 -import org.openide.windows.IOProvider;
12.33 -import org.openide.windows.InputOutput;
12.34
12.35 @ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlCommitAction", category = "PLSQL")
12.36 @ActionRegistration(displayName = "#CTL_PlsqlCommit")
13.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java Mon Jun 18 17:05:11 2012 +0530
13.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlExecuteAction.java Tue Jun 19 14:47:18 2012 +0200
13.3 @@ -55,19 +55,10 @@
13.4 import java.util.ArrayList;
13.5 import java.util.List;
13.6 import java.util.Locale;
13.7 -
13.8 -import javax.swing.AbstractAction;
13.9 -import javax.swing.Action;
13.10 -import javax.swing.ImageIcon;
13.11 -import javax.swing.JButton;
13.12 -import javax.swing.JEditorPane;
13.13 -import javax.swing.JMenuItem;
13.14 -import javax.swing.JOptionPane;
13.15 -import javax.swing.JPopupMenu;
13.16 +import javax.swing.*;
13.17 import javax.swing.event.PopupMenuEvent;
13.18 import javax.swing.event.PopupMenuListener;
13.19 import javax.swing.text.Document;
13.20 -
13.21 import org.netbeans.api.db.explorer.DatabaseConnection;
13.22 import org.netbeans.api.progress.ProgressHandle;
13.23 import org.netbeans.api.progress.ProgressHandleFactory;
13.24 @@ -75,29 +66,25 @@
13.25 import org.netbeans.modules.plsql.utilities.PlsqlFileValidatorService;
13.26 import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
13.27 import org.netbeans.modules.plsqlsupport.options.OptionsUtilities;
13.28 -import org.openide.awt.ActionID;
13.29 -import org.openide.awt.ActionReference;
13.30 -import org.openide.awt.ActionRegistration;
13.31 -import org.openide.awt.DropDownButtonFactory;
13.32 +import org.openide.awt.*;
13.33 import org.openide.cookies.EditorCookie;
13.34 import org.openide.cookies.SaveCookie;
13.35 import org.openide.filesystems.FileObject;
13.36 import org.openide.loaders.DataObject;
13.37 -import org.openide.util.Cancellable;
13.38 -import org.openide.util.ContextAwareAction;
13.39 -import org.openide.util.Exceptions;
13.40 -import org.openide.util.ImageUtilities;
13.41 -import org.openide.util.Lookup;
13.42 -import org.openide.util.NbBundle;
13.43 -import org.openide.util.RequestProcessor;
13.44 -import org.openide.util.Utilities;
13.45 +import org.openide.util.*;
13.46 import org.openide.util.actions.Presenter;
13.47
13.48 @ActionID(id = "org.netbeans.modules.plsql.execution.PlsqlExecuteAction", category = "PLSQL")
13.49 -@ActionRegistration(displayName = "#CTL_fileExecution")
13.50 -@ActionReference(path = "Shortcuts", name = "AS-E")
13.51 +@ActionRegistration(displayName = "#CTL_Execution", iconBase = "org/netbeans/modules/plsql/execution/execute.png")
13.52 +@ActionReferences({
13.53 +// @ActionReference(path = "Shortcuts", name = "DS-E"),
13.54 + @ActionReference(path = "Shortcuts", name = "OS-E"),
13.55 + @ActionReference(path = "Editors/text/x-plsql/Popup", name = "org-netbeans-modules-plsql-execution-PlsqlExecuteAction",
13.56 + position = 405, separatorBefore = 404)
13.57 +})
13.58 public class PlsqlExecuteAction extends AbstractAction implements ContextAwareAction, Presenter.Toolbar {
13.59
13.60 + private static final String ICON_PATH = "org/netbeans/modules/plsql/execution/execute.png";
13.61 private static final RequestProcessor RP = new RequestProcessor(PlsqlExecuteAction.class);
13.62 private static final PlsqlFileValidatorService validator = Lookup.getDefault().lookup(PlsqlFileValidatorService.class);
13.63 private static final String DATABASE_CONNECTION_KEY = "databaseConnection";
13.64 @@ -112,15 +99,16 @@
13.65 private ActionListener buttonListener = new ButtonListener();
13.66 private boolean autoCommit = true;
13.67 PlsqlCommit commit;
13.68 -
13.69 +
13.70 public PlsqlExecuteAction() {
13.71 this(Utilities.actionsGlobalContext());
13.72 }
13.73
13.74 public PlsqlExecuteAction(Lookup context) {
13.75 - putValue(NAME, NbBundle.getMessage(PlsqlExecuteAction.class, "CTL_fileExecution"));
13.76 - putValue(SHORT_DESCRIPTION, NbBundle.getMessage(PlsqlExecuteAction.class, "CTL_fileExecution"));
13.77 - putValue(SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/plsql/execution/execute.png")));
13.78 + putValue(NAME, NbBundle.getMessage(PlsqlExecuteAction.class, "CTL_Execution"));
13.79 + putValue(SHORT_DESCRIPTION, NbBundle.getMessage(PlsqlExecuteAction.class, "CTL_ExecutionDescription"));
13.80 +// putValue(LONG_DESCRIPTION, NbBundle.getMessage(PlsqlExecuteAction.class, "CTL_ExecutionDescription"));
13.81 + putValue(SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(ICON_PATH)));
13.82
13.83 dataObject = context.lookup(DataObject.class);
13.84
13.85 @@ -140,7 +128,7 @@
13.86 if (validator.isValidTDB(dataObject)) {
13.87 autoCommit = OptionsUtilities.isCommandWindowAutoCommitEnabled();
13.88 }
13.89 - if(dataObject != null){
13.90 + if (dataObject != null) {
13.91 commit = PlsqlCommit.getInstance(dataObject);
13.92 }
13.93 }
13.94 @@ -254,7 +242,7 @@
13.95 popup.add(item);
13.96 }
13.97 }
13.98 -
13.99 +
13.100 private void setConnection(DatabaseConnection newConnection) {
13.101 if (connection != null && connection.getName().equals(newConnection.getName())) {
13.102 connection = dataObject.getLookup().lookup(DatabaseConnection.class);
13.103 @@ -263,7 +251,7 @@
13.104 connection = dataObject.getLookup().lookup(DatabaseConnection.class);
13.105 if (commit.getCommit()) {
13.106 if (!OptionsUtilities.isDeployNoPromptEnabled()) {
13.107 -
13.108 +
13.109 String msg = "Commit transactions for " + connection.getDisplayName() + " ?";
13.110 String title = "Confirm!";
13.111 int showOptionDialog = JOptionPane.showOptionDialog(null,
13.112 @@ -272,7 +260,7 @@
13.113 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
13.114 null, null, null);
13.115
13.116 - if (showOptionDialog == JOptionPane.YES_OPTION) {
13.117 + if (showOptionDialog == JOptionPane.YES_OPTION) {
13.118 commit.commitTransaction(dataObject, connection, connectionProvider);
13.119 } else if (showOptionDialog == JOptionPane.NO_OPTION) {
13.120 commit.rollbackTransaction(dataObject, connection, connectionProvider);
13.121 @@ -374,7 +362,7 @@
13.122 private List<PlsqlExecutableObject> blocks;
13.123 private Document document;
13.124 private PlsqlFileExecutor executor;
13.125 -
13.126 +
13.127 public ExecutionHandler(DatabaseConnectionManager connectionProvider, DatabaseConnection connection,
13.128 List<PlsqlExecutableObject> blocks, Document doc) {
13.129 this.connectionProvider = connectionProvider;
14.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/ViewDataAction.java Mon Jun 18 17:05:11 2012 +0530
14.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/ViewDataAction.java Tue Jun 19 14:47:18 2012 +0200
14.3 @@ -60,7 +60,7 @@
14.4
14.5 @ActionID(id = "org.netbeans.modules.plsql.execution.ViewDataAction", category = "PLSQL")
14.6 @ActionRegistration(displayName = "#CTL_ViewDataAction")
14.7 -@ActionReference(path = "Editors/text/x-plsql/Popup", position = 282)
14.8 +@ActionReference(path = "Editors/text/x-plsql/Popup", position = 430)
14.9 public final class ViewDataAction extends CookieAction {
14.10
14.11 /**
15.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/actions/DeployFilesAction.java Mon Jun 18 17:05:11 2012 +0530
15.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/actions/DeployFilesAction.java Tue Jun 19 14:47:18 2012 +0200
15.3 @@ -61,13 +61,7 @@
15.4 import org.openide.filesystems.FileUtil;
15.5 import org.openide.loaders.DataObject;
15.6 import org.openide.nodes.Node;
15.7 -import org.openide.util.Cancellable;
15.8 -import org.openide.util.Exceptions;
15.9 -import org.openide.util.HelpCtx;
15.10 -import org.openide.util.Lookup;
15.11 -import org.openide.util.NbBundle;
15.12 -import org.openide.util.RequestProcessor;
15.13 -import org.openide.util.Task;
15.14 +import org.openide.util.*;
15.15 import org.openide.util.actions.CookieAction;
15.16 import org.openide.windows.IOProvider;
15.17 import org.openide.windows.InputOutput;
15.18 @@ -142,10 +136,9 @@
15.19 }
15.20
15.21 private void execute(File[] files) throws IOException {
15.22 - DatabaseConnectionManager connectionProvider = null;
15.23 project = activatedNodes[0].getLookup().lookup(Project.class);
15.24
15.25 - connectionProvider = DatabaseConnectionManager.getInstance(project);
15.26 + DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(project);
15.27 RP.post(new MultipleDbFileExecutionHandler(connectionProvider, files));
15.28 }
15.29
16.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/actions/DeploySelectedCodeAction.java Mon Jun 18 17:05:11 2012 +0530
16.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/actions/DeploySelectedCodeAction.java Tue Jun 19 14:47:18 2012 +0200
16.3 @@ -46,7 +46,6 @@
16.4 import java.io.File;
16.5 import java.io.FileWriter;
16.6 import java.io.IOException;
16.7 -
16.8 import java.util.List;
16.9 import javax.swing.JEditorPane;
16.10 import javax.swing.JMenu;
16.11 @@ -55,7 +54,6 @@
16.12 import javax.swing.text.BadLocationException;
16.13 import javax.swing.text.Caret;
16.14 import javax.swing.text.Document;
16.15 -
16.16 import org.netbeans.api.db.explorer.DatabaseConnection;
16.17 import org.netbeans.api.project.FileOwnerQuery;
16.18 import org.netbeans.api.project.Project;
16.19 @@ -76,7 +74,8 @@
16.20
16.21 @ActionID(id = "org.netbeans.modules.plsql.execution.actions.DeploySelectedCodeAction", category = "PLSQL")
16.22 @ActionRegistration(displayName = "#CTL_DeploySelectedCodeAction")
16.23 -@ActionReference(path = "Editors/text/x-plsql/Popup", name = "org-netbeans-modules-plsql-execution-action-DeploySelectedCodeAction", position = 280)
16.24 +@ActionReference(path = "Editors/text/x-plsql/Popup", name = "org-netbeans-modules-plsql-execution-action-DeploySelectedCodeAction",
16.25 +position = 410)
16.26 public final class DeploySelectedCodeAction extends CookieAction {
16.27
16.28 private Node[] activatedNodes;
16.29 @@ -87,7 +86,8 @@
16.30 private final String TEMP_SQL_FILE_PREFIX = "Tempory";
16.31
16.32 /**
16.33 - * Create a sql execution window for the selected methoad
16.34 + * Create a SQL execution window for the selected method
16.35 + *
16.36 * @param activatedNodes
16.37 */
16.38 @Override
16.39 @@ -128,6 +128,7 @@
16.40
16.41 /**
16.42 * Enable this action when right clicked on procedures or functions
16.43 + *
16.44 * @param arg0
16.45 * @return
16.46 */
16.47 @@ -216,17 +217,17 @@
16.48 tmpFile.deleteOnExit();
16.49 writer = new FileWriter(tmpFile);
16.50 writer.write(output);
16.51 -
16.52 +
16.53 } catch (IOException ex) {
16.54 Exceptions.printStackTrace(ex);
16.55 - }
16.56 - finally{
16.57 - if (writer!=null)
16.58 - try {
16.59 - writer.close();
16.60 - } catch (IOException ignore) {
16.61 - // Exceptions.printStackTrace(ex);
16.62 - }
16.63 + } finally {
16.64 + if (writer != null) {
16.65 + try {
16.66 + writer.close();
16.67 + } catch (IOException ignore) {
16.68 + // Exceptions.printStackTrace(ex);
16.69 + }
16.70 + }
16.71 }
16.72 File[] files = {tmpFile};
16.73 try {
17.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/layer.xml Mon Jun 18 17:05:11 2012 +0530
17.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/layer.xml Tue Jun 19 14:47:18 2012 +0200
17.3 @@ -51,7 +51,7 @@
17.4 <attr name="position" intvalue="19400"/>
17.5 </file>
17.6 <file name="org-netbeans-modules-plsql-execution-PlsqlExecuteAction.instance">
17.7 - <attr bundlevalue="org.netbeans.modules.plsql.execution.Bundle#CTL_fileExecution" name="displayName"/>
17.8 + <attr bundlevalue="org.netbeans.modules.plsql.execution.Bundle#CTL_ExecutionDescription" name="displayName"/>
17.9 <attr name="position" intvalue="19500"/>
17.10 </file>
17.11 <!-- <file name="org-netbeans-modules-plsql-execution-PlsqlCommitAction.instance">