/** */ 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; }
/** */ 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; }
/** */ private IDOMModel readModel(InputStream input) throws IOException, UnsupportedEncodingException { if (input == null) return null; // create temporary model String id = input.toString() + ".html"; //$NON-NLS-1$ IModelManager manager = StructuredModelManager.getModelManager(); IStructuredModel model = manager.getModelForEdit(id, input, null); if (!(model instanceof IDOMModel)) { if (model == null) model.releaseFromEdit(); return null; } return (IDOMModel) model; }
/** */ private IDOMModel readModel(IFile file) throws IOException, CoreException { if (file == null) return null; IModelManager manager = StructuredModelManager.getModelManager(); IStructuredModel model = manager.getModelForEdit(file); if (!(model instanceof IDOMModel)) { if (model != null) model.releaseFromEdit(); return null; } return (IDOMModel) model; }
public Object getModel() { if(model == null){ //System.out.println("creating DOM for " + getPath()); IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(getPath())); if(file != null){ try { model = (IDOMModel)StructuredModelManager.getModelManager().getModelForEdit(file); } catch (IOException e) { e.printStackTrace(); } catch (CoreException e) { e.printStackTrace(); } } } return model; }
/** * Get the user agent default style sheet. * * @param element * @return * @throws IOException * @throws UnsupportedEncodingException */ // XXX: in the future, we may get user agent default style sheet based on // device type. private static StyleSheet getUserAgentDefaultStyleSheet(Element element) throws UnsupportedEncodingException, IOException { if (_userAgentDefault == null) { InputStream input = CSSUtil.class .getResourceAsStream(IJMTConstants.USERAGENT); IStructuredModel model = StructuredModelManager.getModelManager() .getModelForEdit(IJMTConstants.USERAGENT, input, null); ICSSModel cssmodel = (ICSSModel) model; _userAgentDefault = (StyleSheet) cssmodel.getDocument(); ResourceUtils.ensureClosed(input); } return _userAgentDefault; }
model = getModelManager().getModelForEdit(id, inStream, resolver);
model = getModelManager().getModelForEdit(id, inStream, resolver);
: (tuple.getFile() != null ? (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit( tuple.getFile()) : (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForEdit(
model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) doc);
IDOMModel mod = (IDOMModel)manager.getExistingModelForEdit(id); if (mod == null) setXMLModel((IDOMModel) manager.getModelForEdit(file)); else { setXMLModel(mod);