/**
* Opens given {@link IResourceModelElement} in associated editor.
*/
public static IEditorPart openInEditor(IResourceModelElement element,
boolean activate) {
IResourceModelElement sourceElement;
IResource resource = null;
ZipEntryStorage zipEntryStorage = null;
int line;
if (element instanceof ISourceModelElement) {
ISourceModelElement source = (ISourceModelElement) element;
sourceElement = source.getElementSourceElement();
line = source.getElementStartLine();
Resource res = source.getElementSourceLocation().getResource();
if (res instanceof IAdaptable) {
resource = (IResource) ((IAdaptable) res)
.getAdapter(IResource.class);
zipEntryStorage = (ZipEntryStorage) ((IAdaptable) res)
.getAdapter(ZipEntryStorage.class);
}
else {
resource = sourceElement.getElementResource();
}
}
else if (element instanceof AbstractBeansConfig) {
sourceElement = element;
line = ((AbstractBeansConfig) element).getElementStartLine();
resource = sourceElement.getElementResource();
}
else {
return null;
}
if (resource instanceof IFile) {
// add to history
BeansUIActivationHistory.addToHistory(element);
IFile file = (IFile) resource;
if (sourceElement.isElementArchived()) {
try {
ZipEntryStorage storage = new ZipEntryStorage(sourceElement);
return openZipEntryStorage(line, file, storage);
}
catch (CoreException e) {