import net.sf.openrocket.gui.PreferencesDialog;
import net.sf.openrocket.gui.StorageOptionChooser;
import net.sf.openrocket.gui.configdialog.ComponentConfigDialog;
+import net.sf.openrocket.gui.dialogs.BugDialog;
import net.sf.openrocket.gui.scalefigure.RocketPanel;
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
}
@Override
public boolean accept(File f) {
+ if (f.isDirectory())
+ return true;
String name = f.getName().toLowerCase();
return name.endsWith(".ork") || name.endsWith(".ork.gz");
}
private RocketPanel rocketpanel;
private ComponentTree tree = null;
- private final TreeSelectionModel selectionModel;
+ private final TreeSelectionModel componentSelectionModel;
+ // private final ListSelectionModel simulationSelectionModel; ...
/** Actions available for rocket modifications */
private final RocketActions actions;
// Create the selection model that will be used
- selectionModel = new DefaultTreeSelectionModel();
- selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ componentSelectionModel = new DefaultTreeSelectionModel();
+ componentSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
- actions = new RocketActions(document, selectionModel, this);
+ actions = new RocketActions(document, componentSelectionModel, this);
// The main vertical split pane
JPanel panel = new JPanel(new MigLayout("fill, flowy","","[grow]"));
tree = new ComponentTree(rocket);
- tree.setSelectionModel(selectionModel);
+ tree.setSelectionModel(componentSelectionModel);
// Remove JTree key events that interfere with menu accelerators
InputMap im = SwingUtilities.getUIInputMap(tree, JComponent.WHEN_FOCUSED);
tree.addMouseListener(ml);
// Update dialog when selection is changed
- selectionModel.addTreeSelectionListener(new TreeSelectionListener() {
+ componentSelectionModel.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
// Scroll tree to the selected item
- TreePath path = selectionModel.getSelectionPath();
+ TreePath path = componentSelectionModel.getSelectionPath();
if (path == null)
return;
tree.scrollPathToVisible(path);
scroll = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
- scroll.setViewportView(new ComponentAddButtons(document, selectionModel,
+ scroll.setViewportView(new ComponentAddButtons(document, componentSelectionModel,
scroll.getViewport()));
scroll.setBorder(null);
scroll.setViewportBorder(null);
menu.getAccessibleContext().setAccessibleDescription("Information about OpenRocket");
menubar.add(menu);
+
+
item = new JMenuItem("License",KeyEvent.VK_L);
item.getAccessibleContext().setAccessibleDescription("OpenRocket license information");
item.addActionListener(new ActionListener() {
});
menu.add(item);
+ item = new JMenuItem("Bug report",KeyEvent.VK_B);
+ item.getAccessibleContext().setAccessibleDescription("Information about reporting " +
+ "bugs in OpenRocket");
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new BugDialog(BasicFrame.this).setVisible(true);
+ }
+ });
+ menu.add(item);
+
item = new JMenuItem("About",KeyEvent.VK_A);
item.getAccessibleContext().setAccessibleDescription("About OpenRocket");
item.addActionListener(new ActionListener() {
- // TODO: HIGH: Remember last directory on open/save
private void openAction() {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(ROCKET_DESIGN_FILTER);
chooser.setMultiSelectionEnabled(true);
chooser.setCurrentDirectory(Prefs.getDefaultDirectory());
- if (chooser.showOpenDialog(BasicFrame.this) != JFileChooser.APPROVE_OPTION)
+ if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
return;
Prefs.setDefaultDirectory(chooser.getCurrentDirectory());