import java.util.List;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.l10n.Messages;
/**
* @author k.luther
*
*/
public class DeleteResultMessagingUtils extends MessagingUtils {
+
+ private static final String DELETE_WAS_ABORTED = Messages.DeleteResultMessagingUtils_ABORT;
+ private static final String DELETE_WAS_SUCCESSFULL = Messages.DeleteResultMessagingUtils_SUCCES;
+
/**
* Displays a message {@link org.eclipse.jface.dialogs.MessageDialog}.
*
return;
}
List<String> details = new ArrayList<String>();
- String title= "";
+ String title= ""; //$NON-NLS-1$
if (result.getExceptions().size() > 0){
for (Exception e:result.getExceptions()){
details.add(e.getMessage());
}
if (result.isOk()){
- title = "Delete was successfull.";
+ title = DELETE_WAS_SUCCESSFULL;
} else {
- title = "Delete was aborted.";
+ title = DELETE_WAS_ABORTED;
}
}
StringBuffer relatedObjectsString = new StringBuffer();
} else{
relatedObjects.add(object.getUserFriendlyTypeName());
}
-
}
for (String relatedObject: relatedObjects){
relatedObjectsString.append(System.lineSeparator());
}
}
- message = message + "\n" ;
+ message = message + "\n" ; //$NON-NLS-1$
String stackTraceWithContext = getContextInfo(details);
CdmDeleteErrorDialog ced = new CdmDeleteErrorDialog(AbstractUtility.getShell(), title, message,new Status(IStatus.INFO, pluginId, relatedObjectsString.toString(), result.getExceptions().iterator().next()), stackTraceWithContext, result.getUpdatedObjects().toArray());
ced.open();
-
-
-
}
-
+
public static void messageDialogWithDetails(IStatus result, String message, String pluginId) {
-
+
List<String> details = new ArrayList<String>();
- String title= "";
+ String title= ""; //$NON-NLS-1$
Throwable e = null;
if (result.isMultiStatus()){
for (IStatus childStatus:result.getChildren()){
details.add(childStatus.getMessage());
}
e = result.getChildren()[0].getException();
- if (result.equals(Status.OK_STATUS)|| result.equals(Status.WARNING)){
- title = "Delete was successfull.";
+ if (result.equals(Status.OK_STATUS)|| result.equals(IStatus.WARNING)){
+ title = DELETE_WAS_SUCCESSFULL;
} else {
- title = "Delete was aborted.";
+ title = DELETE_WAS_ABORTED;
}
}
- StringBuffer relatedObjectsString = new StringBuffer();
- Object[] relatedObjects = new ArrayList<Object>().toArray();
-
-
-
+ Object[] relatedObjects = new ArrayList<Object>().toArray();
+
String stackTraceWithContext = getContextInfo(details);
CdmDeleteErrorDialog ced = new CdmDeleteErrorDialog(AbstractUtility.getShell(), title, message,new Status(IStatus.INFO, pluginId, null, e), stackTraceWithContext, relatedObjects);
ced.open();
-
-
-
}
-
+
}