Skip to content

Commit

Permalink
Retrieving user details now, for configuring SBATCH commands
Browse files Browse the repository at this point in the history
  • Loading branch information
samuell committed Aug 2, 2011
1 parent a1783ad commit e94aae0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Expand Up @@ -13,6 +13,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import net.bioclipse.hpc.Activator;
import net.bioclipse.hpc.domains.application.HPCApplication;
import net.bioclipse.hpc.xmldisplay.XmlUtils;

import org.eclipse.swt.SWT;
Expand All @@ -24,6 +26,12 @@

public class HPCUtils {

public static HPCApplication getApplication() {
Activator plugin = Activator.getDefault();
HPCApplication application = plugin.application;
return application;
}

public static String[] readFileToStringArray(String filePath) {
File file = new File(filePath);
FileInputStream fis = null;
Expand Down
Expand Up @@ -14,6 +14,7 @@

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.rse.core.IRSECoreRegistry;
import org.eclipse.rse.core.RSECorePlugin;
Expand Down Expand Up @@ -155,7 +156,7 @@ private void createSelectRemoteFileForParam(Parameter parameter) {
btnBrowseRemoteFiles.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IHost hpcHost = getApplication().getHPCHost();
IHost hpcHost = HPCUtils.getApplication().getHPCHost();

if (hpcHost == null) {
MessageDialog.openWarning(SystemBasePlugin.getActiveWorkbenchShell(), "HPC Host was null!", "HPC Host was null!");
Expand Down Expand Up @@ -247,10 +248,11 @@ public void handleEvent(Event event) {
public String getCommandText() {
return commandText.getText();
}

protected HPCApplication getApplication() {
Activator plugin = Activator.getDefault();
HPCApplication application = plugin.application;
return application;

@Override
public IWizardPage getNextPage() {
ConfigureSbatchScriptPage configSbatchScriptPage = ((ConfigureSbatchScriptPage) this.getWizard().getPage("Page 5"));
configSbatchScriptPage.onEnterPage();
return configSbatchScriptPage;
}
}
Expand Up @@ -2,8 +2,10 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import net.bioclipse.hpc.business.HPCUtils;
import net.bioclipse.hpc.domains.application.HPCApplication;
import net.bioclipse.hpc.domains.toolconfig.Option;
import net.bioclipse.hpc.domains.toolconfig.Parameter;
import net.bioclipse.hpc.domains.toolconfig.Tool;
Expand Down Expand Up @@ -60,6 +62,17 @@ void onEnterPage() {
// -t d-hh:mm:ss | ? // TODO: Find a good widget for setting the time
// --qos=short | Combo (yes/no)
// -J [JobName] | TextField

// Get user info, to use for writing the SBATCH config
Map<String,Object> userInfo = HPCUtils.getApplication().getUserInfo();

String username = (String) userInfo.get("username");
List<String> projects = (List<String>) userInfo.get("projects");

// TODO: Remove Debug code
System.out.println("Username: " + username + ", Projects: " + projects.toString());

this.composite.pack();
}

private void createComboBox(String label, List<String> optionValues, int horizontalSpan) {
Expand Down

0 comments on commit e94aae0

Please sign in to comment.