use of bndtools.editor.BndEditor in project bndtools by bndtools.
the class BlueprintXmlFileWizard method updateBundleBlueprintAndIncludeResource.
private void updateBundleBlueprintAndIncludeResource(IFile blueprintFile, IFile bndFile) throws Exception {
BndEditModel editModel;
IEditorPart editor = ResourceUtil.findEditor(workbench.getActiveWorkbenchWindow().getActivePage(), bndFile);
IDocument doc = null;
if (editor instanceof BndEditor) {
editModel = ((BndEditor) editor).getEditModel();
} else {
editModel = new BndEditModel(Central.getWorkspace());
doc = FileUtils.readFully(bndFile);
editModel.loadFrom(new IDocumentWrapper(doc));
}
String blueprintrelativePath = blueprintFile.getProjectRelativePath().toString();
updateBundleBlueprintIfNecessary(editModel, blueprintrelativePath);
updateIncludeResourceIfNecessary(editModel, blueprintrelativePath, blueprintFile);
if (editor == null) {
editModel.saveChangesTo(new IDocumentWrapper(doc));
FileUtils.writeFully(doc, bndFile, false);
}
}
Aggregations