| Copy/Paste for compartment items... [message #187621] |
Mon, 19 May 2008 02:34  |
Eclipse User |
|
|
|
Hi,
sorry for posting again, but I didn't find the answer.
So, if somebody can help me... I think this feature is very important.
Regards,
Philippe BLANC
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);
> }
> }
> }
|
|
|
| Re: Copy/Paste for compartment items... [message #188074 is a reply to message #187621] |
Wed, 21 May 2008 01:58  |
Eclipse User |
|
|
|
Hi Philippe,
i also still struggle with the correct implementation of the
copy/paste-functionality, especially for compartments.
The GMF-generated code provides copy/paste-support for
top-level-elements (with all existing containments), if you enable uuids
in the model file:
1. add
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser
class=" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y "
type="<YOUR MODEL FILE EXTENSION>">
</parser>
</extension>
Vlad's post
( http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg04918.html)
allows pasting into compartments.
However this solution doesn't persist the compartment-copy in the domain
model file, but in the diagram file as a reference to the source. So if
the source is deleted, the copy is gone as well.
I'm kind of stuck at this moment, because I don't really know where to
go from here.
Has anyone found a further refinement of Vlad's solution?
I think the copy-paste feature is very essential and important for
successful implementations of GMF-products.
Is there any chance, we could get some final support from the
contributers or maybe even an integration with the upcoming 2.1-release?
This would really help a lot, given that there a quiet a few threads
regarding copy/paste in this newsgroup.
Thanks in advance.
Regards Thomas
Philippe BLANC schrieb:
> Hi,
> sorry for posting again, but I didn't find the answer.
> So, if somebody can help me... I think this feature is very important.
>
>
> Regards,
>
> Philippe BLANC
>
>
>
> 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.03650 seconds