Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Correctly refresh job view on button click
  • Loading branch information
samuell committed Aug 14, 2013
1 parent f7a77e8 commit 789a7bf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
Expand Up @@ -65,6 +65,10 @@ public void setJobs(List<Job> jobs) {
public void addJob(Job job) {
this.jobs.add(job);
}

public void clearJobs() {
this.jobs.clear();
}

/**
* @return the jobState
Expand Down
Expand Up @@ -11,13 +11,13 @@
public class UpdateJobInfoViewAction implements IViewActionDelegate {

@Override
public void run(IAction arg0) {}

@Override
public void selectionChanged(IAction arg0, ISelection arg1) {
public void run(IAction arg0) {
HPCUtils.getApplication().updateJobInfoView();
}

@Override
public void selectionChanged(IAction arg0, ISelection arg1) {}

@Override
public void init(IViewPart arg0) {}

Expand Down
Expand Up @@ -26,6 +26,12 @@ public void clearJobStates() {
jobStates.clear();
}

public void clearJobsinJobStates() {
for (JobState jobState : this.jobStates) {
jobState.clearJobs();
}
}

/**
* @return the jobStates
*/
Expand Down
Expand Up @@ -87,7 +87,8 @@ public void updateViewFromXml(String rawXmlContent) {

Document xmlDoc = XmlUtils.xmlToDOMDocument(rawXmlContent);
if (xmlDoc != null) {
List<Node> jobDOMNodes = XmlUtils.evalXPathExprToListOfNodes("/simpleapi/jobinfo/jobs/job", xmlDoc);
List<Node> jobDOMNodes = XmlUtils.evalXPathExprToListOfNodes("/simpleapi/jobinfo/jobs/job", xmlDoc);
contentModel.clearJobsinJobStates();

if (!jobDOMNodes.isEmpty()) {
for (Node jobNode : jobDOMNodes) {
Expand Down Expand Up @@ -120,12 +121,11 @@ public void updateViewFromXml(String rawXmlContent) {
logger.error("Could not find a job state object for state: " + state + "!");
}
}
treeViewer.refresh();
treeViewer.expandAll();

} else {
logger.error("Didn't get any jobs to parse!");
logger.warn("Didn't get any jobs to parse!");
}
treeViewer.refresh();
treeViewer.expandAll();
} else {
logger.error("Could not parse XML to DOM document!");
}
Expand Down

0 comments on commit 789a7bf

Please sign in to comment.