use of org.eclipse.wst.xsd.ui.internal.adt.editor.IADTEditorInput in project webtools.sourceediting by eclipse.
the class InternalXSDMultiPageEditor method initializeGraphicalViewer.
protected void initializeGraphicalViewer() {
RootContentEditPart root = new RootContentEditPart();
if (!(getEditorInput() instanceof IADTEditorInput)) {
root.setModel(model);
}
graphicalViewer.setContents(root);
}
use of org.eclipse.wst.xsd.ui.internal.adt.editor.IADTEditorInput in project webtools.sourceediting by eclipse.
the class InternalXSDMultiPageEditor method buildModel.
public IModel buildModel() {
try {
IEditorInput editorInput = getEditorInput();
// If the input schema is from the WSDL Editor, then use that inline schema
if (editorInput instanceof IADTEditorInput) {
xsdSchema = ((IADTEditorInput) editorInput).getSchema();
if (xsdSchema != null)
model = (IModel) XSDAdapterFactory.getInstance().adapt(xsdSchema);
}
Document document = null;
IDocument doc = structuredTextEditor.getDocumentProvider().getDocument(getEditorInput());
if (doc instanceof IStructuredDocument) {
IStructuredModel model = null;
try {
// TODO: for StorageEditorInputs, should be forRead
model = StructuredModelManager.getModelManager().getExistingModelForEdit(doc);
if (model == null) {
model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) doc);
}
document = ((IDOMModel) model).getDocument();
} finally {
if (model != null) {
model.releaseFromEdit();
}
}
}
Assert.isNotNull(document);
if (model != null)
return model;
xsdSchema = XSDModelAdapter.lookupOrCreateSchema(document);
model = (IModel) XSDAdapterFactory.getInstance().adapt(xsdSchema);
} catch (Exception e) {
}
// }
return model;
}
Aggregations