void showCompanion(boolean switchTabs) { CompanionFacade companion = getSelectedCompanion(); if (companion == null) { if (!switchTabs) { infoPane.setText(""); // $NON-NLS-1$ } return; } if (isCompanionOpen(companion)) { CharacterFacade character = CharacterManager.getCharacterMatching(companion); if (character != null) { if (switchTabs) { frame.setSelectedCharacter(character); return; } else { sheetSupport.setCharacter(character); sheetSupport.refresh(); } } // the companion was not found // TODO: show error, complain? } else if (switchTabs) { frame.loadCharacterFromFile(companion.getFileRef().getReference()); } else { // Display a message telling the user to open the companion. infoPane.setText( LanguageBundle.getString("in_companionLoadCompanionMessage")); // $NON-NLS-1$ } }
public void install() { configureButton(); loadButton.setAction(this); if (selectedRow == -1) { selectionModel.clearSelection(); } else { selectionModel.setSelectionInterval(selectedRow, selectedRow); } selectionModel.addListSelectionListener(this); showCompanion(false); sheetSupport.install(); }
public void uninstall() { selectionModel.removeListSelectionListener(this); sheetSupport.uninstall(); }