/** * Should only be called if current object and model are not <code>null</code>. * * @since 5.5.3 */ private boolean openEditorIfNeeded(ModelResource currentModel) { boolean openEditorCancelled = false; // we only need to worry about the readonly status if the file is not currently open, // and its underlying IResource is not read only if (currentModel == null) { } else if (!isEditorOpen(currentModel) && !currentModel.getResource().getResourceAttributes().isReadOnly()) { final IFile modelFile = (IFile) currentModel.getResource(); Shell shell = UiPlugin.getDefault().getCurrentWorkbenchWindow().getShell(); // may want to change these text strings eventually: if (MessageDialog.openQuestion( shell, ModelEditorManager.OPEN_EDITOR_TITLE, ModelEditorManager.OPEN_EDITOR_MESSAGE)) { // load and activate, not async (to prevent multiple dialogs from coming up): // Changed to use method that insures Object editor mode is on ModelEditorManager.openInEditMode( modelFile, true, UiConstants.ObjectEditor.IGNORE_OPEN_EDITOR); } else { openEditorCancelled = true; } } return openEditorCancelled; }