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.

Bug 153632 - SQL History: Statement is inserted in wrong SQL editor
Summary: SQL History: Statement is inserted in wrong SQL editor
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: John Baker
URL:
Keywords:
Depends on:
Blocks: 152774 153160
  Show dependency tree
 
Reported: 2008-11-21 11:17 UTC by Roman Mostyka
Modified: 2009-02-19 20:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2008-11-21 11:17:49 UTC
1. Execute some statement in separated SQL editors.
2. Open "SQL History" dialog.
3. Select some other SQL editor, select some record in "SQL History" dialog and click "Insert".

Result: Statement is inserted, but in opened SQL editor. Statement was inserted in SQL editor, which had had focus when
"SQL History" dialog was opened.
Comment 1 John Baker 2008-11-21 22:39:10 UTC
1f7418aa2220
Comment 2 Quality Engineering 2008-11-23 17:09:57 UTC
Integrated into 'main-golden', will be available in build *200811231401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1f7418aa2220
User: John Baker <jbaker@netbeans.org>
Log: #153632 fix
Comment 3 pgebauer 2008-11-24 09:30:55 UTC
The issue didn't pass the nomination process by nomination cut-off date. It has been marked as 65fixes2-candidate.
Comment 4 Roman Mostyka 2008-11-24 15:33:33 UTC
Verified with build 081123.
Comment 5 Rob Englander 2008-11-25 18:55:37 UTC
John, Roman, could you explain what the fix does?  Sorry for jumping in so late.

It looks like this fix causes the insert to happen in the sql editor that it was originally
executed in.  That will cause blind inserts.  I don't think that's what the user would expect.
Since the user launched the sql history dialog from a specific editor, I think that's where the
insert should take place.

Am I understanding the fix correctly?
Comment 6 John Baker 2008-11-25 19:07:39 UTC
The following is what the fix intends to do:

Use case is
1) Open the SQL Editor A
2) Open another SQL Editor B
3) Launch SQL History from B
4) With SQL History still open, click on SQL Editor A
5) Select a statement in History and click Insert

statement should be inserted in Editor A, not B

This is one advantage of making the History non-modal - when there's more than one SQL file to edit

Comment 7 _ wadechandler 2008-11-25 21:11:30 UTC
Exactly. The SQL editor I currently have opened with the cursor is where SQL history should be placed. This should
basically work like all other editor actions such as in the Java editor when I am typing and use CTRL+V to paste. It
inserts this pasted information where the cursor resides. I haven't tried this out yet, but does it put it where the
cursor is? This is how I would expect it to work...follow the cursor not only to locate an editor, but too, to find
where in the editor to place the text.
Comment 8 _ wadechandler 2008-11-25 21:19:12 UTC
Looking at the fix source. If a .java file has the last focus the insert of source will take place there is this
correct? Seems a good candidate for an SPI to allow different editors to support special formatters and transormations
to the SQL history module to allow queries to be injected into source code.
Comment 9 _ wadechandler 2008-11-25 21:21:16 UTC
...the formatters and transformations would allow the history module to ask them to format logic for a given file type
mime, ext, something, and then that would be used to transform the logic for the given editor to insert it correctly as
needed versus a straight text dump. Either way, I definitely think the way it should work is to insert into the editor
with the cursor which is what the fixes source does.
Comment 10 pgebauer 2008-12-19 17:19:01 UTC
The issue is marked as the candidate for 65patch2. Since it has P3 priority, in accord with rules "How to include issues into patch"
(http://wiki.netbeans.org/NetBeansPatches) it must include an explanation as to why its backport is necessary and how
safe it is.

Could you please provide such explanation?

Comment 11 Roman Mostyka 2008-12-22 11:17:44 UTC
The justification is the same as for issue #153160, since this issue is a consequence of that issue.
This issue was reported after users compliance and it will help to improve work flow.
John, can you provide some information how safe this fix is.
Comment 12 John Baker 2008-12-22 17:41:50 UTC
Users wanted the SQL History dialog to be non-modal.  Once the dialog is not modal and there are multiple SQL editors
open, then when statements are to be inserted from the dialog to the Editor, the statements should be inserted in the
SQL editor in focus.

Fix ensures statements are only inserted in the SQL editor, not Java or other editor.  Fix has been reviewed and is safe
Comment 13 pgebauer 2009-01-12 12:10:29 UTC
The fix has been ported into the release65_fixes repository.

http://hg.netbeans.org/release65_fixes/rev/b0282fbaa7ae