diff options
author | Claudia Knobloch | 2012-03-19 13:03:48 +0000 |
---|---|---|
committer | Claudia Knobloch | 2012-03-19 13:03:48 +0000 |
commit | a3be4c5b465c5a7e9280fdc28e040b7893f931fe (patch) | |
tree | 64144d6ec0d320ef7677fe1124157ea2432c3fd6 | |
parent | fe3a635f5ea62cb89f5cd9a71816122f93d24f2a (diff) | |
download | org.eclipse.ptp-a3be4c5b465c5a7e9280fdc28e040b7893f931fe.tar.gz org.eclipse.ptp-a3be4c5b465c5a7e9280fdc28e040b7893f931fe.tar.xz org.eclipse.ptp-a3be4c5b465c5a7e9280fdc28e040b7893f931fe.zip |
Bug fix for 374492
3 files changed, 38 insertions, 40 deletions
diff --git a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/LguiItem.java b/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/LguiItem.java index 267a9f9f1..9e71c159c 100644 --- a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/LguiItem.java +++ b/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/LguiItem.java @@ -317,7 +317,7 @@ public class LguiItem implements ILguiItem { */ public JobStatusData[] getUserJobs() { synchronized (fJobMap) { - return fJobMap.values().toArray(new JobStatusData[0]); + return fJobMap.values().toArray(new JobStatusData[fJobMap.values().size()]); } } diff --git a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/OIDToInformation.java b/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/OIDToInformation.java index 33a2d658b..097873984 100644 --- a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/OIDToInformation.java +++ b/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/OIDToInformation.java @@ -30,20 +30,20 @@ import org.eclipse.ptp.rm.lml.internal.core.elements.LguiType; public class OIDToInformation extends LguiHandler { // Hashmap, keys are oid-references, values are lists of InfoType - private HashMap<String, List<InfoType>> oidtoinfo; + private HashMap<String, List<InfoType>> oidToInfo; /** * Create an information-handler with standard-parameters. * - * @param psuperHandler + * @param lguiItem * LML-data-handler, which groups this handler and others to a * set of LMLHandler. This instance is needed to notify all * LMLHandler, if any data of the LguiType-instance was changed. */ - public OIDToInformation(ILguiItem psuperHandler, LguiType model) { - super(psuperHandler, model); + public OIDToInformation(ILguiItem lguiItem, LguiType lgui) { + super(lguiItem, lgui); - updateData(model); + updateData(lgui); lguiItem.addListener(new ILguiListener() { @@ -54,7 +54,7 @@ public class OIDToInformation extends LguiHandler { } /** - * Not sure why this is needed. DO NOT USE. + * * * @param oid * @return @@ -112,7 +112,7 @@ public class OIDToInformation extends LguiHandler { * this id */ public List<InfoType> getInfosById(String id) { - return oidtoinfo.get(id); + return oidToInfo.get(id); } /** @@ -156,20 +156,20 @@ public class OIDToInformation extends LguiHandler { */ public List<InfoType> getInfosByType(String id, String type) { - final List<InfoType> allinfos = getInfosById(id); - if (allinfos == null) { + final List<InfoType> infoList = getInfosById(id); + if (infoList == null) { return null; } - final List<InfoType> res = new ArrayList<InfoType>(); + final List<InfoType> result = new ArrayList<InfoType>(); // Get only infos with specific type - for (final InfoType ainfo : allinfos) { - if (ainfo.getType().equals(type)) { - res.add(ainfo); + for (final InfoType info : infoList) { + if (info.getType().equals(type)) { + result.add(info); } } - return res; + return result; } /** @@ -180,8 +180,8 @@ public class OIDToInformation extends LguiHandler { * @param lgui * new lml-data-model */ - public void updateData(LguiType pmodel) { - lgui = pmodel; + public void updateData(LguiType lgui) { + this.lgui = lgui; getInformationFromModel(); } @@ -191,7 +191,7 @@ public class OIDToInformation extends LguiHandler { */ private void getInformationFromModel() { - oidtoinfo = new HashMap<String, List<InfoType>>(); + oidToInfo = new HashMap<String, List<InfoType>>(); for (final Object object : jaxbUtil.getObjects(lgui)) { @@ -199,22 +199,20 @@ public class OIDToInformation extends LguiHandler { continue; } - final InformationType ainfos = (InformationType) object; - - final List<InfoType> realinfos = ainfos.getInfo(); - - for (final InfoType ainfo : realinfos) { // over all info-tags - // (information/info) + for (final InfoType info : ((InformationType) object).getInfo()) { + // over all info-tags (information/info) - final String oid = ainfo.getOid(); + final String oid = info.getOid(); - if (oidtoinfo.containsKey(oid)) {// Already list existent - final List<InfoType> oldlist = oidtoinfo.get(oid); - oldlist.add(ainfo); - } else {// new list for oid - final ArrayList<InfoType> newlist = new ArrayList<InfoType>(); - newlist.add(ainfo); - oidtoinfo.put(oid, newlist); + if (oidToInfo.containsKey(oid)) { + // Already list existent + final List<InfoType> oldList = oidToInfo.get(oid); + oldList.add(info); + } else { + // new list for oid + final ArrayList<InfoType> newList = new ArrayList<InfoType>(); + newList.add(info); + oidToInfo.put(oid, newList); } } diff --git a/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/views/InfoView.java b/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/views/InfoView.java index 5f30d12f8..79b6208a7 100644 --- a/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/views/InfoView.java +++ b/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/views/InfoView.java @@ -152,7 +152,7 @@ public class InfoView extends ViewPart { public void setFocus() { } - public void setNewLabelText(String type, String id) { + public void setNewLabelText(String type, String oid) { if (type.equals(ILMLUIConstants.INFO_MOTD)) { content = new Text(parent, SWT.LEFT | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL); ((Text) content).setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); @@ -166,9 +166,6 @@ public class InfoView extends ViewPart { } else if (message[0].equals(ILMLUIConstants.INFO_MOTD)) { ((Text) content).append(message[1]); } - // ((Text) content).append("Message of the Day\n" + - // "---------------------------\n\n" + - // "Here will be more text!"); } else if (type.equals(ILMLUIConstants.INFO_JOB)) { content = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION); ((Table) content).setLinesVisible(true); @@ -179,10 +176,13 @@ public class InfoView extends ViewPart { column.setText(title); column.setWidth(100); } - for (final InfodataType infodata : lmlManager.getSelectedLguiItem().getOIDToInformation().getInfoByOid(id).getData()) { - final TableItem item = new TableItem(((Table) content), SWT.NONE); - item.setText(0, infodata.getKey()); - item.setText(1, infodata.getValue()); + if (lmlManager.getSelectedLguiItem().getOIDToInformation().getInfoByOid(oid) != null) { + for (final InfodataType infodata : lmlManager.getSelectedLguiItem().getOIDToInformation().getInfoByOid(oid) + .getData()) { + final TableItem item = new TableItem(((Table) content), SWT.NONE); + item.setText(0, infodata.getKey()); + item.setText(1, infodata.getValue()); + } } for (final TableColumn column : ((Table) content).getColumns()) { |