Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Doubt regarding copy/paste
Doubt regarding copy/paste [message #191852] Tue, 10 June 2008 10:20 Go to next message
Eclipse UserFriend
Originally posted by: mike.gmail.com

Hello all,


I am working on an RCP application which has a number of custom plugins
using GMF. When I copy/paste a component in the same window, the new
component renames itself as Copy_*_componentname where * is the number,
1-n based on the number of times the component is pasted.

eg. Component named "A" after copy pasting becomes "Copy_1_A". I don't
want the components to be renamed after pasting. ie. "A" should be "A"
itself after pasting.

Can anyone please guide me where to look for to fix this. I believe this
is done some where inside the GMF/EMF plugin classes. I have been
searching with no luck so far. Any help will be appreciated.

Hoping to hear from some one.

Thanks in advance,

mike
Re: Doubt regarding copy/paste [message #191968 is a reply to message #191852] Tue, 10 June 2008 16:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-fHDyeu26gL/q78jSWfdr
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Mike,

The renaming of the pasted element is done by the
ClipboardSupportUtil::rename(...) method called by the
PasteChildOperation::handleCollision(...) method. Looking in there, I
see this:

public static void rename(Collection list, EObject eObject, String
prefix) {
if (isNameable(eObject) == false) {
return;
}

Depending on what other use the copy/paste infra makes of the
isNameable(EObject) method, you might be able to define the
IClipboardSupport::isNameable(EObject) for your Ecore model as
indicating that your elements are not nameable.

I have not tried this.

HTH,

Christian


On Tue, 2008-06-10 at 10:20 +0000, Mike wrote:

> Hello all,
>
>
> I am working on an RCP application which has a number of custom plugins
> using GMF. When I copy/paste a component in the same window, the new
> component renames itself as Copy_*_componentname where * is the number,
> 1-n based on the number of times the component is pasted.
>
> eg. Component named "A" after copy pasting becomes "Copy_1_A". I don't
> want the components to be renamed after pasting. ie. "A" should be "A"
> itself after pasting.
>
> Can anyone please guide me where to look for to fix this. I believe this
> is done some where inside the GMF/EMF plugin classes. I have been
> searching with no luck so far. Any help will be appreciated.
>
> Hoping to hear from some one.
>
> Thanks in advance,
>
> mike
>

--=-fHDyeu26gL/q78jSWfdr
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Mike,<BR>
<BR>
The renaming of the pasted element is done by the&nbsp; ClipboardSupportUtil::rename(...) method called by the PasteChildOperation::handleCollision(...) method.&nbsp; Looking in there, I see this:<BR>
<BR>
public static void rename(Collection list, EObject eObject, String prefix) {<BR>
if (isNameable(eObject) == false) {<BR>
return;<BR>
}<BR>
<BR>
Depending on what other use the copy/paste infra makes of the isNameable(EObject) method, you might be able to define the IClipboardSupport::isNameable(EObject) for your Ecore model as indicating that your elements are not nameable.<BR>
<BR>
I have not tried this.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Tue, 2008-06-10 at 10:20 +0000, Mike wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hello all,</FONT>


<FONT COLOR="#000000">I am working on an RCP application which has a number of custom plugins </FONT>
<FONT COLOR="#000000">using GMF. When I copy/paste a component in the same window, the new </FONT>
<FONT COLOR="#000000">component renames itself as Copy_*_componentname where * is the number, </FONT>
<FONT COLOR="#000000">1-n based on the number of times the component is pasted.</FONT>

<FONT COLOR="#000000">eg. Component named &quot;A&quot; after copy pasting becomes &quot;Copy_1_A&quot;. I don't </FONT>
<FONT COLOR="#000000">want the components to be renamed after pasting. ie. &quot;A&quot; should be &quot;A&quot; </FONT>
<FONT COLOR="#000000">itself after pasting.</FONT>

<FONT COLOR="#000000">Can anyone please guide me where to look for to fix this. I believe this </FONT>
<FONT COLOR="#000000">is done some where inside the GMF/EMF plugin classes. I have been </FONT>
<FONT COLOR="#000000">searching with no luck so far. Any help will be appreciated.</FONT>

<FONT COLOR="#000000">Hoping to hear from some one.</FONT>

<FONT COLOR="#000000">Thanks in advance,</FONT>

<FONT COLOR="#000000">mike</FONT>

</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-fHDyeu26gL/q78jSWfdr--
Re: Doubt regarding copy/paste [message #192105 is a reply to message #191968] Wed, 11 June 2008 14:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mike.gmail.com

Hello Christian,

First of all thanks for the response.

My plugin uses OverridePasteChildOperation for pasting. I tried to
override the function handleCollision in my plugin class that extends
OverridePasteChildOperation. As per
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. gmf.doc/reference/api/common/org/eclipse/gmf/runtime/emf/cli pboard/core/OverridePasteChildOperation.html
the method handleCollision is inherited from PasteChildOperation

To check whether it works, I commented the rename function call like this.

*************************code
Snippet******************************************
protected boolean handleCollision(EReference reference, List list,
EObject eObject, ObjectInfo eObjectInfo) {
...

//ClipboardSupportUtil.rename(list, eObject, COPY);

.....

.....

}


*************************code
Snippet******************************************

But it didn't work as expected. Still the Copy_*_ comes when I copy paste
a component. Am I missing anything here?

Is there a better way/method to test this out?



Thanks,

Mike
Re: Doubt regarding copy/paste [message #192198 is a reply to message #192105] Wed, 11 June 2008 23:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-i+KdAsbY9W5IYmUjPLF/
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Mike,

That is peculiar. My understanding of the OverridePasteChildOperation
is that it should, well, override the default paste behaviour. Perhaps
it just decorates it?

Put a breakpoint in the ClipboardSupportUtil::rename(...) method to see
why it is still being called. That's the best I can suggest, for now.

cW

On Wed, 2008-06-11 at 14:16 +0000, Mike wrote:

> Hello Christian,
>
> First of all thanks for the response.
>
> My plugin uses OverridePasteChildOperation for pasting. I tried to
> override the function handleCollision in my plugin class that extends
> OverridePasteChildOperation. As per
> http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. gmf.doc/reference/api/common/org/eclipse/gmf/runtime/emf/cli pboard/core/OverridePasteChildOperation.html
> the method handleCollision is inherited from PasteChildOperation
>
> To check whether it works, I commented the rename function call like this.
>
> *************************code
> Snippet******************************************
> protected boolean handleCollision(EReference reference, List list,
> EObject eObject, ObjectInfo eObjectInfo) {
> ..
>
> //ClipboardSupportUtil.rename(list, eObject, COPY);
>
> ....
>
> ....
>
> }
>
>
> *************************code
> Snippet******************************************
>
> But it didn't work as expected. Still the Copy_*_ comes when I copy paste
> a component. Am I missing anything here?
>
> Is there a better way/method to test this out?
>
>
>
> Thanks,
>
> Mike
>

--=-i+KdAsbY9W5IYmUjPLF/
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Mike,<BR>
<BR>
That is peculiar.&nbsp; My understanding of the OverridePasteChildOperation is that it should, well, override the default paste behaviour.&nbsp; Perhaps it just decorates it?<BR>
<BR>
Put a breakpoint in the ClipboardSupportUtil::rename(...) method to see why it is still being called.&nbsp; That's the best I can suggest, for now.<BR>
<BR>
cW<BR>
<BR>
On Wed, 2008-06-11 at 14:16 +0000, Mike wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hello Christian,</FONT>

<FONT COLOR="#000000">First of all thanks for the response.</FONT>

<FONT COLOR="#000000">My plugin uses OverridePasteChildOperation for pasting. I tried to </FONT>
<FONT COLOR="#000000">override the function handleCollision in my plugin class that extends </FONT>
<FONT COLOR="#000000">OverridePasteChildOperation. As per </FONT>
<FONT COLOR="#000000"><A HREF=" http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. gmf.doc/reference/api/common/org/eclipse/gmf/runtime/emf/cli pboard/core/OverridePasteChildOperation.html"> http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. gmf.doc/reference/api/common/org/eclipse/gmf/runtime/emf/cli pboard/core/OverridePasteChildOperation.html</A></FONT>
<FONT COLOR="#000000">the method handleCollision is inherited from PasteChildOperation</FONT>

<FONT COLOR="#000000">To check whether it works, I commented the rename function call like this.</FONT>

<FONT COLOR="#000000">*************************code </FONT>
<FONT COLOR="#000000">Snippet****************************************** </FONT>
<FONT COLOR="#000000">protected boolean handleCollision(EReference reference, List list,</FONT>
<FONT COLOR="#000000"> EObject eObject, ObjectInfo eObjectInfo) {</FONT>
<FONT COLOR="#000000">..</FONT>

<FONT COLOR="#000000">//ClipboardSupportUtil.rename(list, eObject, COPY);</FONT>

<FONT COLOR="#000000">....</FONT>

<FONT COLOR="#000000">....</FONT>

<FONT COLOR="#000000">}</FONT>


<FONT COLOR="#000000">*************************code </FONT>
<FONT COLOR="#000000">Snippet****************************************** </FONT>

<FONT COLOR="#000000">But it didn't work as expected. Still the Copy_*_ comes when I copy paste </FONT>
<FONT COLOR="#000000">a component. Am I missing anything here?</FONT>

<FONT COLOR="#000000">Is there a better way/method to test this out?</FONT>



<FONT COLOR="#000000">Thanks,</FONT>

<FONT COLOR="#000000">Mike</FONT>

</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-i+KdAsbY9W5IYmUjPLF/--
Re: Doubt regarding copy/paste [message #192473 is a reply to message #192198] Fri, 13 June 2008 12:05 Go to previous message
Eclipse UserFriend
Originally posted by: mike.gmail.com

No luck so far...

I tried overriding the isNameable(EObject eObject) method in my class that
implements IClipboardSupport like this.
***************code*********************************
@Override
public boolean isNameable(EObject eObject) {
return false;
}
***************code**********************************
That doesn't work either.


Is there any other method to solve this out? I want the execution to
break and return with out renaming my component.Either
handleCollision(...) should not be called at first place or the rename
shouldn't happen and return when it enters


****************code*****************
ClipboardSupportUtil.java
--------------------------
public static void rename(Collection list, EObject eObject, String prefix)
{
if (isNameable(eObject) == false) {
return;
}

..........

}
****************code*****************

Hope someone will be able to help me out.

Thanks,

Mike
Previous Topic:Automatically set value of property
Next Topic:Disable Tooltips?
Goto Forum:
  


Current Time: Fri Apr 26 00:06:26 GMT 2024

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

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

Back to the top