private boolean areAllVisible() { boolean retVal = true; final SessionEditor editor = getEditor(); final Session session = editor.getSession(); final List<TierViewItem> view = session.getTierView(); for (TierViewItem tvi : view) { retVal &= tvi.isVisible(); } return retVal; }
@Override public void hookableActionPerformed(ActionEvent e) { final SessionEditor editor = getEditor(); final Session session = editor.getSession(); final List<TierViewItem> view = session.getTierView(); final List<TierViewItem> newView = new ArrayList<TierViewItem>(); final SessionFactory factory = SessionFactory.newFactory(); final boolean allVisible = areAllVisible(); for (TierViewItem oldItem : view) { final TierViewItem newItem = factory.createTierViewItem( oldItem.getTierName(), !allVisible, oldItem.getTierFont(), oldItem.isTierLocked()); newView.add(newItem); } final TierViewEdit edit = new TierViewEdit(getEditor(), view, newView); editor.getUndoSupport().postEdit(edit); putValue(NAME, (!allVisible ? "Hide " : "Show ") + "all tiers"); }