Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Show message on fail to run remote command. Moved file browser update…
… to HPCApplication
  • Loading branch information
samuell committed Aug 14, 2013
1 parent caec6e5 commit 7fc9686
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
Expand Up @@ -13,16 +13,22 @@
import net.bioclipse.hpc.views.projinfo.ProjInfoView;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemStartHere;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
import org.eclipse.rse.subsystems.shells.core.model.SimpleCommandOperation;
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.slf4j.Logger;
Expand Down Expand Up @@ -257,6 +263,14 @@ private ProjInfoView getProjInfoView() {

/* ------------ Utility methods ------------ */

public void showMessage(String title, String message) {
MessageBox messageDialog = new MessageBox(getShell(), SWT.ERROR);
messageDialog.setText(title);
messageDialog.setMessage(message);
int returnCode = messageDialog.open();
logger.error("Error opening MessageBox: " + returnCode);
}

/**
* Execute a remote command via SSH
* @param String command
Expand Down Expand Up @@ -303,8 +317,9 @@ public String execRemoteCommand(String command) {
// }
}
} catch (Exception commandError) {
errMsg = "Could not execute command! Are you logged in?";
logger.error(errMsg + ", Exception message: " + commandError.getMessage());
errMsg = "Failed to execute a remote command! Are you logged in?";
showMessage("ERROR: Could not execute remot command", errMsg);
logger.warn(errMsg + ", Exception message: " + commandError.getMessage());
return errMsg;
}
}
Expand Down Expand Up @@ -346,5 +361,14 @@ public void setDefaultPreferences() {
store.setDefault("username", "anonymous");
store.setDefault("galaxytoolconfigpath", "/var/www/galaxy/tools");
store.setDefault("showdialogonstartup", true);
}

public void updateFileBrowser() {
// Update the file browser, to show any newly created files
IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem(getHPCHost());
SystemResourceChangeEvent refreshFileSubStystemEvent = new SystemResourceChangeEvent(this,
ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED_PARENT, rfss);
ISystemRegistry registry = SystemStartHere.getSystemRegistry();
registry.fireEvent(refreshFileSubStystemEvent);
}
}
Expand Up @@ -82,13 +82,7 @@ public boolean performFinish() {
// scriptString = addLineToScript(command, scriptString, fileName);

HPCUtils.getApplication().execRemoteCommand(scriptString);

// Update the file browser, to show any newly created files
IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem(HPCUtils.getApplication().getHPCHost());
SystemResourceChangeEvent refreshFileSubStystemEvent = new SystemResourceChangeEvent(this,
ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED_PARENT, rfss);
ISystemRegistry registry = SystemStartHere.getSystemRegistry();
registry.fireEvent(refreshFileSubStystemEvent);
HPCUtils.getApplication().updateFileBrowser();

return true;
}
Expand Down

0 comments on commit 7fc9686

Please sign in to comment.