org-netbeans-modules-autoupdate-ui

vider, UpdateUnitProviderPanel paramUpdateUnitProviderPanel, int paramInt) {}
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    SettingsTab.access$1400(this$1.this$0, val$provider, val$panel);
    SettingsTab.access$700(this$1.this$0).getSelectionModel().setSelectionInterval(val$rowIndex, val$rowIndex);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.EditAction.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.awt.Dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import org.netbeans.api.autoupdate.UpdateUnitProvider;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;

class SettingsTab$EditAction
  extends AbstractAction
{
  SettingsTab$EditAction(SettingsTab paramSettingsTab)
  {
    super(UnitTab.textForKey("SettingsTab.EditButton.text"));
    putValue("MnemonicKey", Integer.valueOf(UnitTab.mnemonicForKey("SettingsTab.EditButton.text")));
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    final int i = SettingsTab.access$700(this$0).getSelectedRow();
    if (i != -1)
    {
      final UpdateUnitProvider localUpdateUnitProvider = this$0.getSettingsTableModel().getUpdateUnitProvider(i);
      if (localUpdateUnitProvider == null) {
        return;
      }
      if (localUpdateUnitProvider.getProviderURL() == null) {
        return;
      }
      final UpdateUnitProviderPanel localUpdateUnitProviderPanel = new UpdateUnitProviderPanel(localUpdateUnitProvider.isEnabled(), localUpdateUnitProvider.getDisplayName(), localUpdateUnitProvider.getProviderURL().toExternalForm(), true);
      
      DialogDescriptor localDialogDescriptor = SettingsTab.access$1300(localUpdateUnitProviderPanel);
      localUpdateUnitProviderPanel.getOKButton().addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent paramAnonymousActionEvent)
        {
          SettingsTab.access$1400(this$0, localUpdateUnitProvider, localUpdateUnitProviderPanel);
          SettingsTab.access$700(this$0).getSelectionModel().setSelectionInterval(i, i);
        }
      });
      DialogDisplayer.getDefault().createDialog(localDialogDescriptor).setVisible(true);
      if (SettingsTab.access$1500(this$0) != null) {
        SettingsTab.Listener.access$600(SettingsTab.access$1500(this$0));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.EditAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

class SettingsTab$Listener$1
  implements Runnable
{
  SettingsTab$Listener$1(SettingsTab.Listener paramListener) {}
  
  public void run()
  {
    SettingsTab.Listener.access$600(this$1);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.Listener.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

class SettingsTab$Listener$2
  implements Runnable
{
  SettingsTab$Listener$2(SettingsTab.Listener paramListener) {}
  
  public void run()
  {
    SettingsTab.Listener.access$600(this$1);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.Listener.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.Action;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import org.netbeans.api.autoupdate.UpdateUnitProvider;
import org.openide.util.NbBundle;

class SettingsTab$Listener
  implements ListSelectionListener, TableModelListener
{
  private SettingsTab$Listener(SettingsTab paramSettingsTab) {}
  
  public void valueChanged(ListSelectionEvent paramListSelectionEvent)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        SettingsTab.Listener.this.modelOrSelectionChanged();
      }
    });
  }
  
  public void tableChanged(TableModelEvent paramTableModelEvent)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        SettingsTab.Listener.this.modelOrSelectionChanged();
      }
    });
  }
  
  private void modelOrSelectionChanged()
  {
    int i = SettingsTab.access$700(this$0).getSelectedRow();
    Object localObject1;
    if ((i != -1) && (SettingsTab.access$700(this$0).getRowCount() > 0))
    {
      localObject1 = ((SettingsTableModel)SettingsTab.access$700(this$0).getModel()).getUpdateUnitProvider(i);
      if (localObject1 != null)
      {
        StringBuffer localStringBuffer = new StringBuffer();
        SettingsTab.access$800(this$0).setTitle(((UpdateUnitProvider)localObject1).getDisplayName());
        long l = SettingsTab.access$900(this$0, (UpdateUnitProvider)localObject1);
        if (l > 0L)
        {
          localStringBuffer.append("<b>" + NbBundle.getMessage(UnitTab.class, "UnitTab_ReloadTime", "</b>")).append(new SimpleDateFormat().format(new Date(l))).append("<br>");
        }
        else
        {
          localObject2 = SettingsTab.access$1000("UnitTab_ReloadTime_Never");
          localStringBuffer.append("<b>" + NbBundle.getMessage(UnitTab.class, "UnitTab_ReloadTime", "</b>")).append((String)localObject2).append("<br>");
        }
        Object localObject2 = ((UpdateUnitProvider)localObject1).getProviderURL();
        String str = ((UpdateUnitProvider)localObject1).getDescription() == null ? "" : ((UpdateUnitProvider)localObject1).getDescription();
        if (localObject2 != null)
        {
          if (str.length() > 0)
          {
            localStringBuffer.append("<b>" + SettingsTab.access$1000("SettingsTab_UpdateUnitProvider_Description") + "</b><br>");
            localStringBuffer.append(str + "<br><br>");
          }
          localStringBuffer.append("<b>" + SettingsTab.access$1000("SettingsTab_UpdateUnitProvider_URL") + " </b><a href=\"" + ((URL)localObject2).toExternalForm() + "\">" + ((URL)localObject2).toExternalForm() + "</a><br>");
          
          SettingsTab.access$1100(this$0).setEnabled(true);
        }
        else
        {
          SettingsTab.access$1100(this$0).setEnabled(false);
        }
        SettingsTab.access$800(this$0).setText(localStringBuffer.toString());
        SettingsTab.access$800(this$0).setActionListener(SettingsTab.access$1200(this$0));
        SettingsTab.access$800(this$0).setActionListener2(SettingsTab.access$1100(this$0));
      }
    }
    else
    {
      SettingsTab.access$800(this$0).setTitle(null);
      SettingsTab.access$800(this$0).setText(null);
      SettingsTab.access$800(this$0).setActionListener2(null);
      SettingsTab.access$800(this$0).setActionListener(null);
      
      localObject1 = SettingsTab.access$700(this$0).getSelectionModel();
      ((ListSelectionModel)localObject1).setSelectionInterval(0, 0);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.Listener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import org.netbeans.api.autoupdate.UpdateUnitProvider;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.NotifyDescriptor.Confirmation;
import org.openide.util.NbBundle;

class SettingsTab$RemoveAction
  extends AbstractAction
{
  SettingsTab$RemoveAction(SettingsTab paramSettingsTab)
  {
    super(UnitTab.textForKey("SettingsTab.RemoveButton.text"));
    putValue("MnemonicKey", Integer.valueOf(UnitTab.mnemonicForKey("SettingsTab.RemoveButton.text")));
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    SettingsTableModel localSettingsTableModel = this$0.getSettingsTableModel();
    int[] arrayOfInt1 = SettingsTab.access$700(this$0).getSelectedRows();
    for (int k : arrayOfInt1) {
      if (k != -1)
      {
        UpdateUnitProvider localUpdateUnitProvider = localSettingsTableModel.getUpdateUnitProvider(k);
        if (localUpdateUnitProvider != null)
        {
          String str = NbBundle.getMessage(SettingsTab.class, "SettingsTab.bRemove.message", localUpdateUnitProvider.getDisplayName());
          NotifyDescriptor.Confirmation localConfirmation = new NotifyDescriptor.Confirmation(str);
          localConfirmation.setOptionType(0);
          Object localObject = DialogDisplayer.getDefault().notify(localConfirmation);
          if (NotifyDescriptor.YES_OPTION.equals(localObject)) {
            localSettingsTableModel.remove(k);
          }
        }
      }
    }
    localSettingsTableModel.refreshModel();
    if (arrayOfInt1.length > 0) {
      if (localSettingsTableModel.getRowCount() > arrayOfInt1[0]) {
        SettingsTab.access$700(this$0).getSelectionModel().setSelectionInterval(arrayOfInt1[0], arrayOfInt1[0]);
      } else {
        SettingsTab.access$700(this$0).getSelectionModel().setSelectionInterval(0, 0);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.RemoveAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import javax.accessibility.AccessibleContext;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.table.TableCellRenderer;
import org.openide.util.NbBundle;

class SettingsTab$Table
  extends JTable
{
  public SettingsTab$Table(SettingsTab paramSettingsTab)
  {
    setShowGrid(false);
    setIntercellSpacing(new Dimension(0, 0));
    getAccessibleContext().setAccessibleName(NbBundle.getMessage(UnitTable.class, "ACN_UpdateCentersTable"));
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(UnitTab.class, "ACD_UpdateCentersTable"));
    SettingsTab.access$1600(paramSettingsTab).setLabelFor(this);
  }
  
  public void addNotify()
  {
    super.addNotify();
    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
      getParent().setBackground(new Color(getBackground().getRGB(), false));
    } else {
      getParent().setBackground(getBackground());
    }
  }
  
  public Component prepareRenderer(TableCellRenderer paramTableCellRenderer, int paramInt1, int paramInt2)
  {
    Component localComponent = super.prepareRenderer(paramTableCellRenderer, paramInt1, paramInt2);
    Color localColor1 = getBackground();
    Color localColor2 = UnitTable.getDarkerColor(localColor1);
    if (isRowSelected(paramInt1)) {
      localComponent.setForeground(getSelectionForeground());
    } else {
      localComponent.setForeground(getForeground());
    }
    if (!isCellSelected(paramInt1, paramInt2)) {
      if (paramInt1 % 2 == 0) {
        localComponent.setBackground(localColor2);
      } else {
        localComponent.setBackground(localColor1);
      }
    }
    return localComponent;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.Table
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import org.netbeans.api.autoupdate.UpdateUnitProvider;
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
import org.openide.util.ImageUtilities;

class SettingsTab$UpdateProviderRenderer
  extends DefaultTableCellRenderer
{
  public Component getTableCellRendererComponent(JTable paramJTable, Object paramObject, boolean paramBoolean1, boolean paramBoolean2, int paramInt1, int paramInt2)
  {
    JLabel localJLabel = (JLabel)super.getTableCellRendererComponent(paramJTable, paramObject, paramBoolean1, paramBoolean2, paramInt1, paramInt2);
    if ((paramObject instanceof UpdateUnitProvider))
    {
      localObject = (UpdateUnitProvider)paramObject;
      UpdateUnitProvider.CATEGORY localCATEGORY = ((UpdateUnitProvider)localObject).getCategory();
      if (UpdateUnitProvider.CATEGORY.BETA.equals(localCATEGORY)) {
        localJLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/icon-beta.png", false));
      } else if (UpdateUnitProvider.CATEGORY.COMMUNITY.equals(localCATEGORY)) {
        localJLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/icon-community.png", false));
      } else if (UpdateUnitProvider.CATEGORY.STANDARD.equals(localCATEGORY)) {
        localJLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/icon-standard.png", false));
      }
      localJLabel.setText(((UpdateUnitProvider)localObject).getDisplayName());
      localJLabel.setHorizontalAlignment(2);
    }
    Object localObject = localJLabel;
    return (Component)localObject;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.SettingsTab.UpdateProviderRenderer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
import javax.accessibility.AccessibleContext;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout.ParallelGroup;
import javax.swing.GroupLayout.SequentialGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.ListSelectionModel;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import org.netbeans.api.autoupdate.UpdateUnitProvider;
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
import org.netbeans.api.options.OptionsDisplayer;
import org.netbeans.modules.autoupdate.ui.actions.AutoupdateSettings;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.NotifyDescriptor.Confirmation;
import org.openide.awt.Mnemonics;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;

public class SettingsTab
  extends JPanel
{
  private DetailsPanel details;
  private JScrollPane scrollerForDetails;
  private JTable table;
  private JScrollPane scrollerForTable;
  private Action removeAction;
  private Action editAction;
  private Action addAction;
  private Listener listener;
  private PluginManagerUI manager;
  private boolean refreshModel;
  private JButton addButton;
  private JButton bProxy;
  private JComboBox cbCheckPeriod;
  private JCheckBox cbGlobalInstall;
  private JSeparator jSeparatorAdvanced;
  private JSeparator jSeparatorConnection;
  private JLabel lCheckPeriod;
  private JLabel lConnection;
  private JLabel lGeneral;
  private JLabel lUpdateCenters;
  private ButtonGroup pluginsViewGroup;
  private JSplitPane spTab;
  
  public SettingsTab(PluginManagerUI paramPluginManagerUI)
  {
    manager = paramPluginManagerUI;
    initComponents();
    scrollerForTable = new JScrollPane();
    table = new Table();
    scrollerForTable.setViewportView(table);
    
    scrollerForDetails = new JScrollPane();
    details = new DetailsPanel();
    scrollerForDetails.setViewportView(details);
    
    spTab.setLeftComponent(scrollerForTable);
    spTab.setRightComponent(scrollerForDetails);
    
    table.setModel(new SettingsTableModel());
    TableColumnModel localTableColumnModel = table.getColumnModel();
    localTableColumnModel.getColumn(1).setCellRenderer(new UpdateProviderRenderer(null));
    
    cbCheckPeriod.setModel(new DefaultComboBoxModel(new String[] { getMessage("CTL_Update_every_startup"), getMessage("CTL_Update_every_day"), getMessage("CTL_Update_every_week"), getMessage("CTL_Update_every_2weeks"), getMessage("CTL_Update_every_month"), getMessage("CTL_Update_never") }));
    if (6 == getAutoUpdatePeriod()) {
      cbCheckPeriod.addItem(getMessage("CTL_Update_custom"));
    }
    cbCheckPeriod.setSelectedIndex(getAutoUpdatePeriod());
    
    cbGlobalInstall.setSelected(Utilities.isGlobalInstallation());
    getSettingsTableModel().setSettingsTab(this);
    TableColumn localTableColumn = table.getColumnModel().getColumn(0);
    localTableColumn.setMaxWidth(table.getTableHeader().getHeaderRect(0).width);
    
    editAction = new EditAction();
    removeAction = new RemoveAction();
    addAction = new AddAction();
    addButton.setAction(addAction);
  }
  
  public String getDisplayName()
  {
    return NbBundle.getMessage(SettingsTab.class, "SettingsTab_displayName");
  }
  
  PluginManagerUI getPluginManager()
  {
    return manager;
  }
  
  private void addListener()
  {
    if (listener == null)
    {
      listener = new Listener(null);
      table.getSelectionModel().addListSelectionListener(listener);
      getSettingsTableModel().addTableModelListener(listener);
    }
  }
  
  private void removeListener()
  {
    if (listener != null)
    {
      table.getSelectionModel().removeListSelectionListener(listener);
      getSettingsTableModel().removeTableModelListener(listener);
      listener = null;
    }
  }
  
  public void addNotify()
  {
    super.addNotify();
    Utilities.startAsWorkerThread(new Runnable()
    {
      public void run()
      {
        getSettingsTableModel().refreshModel();
      }
    });
    refreshModel = false;
    addListener();
  }
  
  public void removeNotify()
  {
    super.removeNotify();
    removeListener();
    doLazyRefresh(null);
  }
  
  public void doLazyRefresh(final Runnable paramRunnable)
  {
    if (needRefresh()) {
      Utilities.startAsWorkerThread(new Runnable()
      {
        public void run()
        {
          setWaitingState(true);
          try
          {
            Utilities.presentRefreshProviders(manager, false);
            manager.updateUnitsChanged();
            if (paramRunnable != null) {
              paramRunnable.run();
            }
          }
          finally
          {
            setWaitingState(false);
          }
        }
      });
    }
    refreshModel = false;
  }
  
  private static String getMessage(String paramString)
  {
    return NbBundle.getMessage(SettingsTab.class, paramString);
  }
  
  private void initComponents()
  {
    pluginsViewGroup = new ButtonGroup();
    lUpdateCenters = new JLabel();
    spTab = new JSplitPane();
    addButton = new JButton();
    lConnection = new JLabel();
    jSeparatorConnection = new JSeparator();
    lCheckPeriod = new JLabel();
    cbCheckPeriod = new JComboBox();
    bProxy = new JButton();
    lGeneral = new JLabel();
    cbGlobalInstall = new JCheckBox();
    jSeparatorAdvanced = new JSeparator();
    
    Mnemonics.setLocalizedText(lUpdateCenters, NbBundle.getMessage(SettingsTab.class, "SettingsTab.lUpdateCenters.text"));
    
    spTab.setBorder(null);
    spTab.setDividerLocation(Integer.parseInt(NbBundle.getMessage(SettingsTab.class, "SettingsTab_Splitter_DefaultDividerLocation")));
    spTab.setResizeWeight(0.5D);
    spTab.setOneTouchExpandable(true);
    
    Mnemonics.setLocalizedText(addButton, NbBundle.getMessage(SettingsTab.class, "SettingsTab.addButton.text"));
    
    Mnemonics.setLocalizedText(lConnection, NbBundle.getMessage(SettingsTab.class, "SettingsTab.lConnection.text"));
    
    lCheckPeriod.setLabelFor(cbCheckPeriod);
    Mnemonics.setLocalizedText(lCheckPeriod, NbBundle.getMessage(SettingsTab.class, "SettingsTab.lCheckPeriod.text"));
    
    cbCheckPeriod.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        SettingsTab.this.cbCheckPeriodActionPerformed(paramAnonymousActionEvent);
      }
    });
    Mnemonics.setLocalizedText(bProxy, NbBundle.getMessage(SettingsTab.class, "SettingsTab.bProxy.text"));
    bProxy.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        SettingsTab.this.bProxyActionPerformed(paramAnonymousActionEvent);
      }
    });
    Mnemonics.setLocalizedText(lGeneral, NbBundle.getMessage(SettingsTab.class, "SettingsTab.lGeneral.text"));
    
    Mnemonics.setLocalizedText(cbGlobalInstall, NbBundle.getMessage(SettingsTab.class, "SettingsTab.cbSharedInstall.text"));
    cbGlobalInstall.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    cbGlobalInstall.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        SettingsTab.this.cbGlobalInstallActionPerformed(paramAnonymousActionEvent);
      }
    });
    GroupLayout localGroupLayout = new GroupLayout(this);
    setLayout(localGroupLayout);
    localGroupLayout.setHorizontalGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createSequentialGroup().addContainerGap().addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createSequentialGroup().addGap(10, 10, 10).addComponent(cbGlobalInstall)).addGroup(localGroupLayout.createSequentialGroup().addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(addButton).addComponent(spTab, -1, 871, 32767)).addGap(1, 1, 1)).addGroup(localGroupLayout.createSequentialGroup().addGap(12, 12, 12).addComponent(lCheckPeriod).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cbCheckPeriod, 0, 548, 32767).addGap(58, 58, 58).addComponent(bProxy)).addGroup(localGroupLayout.createSequentialGroup().addComponent(lGeneral).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jSeparatorAdvanced, -1, 792, 32767)).addGroup(localGroupLayout.createSequentialGroup().addComponent(lConnection).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jSeparatorConnection, -1, 630, 32767)).addComponent(lUpdateCenters)).addContainerGap()));
    
    localGroupLayout.setVerticalGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, localGroupLayout.createSequentialGroup().addContainerGap().addComponent(lUpdateCenters).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(spTab, -1, 37, 32767).addGap(4, 4, 4).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING).addGroup(localGroupLayout.createSequentialGroup().addComponent(addButton).addGap(11, 11, 11).addComponent(jSeparatorConnection, -2, 10, -2)).addComponent(lConnection)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(bProxy).addComponent(lCheckPeriod).addComponent(cbCheckPeriod, -2, -1, -2)).addGap(11, 11, 11).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(lGeneral, -2, 15, -2).addComponent(jSeparatorAdvanced, -2, 10, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(cbGlobalInstall).addContainerGap()));
  }
  
  private void cbGlobalInstallActionPerformed(ActionEvent paramActionEvent)
  {
    if (cbGlobalInstall.isSelected())
    {
      List localList = Utilities.sharedDirs();
      if (localList.isEmpty())
      {
        localObject = new NotifyDescriptor(NbBundle.getMessage(SettingsTab.class, "SettingsTab.cbSharedInstall.NoSharedMessage"), NbBundle.getMessage(SettingsTab.class, "SettingsTab.cbSharedInstall.NoSharedTitle"), 0, 0, new Object[] { NotifyDescriptor.OK_OPTION }, null);
        
        DialogDisplayer.getDefault().notifyLater((NotifyDescriptor)localObject);
        cbGlobalInstall.setSelected(false);
        return;
      }
      for (Object localObject = localList.iterator(); ((Iterator)localObject).hasNext();)
      {
        File localFile = (File)((Iterator)localObject).next();
        if ((localFile.exists()) && (localFile.isDirectory()) && (!Utilities.canWriteInCluster(localFile)))
        {
          NotifyDescriptor localNotifyDescriptor = new NotifyDescriptor(NbBundle.getMessage(SettingsTab.class, "SettingsTab.cbSharedInstall.ReadOnlyMessage", localFile), NbBundle.getMessage(SettingsTab.class, "SettingsTab.cbSharedInstall.ReadOnlyTitle"), 0, 0, new Object[] { NotifyDescriptor.OK_OPTION }, null);
          
          DialogDisplayer.getDefault().notifyLater(localNotifyDescriptor);
          cbGlobalInstall.setSelected(false);
          return;
        }
      }
      Utilities.setGlobalInstallation(true);
    }
    else
    {
      Utilities.setGlobalInstallation(false);
    }
  }
  
  private void cbCheckPeriodActionPerformed(ActionEvent paramActionEvent)
  {
    setAutoUpdatePeriod(cbCheckPeriod.getSelectedIndex());
  }
  
  private void bProxyActionPerformed(ActionEvent paramActionEvent)
  {
    OptionsDisplayer.getDefault().open("General");
  }
  
  public SettingsTableModel getSettingsTableModel()
  {
    return (SettingsTableModel)table.getModel();
  }
  
  private class Listener
    implements ListSelectionListener, TableModelListener
  {
    private Listener() {}
    
    public void valueChanged(ListSelectionEvent paramListSelectionEvent)
    {
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          SettingsTab.Listener.this.modelOrSelectionChanged();
        }
      });
    }
    
    public void tableChanged(TableModelEvent paramTableModelEvent)
    {
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          SettingsTab.Listener.this.modelOrSelectionChanged();
        }
      });
    }
    
    private void modelOrSelectionChanged()
    {
      int i = table.getSelectedRow();
      Object localObject1;
      if ((i != -1) && (table.getRowCount() > 0))
      {
        localObject1 = ((SettingsTableModel)table.getModel()).getUpdateUnitProvider(i);
        if (localObject1 != null)
        {
          StringBuffer localStringBuffer = new StringBuffer();
          details.setTitle(((UpdateUnitProvider)localObject1).getDisplayName());
          long l = SettingsTab.this.lastModification((UpdateUnitProvider)localObject1);
          if (l > 0L)
          {
            localStringBuffer.append("<b>" + NbBundle.getMessage(UnitTab.class, "UnitTab_ReloadTime", "</b>")).append(new SimpleDateFormat().format(new Date(l))).append("<br>");
          }
          else
          {
            localObject2 = SettingsTab.getMessage("UnitTab_ReloadTime_Never");
            localStringBuffer.append("<b>" + NbBundle.getMessage(UnitTab.class, "UnitTab_ReloadTime", "</b>")).append((String)localObject2).append("<br>");
          }
          Object localObject2 = ((UpdateUnitProvider)localObject1).getProviderURL();
          String str = ((UpdateUnitProvider)localObject1).getDescription() == null ? "" : ((UpdateUnitProvider)localObject1).getDescription();
          if (localObject2 != null)
          {
            if (str.length() > 0)
            {
              localStringBuffer.append("<b>" + SettingsTab.getMessage("SettingsTab_UpdateUnitProvider_Description") + "</b><br>");
              localStringBuffer.append(str + "<br><br>");
            }
            localStringBuffer.append("<b>" + SettingsTab.getMessage("SettingsTab_UpdateUnitProvider_URL") + " </b><a href=\"" + ((URL)localObject2).toExternalForm() + "\">" + ((URL)localObject2).toExternalForm() + "</a><br>");
            
            editAction.setEnabled(true);
          }
          else
          {
            editAction.setEnabled(false);
          }
          details.setText(localStringBuffer.toString());
          details.setActionListener(removeAction);
          details.setActionListener2(editAction);
        }
      }
      else
      {
        details.setTitle(null);
        details.setText(null);
        details.setActionListener2(null);
        details.setActionListener(null);
        
        localObject1 = table.getSelectionModel();
        ((ListSelectionModel)localObject1).setSelectionInterval(0, 0);
      }
    }
  }
  
  private long lastModification(UpdateUnitProvider paramUpdateUnitProvider)
  {
    Preferences localPreferences = NbPreferences.root().node("/org/netbeans/modules/autoupdate");
    return localPreferences.getLong(paramUpdateUnitProvider.getName() + "_" + "lastCheckTime", 0L);
  }
  
  private boolean needRefresh()
  {
    return refreshModel;
  }
  
  public void setNeedRefresh()
  {
    refreshModel = true;
    getPluginManager().undecorateTabTitles();
  }
  
  private void setData(UpdateUnitProvider paramUpdateUnitProvider, UpdateUnitProviderPanel paramUpdateUnitProviderPanel)
  {
    paramUpdateUnitProvider.setDisplayName(paramUpdateUnitProviderPanel.getProviderName());
    boolean bool = false;
    try
    {
      URL localURL1 = paramUpdateUnitProvider.getProviderURL();
      URL localURL2 = new URL(paramUpdateUnitProviderPanel.getProviderURL());
      if (!localURL1.toExternalForm().equals(localURL2.toExternalForm()))
      {
        paramUpdateUnitProvider.setProviderURL(localURL2);
        setNeedRefresh();
        bool = true;
      }
    }
    catch (MalformedURLException localMalformedURLException)
    {
      Logger.getLogger(SettingsTab.class.getName()).log(Level.INFO, localMalformedURLException.getLocalizedMessage(), localMalformedURLException);
    }
    paramUpdateUnitProvider.setEnable(paramUpdateUnitProviderPanel.isActive());
    if (paramUpdateUnitProviderPanel.isActive()) {
      refreshProvider(paramUpdateUnitProvider, bool);
    } else {
      setNeedRefresh();
    }
  }
  
  public void refreshProvider(final UpdateUnitProvider paramUpdateUnitProvider, final boolean paramBoolean)
  {
    setWaitingState(true);
    Utilities.startAsWorkerThread(new Runnable()
    {
      public void run()
      {
        try
        {
          Utilities.presentRefreshProviders(Collections.singleton(paramUpdateUnitProvider), getPluginManager(), paramBoolean);
          getPluginManager().updateUnitsChanged();
        }
        finally
        {
          setWaitingState(false);
        }
      }
    });
  }
  
  private static DialogDescriptor getCustomizerDescriptor(UpdateUnitProviderPanel paramUpdateUnitProviderPanel)
  {
    JButton localJButton = paramUpdateUnitProviderPanel.getOKButton();
    Object[] arrayOfObject = new Object[2];
    arrayOfObject[0] = localJButton;
    arrayOfObject[1] = DialogDescriptor.CANCEL_OPTION;
    
    DialogDescriptor localDialogDescriptor = new DialogDescriptor(paramUpdateUnitProviderPanel, paramUpdateUnitProviderPanel.getDisplayName(), true, arrayOfObject, DialogDescriptor.OK_OPTION, 0, null, null);
    return localDialogDescriptor;
  }
  
  private class EditAction
    extends AbstractAction
  {
    EditAction()
    {
      super();
      putValue("MnemonicKey", Integer.valueOf(UnitTab.mnemonicForKey("SettingsTab.EditButton.text")));
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      final int i = table.getSelectedRow();
      if (i != -1)
      {
        final UpdateUnitProvider localUpdateUnitProvider = getSettingsTableModel().getUpdateUnitProvider(i);
        if (localUpdateUnitProvider == null) {
          return;
        }
        if (localUpdateUnitProvider.getProviderURL() == null) {
          return;
        }
        final UpdateUnitProviderPanel localUpdateUnitProviderPanel = new UpdateUnitProviderPanel(localUpdateUnitProvider.isEnabled(), localUpdateUnitProvider.getDisplayName(), localUpdateUnitProvider.getProviderURL().toExternalForm(), true);
        
        DialogDescriptor localDialogDescriptor = SettingsTab.getCustomizerDescriptor(localUpdateUnitProviderPanel);
        localUpdateUnitProviderPanel.getOKButton().addActionListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent paramAnonymousActionEvent)
          {
            SettingsTab.this.setData(localUpdateUnitProvider, localUpdateUnitProviderPanel);
            table.getSelectionModel().setSelectionInterval(i, i);
          }
        });
        DialogDisplayer.getDefault().createDialog(localDialogDescriptor).setVisible(true);
        if (listener != null) {
          SettingsTab.Listener.access$600(listener);
        }
      }
    }
  }
  
  private class RemoveAction
    extends AbstractAction
  {
    RemoveAction()
    {
      super();
      putValue("MnemonicKey", Integer.valueOf(UnitTab.mnemonicForKey("SettingsTab.RemoveButton.text")));
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      SettingsTableModel localSettingsTableModel = getSettingsTableModel();
      int[] arrayOfInt1 = table.getSelectedRows();
      for (int k : arrayOfInt1) {
        if (k != -1)
        {
          UpdateUnitProvider localUpdateUnitProvider = localSettingsTableModel.getUpdateUnitProvider(k);
          if (localUpdateUnitProvider != null)
          {
            String str = NbBundle.getMessage(SettingsTab.class, "SettingsTab.bRemove.message", localUpdateUnitProvider.getDisplayName());
            NotifyDescriptor.Confirmation localConfirmation = new NotifyDescriptor.Confirmation(str);
            localConfirmation.setOptionType(0);
            Object localObject = DialogDisplayer.getDefault().notify(localConfirmation);
            if (NotifyDescriptor.YES_OPTION.equals(localObject)) {
              localSettingsTableModel.remove(k);
            }
          }
        }
      }
      localSettingsTableModel.refreshModel();
      if (arrayOfInt1.length > 0) {
        if (localSettingsTableModel.getRowCount() > arrayOfInt1[0]) {
          table.getSelectionModel().setSelectionInterval(arrayOfInt1[0], arrayOfInt1[0]);
        } else {
          table.getSelectionModel().setSelectionInterval(0, 0);
        }
      }
    }
  }
  
  private class AddAction
    extends AbstractAction
  {
    AddAction()
    {
      super();
      putValue("MnemonicKey", Integer.valueOf(UnitTab.mnemonicForKey("SettingsTab.AddButton.text")));
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      final UpdateUnitProviderPanel localUpdateUnitProviderPanel = new UpdateUnitProviderPanel(true, NbBundle.getMessage(SettingsTab.class, "SettingsTab_NewProviderName"), NbBundle.getMessage(SettingsTab.class, "SettingsTab_NewProviderURL"), false);
      
      DialogDescriptor localDialogDescriptor = SettingsTab.getCustomizerDescriptor(localUpdateUnitProviderPanel);
      localUpdateUnitProviderPanel.getOKButton().addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent paramAnonymousActionEvent)
        {
          try
          {
            getSettingsTableModel().add(localUpdateUnitProviderPanel.getProviderName(), localUpdateUnitProviderPanel.getProviderName(), new URL(localUpdateUnitProviderPanel.getProviderURL()), localUpdateUnitProviderPanel.isActive());
            
            getSettingsTableModel().refreshModel();
            SettingsTableModel localSettingsTableModel = getSettingsTableModel();
            for (int i = 0; i < localSettingsTableModel.getRowCount(); i++)
            {
              String str = localSettingsTableModel.getValueAt(i, 1).toString();
              if ((localUpdateUnitProviderPanel.getProviderName() != null) && (localUpdateUnitProviderPanel.getProviderName().equals(str))) {
                table.getSelectionModel().setSelectionInterval(i, i);
              }
            }
          }
          catch (MalformedURLException localMalformedURLException)
          {
            Logger.getLogger(SettingsTab.class.getName()).log(Level.INFO, localMalformedURLException.getLocalizedMessage(), localMalformedURLException);
          }
        }
      });
      DialogDisplayer.getDefault().createDialog(localDialogDescriptor).setVisible(true);
    }
  }
  
  private class Table
    extends JTable
  {
    public Table()
    {
      setShowGrid(false);
      setIntercellSpacing(new Dimension(0, 0));
      getAccessibleContext().setAccessibleName(NbBundle.getMessage(UnitTable.class, "ACN_UpdateCentersTable"));
      getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(UnitTab.class, "ACD_UpdateCentersTable"));
      lUpdateCenters.setLabelFor(this);
    }
    
    public void addNotify()
    {
      super.addNotify();
      if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
        getParent().setBackground(new Color(getBackground().getRGB(), false));
      } else {
        getParent().setBackground(getBackground());
      }
    }
    
    public Component prepareRenderer(TableCellRenderer paramTableCellRenderer, int paramInt1, int paramInt2)
    {
      Component localComponent = super.prepareRenderer(paramTableCellRenderer, paramInt1, paramInt2);
      Color localColor1 = getBackground();
      Color localColor2 = UnitTable.getDarkerColor(localColor1);
      if (isRowSelected(paramInt1)) {
        localComponent.setForeground(getSelectionForeground());
      } else {
        localComponent.setForeground(getForeground());
      }
      if (!isCellSelected(paramInt1, paramInt2)) {
        if (paramInt1 % 2 == 0) {
          localComponent.setBackground(localColor2);
        } else {
          localComponent.setBackground(localColor1);
        }
      }
      return localComponent;
    }
  }
  
  private int getAutoUpdatePeriod()
  {
    return AutoupdateSettings.getPeriod();
  }
  
  private void setAutoUpdatePeriod(int paramInt)
  {
    if (paramInt != getAutoUpdatePeriod())
    {
      AutoupdateSettings.setPeriod(paramInt);
      cbCheckPeriod.removeItem(getMessage("CTL_Update_custom"));
    }
  }
  
  void setWaitingState(boolean paramBoolean)
  {
    getPluginManager().setWaitingState(paramBoolean);
    table.setEnabled(!paramBoolean);
  }
  
  private static class UpdateProviderRenderer
    extends DefaultTableCellRenderer
  {
    public Component getTableCellRendererComponent(JTable paramJTable, Object paramObject, boolean paramBoolean1, boolean paramBoolean2, int paramInt1, int paramInt2)
    {
      JLabel localJLabel = (JLabel)super.getTableCellRendererCompon
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd