Bug 119259 - provide a way to get fully qualified class name into clipboard
Summary: provide a way to get fully qualified class name into clipboard
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: Benno Baumgartner CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 125907 135425 (view as bug list)
Depends on: 129309
Blocks:
  Show dependency tree
 
Reported: 2005-12-05 10:47 EST by Andrew Ferguson CLA
Modified: 2006-05-12 04:39 EDT (History)
3 users (show)

See Also:


Attachments
fix for block not qualifiable (1.24 KB, patch)
2006-05-12 04:39 EDT, Benno Baumgartner CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Ferguson CLA 2005-12-05 10:47:57 EST
hi,

 not sure what people will think of this but..

often when using Eclipse (and the PDE) its necessary to specify the fully qualified class name of a class and put it into a text field. It would be very neat to have some kind of shortcut way of doing this, maybe with a key shortcut also.

So the action is to copy the fully qualified class name to the clipboard, ways to invoke the action might be
(i) within an class textual scope, or within a file (for single class files) right-click context menu with entry (maybe under Source?)
(ii) in the Package Explorer view have context menu for compilation units (class acted upon would be the outermost class)
(iii) on resolved class names within programming text, the context menu could resolve to the currently selected text (in the same way refactoring selection works on the currently selected text)

thanks,
Andrew
Comment 1 Martin Aeschlimann CLA 2005-12-07 04:26:58 EST
I see the problem, in fact I'm missing something like that as well. But adding a extra context menu 'Copy qualified name' is not an option, we are desperatly trying to keep the context menu short. The action also seems to be too specific.

Maybe an idea would be if the status line could be selectable?
Comment 2 Andrew Ferguson CLA 2005-12-07 05:59:57 EST
an selectable status line would be good, although possibly a little non-standard usage? (i.e. i've not seen the status bar used in this way elsewhere?)

I can fully appreciate the sentiment about keeping context menus short though :)

one probably non-contraversial place, but also not so convenient would be the resource properties - all of the declared classes could be listed in the info tab maybe?

however, this doesn't pick up the use cases where references classes are being selected in the editor

will give this a bit more thought also..
Comment 3 Martin Aeschlimann CLA 2006-02-09 03:04:05 EST
*** Bug 125907 has been marked as a duplicate of this bug. ***
Comment 4 Martin Aeschlimann CLA 2006-02-24 04:56:42 EST
We should do something here for 3.2

I filed bug 129309, to offer copy on the status bar. That would help already a bit.
Comment 5 Martin Aeschlimann CLA 2006-04-10 12:51:05 EDT
Action is now available in global Edit menu. Benno, no plans to add it to the context menu?
Comment 6 Martin Aeschlimann CLA 2006-04-10 12:51:41 EDT
*** Bug 135425 has been marked as a duplicate of this bug. ***
Comment 7 Benno Baumgartner CLA 2006-04-13 05:00:22 EDT
(In reply to comment #5)
> Action is now available in global Edit menu. Benno, no plans to add it to the
> context menu?
> 

What about your comment #1:
> adding a extra context menu 'Copy qualified name' is not an option

I guess you want it right below 'Copy', like in the 'Edit' menu, and not in the source menu. 
Comment 8 Benno Baumgartner CLA 2006-04-25 11:39:18 EDT
Action is now also in the context menu for Java Views (except CompilationUnitEditor)

fixed > N20060425
Comment 9 Johannes Rieken CLA 2006-05-11 12:25:11 EDT
verifying for I20060511-0800
Comment 10 Johannes Rieken CLA 2006-05-11 12:44:11 EDT
do not verify for the following reason:

have a CU like this: 

package bug136124;
public class X {
  void foo() {
  }
  static class Y{	  
  }
}

+ edit a source file and the qualified name of the type currently edited is 
  copied (e.g. bug136124.X.Y)
- put your caret in a method (e.g X.foo) and 'Copy Qualified Names' fails

- select X in the package explorer and 'Copy FQN' will deliver 
  'bug136124.X.java' -> '.java' bugs me
+ selected an inner type (e.g bug136124.X.Y) or an member in package explorer
  (e.g. bug136124.X.foo()) works as one would expect.
Comment 11 Benno Baumgartner CLA 2006-05-12 04:37:18 EDT
(In reply to comment #10)
> do not verify for the following reason:
> 
> 
> + edit a source file and the qualified name of the type currently edited is 
>   copied (e.g. bug136124.X.Y)
> - put your caret in a method (e.g X.foo) and 'Copy Qualified Names' fails

It does not fail, it says 'nothing to qualify':-) You have to put your caret onto something to qualify, here the caret is on a block, which can't be qualified. I agree that this looks strange to the user since the type can be qualified if the caret is inside the type (on a TypeDeclaration). Attached patch does fix it, but IMHO too minor for 3.2

> 
> - select X in the package explorer and 'Copy FQN' will deliver 
>   'bug136124.X.java' -> '.java' bugs me

It's a feature not a bug, select the CU and the .java extension is appended, select only the type and it is not. Maybe this is confusing and I should allways use the primary type. Drawback is that I must open the CU which may result in a parse which may be a long running op for large CUs and require a progress dialog.

> + selected an inner type (e.g bug136124.X.Y) or an member in package explorer
>   (e.g. bug136124.X.foo()) works as one would expect.
> 

Comment 12 Benno Baumgartner CLA 2006-05-12 04:39:02 EDT
Created attachment 41290 [details]
fix for block not qualifiable