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 41087 - Cutting a file doesn't give good feedback
Summary: Cutting a file doesn't give good feedback
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: UI
: 16339 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-17 20:02 UTC by David-john Burrowes
Modified: 2010-04-02 07:06 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Diff (9.29 KB, patch)
2005-07-09 11:23 UTC, _ tboudreau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David-john Burrowes 2004-03-17 20:02:58 UTC
If I select a file in the filesystems (or
forthcoming projects) window, and issue the Cut
command, there is no visible feedback that the
file is "cut".  In essence, this means there is no
feedback that the IDE has successfully received
the command (and no feedback to check back with to
verify that one cut the right thing)
Comment 1 Jiri Rechtacek 2004-04-23 10:45:38 UTC
Assigned to new owner.
Comment 2 _ tboudreau 2005-07-09 11:22:56 UTC
I have a patch for you; it involves a smidgen of API.  It could either be
implemented on Node (as in the patch I sent), or someplace else that Node can
see.  The idea is pretty simple - keep a collection of the cut items and have a
test in Node.getHtmlDisplayName & friends to check it and return grayed out text
(same for icon but I didn't try it yet - there's some good icon graying code in
navigator/javanavigation if you want it).

It adds a few protected static methods to Node (which could really go anywhere):
protected static void nodeCut();
protected static boolean wasCut(Node n);
public static void pastePerformed();

The last one is ugly;  it could also be somewhere else (maybe put all of these
methods on ExClipboard and generalize it to Object instead of Node?).  Rather
than create packages in CVS just to send you a patch, I put that last method on
Node for now.

The only clever trick in here is that it's pretty safe to assume cut over
multiple nodes happens in a single cycle in the event dispatch thread, so
there's a cute little flag that gets set and reset to make this work.

Anyway, it works - with a few aesthetic choices about where to put the code,
it'd be pretty simple to implement/integrate.
Comment 3 _ tboudreau 2005-07-09 11:23:18 UTC
Created attachment 23046 [details]
Diff
Comment 4 Jaroslav Tulach 2005-07-11 08:48:11 UTC
1. the proposed methods are not correct. 
2. you can very likely just observe ExClipboard.getDefault() content to know 
which nodes are the correct ones 
3. test would be more useful patch than the one attached 
Comment 5 _ tboudreau 2005-07-11 18:46:54 UTC
> 1. the proposed methods are not correct

Please explain what you mean by this.

Re observing ExClipboard.getDefault(), remember that the isCut() test will need to be done once (more 
typically twice - once getting the HTML display name and once getting the icon).  I suspect that for 
performance reasons, we do not want to be calling Lookup.getDefault().lookup(ExClipboard.class) twice 
for every node on screen from inside the paint loop.  

I didn't test this, but I'd suspect there will be problems if we need to actually get the clipboard contents 
to see if it's a node and if it's the right one while painting the nodes (imagine I have just copied a 4K px 
bitmap in photoshop and switch to NetBeans).  

So some kind of tracking mechanism that is node-specific will be needed.

As I noted before, it doesn't really matter what class isCut(Node n), etc. is implemented - just that it be 
fast.
Comment 6 Jaroslav Tulach 2005-07-12 10:18:45 UTC
Performance consideration needs to take place. However please notice that 
ExClipboard is not "native clipboard". It is a copy. 
 
Also please realize that the proposed methods (definitevely the static one) 
are not correct.  
 
Comment 7 _ tboudreau 2005-07-12 17:47:06 UTC
Then please suggest an alternative - "not correct" is pretty ambiguous (since I've already pointed out 
that the methods could live on any class accessible to Node and be static or non-static).  I could 
imagine it being on ExClipboard, i.e.

boolean isCut;
ExClipboard ex = (ExClipboard) Lookup.getDefault().lookup (ExClipboard.class);
return ex.isCut (this)

except that once again we're calling into Lookup once per node per paint cycle, which doesn't seem like 
a good idea to me.  I expect we don't want to actually add static methods to Node, since there's the 
vague possibility that someone will have instance methods with the same names - but again, the 
placement and naming of the methods is proof-of-concept.  So, Jarda, don't be shy - if you have a 
concrete suggestion, make it.
Comment 8 Jaroslav Tulach 2005-07-13 08:33:06 UTC
The fact that someone calls Node.clipboardCut does not necessarily mean that 
the node is being pasted into (system) clipboard. That is why you cannot use 
static methods the way you try to use them, regardless of their potential 
place. 
Comment 9 _ tboudreau 2005-07-13 17:55:37 UTC
Okay;  so I think what you're saying is this logic would have to be in CutAction?

Who else does use clipboardCut, and for what?  An aborted drag and drop could use the same 
mechanism to reset the "cut" state of the nodes;  what else uses clipboardCut?
Comment 10 Antonin Nebuzelsky 2008-02-07 16:06:45 UTC
Reassigning to new module owner Tomas Holy.
Comment 11 t_h 2008-10-20 13:12:41 UTC
*** Issue 16339 has been marked as a duplicate of this issue. ***
Comment 12 Jaroslav Tulach 2010-04-02 07:06:39 UTC
The feedback is the same for last ten years. Won'tfix unless someone provides a patch.