Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » The best way to edit CDATA section
The best way to edit CDATA section [message #548907] Fri, 23 July 2010 09:08 Go to next message
Eclipse UserFriend
Hi everyone,
I want to edit a CDATA section with my GMF Editor but I can't access to the element (extendedMetaData="kind='elementWildcard' name=':mixed'").

However using my EMF Tree Editor I can directy set my CDATA Section.

I found a reference of CDATA in the generated class "CodeItemprovider" (myProject.Edit)
		newChildDescriptors.add
			(createChildParameter
				(DevPackage.Literals.CODE_TYPE__MIXED,
				 FeatureMapUtil.createEntry
					(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA,
					 "")));


Is it possible to set CDATA section from a EditPart Parent class ?
Re: The best way to edit CDATA section [message #551743 is a reply to message #548907] Mon, 09 August 2010 08:38 Go to previous message
Eclipse UserFriend
[resolved]

//-- Retrieve the CDATA content
CodeType code = mymodel.getCode();
FeatureMap map = code.getMixed();
if(map.size() > 0){
    // Display CDATA
    System.out.println(map.getValue(0));
}



//-- Set the CDATA content
String newCDATAValue = '......';
CodeType code = DevFactory.eINSTANCE.createCodeType();
FeatureMap m = code.getMixed();
m.add(FeatureMapUtil.createCDATAEntry(newCDATAValue));

Command setCodeType = SetCommand.create(getEditingDomain(), mymodel, DevPackage.Literals.MODELTYPE__CODE, c);
getEditingDomain().getCommandStack().execute(setCodeType);

[Updated on: Mon, 09 August 2010 08:43] by Moderator

Previous Topic:I have a problem with org.eclipse.gmf.examples.mindmap
Next Topic:Feature Seq Initializer to link 2 objects
Goto Forum:
  


Current Time: Tue Nov 04 09:50:29 EST 2025

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

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

Back to the top