Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:08 Go to next message
Olivier Hélin is currently offline Olivier HélinFriend
Messages: 4
Registered: July 2010
Location: Sophia Antipolis
Junior Member

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 12:38 Go to previous message
Olivier Hélin is currently offline Olivier HélinFriend
Messages: 4
Registered: July 2010
Location: Sophia Antipolis
Junior Member

[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 12:43]

Report message to a 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: Sat May 25 00:06:09 GMT 2024

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

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

Back to the top