Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » suggestions for visual clues of "cut" items
suggestions for visual clues of "cut" items [message #215225] Thu, 27 April 2006 20:38 Go to next message
Eclipse UserFriend
Originally posted by: nospam-ejohnson.nospam-avaya.com

Hi-
I'm wondering what people have done for visual indications of items that
have been "cut" but pending a paste operation. I need to implment a lazy
cut (ie. a copy then delete after paste rather than delete prior to paste),
and need a mechanism to indicate which nodes on the canvas have been cut.

My thoughts are something like making the figures translucent (any hints on
how that could be achieved would be helpful), or any if anyone has other
thoughts/suggestions, I would appreciate any ideas.

Regards,
Erik

Also, anyone have any clue how to change the Edit Menu labels for
Cut/Copy/Paste so that the accelerators are listed as Ctrl X/C/V rather than
Shift+Delete/Shift+Insert/Ctrl+Insert ?
Re: suggestions for visual clues of "cut" items [message #215281 is a reply to message #215225] Fri, 28 April 2006 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

Erik Johnson <nospam-ejohnson@nospam-avaya.com> wrote:
> Hi-
> I'm wondering what people have done for visual indications of items
> that have been "cut" but pending a paste operation. I need to
> implment a lazy cut (ie. a copy then delete after paste rather than
> delete prior to paste), and need a mechanism to indicate which nodes
> on the canvas have been cut.
> My thoughts are something like making the figures translucent (any
> hints on how that could be achieved would be helpful), or any if
> anyone has other thoughts/suggestions, I would appreciate any ideas.
>

Sure, replace the default cut command with your own "lazy cut" command.
Set a property on the model objects indicating that they have been cut.
Whenever the property is set, let the peer EditPart for the model object
modify the IFigure to indicate that it is cut. Perhaps to make it
translucent, the EditPart could take a snapshot of the IFigure and set the
alpha value of the image to 50% to make it translucent.
Someone had earlier posted code (or a link to code) to generate a
translucent image of an IFigure- except that he was doing it to provide
feedback during move or resize.
When cut is completed, then remove the model objects, otherwise unset the
property to restore the default IFigure.

> Regards,
> Erik
>
> Also, anyone have any clue how to change the Edit Menu labels for
> Cut/Copy/Paste so that the accelerators are listed as Ctrl X/C/V
> rather than Shift+Delete/Shift+Insert/Ctrl+Insert ?

??? I see Ctrl X/C/V in my Edit Menu. Are you retargeting the default
Cut/Copy/Paste commands or not?

--
Sunil
Re: suggestions for visual clues of "cut" items [message #215298 is a reply to message #215281] Fri, 28 April 2006 21:09 Go to previous message
Eclipse UserFriend
Originally posted by: nospam-ejohnson.nospam-avaya.com

"Sunil Kamath" <sunil_kamath@nohotspammail.com> wrote in message
news:e2tiou$4bi$1@utils.eclipse.org...
> Erik Johnson <nospam-ejohnson@nospam-avaya.com> wrote:
>> Hi-
>> I'm wondering what people have done for visual indications of items
>> that have been "cut" but pending a paste operation. I need to
>> implment a lazy cut (ie. a copy then delete after paste rather than
>> delete prior to paste), and need a mechanism to indicate which nodes
>> on the canvas have been cut.
>> My thoughts are something like making the figures translucent (any
>> hints on how that could be achieved would be helpful), or any if
>> anyone has other thoughts/suggestions, I would appreciate any ideas.
>>
>
> Sure, replace the default cut command with your own "lazy cut" command.
> Set a property on the model objects indicating that they have been cut.
> Whenever the property is set, let the peer EditPart for the model object
> modify the IFigure to indicate that it is cut. Perhaps to make it
> translucent, the EditPart could take a snapshot of the IFigure and set the
> alpha value of the image to 50% to make it translucent.
> Someone had earlier posted code (or a link to code) to generate a
> translucent image of an IFigure- except that he was doing it to provide
> feedback during move or resize.
> When cut is completed, then remove the model objects, otherwise unset the
> property to restore the default IFigure.

Using the model to track being cut is an intersting thought and would
definately make changing the figure easy to do. I found a post about
creating translucent figures based on some code in the ThumbnailFigure.
The only other issue that I've encoutered is determining when the paste
action runs so that the cut items can be removed from the source model. The
issue is if the paste target is a different model/editor, I haven't found a
way to notify the cut objects that they can be deleted. It seems that the
action instance is different, so I can't necessarily register the cut action
as a listener to the paste action since a different instance may be the one
that runs. I could do something with singleton/statics, but that seems
pretty kludgey.

>
>> Regards,
>> Erik
>>
>> Also, anyone have any clue how to change the Edit Menu labels for
>> Cut/Copy/Paste so that the accelerators are listed as Ctrl X/C/V
>> rather than Shift+Delete/Shift+Insert/Ctrl+Insert ?
>
> ??? I see Ctrl X/C/V in my Edit Menu. Are you retargeting the default
> Cut/Copy/Paste commands or not?

Yes, I've implemented retarget actions for the cut/copy/paste defined by the
workbench:
addRetargetAction(createAction(ActionFactory.CUT.getId(), "Cut",
ISharedImages.IMG_TOOL_CUT, ISharedImages.IMG_TOOL_CUT_DISABLED));
addRetargetAction(createAction(ActionFactory.COPY.getId(), "Copy",
ISharedImages.IMG_TOOL_COPY, ISharedImages.IMG_TOOL_COPY_DISABLED));
addRetargetAction(createAction(ActionFactory.PASTE.getId(), "Paste",
ISharedImages.IMG_TOOL_PASTE, ISharedImages.IMG_TOOL_PASTE_DISABLED));

private RetargetAction createAction(String id, String name, String imgId,
String disabledImgId) {
RetargetAction action = new LabelRetargetAction(id, name);
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
action.setImageDescriptor(sharedImages.getImageDescriptor(im gId));
action.setDisabledImageDescriptor(sharedImages.getImageDescr iptor(disabledImgId));
return action;
}

See attached snapshot of the menus. I see Ctrl X/C/V when I have a text
editor open.



  • Attachment: menu.JPG
    (Size: 9.02KB, Downloaded 99 times)
Previous Topic:Problem with Child creation using the palette
Next Topic:The example in the example of ibm Red book
Goto Forum:
  


Current Time: Fri Apr 19 22:12:48 GMT 2024

Powered by FUDForum. Page generated in 0.02867 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top