JMenuItem queryItem = new JMenuItem(fileObject.getNameExt());
queryItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
File file = FileUtil.toFile(fileObject);
ColorQuerySet cqs = XMLDocReaderWriter.readQueryFile(file);
Mode output = WindowManager.getDefault().findMode("output");
colmap = (ColorMapper) output.getSelectedTopComponent();
colmap.clearQueries();
colmap.setQueries(cqs);
colmap.setDisplayName(colmap.getDisplayName() + ": " + cqs.getName());
colmap.requestActive();
}
});
menu.add(queryItem);
StatusDisplayer.getDefault().setStatusText(fileObject.getName() + " "
+ "is available from the Query menu...");
}
});
}
FileObject[] children = queriesFo.getChildren();
for (final FileObject fileObject : children) {
if (fileObject.getExt().equals("query")) {
JMenuItem queryItem = new JMenuItem(fileObject.getNameExt());
queryItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
File file = FileUtil.toFile(fileObject);
ColorQuerySet cqs = XMLDocReaderWriter.readQueryFile(file);
Mode output = WindowManager.getDefault().findMode("output");
colmap = (ColorMapper) output.getSelectedTopComponent();
colmap.clearQueries();
colmap.setQueries(cqs);
colmap.setDisplayName(colmap.getDisplayName() + ": " + cqs.getName());
colmap.requestActive();
}
});
menu.add(queryItem);
}