use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredTextPartitioner in project webtools.sourceediting by eclipse.
the class TestStructuredPartitionerXML method testDisconnectConnect.
public void testDisconnectConnect() {
IStructuredModel model = null;
try {
model = getModelForEdit("testfiles/xml/example01.xml");
if (model != null) {
IStructuredDocument sDoc = model.getStructuredDocument();
assertTrue("sDoc implementation not instance of IDocumentExtension3", sDoc instanceof IDocumentExtension3);
IDocumentPartitioner partitioner = ((IDocumentExtension3) sDoc).getDocumentPartitioner(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING);
assertTrue("partitioner doesn't implement IStructuredTextPartitioner", partitioner instanceof IStructuredTextPartitioner);
IStructuredTextPartitioner stp = (IStructuredTextPartitioner) partitioner;
assertNotNull("partitioner was null for sDoc:" + sDoc, partitioner);
try {
stp.disconnect();
} catch (Exception e) {
assertTrue("problem disconnecting w/:" + sDoc + "/n" + e, false);
}
try {
stp.connect(sDoc);
} catch (Exception e) {
assertTrue("problem connecting w/:" + sDoc + "/n" + e, false);
}
} else {
assertTrue("could not retrieve structured model", false);
}
} finally {
if (model != null)
model.releaseFromEdit();
}
}
use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredTextPartitioner in project webtools.sourceediting by eclipse.
the class TestStructuredPartitionerXML method testGetDefaultPartitionType.
public void testGetDefaultPartitionType() {
IStructuredModel model = null;
try {
model = getModelForEdit("testfiles/xml/example01.xml");
if (model != null) {
IStructuredDocument sDoc = model.getStructuredDocument();
assertTrue("sDoc implementation not instance of IDocumentExtension3", sDoc instanceof IDocumentExtension3);
IDocumentPartitioner partitioner = ((IDocumentExtension3) sDoc).getDocumentPartitioner(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING);
assertTrue("partitioner doesn't implement IStructuredTextPartitioner", partitioner instanceof IStructuredTextPartitioner);
IStructuredTextPartitioner stp = (IStructuredTextPartitioner) partitioner;
String defaultPartitionType = stp.getDefaultPartitionType();
assertTrue("wrong default partition type was: [" + defaultPartitionType + "] should be: [" + IXMLPartitions.XML_DEFAULT + "]", defaultPartitionType.equals(IXMLPartitions.XML_DEFAULT));
} else {
assertTrue("could not retrieve structured model", false);
}
} finally {
if (model != null)
model.releaseFromEdit();
}
}
Aggregations