use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class AddFilePopupMenu method actionPerformed.
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent event) {
Object src = event.getSource();
RawDataFile file = menuItemFiles.get(src);
if (file != null)
visualizer.addRawDataFile(file);
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class AddFilePopupMenu method menuSelected.
/**
* @see javax.swing.event.MenuListener#menuSelected(javax.swing.event.MenuEvent)
*/
public void menuSelected(MenuEvent event) {
// remove all menu items
removeAll();
// get all project files
RawDataFile[] openFiles = MZmineCore.getProjectManager().getCurrentProject().getDataFiles();
List<RawDataFile> visualizedFiles = Arrays.asList(visualizer.getRawDataFiles());
menuItemFiles = new Hashtable<JMenuItem, RawDataFile>();
for (RawDataFile file : openFiles) {
// if this file is already added, skip it
if (visualizedFiles.contains(file))
continue;
// add a menu item for each file
JMenuItem newItem = new JMenuItem(file.getName());
newItem.addActionListener(this);
menuItemFiles.put(newItem, file);
add(newItem);
}
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class RemoveFilePopupMenu method actionPerformed.
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent event) {
Object src = event.getSource();
RawDataFile file = menuItemFiles.get(src);
if (file != null)
visualizer.removeRawDataFile(file);
// Disable menu?
RawDataFile[] files = visualizer.getRawDataFiles();
if (files.length == 1) {
this.setEnabled(false);
}
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class ShoulderPeaksFilterModule method runModule.
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
RawDataFile[] dataFiles = parameters.getParameter(ShoulderPeaksFilterParameters.dataFiles).getValue().getMatchingRawDataFiles();
for (RawDataFile dataFile : dataFiles) {
Task newTask = new ShoulderPeaksFilterTask(dataFile, parameters.cloneParameterSet());
tasks.add(newTask);
}
return ExitCode.OK;
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class UserParameterOpenHandler_2_3 method endElement.
/**
* @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String,
* java.lang.String)
*/
@SuppressWarnings("unchecked")
public void endElement(String namespaceURI, String sName, String qName) throws SAXException {
if (canceled)
throw new SAXException("Parsing canceled");
// <OPTION>
if (qName.equals(UserParameterElementName_2_3.OPTION.getElementName())) {
String optionValue = getTextOfElement();
currentOptions.add(optionValue);
}
// <VALUE>
if (qName.equals(UserParameterElementName_2_3.VALUE.getElementName())) {
RawDataFile currentDataFile = dataFilesIDMap.get(currentDataFileID);
String valueString = getTextOfElement();
Object value;
if (currentParameter instanceof DoubleParameter) {
value = new Double(valueString);
} else
value = valueString;
currentValues.put(currentDataFile, value);
}
// <PARAMETER>
if (qName.equals(UserParameterElementName_2_3.PARAMETER.getElementName())) {
if (currentParameter instanceof ComboParameter) {
String[] newChoices = currentOptions.toArray(new String[0]);
((ComboParameter<String>) currentParameter).setChoices(newChoices);
}
newProject.addParameter(currentParameter);
for (RawDataFile dataFile : currentValues.keySet()) {
Object value = currentValues.get(dataFile);
newProject.setParameterValue(currentParameter, dataFile, value);
}
parsedParams++;
}
}
Aggregations