Hi Thomas,

I think instead of adding the row manually to the tree model, you should just 
let the tree model know that the peak list structure has changed, by calling

treeModel.notifyObjectChanged(peakList, true);

That should result in updating the peak list rows in the tree.

Cheers,

Tomas


On Oct 30, 2014, at 19:05, TFRD (Thomas Franck Dyrlund) 
<t...@steno.dk<mailto:t...@steno.dk>> wrote:

Hi everyone

I need your help to fix a bug in MZmine. The problem is that after adding a new 
peak to the peak list table, it is not shown in the tree if the peak list is 
expanded in the main window. When a user then deletes this row, an error is 
returned in SimplePeakList.java l. 246.

Based on what I can see, the problem is that the project tree model is not 
updated after adding the row in SimplePeakList.java:
public void addRow(PeakListRow row) {
       List<RawDataFile> myFiles = Arrays.asList(this.getRawDataFiles());
       for (RawDataFile testFile : row.getRawDataFiles()) {
              if (!myFiles.contains(testFile))
                     throw (new IllegalArgumentException("Data file " + 
testFile+ " is not in this peak list"));
       }
       peakListRows.add(row);

       ...

}

Deleting a non-user added row works fine and I have therefore tried adding the 
following to addRow():
// We have to update the project tree model
MZmineProjectImpl project = (MZmineProjectImpl) MZmineCore.getCurrentProject();
PeakListTreeModel treeModel = project.getPeakListTreeModel();
treeModel.addObject(row);

However, I get the following error when loading a project and also a new row is 
not added to the peak list tree:
java.lang.IllegalStateException: This method must be called from Swing thread

Can anyone please help solve this bug?

Best regards,

Thomas
------------------------------------------------------------------------------
_______________________________________________
Mzmine-devel mailing list
Mzmine-devel@lists.sourceforge.net<mailto:Mzmine-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/mzmine-devel

===============================================
Tomas Pluskal
G0 Cell Unit, Okinawa Institute of Science and Technology Graduate University
1919-1 Tancha, Onna-son, Okinawa 904-0495, Japan
WWW: https://groups.oist.jp/g0
TEL: +81-98-966-8684
Fax: +81-98-966-2890

------------------------------------------------------------------------------
_______________________________________________
Mzmine-devel mailing list
Mzmine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mzmine-devel

Reply via email to