+ /**
+ * Hides certain redundant Archaeopteryx GUI elements such as the menu items
+ * for reading in trees and adds extra items related to Jalview such as the
+ * tree sorting item.
+ *
+ *
+ * @param aptxFrame
+ */
+ private static void adaptAptxGui(MainFrame aptxFrame)
+ {
+ JMenuBar frameBar = aptxFrame.getJMenuBar();
+
+ for (int i = 0; i < frameBar.getMenuCount();i++) {
+ JMenu menu = frameBar.getMenu(i);
+
+ if (menu.getText().contains("File"))
+ {
+ // hide all "Read from ..." and "New" menu items and any Separators that
+ // come directly after them
+ Component previousMenuItem = null;
+ for (Component menuItem : menu.getMenuComponents()) {
+ if (previousMenuItem instanceof JMenuItem)
+ {
+ if (((JMenuItem) previousMenuItem).getText().startsWith("Read")
+ || ((JMenuItem) previousMenuItem).getText()
+ .startsWith("New"))
+ {
+ previousMenuItem.setVisible(false);
+
+ if (menuItem instanceof JSeparator)
+ {
+ menuItem.setVisible(false);
+ }
+ }
+ }
+ previousMenuItem = menuItem;
+ }
+ }
+ else if (menu.getText().contains("Inference"))
+ {
+ menu.setVisible(false);
+ }
+ else if (menu.getText().contains("View"))
+ {
+ menu.addSeparator();
+ JMenuItem sortByTree = new JMenuItem("Sort alignment by tree");
+ JMenuItem refreshJalview = new JMenuItem(
+ "Filter alignment to show only currently visible sequences");
+
+ refreshJalview.setFont(menu.getFont());
+
+ menu.add(sortByTree);
+ menu.add(refreshJalview);