setSourcePage(sourcePage);
setPartNameForInput(input);
IResource resource = ResourceUtil.getResource(input);
String resourceName;
if (resource != null) {
resource.getWorkspace().addResourceChangeListener(this);
resourceName = resource.getName();
} else {
IStorage storage = (IStorage) input.getAdapter(IStorage.class);
if (storage != null) {
resourceName = storage.getName();
} else {
resourceName = input.getName();
}
}
final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
IDocument document = docProvider.getDocument(input);
try {
model.loadFrom(new IDocumentWrapper(document));
model.setBndResourceName(resourceName);
if (resource != null) {
model.setBndResource(resource.getLocation().toFile());
}
// model.addPropertyChangeListener(modelListener);
} catch (IOException e) {
throw new PartInitException("Error reading editor input.", e);
}