This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 70392
Collapse All | Expand All

(-)db/libsrc/org/netbeans/lib/ddl/DatabaseSpecificationFactory.java (-8 lines)
Lines 95-108 Link Here
95
95
96
    public DatabaseSpecification createSpecification(Connection c)
96
    public DatabaseSpecification createSpecification(Connection c)
97
    throws DatabaseProductNotFoundException, SQLException;
97
    throws DatabaseProductNotFoundException, SQLException;
98
99
    /** Returns debug-mode flag
100
    */
101
    public boolean isDebugMode();
102
103
    /** Sets debug-mode flag
104
    */
105
    public void setDebugMode(boolean mode);
106
}
98
}
107
99
108
/*
100
/*
(-)db/libsrc/org/netbeans/lib/ddl/impl/AbstractCommand.java (-20 / +5 lines)
Lines 56-75 Link Here
56
import org.openide.DialogDisplayer;
56
import org.openide.DialogDisplayer;
57
import org.openide.NotifyDescriptor;
57
import org.openide.NotifyDescriptor;
58
import org.openide.util.NbBundle;
58
import org.openide.util.NbBundle;
59
import org.openide.windows.IOProvider;
60
import org.openide.windows.OutputWriter;
61
59
62
import org.netbeans.lib.ddl.DatabaseSpecification;
60
import org.netbeans.lib.ddl.DatabaseSpecification;
63
import org.netbeans.lib.ddl.DDLCommand;
61
import org.netbeans.lib.ddl.DDLCommand;
64
import org.netbeans.lib.ddl.DDLException;
62
import org.netbeans.lib.ddl.DDLException;
65
import org.netbeans.lib.ddl.util.CommandFormatter;
63
import org.netbeans.lib.ddl.util.CommandFormatter;
66
import org.openide.windows.InputOutput;
67
64
68
/**
65
/**
69
* Basic implementation of DDLCommand. This class can be used for really simple
66
* Basic implementation of DDLCommand. This class can be used for really simple
70
* commands with format and without arguments. Heavilly subclassed.
67
* commands with format and without arguments. Heavilly subclassed.
71
*/
68
*/
72
public class AbstractCommand implements Serializable, DDLCommand {
69
public class AbstractCommand implements Serializable, DDLCommand {
70
    private static final Logger LOG = Logger.getLogger(AbstractCommand.class.getName());
71
    
73
    /** Command owner */
72
    /** Command owner */
74
    private DatabaseSpecification spec;
73
    private DatabaseSpecification spec;
75
74
Lines 208-232 Link Here
208
            return;
207
            return;
209
        }
208
        }
210
209
211
        //In case of debug mode print command
210
        // Output command to log -- log function contain short circuit filters, so 
212
        if (spec.getSpecificationFactory().isDebugMode()) {
211
        // the call should be cheap not to need another guard
212
        LOG.fine(fcmd);
213
213
214
            try {
214
            try {
215
                InputOutput io = IOProvider.getDefault().getIO(NbBundle.getBundle("org.netbeans.lib.ddl.resources.Bundle").getString("LBL_Output_Window"), false);
216
                io.select();
217
                OutputWriter ow = io.getOut(); //NOI18N
218
                if (ow != null) {
219
                    ow.println(fcmd);
220
                    ow.println(" "); //NOI18N
221
                } else
222
                    throw new Exception();
223
224
            } catch (Exception e) {
225
                Logger.getLogger("global").log(Level.INFO, e.getMessage() + "\n" + fcmd); //NOI18N
226
            }
227
        }
228
229
        try {
230
            fcon = spec.getJDBCConnection();
215
            fcon = spec.getJDBCConnection();
231
            if (fcon == null) {
216
            if (fcon == null) {
232
                fcon = spec.openJDBCConnection();
217
                fcon = spec.openJDBCConnection();
(-)db/libsrc/org/netbeans/lib/ddl/impl/SpecificationFactory.java (-12 lines)
Lines 253-270 Link Here
253
        return spec;
253
        return spec;
254
    }
254
    }
255
255
256
    /** Returns debug-mode flag
257
    */
258
    public boolean isDebugMode() {
259
        return debug;
260
    }
261
262
    /** Sets debug-mode flag
263
    */
264
    public void setDebugMode(boolean mode) {
265
        debug = mode;
266
    }
267
268
    /** Returns array of driver products supported by system.
256
    /** Returns array of driver products supported by system.
269
    * It returns string array only, if you need a Specification instance, use 
257
    * It returns string array only, if you need a Specification instance, use 
270
    * appropriate createDriverSpecification method.
258
    * appropriate createDriverSpecification method.
(-)db/src/org/netbeans/modules/db/explorer/action/DisableDebugAction.java (-74 lines)
Lines 1-74 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 * 
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 * 
38
 * Contributor(s):
39
 * 
40
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.db.explorer.action;
44
45
import org.netbeans.modules.db.explorer.node.RootNode;
46
import org.openide.nodes.Node;
47
import org.openide.util.HelpCtx;
48
import org.openide.util.NbBundle;
49
50
/**
51
 *
52
 * @author Rob Englander
53
 */
54
public class DisableDebugAction extends BaseAction {
55
    @Override
56
    public String getName() {
57
        return NbBundle.getMessage (DisableDebugAction.class, "DisableDebug"); // NOI18N
58
    }
59
60
    @Override
61
    public HelpCtx getHelpCtx() {
62
        return new HelpCtx(DisableDebugAction.class);
63
    }
64
65
    protected boolean enable(Node[] activatedNodes) {
66
        return RootNode.instance().getSpecificationFactory().isDebugMode();
67
    }
68
69
    @Override
70
    protected void performAction(Node[] activatedNodes) {
71
        RootNode.instance().getSpecificationFactory().setDebugMode(false);
72
    }
73
74
}
(-)db/src/org/netbeans/modules/db/explorer/action/EnableDebugAction.java (-74 lines)
Lines 1-74 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 * 
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 * 
38
 * Contributor(s):
39
 * 
40
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.db.explorer.action;
44
45
import org.netbeans.modules.db.explorer.node.RootNode;
46
import org.openide.nodes.Node;
47
import org.openide.util.HelpCtx;
48
import org.openide.util.NbBundle;
49
50
/**
51
 *
52
 * @author Rob Englander
53
 */
54
public class EnableDebugAction extends BaseAction {
55
    @Override
56
    public String getName() {
57
        return NbBundle.getMessage (EnableDebugAction.class, "EnableDebug"); // NOI18N
58
    }
59
60
    @Override
61
    public HelpCtx getHelpCtx() {
62
        return new HelpCtx(EnableDebugAction.class);
63
    }
64
65
    protected boolean enable(Node[] activatedNodes) {
66
        return !RootNode.instance().getSpecificationFactory().isDebugMode();
67
    }
68
69
    @Override
70
    protected void performAction(Node[] activatedNodes) {
71
        RootNode.instance().getSpecificationFactory().setDebugMode(true);
72
    }
73
74
}
(-)db/src/org/netbeans/modules/db/resources/mf-layer.xml (-10 lines)
Lines 65-80 Link Here
65
                    <file name="org-netbeans-modules-db-explorer-action-AddConnectionAction.instance">
65
                    <file name="org-netbeans-modules-db-explorer-action-AddConnectionAction.instance">
66
                        <attr name="position" intvalue="100"/>
66
                        <attr name="position" intvalue="100"/>
67
                    </file>
67
                    </file>
68
                    <file name="Separator1.instance">
69
                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
70
                        <attr name="position" intvalue="150"/>
71
                    </file>
72
                    <file name="org-netbeans-modules-db-explorer-action-EnableDebugAction.instance">
73
                        <attr name="position" intvalue="175"/>
74
                    </file>
75
                    <file name="org-netbeans-modules-db-explorer-action-DisableDebugAction.instance">
76
                        <attr name="position" intvalue="200"/>
77
                    </file>
78
                </folder>
68
                </folder>
79
            </folder>
69
            </folder>
80
            <folder name="DriverList">
70
            <folder name="DriverList">

Return to bug 70392