public void run() {
IWorkbenchPart part = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getActivePart();
if (part instanceof SequenceEditor) {
SequenceEditor editor = (SequenceEditor) part;
Object inputObj = editor.getInputAsSequence();
if (inputObj instanceof ISequence) {
ISequence sequence = (ISequence) inputObj;
if (sequence != null && sequence.getLogEntries() != null
&& !sequence.getLogEntries().isEmpty()) {
FileDialog dialog = new FileDialog(window.getShell(),
SWT.SAVE);
dialog.setFileName("backup.log");
String[] extentions = new String[] { "*.log", "*.*" };
dialog.setFilterExtensions(extentions);
String selectedFile = dialog.open();
if (selectedFile != null) {
boolean ok = true;
if ((new File(selectedFile)).exists()) {
ok = MessageDialog
.openQuestion(window.getShell(),
"Overwrite",
"The given file already exist, do you really want to overwrite it?");
}
if(ok){
editor.save(selectedFile);
}
}
} else {
MessageDialog.openInformation(window.getShell(),
"Information", "There is nothing to save");