use of org.eclipse.wst.sse.core.internal.provisional.IModelManager in project webtools.sourceediting by eclipse.
the class URLModelProviderCSS method getModelForRead.
/**
*/
private IStructuredModel getModelForRead(IFile file) throws IOException {
if (file == null)
return null;
IModelManager manager = getModelManager();
// create a fake InputStream
IStructuredModel model = null;
try {
model = manager.getModelForRead(file);
} catch (UnsupportedCharsetException ex) {
try {
model = manager.getModelForRead(file, EncodingRule.FORCE_DEFAULT);
} catch (IOException ioe) {
} catch (CoreException ce) {
}
} catch (CoreException ce) {
}
return model;
}
use of org.eclipse.wst.sse.core.internal.provisional.IModelManager in project webtools.sourceediting by eclipse.
the class URLModelProviderCSS method getNewModelForRead.
public IStructuredModel getNewModelForRead(IFile iFile) {
if (iFile == null)
return null;
IModelManager manager = getModelManager();
if (manager == null)
return null;
IStructuredModel model = null;
try {
model = manager.getNewModelForEdit(iFile, false);
} catch (IOException ex) {
} catch (ResourceInUse riu) {
} catch (ResourceAlreadyExists rae) {
} catch (CoreException ce) {
}
return model;
}
use of org.eclipse.wst.sse.core.internal.provisional.IModelManager in project webtools.sourceediting by eclipse.
the class URLModelProviderCSS method getModelForEdit.
/**
*/
private IStructuredModel getModelForEdit(IFile file) throws IOException {
if (file == null)
return null;
IModelManager manager = getModelManager();
// create a fake InputStream
IStructuredModel model = null;
try {
model = manager.getModelForEdit(file);
} catch (UnsupportedCharsetException ex) {
try {
model = manager.getModelForEdit(file, EncodingRule.FORCE_DEFAULT);
} catch (IOException ioe) {
} catch (CoreException ce) {
}
} catch (CoreException ce) {
}
return model;
}
use of org.eclipse.wst.sse.core.internal.provisional.IModelManager in project webtools.sourceediting by eclipse.
the class URLModelProviderCSS method getNewModelForEdit.
public IStructuredModel getNewModelForEdit(IFile iFile) {
if (iFile == null)
return null;
IModelManager manager = getModelManager();
if (manager == null)
return null;
IStructuredModel model = null;
try {
model = manager.getNewModelForEdit(iFile, false);
} catch (IOException ex) {
} catch (ResourceInUse riu) {
} catch (ResourceAlreadyExists rae) {
} catch (CoreException ce) {
}
return model;
}
use of org.eclipse.wst.sse.core.internal.provisional.IModelManager in project webtools.sourceediting by eclipse.
the class StructuredDocumentToDOMUnitTests method testNodeDeletion4.
/**
* Unit test -- test insert followed by delete at beginning of string.
*/
void testNodeDeletion4() {
String initialString = getTestString4();
// print out what we always can
System.out.println();
System.out.println("----------------");
System.out.println("Test Node Insert and Delete");
String outString = StringUtils.escape(initialString);
System.out.println("Initial String: " + outString);
// always start with fresh model
IStructuredDocument f = null;
IModelManager mm = StructuredModelManager.getModelManager();
try {
f = mm.createStructuredDocumentFor("dummy.xml", (InputStream) null, null);
} catch (IOException e) {
// do nothing, since dummy
}
//
// we'll listen to structuredDocument events to print out diagnostics
f.addDocumentChangedListener(this);
//
IDOMModel tree = new DOMModelImpl();
f.addDocumentChangingListener((IStructuredDocumentListener) tree);
// set text to structuredDocument (which updates tree)
f.setText(null, initialString);
// dump initial structuredDocument
Debug.dump(f);
// dump initial dom
DebugDocument.dump(tree.getDocument());
//
//
f.replaceText(null, 0, 0, "a");
System.out.println(" ==== Results after insert");
// display resulting text
System.out.println("resultString (from structuredDocument): ");
System.out.println(StringUtils.escape(f.getText()));
//
//
// dump post change structuredDocument
Debug.dump(f);
// dump post change DOM
DebugDocument.dump(tree.getDocument());
//
f.replaceText(null, 0, 1, "");
System.out.println(" ==== Results after delete");
// display resulting text
System.out.println("resultString (from structuredDocument): ");
System.out.println(StringUtils.escape(f.getText()));
//
//
// dump post change structuredDocument
Debug.dump(f);
// dump post change DOM
DebugDocument.dump(tree.getDocument());
//
}
Aggregations