Copy/Paste implementation issue [message #184908] |
Wed, 30 April 2008 14:39 |
BLANC Philippe Messages: 89 Registered: July 2009 |
Member |
|
|
Hi,
I want to enable copy/paste feature to my diagram (nodes and compartment).
I found this post :
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg04918.html
but I need some explications...
1] I have implemented my ClipBoard support and ClipBoard support
factory. If I use nsri =
"http://www.eclipse.org/gmf/runtime/1.0.1/notation" in my plugin.xml
file, just my view is copy/paste (there is no node created in my
semantic model). But, if I use nsri = "http://mySemanticDomainNSRI",
copy/past for nodes work, but my code is never called. Is it normal ?
2]Can someboy explain precisly what are the functions to override to
implement copy/paste in compartments ? And explain how to implement them ?
Thanks for your help.
Best regards,
Philippe
Here is my simple code :
public class EventBClipboardSupport extends AbstractClipboardSupport {
@Override
public boolean isCopyAlways(EObject eObject, EReference eReference,
Object value) {
EClass pack = eObject.eClass();
EClass pack2 = EventBPackage.eINSTANCE.getMachine();
if (eObject.eClass() == EventBPackage.eINSTANCE.getMachine()
||
eObject.eClass() == EventBPackage.eINSTANCE.getContext()){
/*
* Do not copy Refines and IsRefined link.
* */
if (eReference == EventBPackage.eINSTANCE.getMachine_Refines()
||
eReference == EventBPackage.eINSTANCE.getMachine_IsRefined()
||
eReference == EventBPackage.eINSTANCE.getContext_Extends()
||
eReference == EventBPackage.eINSTANCE.getContext_IsExtended())
return false;
else
return true;
} else
return super.isCopyAlways(eObject, eReference, value);
}
public PasteAction getPasteCollisionAction(EClass eClass) {
if (eClass == EventBPackage.eINSTANCE.getMachine()) {
return PasteAction.CLONE;
} else if (eClass == EventBPackage.eINSTANCE.getContext()) {
return PasteAction.CLONE;
} else {
return super.getPasteCollisionAction(eClass);
}
}
}
|
|
|
Re: Copy/Paste implementation issue [message #185287 is a reply to message #184908] |
Mon, 05 May 2008 09:14 |
BLANC Philippe Messages: 89 Registered: July 2009 |
Member |
|
|
Any ideas ?
Philippe BLANC a écrit :
> Hi,
> I want to enable copy/paste feature to my diagram (nodes and compartment).
> I found this post :
> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg04918.html
> but I need some explications...
>
> 1] I have implemented my ClipBoard support and ClipBoard support
> factory. If I use nsri =
> "http://www.eclipse.org/gmf/runtime/1.0.1/notation" in my plugin.xml
> file, just my view is copy/paste (there is no node created in my
> semantic model). But, if I use nsri = "http://mySemanticDomainNSRI",
> copy/past for nodes work, but my code is never called. Is it normal ?
>
> 2]Can someboy explain precisly what are the functions to override to
> implement copy/paste in compartments ? And explain how to implement them ?
>
>
> Thanks for your help.
> Best regards,
>
> Philippe
>
>
>
> Here is my simple code :
>
>
> public class EventBClipboardSupport extends AbstractClipboardSupport {
>
> @Override
> public boolean isCopyAlways(EObject eObject, EReference eReference,
> Object value) {
> EClass pack = eObject.eClass();
> EClass pack2 = EventBPackage.eINSTANCE.getMachine();
> if (eObject.eClass() == EventBPackage.eINSTANCE.getMachine()
> ||
> eObject.eClass() == EventBPackage.eINSTANCE.getContext()){
> /*
> * Do not copy Refines and IsRefined link.
> * */
> if (eReference == EventBPackage.eINSTANCE.getMachine_Refines()
> ||
> eReference ==
> EventBPackage.eINSTANCE.getMachine_IsRefined()
> ||
> eReference ==
> EventBPackage.eINSTANCE.getContext_Extends()
> ||
> eReference ==
> EventBPackage.eINSTANCE.getContext_IsExtended())
> return false;
> else
> return true;
> } else
> return super.isCopyAlways(eObject, eReference, value);
>
> }
>
>
>
> public PasteAction getPasteCollisionAction(EClass eClass) {
> if (eClass == EventBPackage.eINSTANCE.getMachine()) {
> return PasteAction.CLONE;
> } else if (eClass == EventBPackage.eINSTANCE.getContext()) {
> return PasteAction.CLONE;
> } else {
> return super.getPasteCollisionAction(eClass);
> }
> }
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03202 seconds