Remote PL/SQL debugging doesn't always work release701
authorSubhashini Sooriarachchi <subslk@netbeans.org>
Tue, 26 Jun 2012 14:00:18 +0530
branchrelease701
changeset 24965f8a07d9738
parent 248 1a8d21270103
child 250 df3a5b147f52
child 251 8e6fdacd16bc
Remote PL/SQL debugging doesn't always work
PLSQL/Debugging/nbproject/project.xml
PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/Bundle.properties
PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/GetProjectDialog.form
PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/GetProjectDialog.java
PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlEditorContext.java
     1.1 --- a/PLSQL/Debugging/nbproject/project.xml	Fri Jun 22 10:26:29 2012 +0530
     1.2 +++ b/PLSQL/Debugging/nbproject/project.xml	Tue Jun 26 14:00:18 2012 +0530
     1.3 @@ -7,6 +7,24 @@
     1.4              <suite-component/>
     1.5              <module-dependencies>
     1.6                  <dependency>
     1.7 +                    <code-name-base>org.jdesktop.beansbinding</code-name-base>
     1.8 +                    <build-prerequisite/>
     1.9 +                    <compile-dependency/>
    1.10 +                    <run-dependency>
    1.11 +                        <release-version>1</release-version>
    1.12 +                        <specification-version>1.11.1.121</specification-version>
    1.13 +                    </run-dependency>
    1.14 +                </dependency>
    1.15 +                <dependency>
    1.16 +                    <code-name-base>org.jdesktop.layout</code-name-base>
    1.17 +                    <build-prerequisite/>
    1.18 +                    <compile-dependency/>
    1.19 +                    <run-dependency>
    1.20 +                        <release-version>1</release-version>
    1.21 +                        <specification-version>1.17.1</specification-version>
    1.22 +                    </run-dependency>
    1.23 +                </dependency>
    1.24 +                <dependency>
    1.25                      <code-name-base>org.netbeans.api.debugger</code-name-base>
    1.26                      <build-prerequisite/>
    1.27                      <compile-dependency/>
     2.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/Bundle.properties	Fri Jun 22 10:26:29 2012 +0530
     2.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/Bundle.properties	Tue Jun 26 14:00:18 2012 +0530
     2.3 @@ -7,3 +7,5 @@
     2.4  TOOLTIP_CURRENT_EXP_LINE=Current Program Counter In Expression
     2.5  TOOLTIP_OTHER_THREAD=Thread {0} suspended at this line
     2.6  TOOLTIP_CALLSITE=Call Stack Line
     2.7 +GetProjectDialog.okButton.text=OK
     2.8 +GetProjectDialog.lblProject.text=Select a project to debug
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/GetProjectDialog.form	Tue Jun 26 14:00:18 2012 +0530
     3.3 @@ -0,0 +1,86 @@
     3.4 +<?xml version="1.1" encoding="UTF-8" ?>
     3.5 +
     3.6 +<Form version="1.5" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
     3.7 +  <Properties>
     3.8 +    <Property name="defaultCloseOperation" type="int" value="2"/>
     3.9 +  </Properties>
    3.10 +  <SyntheticProperties>
    3.11 +    <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
    3.12 +  </SyntheticProperties>
    3.13 +  <AuxValues>
    3.14 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    3.15 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
    3.16 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
    3.17 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
    3.18 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
    3.19 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
    3.20 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
    3.21 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
    3.22 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
    3.23 +  </AuxValues>
    3.24 +
    3.25 +  <Layout>
    3.26 +    <DimensionLayout dim="0">
    3.27 +      <Group type="103" groupAlignment="0" attributes="0">
    3.28 +          <Group type="102" attributes="0">
    3.29 +              <Group type="103" groupAlignment="0" attributes="0">
    3.30 +                  <Group type="102" alignment="0" attributes="0">
    3.31 +                      <EmptySpace max="-2" attributes="0"/>
    3.32 +                      <Component id="lblProject" min="-2" max="-2" attributes="0"/>
    3.33 +                  </Group>
    3.34 +                  <Group type="102" alignment="0" attributes="0">
    3.35 +                      <EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
    3.36 +                      <Group type="103" groupAlignment="1" attributes="0">
    3.37 +                          <Component id="okButton" alignment="1" min="-2" max="-2" attributes="0"/>
    3.38 +                          <Component id="cbProjects" alignment="1" min="-2" pref="214" max="-2" attributes="0"/>
    3.39 +                      </Group>
    3.40 +                  </Group>
    3.41 +              </Group>
    3.42 +              <EmptySpace pref="31" max="32767" attributes="0"/>
    3.43 +          </Group>
    3.44 +      </Group>
    3.45 +    </DimensionLayout>
    3.46 +    <DimensionLayout dim="1">
    3.47 +      <Group type="103" groupAlignment="0" attributes="0">
    3.48 +          <Group type="102" alignment="0" attributes="0">
    3.49 +              <EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
    3.50 +              <Component id="lblProject" min="-2" max="-2" attributes="0"/>
    3.51 +              <EmptySpace type="separate" max="-2" attributes="0"/>
    3.52 +              <Component id="cbProjects" min="-2" max="-2" attributes="0"/>
    3.53 +              <EmptySpace type="unrelated" max="-2" attributes="0"/>
    3.54 +              <Component id="okButton" min="-2" max="-2" attributes="0"/>
    3.55 +              <EmptySpace max="32767" attributes="0"/>
    3.56 +          </Group>
    3.57 +      </Group>
    3.58 +    </DimensionLayout>
    3.59 +  </Layout>
    3.60 +  <SubComponents>
    3.61 +    <Component class="javax.swing.JButton" name="okButton">
    3.62 +      <Properties>
    3.63 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
    3.64 +          <ResourceString bundle="org/netbeans/modules/plsql/debug/Bundle.properties" key="GetProjectDialog.okButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
    3.65 +        </Property>
    3.66 +      </Properties>
    3.67 +      <Events>
    3.68 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
    3.69 +      </Events>
    3.70 +    </Component>
    3.71 +    <Component class="javax.swing.JLabel" name="lblProject">
    3.72 +      <Properties>
    3.73 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
    3.74 +          <ResourceString bundle="org/netbeans/modules/plsql/debug/Bundle.properties" key="GetProjectDialog.lblProject.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
    3.75 +        </Property>
    3.76 +      </Properties>
    3.77 +    </Component>
    3.78 +    <Component class="javax.swing.JComboBox" name="cbProjects">
    3.79 +      <Properties>
    3.80 +        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
    3.81 +          <StringArray count="0"/>
    3.82 +        </Property>
    3.83 +      </Properties>
    3.84 +      <BindingProperties>
    3.85 +        <BindingProperty name="elements" source="cbProjects" target="cbProjects" targetPath="elements" updateStrategy="0" immediately="false"/>
    3.86 +      </BindingProperties>
    3.87 +    </Component>
    3.88 +  </SubComponents>
    3.89 +</Form>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/GetProjectDialog.java	Tue Jun 26 14:00:18 2012 +0530
     4.3 @@ -0,0 +1,152 @@
     4.4 +/*
     4.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4.6 + *
     4.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     4.8 + *
     4.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    4.10 + * Other names may be trademarks of their respective owners.
    4.11 + *
    4.12 + * The contents of this file are subject to the terms of either the GNU
    4.13 + * General Public License Version 2 only ("GPL") or the Common
    4.14 + * Development and Distribution License("CDDL") (collectively, the
    4.15 + * "License"). You may not use this file except in compliance with the
    4.16 + * License. You can obtain a copy of the License at
    4.17 + * http://www.netbeans.org/cddl-gplv2.html
    4.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    4.19 + * specific language governing permissions and limitations under the
    4.20 + * License.  When distributing the software, include this License Header
    4.21 + * Notice in each file and include the License file at
    4.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    4.23 + * particular file as subject to the "Classpath" exception as provided
    4.24 + * by Oracle in the GPL Version 2 section of the License file that
    4.25 + * accompanied this code. If applicable, add the following below the
    4.26 + * License Header, with the fields enclosed by brackets [] replaced by
    4.27 + * your own identifying information:
    4.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    4.29 + *
    4.30 + * If you wish your version of this file to be governed by only the CDDL
    4.31 + * or only the GPL Version 2, indicate your decision by adding
    4.32 + * "[Contributor] elects to include this software in this distribution
    4.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    4.34 + * single choice of license, a recipient has the option to distribute
    4.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    4.36 + * to extend the choice of license to its licensees as provided above.
    4.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    4.38 + * Version 2 license, then the option applies only if the new code is
    4.39 + * made subject to such option by the copyright holder.
    4.40 + *
    4.41 + * Contributor(s):
    4.42 + *
    4.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
    4.44 + */
    4.45 +package org.netbeans.modules.plsql.debug;
    4.46 +
    4.47 +import java.util.HashMap;
    4.48 +import java.util.Map;
    4.49 +
    4.50 +/**
    4.51 + *
    4.52 + * @author  YaDhLK
    4.53 + */
    4.54 +public class GetProjectDialog extends javax.swing.JDialog {
    4.55 +
    4.56 +   static final Map<String, String> previousValues = new HashMap<String, String>();
    4.57 +   String variableName = null;
    4.58 +
    4.59 +   /** Creates new form PromptValue */
    4.60 +   public GetProjectDialog(java.awt.Frame parent, String[] variable, boolean modal) {
    4.61 +      super(parent, modal);
    4.62 +      initComponents();
    4.63 +      getRootPane().setDefaultButton(okButton);
    4.64 +      this.setLocation(325, 125);
    4.65 +      this.setTitle("Select Debug Project");
    4.66 +      for(int x =0; x < variable.length; x++){
    4.67 +       this.cbProjects.addItem(variable[x]);
    4.68 +      }
    4.69 +   }
    4.70 +   
    4.71 +   
    4.72 +    /**
    4.73 +    * Return the value of the text field
    4.74 +    * @return
    4.75 +    */
    4.76 +   public String getValue() {
    4.77 +      String value = cbProjects.getSelectedItem().toString();
    4.78 +      return value;
    4.79 +   }
    4.80 +   
    4.81 +   /** This method is called from within the constructor to
    4.82 +    * initialize the form.
    4.83 +    * WARNING: Do NOT modify this code. The content of this method is
    4.84 +    * always regenerated by the Form Editor.
    4.85 +    */
    4.86 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    4.87 +    private void initComponents() {
    4.88 +        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
    4.89 +
    4.90 +        okButton = new javax.swing.JButton();
    4.91 +        lblProject = new javax.swing.JLabel();
    4.92 +        cbProjects = new javax.swing.JComboBox();
    4.93 +
    4.94 +        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    4.95 +
    4.96 +        okButton.setText(org.openide.util.NbBundle.getMessage(GetProjectDialog.class, "GetProjectDialog.okButton.text")); // NOI18N
    4.97 +        okButton.addActionListener(new java.awt.event.ActionListener() {
    4.98 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
    4.99 +                okButtonActionPerformed(evt);
   4.100 +            }
   4.101 +        });
   4.102 +
   4.103 +        lblProject.setText(org.openide.util.NbBundle.getMessage(GetProjectDialog.class, "GetProjectDialog.lblProject.text")); // NOI18N
   4.104 +
   4.105 +        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cbProjects, org.jdesktop.beansbinding.ObjectProperty.create(), cbProjects, org.jdesktop.beansbinding.BeanProperty.create("elements"));
   4.106 +        bindingGroup.addBinding(binding);
   4.107 +
   4.108 +        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
   4.109 +        getContentPane().setLayout(layout);
   4.110 +        layout.setHorizontalGroup(
   4.111 +            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   4.112 +            .add(layout.createSequentialGroup()
   4.113 +                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   4.114 +                    .add(layout.createSequentialGroup()
   4.115 +                        .addContainerGap()
   4.116 +                        .add(lblProject))
   4.117 +                    .add(layout.createSequentialGroup()
   4.118 +                        .add(31, 31, 31)
   4.119 +                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
   4.120 +                            .add(okButton)
   4.121 +                            .add(cbProjects, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 214, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
   4.122 +                .addContainerGap(31, Short.MAX_VALUE))
   4.123 +        );
   4.124 +        layout.setVerticalGroup(
   4.125 +            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   4.126 +            .add(layout.createSequentialGroup()
   4.127 +                .add(24, 24, 24)
   4.128 +                .add(lblProject)
   4.129 +                .add(18, 18, 18)
   4.130 +                .add(cbProjects, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
   4.131 +                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
   4.132 +                .add(okButton)
   4.133 +                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
   4.134 +        );
   4.135 +
   4.136 +        bindingGroup.bind();
   4.137 +
   4.138 +        pack();
   4.139 +    }// </editor-fold>//GEN-END:initComponents
   4.140 +
   4.141 +   private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
   4.142 +      // TODO add your handling code here:
   4.143 +      this.setVisible(false);
   4.144 +      this.dispose();
   4.145 +}//GEN-LAST:event_okButtonActionPerformed
   4.146 +  
   4.147 +  
   4.148 +    // Variables declaration - do not modify//GEN-BEGIN:variables
   4.149 +    private javax.swing.JComboBox cbProjects;
   4.150 +    private javax.swing.JLabel lblProject;
   4.151 +    private javax.swing.JButton okButton;
   4.152 +    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
   4.153 +    // End of variables declaration//GEN-END:variables
   4.154 +   
   4.155 +}
     5.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlEditorContext.java	Fri Jun 22 10:26:29 2012 +0530
     5.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlEditorContext.java	Tue Jun 26 14:00:18 2012 +0530
     5.3 @@ -41,6 +41,7 @@
     5.4   */
     5.5  package org.netbeans.modules.plsql.debug;
     5.6  
     5.7 +import java.io.UnsupportedEncodingException;
     5.8  import static org.netbeans.modules.plsql.lexer.PlsqlBlockType.*;
     5.9  import org.netbeans.modules.plsqlsupport.db.DatabaseConnectionManager;
    5.10  import org.netbeans.modules.plsqlsupport.db.DatabaseContentManager;
    5.11 @@ -52,6 +53,7 @@
    5.12  import java.beans.PropertyChangeEvent;
    5.13  import java.beans.PropertyChangeListener;
    5.14  import java.beans.PropertyChangeSupport;
    5.15 +import java.io.File;
    5.16  import java.lang.reflect.InvocationTargetException;
    5.17  import java.net.MalformedURLException;
    5.18  import java.net.URL;
    5.19 @@ -63,8 +65,11 @@
    5.20  import javax.swing.SwingUtilities;
    5.21  import javax.swing.text.StyledDocument;
    5.22  import org.netbeans.api.db.explorer.DatabaseConnection;
    5.23 +import org.netbeans.api.debugger.Breakpoint;
    5.24 +import org.netbeans.api.debugger.DebuggerManager;
    5.25  import org.netbeans.api.debugger.jpda.JPDAThread;
    5.26  import org.netbeans.api.debugger.jpda.LineBreakpoint;
    5.27 +import org.netbeans.api.project.FileOwnerQuery;
    5.28  import org.netbeans.spi.debugger.jpda.EditorContext;
    5.29  import org.netbeans.spi.debugger.ui.EditorContextDispatcher;
    5.30  import org.openide.cookies.EditorCookie;
    5.31 @@ -77,6 +82,8 @@
    5.32  import org.openide.util.WeakListeners;
    5.33  import org.netbeans.api.project.Project;
    5.34  import org.openide.cookies.LineCookie;
    5.35 +import org.openide.filesystems.FileUtil;
    5.36 +import org.openide.loaders.DataFolder;
    5.37  import org.openide.text.Annotation;
    5.38  import org.openide.text.Line;
    5.39  import org.openide.util.actions.SystemAction;
    5.40 @@ -125,8 +132,8 @@
    5.41        }
    5.42        return false;
    5.43     }
    5.44 -
    5.45 -   private String extractMethodName(String url, String namespace) {
    5.46 +   
    5.47 +     private String extractMethodName(String url, String namespace) {
    5.48        return null;
    5.49     }
    5.50  
    5.51 @@ -184,7 +191,7 @@
    5.52           for (Iterator it = annotations.iterator(); it.hasNext();) {
    5.53              removeSingleAnnotation((Annotation) it.next());
    5.54           }
    5.55 -      } else {
    5.56 +      } else if(a instanceof Annotation){
    5.57           removeSingleAnnotation((Annotation) a);
    5.58        }
    5.59     }
    5.60 @@ -345,12 +352,9 @@
    5.61        if (blockFactory == null) {
    5.62           return null;
    5.63        }
    5.64 -
    5.65 +      
    5.66        int offset = NbDocument.findLineOffset(document, lineNumber - 1);
    5.67        PlsqlBlock block = PlsqlBlockUtilities.getCurrentBlock(offset, blockFactory.getBlockHierarchy());
    5.68 -      if (block == null) {
    5.69 -         return null;
    5.70 -      }
    5.71  
    5.72        DatabaseConnectionManager connectionProvider = DatabaseConnectionManager.getInstance(dataObject);
    5.73        if (connectionProvider == null) {
    5.74 @@ -360,6 +364,17 @@
    5.75        if (databaseConnection == null) {
    5.76           return null;
    5.77        }
    5.78 +      
    5.79 +      if (block == null) {
    5.80 +          //to avoid making the classname null
    5.81 +         DatabaseContentManager cache = DatabaseContentManager.getInstance(databaseConnection);
    5.82 +         FileObject primaryFile = dataObject.getPrimaryFile();
    5.83 +         String fileName = primaryFile.getName();
    5.84 +         if(cache !=null)
    5.85 +           return "$Oracle.PackageBody." + cache.getOwner(fileName) + "." + fileName;
    5.86 +         else  
    5.87 +           return null;
    5.88 +      }
    5.89  
    5.90        return PlsqlDebuggerUtilities.getClassName(block, databaseConnection);
    5.91     }
    5.92 @@ -399,7 +414,7 @@
    5.93             String url,
    5.94             int lineNumber,
    5.95             String annotationType,
    5.96 -           Object timeStamp) {
    5.97 +           Object timeStamp) {       
    5.98        return annotate(url, lineNumber, annotationType, timeStamp, null);
    5.99     }
   5.100  
   5.101 @@ -445,31 +460,90 @@
   5.102     }
   5.103  
   5.104     @Override
   5.105 -   public Object annotate(final String url,
   5.106 -           int lineNumber,
   5.107 -           String annotationType,
   5.108 -           Object timeStamp,
   5.109 -           JPDAThread thread) {
   5.110 -      if (url == null) {
   5.111 +    public Object annotate(final String url,
   5.112 +            int lineNumber,
   5.113 +            String annotationType,
   5.114 +            Object timeStamp,
   5.115 +            JPDAThread thread) {
   5.116 +        if (url == null) {
   5.117 +            return null;
   5.118 +        }
   5.119 +        Project project = PlsqlToggleBreakpointActionProvider.getProject();
   5.120 +        if (project == null) {
   5.121 +           return setDebugProject();
   5.122 +        }
   5.123 +        DataObject dataObject = getDataObject(url);
   5.124 +        if (dataObject == null) {
   5.125 +            final List result = new ArrayList();
   5.126 +            getDataObject(url, lineNumber, result);
   5.127 +            if (result.size() > 0) {
   5.128 +                lineNumber = ((Integer) result.get(0)).intValue();
   5.129 +                dataObject = (DataObject) result.get(1);
   5.130 +            }
   5.131 +        }
   5.132 +        if (dataObject == null || lineNumber < 1) {
   5.133 +            return null;
   5.134 +        }
   5.135 +        LineCookie lc = dataObject.getCookie(LineCookie.class);
   5.136 +        if (lc == null) {
   5.137 +            return null;
   5.138 +        }
   5.139 +        Line line = lc.getLineSet().getCurrent(lineNumber - 1);
   5.140 +        return new DebuggerAnnotation(annotationType, line, thread);
   5.141 +    }
   5.142 +   
   5.143 +    private DataObject setDebugProject() {
   5.144 +        String debugProj = null;
   5.145 +        Breakpoint[] breakpoints = DebuggerManager.getDebuggerManager().getBreakpoints();
   5.146 +        ArrayList<String> projNames = new ArrayList<String>();
   5.147 +       
   5.148 +        for(Breakpoint breakpoint : breakpoints){
   5.149 +           if(projNames.indexOf(breakpoint.getGroupName()) == -1)
   5.150 +                projNames.add(breakpoint.getGroupName());
   5.151 +        }
   5.152 +        String[] nameArry = new String[projNames.size()];
   5.153 +
   5.154 +        nameArry = projNames.toArray(nameArry);
   5.155 +        if (!projNames.isEmpty()) {
   5.156 +            GetProjectDialog projDialog = new GetProjectDialog(null, nameArry, true);
   5.157 +            projDialog.setVisible(true);
   5.158 +            debugProj = projDialog.getValue();
   5.159 +        }
   5.160 +
   5.161 +        if (debugProj != null) {
   5.162 +            DataObject dataObject = null;
   5.163 +            for (Breakpoint breakpoint : breakpoints) {                
   5.164 +                if (breakpoint.getGroupName().equalsIgnoreCase(debugProj)) {                    
   5.165 +                    if (breakpoint instanceof LineBreakpoint) {
   5.166 +                        LineBreakpoint lbp = (LineBreakpoint) breakpoint;
   5.167 +                        String url = lbp.getURL();
   5.168 +                        int lineNumber = lbp.getLineNumber();
   5.169 +                        if (url != null && lineNumber > -1) {
   5.170 +                            String fileName = url.substring(6);
   5.171 +                            try {
   5.172 +                                fileName = java.net.URLDecoder.decode(fileName, "UTF-8");
   5.173 +                            } catch (UnsupportedEncodingException ex) {
   5.174 +                                Exceptions.printStackTrace(ex);
   5.175 +                            }
   5.176 +                            final File file = new File(fileName);
   5.177 +                            if (!file.exists()) {
   5.178 +                                return null;
   5.179 +                            }
   5.180 +                            try {
   5.181 +                                dataObject = DataFolder.find(FileUtil.toFileObject(file));
   5.182 +                                if (dataObject != null) {
   5.183 +                                    Project debugProject = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
   5.184 +                                    PlsqlToggleBreakpointActionProvider.setProject(debugProject);
   5.185 +                                    return dataObject;
   5.186 +                                }
   5.187 +                            } catch (DataObjectNotFoundException ex) {
   5.188 +                                return null;
   5.189 +                            }
   5.190 +                        }
   5.191 +                    }
   5.192 +                }
   5.193 +            }
   5.194 +        }
   5.195           return null;
   5.196 -      }
   5.197 -      DataObject dataObject = getDataObject(url);
   5.198 -      if (dataObject == null) {
   5.199 -         final List result = new ArrayList();
   5.200 -         getDataObject(url, lineNumber, result);
   5.201 -         if (result.size() > 0) {
   5.202 -            lineNumber = ((Integer) result.get(0)).intValue();
   5.203 -            dataObject = (DataObject) result.get(1);
   5.204 -         }
   5.205 -      }
   5.206 -      if (dataObject == null || lineNumber < 1) {
   5.207 -         return null;
   5.208 -      }
   5.209 -      LineCookie lc = dataObject.getCookie(LineCookie.class);
   5.210 -      if (lc == null) {
   5.211 -         return null;
   5.212 -      }
   5.213 -      Line line = lc.getLineSet().getCurrent(lineNumber - 1);
   5.214 -      return new DebuggerAnnotation(annotationType, line, thread);
   5.215 -   }
   5.216 +    }
   5.217  }