//TODO:  Use the new WidgetUtils.showErrorToUser method.
@Override
	public void runWithEvent(IAction action, Event event) {
		updateEnablement(action);
		if (action.isEnabled()) {
			ISelection currentSelection = getSelection();
			Set<EPlanElement> selected = PlanEditorUtil.emfFromSelection(currentSelection);
			final MoveToOrbitOperation op = new MoveToOrbitOperation(selected);
			String errorMsg = op.analyzeMistakenSelection();
			if (errorMsg != null) {
				LogUtil.warn(errorMsg);
				ErrorDialog.openError(WidgetUtils.getShell(), "Nothing to Move To " + OrbitEventUtil.ORBIT_NAME,
						"No orbit-related plan elements selected.",
						new ExceptionStatus(EditorPlugin.ID, errorMsg, new ExecutionException(selected.toString())));
				return;
			}
			try {
				String orbitId = promptForValue();
				if (orbitId != null) {
					op.setOrbitId(orbitId);
					IUndoContext undoContext = getUndoContext();
					CommonUtils.execute(op, undoContext);
					String errorMsg2 = op.analyzeMissingOrbitDestination();
					if (errorMsg2 != null) {
						LogUtil.warn(errorMsg2);
						//TODO:  Use the new WidgetUtils.showErrorToUser method.
						ErrorDialog.openError(WidgetUtils.getShell(), "Move To " + OrbitEventUtil.ORBIT_NAME,
								"Move To " + OrbitEventUtil.ORBIT_NAME +  " may not have done what you expected.",
								new ExceptionStatus(EditorPlugin.ID, errorMsg2, new ExecutionException(selected.toString())));
						return;
					}
				}
			}
			catch (Exception e) {
					IStatus error = new ExceptionStatus(EditorPlugin.ID, e.getMessage(), e);
					ErrorDialog.openError(WidgetUtils.getShell(), "An error occurred", "That didn't work.", error);
				}
			}
		}
if (errorMsg2 != null) {
LogUtil.warn(errorMsg2);
//TODO: Use the new WidgetUtils.showErrorToUser method.
ErrorDialog.openError(WidgetUtils.getShell(), "Move To " + OrbitEventUtil.ORBIT_NAME,
"Move To " + OrbitEventUtil.ORBIT_NAME + " may not have done what you expected.",
}
try {
String orbitId = promptForValue();
if (orbitId != null) {
op.setOrbitId(orbitId);
IUndoContext undoContext = getUndoContext();
CommonUtils.execute(op, undoContext);
String errorMsg2 = op.analyzeMissingOrbitDestination();
if (errorMsg2 != null) {
LogUtil.warn(errorMsg2);
//TODO: Use the new WidgetUtils.showErrorToUser method.
ErrorDialog.openError(WidgetUtils.getShell(), "Move To " + OrbitEventUtil.ORBIT_NAME,
"Move To " + OrbitEventUtil.ORBIT_NAME + " may not have done what you expected.",
new ExceptionStatus(EditorPlugin.ID, errorMsg2, new ExecutionException(selected.toString())));
return;
}
}
}
catch (Exception e) {
IStatus error = new ExceptionStatus(EditorPlugin.ID, e.getMessage(), e);
ErrorDialog.openError(WidgetUtils.getShell(), "An error occurred", "That didn't work.", error);
ISelection currentSelection = getSelection();
Set<EPlanElement> selected = PlanEditorUtil.emfFromSelection(currentSelection);
final MoveToOrbitOperation op = new MoveToOrbitOperation(selected);
String errorMsg = op.analyzeMistakenSelection();
if (errorMsg != null) {
LogUtil.warn(errorMsg);
ErrorDialog.openError(WidgetUtils.getShell(), "Nothing to Move To " + OrbitEventUtil.ORBIT_NAME,
"No orbit-related plan elements selected.",
new ExceptionStatus(EditorPlugin.ID, errorMsg, new ExecutionException(selected.toString())));
return;
}
try {
String orbitId = promptForValue();
if (orbitId != null) {
op.setOrbitId(orbitId);
IUndoContext undoContext = getUndoContext();
CommonUtils.execute(op, undoContext);
String errorMsg2 = op.analyzeMissingOrbitDestination();
if (errorMsg2 != null) {
LogUtil.warn(errorMsg2);
//TODO: Use the new WidgetUtils.showErrorToUser method.
ErrorDialog.openError(WidgetUtils.getShell(), "Move To " + OrbitEventUtil.ORBIT_NAME,
"Move To " + OrbitEventUtil.ORBIT_NAME + " may not have done what you expected.",
new ExceptionStatus(EditorPlugin.ID, errorMsg2, new ExecutionException(selected.toString())));
return;
}
}
}
catch (Exception e) {
IStatus error = new ExceptionStatus(EditorPlugin.ID, e.getMessage(), e);
ErrorDialog.openError(WidgetUtils.getShell(), "An error occurred", "That didn't work.", error);
}
}
}