if (!e.getValueIsAdjusting()) {
targetPanel.removeAll();
SelectableItem pluginItem = (SelectableItem) mPluginItemList
.getSelectedValue();
final ProgramReceiveIf plugin = (ProgramReceiveIf) pluginItem
.getItem();
mCurrentTargets = plugin.getProgramReceiveTargets();
if (mCurrentTargets != null) {
Arrays.sort(mCurrentTargets);
ArrayList<ProgramReceiveTarget> targets = mReceiveTargetTable
.get(plugin);
if (targets == null || !pluginItem.isSelected()) {
targets = new ArrayList<ProgramReceiveTarget>();
}
if (pluginItem.isSelected() && targets.isEmpty()) {
targets.add(mCurrentTargets[0]);
}
mReceiveTargetTable.put(plugin, targets);
final SelectableItemList targetList = new SelectableItemList(
targets.toArray(), mCurrentTargets, disabledReceiveTargets);
targetPanel.add(targetList, BorderLayout.CENTER);
targetList
.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent listEvent) {
if (!listEvent.getValueIsAdjusting()) {
SelectableItem currPluginItem = (SelectableItem) mPluginItemList
.getSelectedValue();
ProgramReceiveIf currPlugin = (ProgramReceiveIf) currPluginItem
.getItem();
Object[] sel = targetList.getSelection();
ArrayList<ProgramReceiveTarget> selTargets = new ArrayList<ProgramReceiveTarget>(
sel.length);
for (Object obj : sel) {