Merge pull request #739 from teyrana/fix/699-select-stage
[fix] resolves issue #699, fixes PR #738, which only partially selected the first stage
This commit is contained in:
commit
1eeef10a5f
@ -60,6 +60,7 @@ import javax.swing.tree.DefaultTreeSelectionModel;
|
|||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
import javax.swing.tree.TreeSelectionModel;
|
import javax.swing.tree.TreeSelectionModel;
|
||||||
|
|
||||||
|
import net.sf.openrocket.rocketcomponent.AxialStage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -263,6 +264,18 @@ public class BasicFrame extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frames.add(this);
|
frames.add(this);
|
||||||
|
if( componentSelectionModel.isSelectionEmpty() ){
|
||||||
|
final Rocket rocket = document.getRocket();
|
||||||
|
if( rocket != null ) {
|
||||||
|
final AxialStage topStage = (AxialStage) rocket.getChild(0);
|
||||||
|
if (topStage != null) {
|
||||||
|
final TreePath selectionPath = new TreePath(topStage);
|
||||||
|
componentSelectionModel.setSelectionPath(selectionPath);
|
||||||
|
tree.setSelectionRow(1);
|
||||||
|
log.debug("... Setting Initial Selection: " + tree.getSelectionPath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
log.debug("BasicFrame instantiation complete");
|
log.debug("BasicFrame instantiation complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,9 +295,6 @@ public class BasicFrame extends JFrame {
|
|||||||
|
|
||||||
tree = new ComponentTree(document);
|
tree = new ComponentTree(document);
|
||||||
tree.setSelectionModel(componentSelectionModel);
|
tree.setSelectionModel(componentSelectionModel);
|
||||||
if( tree.isSelectionEmpty() ){
|
|
||||||
tree.setSelectionRow(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove JTree key events that interfere with menu accelerators
|
// Remove JTree key events that interfere with menu accelerators
|
||||||
InputMap im = SwingUtilities.getUIInputMap(tree, JComponent.WHEN_FOCUSED);
|
InputMap im = SwingUtilities.getUIInputMap(tree, JComponent.WHEN_FOCUSED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user