try {
try {
contextFile = fileNeedingContext.getPersistentProperty(new QualifiedName(
AbstractSection.PLUGIN_ID, AbstractSection.IMPORTABLE_PART_CONTEXT));
} catch (CoreException e) {
throw new InternalErrorCDE("unexpected exception", e);
}
ContextForPartDialog dialog = new ContextForPartDialog(PlatformUI.getWorkbench().getDisplay()
.getShells()[0], // ok in Eclipse 3.0
getFile().getProject().getParent(), thing, getFile().getLocation(), this, contextFile);
dialog.setTitle("File specifying context for editing importable part");
if (dialog.open() == Window.CANCEL)
throw new MultilevelCancel();
contextFile = dialog.contextPath;
if (null == contextFile) {
Utility
.popMessage(
"Context Info",
"A context is required to edit this part. However no context was supplied. Editing will be cancelled",
Utility.INFORMATION);
throw new MultilevelCancel();
} else {
try {
input = new XMLInputSource(contextFile);
} catch (IOException e) {
showContextLoadFailureMessage(e, contextFile);
throw new MultilevelCancel();
}
if (null != input)
try {
parseSource(input, contextFile);
} catch (PartInitException e) {
showContextLoadFailureMessage(e, contextFile);
throw new MultilevelCancel();
}
}
} finally {
openingContext = false;
}
if (null == aeDescription) {
aeDescription = UIMAFramework.getResourceSpecifierFactory().createAnalysisEngineDescription();
} else {
try {
file.setPersistentProperty(new QualifiedName(AbstractSection.PLUGIN_ID,
AbstractSection.IMPORTABLE_PART_CONTEXT), contextFile);
} catch (CoreException e) {
Utility.popMessage("Unexpected Exception", "While loading Context"
+ getMessagesToRootCause(e), Utility.ERROR);
throw new InternalErrorCDE("Unexpected Exception:" + getMessagesToRootCause(e), e);
}
}
}