"contextCreationFailure.message"); //$NON-NLS-1$
MessageFormat messageFormat =
new MessageFormat(message);
String args [] = {file.getName()};
throw new PartInitException(messageFormat.format(args));
}
boolean validDeviceRepository = false;
// if this is an mcs project then check if the device repository is
// valid
IProject project = context.getPolicyResource().getProject();
try {
if (project.hasNature(MCSProjectNature.NATURE_ID)) {
MCSProjectNature projectNature;
projectNature = MCSProjectNature.getMCSProjectNature(project);
validDeviceRepository = projectNature.
hasValidDeviceRepository();
}
} catch (CoreException coreException) {
EclipseCommonPlugin.handleError(ABPlugin.getDefault(), coreException);
}
if (validDeviceRepository == false) {
// project does not have an MCS nature or the device repository has
// become corrupt so launch wizard to add MCS nature to the project
MCSProjectAssignmentWizard wizard =
new MCSProjectAssignmentWizard(project);
// Instantiates the wizard container with the wizard and opens it
Shell shell = getSite().getShell();
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
int action = dialog.open();
if (action == WizardDialog.CANCEL) {
String pluginId = ABPlugin.getDefault().
getDescriptor().getUniqueIdentifier();
Status status = new Status(Status.OK, pluginId,
ODOMEditorPart.MCS_ASSIGN_WIZARD_CANCELLED_CODE,
EditorMessages.getString(RESOURCE_PREFIX +
"projectAssignmentWizardCancelled.reason"),
null);
PartInitException e = new PartInitException(status);
throw e;
}
}
}