org-netbeans-modules-options-keymap

16:40:03.698 INFO  jd.cli.Main - Decompiling org-netbeans-modules-options-keymap.jar
package org.netbeans.core.options.keymap.api;

public abstract interface ShortcutAction
{
  public abstract String getDisplayName();
  
  public abstract String getId();
  
  public abstract String getDelegatingActionId();
  
  public abstract ShortcutAction getKeymapManagerInstance(String paramString);
}

/* Location:
 * Qualified Name:     org.netbeans.core.options.keymap.api.ShortcutAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.options.keymap.api;

import java.util.Set;

public abstract interface ShortcutsFinder
{
  public abstract ShortcutAction findActionForShortcut(String paramString);
  
  public abstract ShortcutAction findActionForId(String paramString);
  
  public abstract String showShortcutsDialog();
  
  public abstract String[] getShortcuts(ShortcutAction paramShortcutAction);
  
  public abstract void refreshActions();
  
  public abstract void setShortcuts(ShortcutAction paramShortcutAction, Set<String> paramSet);
  
  public abstract void apply();
}

/* Location:
 * Qualified Name:     org.netbeans.core.options.keymap.api.ShortcutsFinder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.options.keymap.spi;

import java.util.List;
import java.util.Map;
import java.util.Set;
import org.netbeans.core.options.keymap.api.ShortcutAction;

public abstract class KeymapManager
{
  private String name;
  
  protected KeymapManager(String paramString)
  {
    name = paramString;
  }
  
  public abstract Map<String, Set<ShortcutAction>> getActions();
  
  public abstract void refreshActions();
  
  public abstract Map<ShortcutAction, Set<String>> getKeymap(String paramString);
  
  public abstract Map<ShortcutAction, Set<String>> getDefaultKeymap(String paramString);
  
  public abstract void saveKeymap(String paramString, Map<ShortcutAction, Set<String>> paramMap);
  
  public abstract List<String> getProfiles();
  
  public String getProfileDisplayName(String paramString)
  {
    return paramString;
  }
  
  public abstract String getCurrentProfile();
  
  public abstract void setCurrentProfile(String paramString);
  
  public abstract void deleteProfile(String paramString);
  
  public abstract boolean isCustomProfile(String paramString);
  
  public final String getName()
  {
    return name;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.options.keymap.spi.KeymapManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import org.netbeans.core.options.keymap.api.ShortcutAction;
import org.openide.util.NbBundle;

public class ActionHolder
{
  private ShortcutAction action;
  private boolean isAlternative;
  
  public ActionHolder(ShortcutAction paramShortcutAction, boolean paramBoolean)
  {
    action = paramShortcutAction;
    isAlternative = paramBoolean;
  }
  
  public ShortcutAction getAction()
  {
    return action;
  }
  
  public boolean isAlternative()
  {
    return isAlternative;
  }
  
  public String toString()
  {
    String str = action.getDisplayName();
    return isAlternative ? str + " " + NbBundle.getMessage(ActionHolder.class, "Alternative_Shortcut") : str;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ActionHolder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.swing.Action;
import org.openide.awt.StatusDisplayer;
import org.openide.util.NbBundle;

class ActionsSearchProvider$ActionResult
  implements Runnable
{
  private static Logger UILOG = Logger.getLogger("org.netbeans.ui.actions");
  private Action command;
  
  public ActionsSearchProvider$ActionResult(Action paramAction)
  {
    command = paramAction;
  }
  
  public void run()
  {
    try
    {
      command.actionPerformed(ActionsSearchProvider.access$000(command));
      uiLog();
    }
    catch (Throwable localThrowable)
    {
      if ((localThrowable instanceof ThreadDeath)) {
        throw ((ThreadDeath)localThrowable);
      }
      Object localObject = command.getValue("Name");
      String str = "";
      if ((localObject instanceof String)) {
        str = (String)localObject;
      }
      Logger.getLogger(getClass().getName()).log(Level.FINE, str + " action can not be invoked.", localThrowable);
      
      StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(getClass(), "MSG_ActionFailure", str));
    }
  }
  
  private void uiLog()
  {
    LogRecord localLogRecord = new LogRecord(Level.FINER, "LOG_QUICKSEARCH_ACTION");
    localLogRecord.setParameters(new Object[] { command.getClass().getName(), command.getValue("Name") });
    localLogRecord.setResourceBundle(NbBundle.getBundle(ActionsSearchProvider.class));
    localLogRecord.setResourceBundleName(ActionsSearchProvider.class.getPackage().getName() + ".Bundle");
    localLogRecord.setLoggerName(UILOG.getName());
    UILOG.log(localLogRecord);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ActionsSearchProvider.ActionResult
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.event.ActionEvent;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.swing.Action;
import javax.swing.JEditorPane;
import javax.swing.KeyStroke;
import javax.swing.text.TextAction;
import org.netbeans.core.options.keymap.api.ShortcutAction;
import org.netbeans.core.options.keymap.spi.KeymapManager;
import org.netbeans.spi.quicksearch.SearchProvider;
import org.netbeans.spi.quicksearch.SearchRequest;
import org.netbeans.spi.quicksearch.SearchResponse;
import org.openide.awt.StatusDisplayer;
import org.openide.cookies.EditorCookie;
import org.openide.nodes.Node;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.windows.TopComponent;
import org.openide.windows.TopComponent.Registry;
import org.openide.windows.WindowManager;

public class ActionsSearchProvider
  implements SearchProvider
{
  public void evaluate(SearchRequest paramSearchRequest, SearchResponse paramSearchResponse)
  {
    HashMap localHashMap = new HashMap();
    ArrayList localArrayList = new ArrayList(7);
    for (Object localObject1 = Lookup.getDefault().lookupAll(KeymapManager.class).iterator(); ((Iterator)localObject1).hasNext();)
    {
      KeymapManager localKeymapManager = (KeymapManager)((Iterator)localObject1).next();
      localMap = localKeymapManager.getKeymap(localKeymapManager.getCurrentProfile());
      for (localObject2 = localKeymapManager.getActions().entrySet().iterator(); ((Iterator)localObject2).hasNext();)
      {
        Map.Entry localEntry = (Map.Entry)((Iterator)localObject2).next();
        for (localObject3 = ((Set)localEntry.getValue()).iterator(); ((Iterator)localObject3).hasNext();)
        {
          localObject4 = (ShortcutAction)((Iterator)localObject3).next();
          
          localObject5 = getActionInfo((ShortcutAction)localObject4, (Set)localMap.get(localObject4));
          if (localObject5 != null) {
            if (!doEvaluation(((ShortcutAction)localObject4).getDisplayName(), paramSearchRequest, (Object[])localObject5, paramSearchResponse, localArrayList, localHashMap)) {
              return;
            }
          }
        }
      }
    }
    Map localMap;
    Object localObject2;
    Object localObject3;
    Object localObject4;
    Object localObject5;
    localObject1 = TopComponent.getRegistry().getActivatedNodes();
    for (int i = 0; i < localObject1.length; i++)
    {
      localObject2 = localObject1[i].getActions(false);
      for (int j = 0; j < localObject2.length; j++)
      {
        localObject3 = checkNodeAction(localObject2[j]);
        if (localObject3 != null)
        {
          localObject4 = new Object[] { localObject3, null, null };
          localObject5 = ((Action)localObject3).getValue("Name");
          if ((localObject5 instanceof String))
          {
            String str = ((String)localObject5).replaceFirst("&(?! )", "");
            if (!doEvaluation(str, paramSearchRequest, (Object[])localObject4, paramSearchResponse, localArrayList, localHashMap)) {
              return;
            }
          }
        }
      }
    }
    for (Iterator localIterator = localArrayList.iterator(); localIterator.hasNext();)
    {
      localObject2 = (Object[])localIterator.next();
      if (!addAction((Object[])localObject2, paramSearchResponse, localHashMap)) {
        return;
      }
    }
  }
  
  private boolean addAction(Object[] paramArrayOfObject, SearchResponse paramSearchResponse, Map<Object, String> paramMap)
  {
    KeyStroke localKeyStroke = null;
    
    Set localSet = (Set)paramArrayOfObject[2];
    if ((localSet != null) && (localSet.size() > 0))
    {
      localObject1 = (String)localSet.iterator().next();
      localKeyStroke = Utilities.stringToKey((String)localObject1);
    }
    Object localObject1 = (Action)paramArrayOfObject[0];
    if (localKeyStroke == null)
    {
      localObject2 = ((Action)localObject1).getValue("AcceleratorKey");
      if ((localObject2 instanceof KeyStroke)) {
        localKeyStroke = (KeyStroke)localObject2;
      }
    }
    Object localObject2 = null;
    ShortcutAction localShortcutAction = (ShortcutAction)paramArrayOfObject[1];
    if (localShortcutAction != null)
    {
      localObject2 = localShortcutAction.getDisplayName();
    }
    else
    {
      Object localObject3 = ((Action)localObject1).getValue("Name");
      if ((localObject3 instanceof String)) {
        localObject2 = ((String)localObject3).replaceFirst("&(?! )", "");
      }
    }
    if (paramMap.put(localObject1, localObject2) != null) {
      return true;
    }
    return paramSearchResponse.addResult(new ActionResult((Action)localObject1), (String)localObject2, null, Collections.singletonList(localKeyStroke));
  }
  
  private boolean doEvaluation(String paramString, SearchRequest paramSearchRequest, Object[] paramArrayOfObject, SearchResponse paramSearchResponse, List<Object[]> paramList, Map<Object, String> paramMap)
  {
    int i = paramString.toLowerCase().indexOf(paramSearchRequest.getText().toLowerCase());
    if (i == 0) {
      return addAction(paramArrayOfObject, paramSearchResponse, paramMap);
    }
    if (i != -1) {
      paramList.add(paramArrayOfObject);
    }
    return true;
  }
  
  private Object[] getActionInfo(ShortcutAction paramShortcutAction, Set<String> paramSet)
  {
    Class localClass = paramShortcutAction.getClass();
    Field localField = null;
    try
    {
      localField = localClass.getDeclaredField("action");
      localField.setAccessible(true);
      Action localAction = (Action)localField.get(paramShortcutAction);
      if (!localAction.isEnabled()) {
        return null;
      }
      return new Object[] { localAction, paramShortcutAction, paramSet };
    }
    catch (Throwable localThrowable)
    {
      if ((localThrowable instanceof ThreadDeath)) {
        throw ((ThreadDeath)localThrowable);
      }
      Logger.getLogger(getClass().getName()).log(Level.FINE, "Some problem getting action " + paramShortcutAction.getDisplayName(), localThrowable);
    }
    return null;
  }
  
  private static ActionEvent createActionEvent(Action paramAction)
  {
    Object localObject = null;
    int i = 1001;
    if ((paramAction instanceof TextAction))
    {
      EditorCookie localEditorCookie = (EditorCookie)Utilities.actionsGlobalContext().lookup(EditorCookie.class);
      if (localEditorCookie == null) {
        return null;
      }
      JEditorPane[] arrayOfJEditorPane = localEditorCookie.getOpenedPanes();
      if ((arrayOfJEditorPane == null) || (arrayOfJEditorPane.length <= 0)) {
        return null;
      }
      localObject = arrayOfJEditorPane[0];
    }
    if (localObject == null) {
      localObject = TopComponent.getRegistry().getActivated();
    }
    if (localObject == null) {
      localObject = WindowManager.getDefault().getMainWindow();
    }
    return new ActionEvent(localObject, i, null);
  }
  
  private Action checkNodeAction(Action paramAction)
  {
    if (paramAction == null) {
      return null;
    }
    try
    {
      if (paramAction.isEnabled()) {
        return paramAction;
      }
    }
    catch (Throwable localThrowable)
    {
      if ((localThrowable instanceof ThreadDeath)) {
        throw ((ThreadDeath)localThrowable);
      }
      Logger.getLogger(getClass().getName()).log(Level.FINE, "Problem asking isEnabled on action " + paramAction, localThrowable);
    }
    return null;
  }
  
  private static class ActionResult
    implements Runnable
  {
    private static Logger UILOG = Logger.getLogger("org.netbeans.ui.actions");
    private Action command;
    
    public ActionResult(Action paramAction)
    {
      command = paramAction;
    }
    
    public void run()
    {
      try
      {
        command.actionPerformed(ActionsSearchProvider.createActionEvent(command));
        uiLog();
      }
      catch (Throwable localThrowable)
      {
        if ((localThrowable instanceof ThreadDeath)) {
          throw ((ThreadDeath)localThrowable);
        }
        Object localObject = command.getValue("Name");
        String str = "";
        if ((localObject instanceof String)) {
          str = (String)localObject;
        }
        Logger.getLogger(getClass().getName()).log(Level.FINE, str + " action can not be invoked.", localThrowable);
        
        StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(getClass(), "MSG_ActionFailure", str));
      }
    }
    
    private void uiLog()
    {
      LogRecord localLogRecord = new LogRecord(Level.FINER, "LOG_QUICKSEARCH_ACTION");
      localLogRecord.setParameters(new Object[] { command.getClass().getName(), command.getValue("Name") });
      localLogRecord.setResourceBundle(NbBundle.getBundle(ActionsSearchProvider.class));
      localLogRecord.setResourceBundleName(ActionsSearchProvider.class.getPackage().getName() + ".Bundle");
      localLogRecord.setLoggerName(UILOG.getName());
      UILOG.log(localLogRecord);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ActionsSearchProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.FocusManager;
import javax.swing.SwingUtilities;

class ButtonCellEditor$1
  implements PropertyChangeListener
{
  ButtonCellEditor$1(ButtonCellEditor paramButtonCellEditor) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    Component localComponent = ButtonCellEditor.access$000(this$0).getFocusOwner();
    if ((localComponent != null) && (!SwingUtilities.isDescendingFrom(localComponent, ButtonCellEditor.access$100())))
    {
      this$0.cancelCellEditing();
      return;
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ButtonCellEditor.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;

class ButtonCellEditor$2
  extends KeyAdapter
{
  ButtonCellEditor$2(ButtonCellEditor paramButtonCellEditor) {}
  
  public void keyPressed(KeyEvent paramKeyEvent)
  {
    if (paramKeyEvent.getKeyCode() == 27)
    {
      JTable localJTable = (JTable)ButtonCellEditor.access$100().getParent();
      localJTable.getCellEditor().cancelCellEditing();
      KeymapPanel.getModel().update();
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ButtonCellEditor.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.Color;
import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Arrays;
import java.util.EventObject;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.swing.DefaultCellEditor;
import javax.swing.FocusManager;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.table.TableCellEditor;
import org.netbeans.core.options.keymap.api.ShortcutAction;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.util.NbBundle;

public class ButtonCellEditor
  extends DefaultCellEditor
{
  private Object action;
  private KeymapViewModel model;
  private String orig;
  private FocusManager focusManager;
  private PropertyChangeListener focusListener = new PropertyChangeListener()
  {
    public void propertyChange(PropertyChangeEvent paramAnonymousPropertyChangeEvent)
    {
      Component localComponent = focusManager.getFocusOwner();
      if ((localComponent != null) && (!SwingUtilities.isDescendingFrom(localComponent, ButtonCellEditor.cell)))
      {
        cancelCellEditing();
        return;
      }
    }
  };
  private KeyAdapter escapeAdapter = new KeyAdapter()
  {
    public void keyPressed(KeyEvent paramAnonymousKeyEvent)
    {
      if (paramAnonymousKeyEvent.getKeyCode() == 27)
      {
        JTable localJTable = (JTable)ButtonCellEditor.cell.getParent();
        localJTable.getCellEditor().cancelCellEditing();
        KeymapPanel.getModel().update();
      }
    }
  };
  private static ShortcutCellPanel cell = new ShortcutCellPanel();
  
  public ButtonCellEditor(KeymapViewModel paramKeymapViewModel)
  {
    super(new ShortcutTextField());
    model = paramKeymapViewModel;
  }
  
  public boolean shouldSelectCell(EventObject paramEventObject)
  {
    return true;
  }
  
  private void removeConflictingShortcut(ShortcutAction paramShortcutAction, String paramString)
  {
    if (paramString.contains(" ")) {
      paramString = paramString.substring(0, paramString.indexOf(' '));
    }
    String[] arrayOfString = model.getShortcuts(paramShortcutAction);
    for (int i = 0; i < arrayOfString.length; i++) {
      if (arrayOfString[i].startsWith(paramString)) {
        model.removeShortcut(paramShortcutAction, arrayOfString[i]);
      }
    }
  }
  
  public boolean stopCellEditing()
  {
    String str = cell.toString();
    
    ShortcutAction localShortcutAction1 = (ShortcutAction)action;
    Set localSet = model.findActionForShortcutPrefix(str);
    localSet.remove(localShortcutAction1);
    if (!localSet.isEmpty())
    {
      Object localObject1 = overrride(localSet);
      Object localObject2;
      if (localObject1.equals(DialogDescriptor.YES_OPTION))
      {
        for (localObject2 = localSet.iterator(); ((Iterator)localObject2).hasNext();)
        {
          ShortcutAction localShortcutAction2 = (ShortcutAction)((Iterator)localObject2).next();
          removeConflictingShortcut(localShortcutAction2, str);
        }
        getComponent().requestFocus();
      }
      else
      {
        if (localObject1.equals(DialogDescriptor.NO_OPTION))
        {
          localObject2 = (JComponent)getComponent();
          ((JComponent)localObject2).setBorder(new LineBorder(Color.red));
          ((JComponent)localObject2).requestFocus();
          return false;
        }
        cell.getTextField().setText(orig);
        fireEditingCanceled();
        setBorderEmpty();
        return true;
      }
    }
    cell.getTextField().removeActionListener(delegate);
    cell.getTextField().removeKeyListener(escapeAdapter);
    model.removeShortcut((ShortcutAction)action, orig);
    if (str.length() != 0) {
      model.addShortcut((ShortcutAction)action, str);
    }
    fireEditingStopped();
    setBorderEmpty();
    model.update();
    if (focusManager != null)
    {
      focusManager.removePropertyChangeListener(focusListener);
      focusManager = null;
    }
    return true;
  }
  
  public void cancelCellEditing()
  {
    cell.getTextField().setText(orig);
    fireEditingCanceled();
    setBorderEmpty();
    if (focusManager != null)
    {
      focusManager.removePropertyChangeListener(focusListener);
      focusManager = null;
    }
  }
  
  public Component getTableCellEditorComponent(JTable paramJTable, Object paramObject, boolean paramBoolean, int paramInt1, int paramInt2)
  {
    cell.setText((String)paramObject);
    orig = cell.getTextField().getText();
    action = ((ActionHolder)paramJTable.getValueAt(paramInt1, 0)).getAction();
    JTextField localJTextField = cell.getTextField();
    localJTextField.addActionListener(delegate);
    localJTextField.setBorder(new LineBorder(Color.BLACK));
    if (!Arrays.asList(localJTextField.getKeyListeners()).contains(escapeAdapter)) {
      localJTextField.addKeyListener(escapeAdapter);
    }
    focusManager = FocusManager.getCurrentManager();
    focusManager.addPropertyChangeListener(focusListener);
    return cell;
  }
  
  public Object getCellEditorValue()
  {
    return cell.getTextField().getText();
  }
  
  public Component getComponent()
  {
    return cell.getTextField();
  }
  
  private Object overrride(Set<ShortcutAction> paramSet)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    for (Object localObject1 = paramSet.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (ShortcutAction)((Iterator)localObject1).next();
      localStringBuffer.append(" '" + ((ShortcutAction)localObject2).getDisplayName() + "'<br>");
    }
    localObject1 = new JPanel();
    ((JPanel)localObject1).add(new JLabel(NbBundle.getMessage(ButtonCellEditor.class, "Override_Shortcut", localStringBuffer)));
    Object localObject2 = new DialogDescriptor(localObject1, NbBundle.getMessage(ButtonCellEditor.class, "Conflicting_Shortcut_Dialog"), true, 1, null, null);
    
    DialogDisplayer.getDefault().notify((NotifyDescriptor)localObject2);
    return ((DialogDescriptor)localObject2).getValue();
  }
  
  private void setBorderEmpty()
  {
    ((JComponent)getComponent()).setBorder(new EmptyBorder(0, 0, 0, 0));
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ButtonCellEditor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

public class ButtonCellRenderer
  implements TableCellRenderer
{
  private TableCellRenderer defaultRenderer;
  private static ShortcutCellPanel panel;
  
  public ButtonCellRenderer(TableCellRenderer paramTableCellRenderer)
  {
    defaultRenderer = paramTableCellRenderer;
  }
  
  public Component getTableCellRendererComponent(JTable paramJTable, Object paramObject, boolean paramBoolean1, boolean paramBoolean2, int paramInt1, int paramInt2)
  {
    if ((paramObject instanceof String))
    {
      Rectangle localRectangle = paramJTable.getCellRect(paramInt1, paramInt2, false);
      String str = (String)paramObject;
      Dimension localDimension = new Dimension((int)localRectangle.getWidth(), (int)localRectangle.getHeight());
      if (panel == null) {
        panel = new ShortcutCellPanel(str);
      } else {
        panel.setText(str);
      }
      panel.setSize(localDimension);
      if (paramBoolean1)
      {
        panel.setBgColor(paramJTable.getSelectionBackground());
        panel.setFgCOlor(paramJTable.getSelectionForeground());
      }
      else
      {
        panel.setBgColor(paramJTable.getBackground());
        panel.setFgCOlor(paramJTable.getForeground());
      }
      return panel;
    }
    return defaultRenderer.getTableCellRendererComponent(paramJTable, paramObject, paramBoolean1, paramBoolean2, paramInt1, paramInt2);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ButtonCellRenderer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.netbeans.core.options.keymap.api.ShortcutAction;

public class CompoundAction
  implements ShortcutAction
{
  private static final String DEFAULT_PROVIDER = "EditorBridge";
  private Map<String, ShortcutAction> actions;
  
  public CompoundAction(Map<String, ShortcutAction> paramMap)
  {
    actions = paramMap;
  }
  
  public String getDisplayName()
  {
    ShortcutAction localShortcutAction1 = (ShortcutAction)actions.get("EditorBridge");
    if (localShortcutAction1 != null) {
      return localShortcutAction1.getDisplayName();
    }
    for (ShortcutAction localShortcutAction2 : actions.values())
    {
      String str = localShortcutAction2.getDisplayName();
      if (str != null) {
        return str;
      }
    }
    return "<error>";
  }
  
  public String getId()
  {
    ShortcutAction localShortcutAction1 = (ShortcutAction)actions.get("EditorBridge");
    if (localShortcutAction1 != null) {
      return localShortcutAction1.getId();
    }
    for (ShortcutAction localShortcutAction2 : actions.values())
    {
      String str = localShortcutAction2.getId();
      if (str != null) {
        return str;
      }
    }
    return "<error>";
  }
  
  public String getDelegatingActionId()
  {
    ShortcutAction localShortcutAction1 = (ShortcutAction)actions.get("EditorBridge");
    if (localShortcutAction1 != null) {
      return localShortcutAction1.getDelegatingActionId();
    }
    for (ShortcutAction localShortcutAction2 : actions.values())
    {
      String str = localShortcutAction2.getDelegatingActionId();
      if (str != null) {
        return str;
      }
    }
    return null;
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof CompoundAction)) {
      return false;
    }
    if (actions.get("EditorBridge") != null) {
      return getKeymapManagerInstance("EditorBridge").equals(((CompoundAction)paramObject).getKeymapManagerInstance("EditorBridge"));
    }
    if (actions.keySet().isEmpty()) {
      return false;
    }
    String str = (String)actions.keySet().iterator().next();
    return getKeymapManagerInstance(str).equals(((CompoundAction)paramObject).getKeymapManagerInstance(str));
  }
  
  public int hashCode()
  {
    if (actions.get("EditorBridge") != null) {
      return getKeymapManagerInstance("EditorBridge").hashCode() * 2;
    }
    if (actions.keySet().isEmpty()) {
      return 0;
    }
    String str = (String)actions.keySet().iterator().next();
    return ((ShortcutAction)actions.get(str)).hashCode() * 2;
  }
  
  public ShortcutAction getKeymapManagerInstance(String paramString)
  {
    return (ShortcutAction)actions.get(paramString);
  }
  
  public String toString()
  {
    return "CompoundAction[" + actions + "]";
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.CompoundAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.event.ActionEvent;
import java.util.Map;
import javax.swing.AbstractAction;

final class ExportShortcutsAction$1
  extends AbstractAction
{
  ExportShortcutsAction$1()
  {
    putValue("Name", ExportShortcutsAction.access$000("CTL_Export_IDE_Actions_Action"));
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    LayersBridge localLayersBridge = new LayersBridge();
    Map localMap1 = localLayersBridge.getActions();
    Map localMap2 = ExportShortcutsAction.access$100(localMap1);
    
    ExportShortcutsAction.access$200(localLayersBridge, localMap2);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ExportShortcutsAction.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.swing.AbstractAction;

final class ExportShortcutsAction$2
  extends AbstractAction
{
  ExportShortcutsAction$2()
  {
    putValue("Name", ExportShortcutsAction.access$000("CTL_Export_IDE_Shortcuts_Action"));
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    HashMap localHashMap = new HashMap();
    
    LayersBridge localLayersBridge = new LayersBridge();
    localLayersBridge.getActions();
    List localList = localLayersBridge.getProfiles();
    Iterator localIterator = localList.iterator();
    while (localIterator.hasNext())
    {
      String str = (String)localIterator.next();
      Map localMap1 = localLayersBridge.getKeymap(str);
      Map localMap2 = LayersBridge.shortcutToAction(localMap1);
      localHashMap.put(str, localMap2);
    }
    ExportShortcutsAction.access$200(localLayersBridge, localHashMap);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ExportShortcutsAction.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import javax.swing.AbstractAction;
import org.netbeans.core.options.keymap.spi.KeymapManager;

final class ExportShortcutsAction$3
  extends AbstractAction
{
  ExportShortcutsAction$3()
  {
    putValue("Name", ExportShortcutsAction.access$000("CTL_Export_Editor_Shortcuts_Action"));
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    Object localObject1 = null;
    for (Object localObject2 = KeymapModel.getKeymapManagerInstances().iterator(); ((Iterator)localObject2).hasNext();)
    {
      KeymapManager localKeymapManager = (KeymapManager)((Iterator)localObject2).next();
      if ("EditorBridge".equals(localKeymapManager.getName()))
      {
        localObject1 = localKeymapManager;
        break;
      }
    }
    if (localObject1 != null)
    {
      localObject2 = ((KeymapManager)localObject1).getKeymap(((KeymapManager)localObject1).getCurrentProfile());
      
      ExportShortcutsAction.access$300((Map)localObject2);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ExportShortcutsAction.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;

final class ExportShortcutsAction$4
  extends AbstractAction
{
  ExportShortcutsAction$4()
  {
    putValue("Name", ExportShortcutsAction.access$000("CTL_Export_Shortcuts_to_HTML_Action"));
  }
  
  public void actionPerformed(ActionEvent paramActionEvent) {}
}

/* Location:
 * Qualified Name:     org.netbeans.modules.options.keymap.ExportShortcutsAction.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.options.keymap;

import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.netbeans.core.options.keymap.api.ShortcutAction;
import org.netbeans.core.options.keymap.spi.KeymapManager;
import org.openide.ErrorManager;
import org.openide.filesystems.FileLock;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;

public class ExportShortcutsAction
{
  private static Action exportIDEActionsAction = new AbstractAction()
  {
    public void actionPerformed(ActionEvent paramAnonymousActionEvent)
    {
      LayersBridge localLayersBridge = new LayersBridge();
      Map localMap1 = localLayersBridge.getActions();
      Map localMap2 = ExportShortcutsAction.resolveNames(localMap1);
      
      ExportShortcutsAction.generateLayersXML(localLayersBridge, localMap2);
    }
  };
  
  public static Action getExportIDEActionsAction()
  {
    return exportIDEActionsAction;
  }
  
  private static Action exportIDEShortcutsAction = new AbstractAction()
  {
    public void actionPerformed(ActionEvent paramAnonymousActionEvent)
    {
      HashMap localHashMap = new HashMap();
      
      LayersBridge localLayersBridge = new LayersBridge();
      localLayersBridge.getActions();
      List localList = localLayersBridge.getProfiles();
      Iterator localIterator = localList.iterator();
      while (localIterator.hasNext())
      {
        String str = (String)localIterator.next();
        Map localMap1 = localLayersBridge.getKeymap(str);
        Map localMap2 = LayersBridge.shortcutToAction(localMap1);
        localHashMap.put(str, localMap2);
      }
      ExportShortcutsAction.generateLayersXML(localLayersBridge, localHashMap);
    }
  };
  
  public static Action getExportIDEShortcutsAction()
  {
    return exportIDEShortcutsAction;
  }
  
  private static Action exportEditorShortcutsAction = new AbstractAction()
  {
    public void actionPerformed(ActionEvent paramAnonymousActionEvent)
    {
      Object localObject1 = null;
      for (Object localObject2 = KeymapModel.getKeymapManagerInstances().iterator(); ((Iterator)localObject2).hasNext();)
      {
        KeymapManager localKeymapManager = (KeymapManager)((Iterator)localObject2).next();
        if ("EditorBridge".equals(localKeymapManager.getName()))
        {
          localObject1 = localKeymapManager;
          break;
        }
      }
      if (localObject1 != null)
      {
        localObject2 = ((KeymapManager)localObject1).getKeymap(((KeymapManager)localObject1).getCurrentProfile());
        
        ExportShortcutsAction.generateEditorXML((Map)localObject2);
      }
    }
  };
  
  public static Action getExportEditorShortcutsAction()
  {
    return exportEditorShortcutsAction;
  }
  
  private static Action exportShortcutsToHTMLAction = new AbstractAction()
  {
    public void actionPerformed(ActionEvent paramAnonymousActionEvent) {}
  };
  
  public static Action getExportShortcutsToHTMLAction()
  {
    return exportShortcutsToHTMLAction;
  }
  
  private static void exportShortcutsToHTML()
  {
    KeymapModel localKeymapModel = new KeymapModel();
    TreeMap localTreeMap = new TreeMap();
    for (Object localObject1 = localKeymapModel.getProfiles().iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (String)((Iterator)localObject1).next();
      localTreeMap.put(localObject2, localKeymapModel.getKeymap((String)localObject2));
    }
    try
    {
      localObject1 = new StringBuffer();
      
      Object localObject2 = new XMLStorage.Attribs(true);
      XMLStorage.generateFolderStart((StringBuffer)localObject1, "html", (XMLStorage.Attribs)localObject2, "");
      XMLStorage.generateFolderStart((StringBuffer)localObject1, "body", (XMLStorage.Attribs)localObject2, "  ");
      ((XMLStorage.Attribs)localObject2).add("border", "1");
      ((XMLStorage.Attribs)localObject2).add("cellpadding", "1");
      ((XMLStorage.Attribs)localObject2).add("cellspacing", "0");
      XMLStorage.generateFolderStart((StringBuffer)localObject1, "table", (XMLStorage.Attribs)localObject2, "    ");
      localObject2 = new XMLStorage.Attribs(true);
      
      XMLStorage.generateFolderStart((StringBuffer)localObject1, "tr", (XMLStorage.Attribs)localObject2, "      ");
      XMLStorage.generateFolderStart((StringBuffer)localObject1, "td", (XMLStorage.Attribs)localObject2, "        ");
      XMLStorage.generateFolderStart((StringBuffer)localObject1, "h2", (XMLStorage.Attribs)localObject2, "        ");
      ((StringBuffer)localObject1).append("Action Name");
      XMLStorage.generateFolderEnd((StringBuffer)localObject1, "h2", "        ");
      XMLStorage.generateFolderEnd((StringBuffer)localObject1, "td", "        ");
      for (Object localObject3 = localTreeMap.keySet().iterator(); ((Iterator)localObject3).hasNext();)
      {
        localObject4 = (String)((Iterator)localObject3).next();
        XMLStorage.generateFolderStart((StringBuffer)localObject1, "td", (XMLStorage.Attribs)localObject2, "        ");
        XMLStorage.generateFolderStart((StringBuffer)localObject1, "h2", (XMLStorage.Attribs)localObject2, "        ");
        ((StringBuffer)localObject1).append((String)localObject4);
        XMLStorage.generateFolderEnd((StringBuffer)localObject1, "h2", "        ");
        XMLStorage.generateFolderEnd((StringBuffer)localObject1, "td", "        ");
      }
      exportShortcutsToHTML2(localKeymapModel, (StringBuffer)localObject1, localTreeMap);
      
      XMLStorage.generateFolderEnd((StringBuffer)localObject1, "table", "    ");
      XMLStorage.generateFolderEnd((StringBuffer)localObject1, "body", "  ");
      XMLStorage.generateFolderEnd((StringBuffer)localObject1, "html", "");
      
      localObject3 = FileUtil.createData(FileUtil.getConfigRoot(), "shortcuts.html");
      
      Object localObject4 = ((FileObject)localObject3).lock();
      try
      {
        OutputStream localOutputStream = ((FileObject)localObject3).getOutputStream((FileLock)localObject4);
        OutputStreamWriter localOutputStreamWriter = new OutputStreamWriter(localOutputStream);
        localOutputStreamWriter.write(((StringBuffer)localObject1).toString());
        localOutputStreamWriter.close();
      }
      catch (IOException localIOException2)
      {
        ErrorManager.getDefault().notify(localIOException2);
      }
      finally
      {
        ((FileLock)localObject4).releaseLock();
      }
    }
    catch (IOException localIOException1)
    {
      ErrorManager.getDefault().notify(localIOException1);
    }
  }
  
  private static void exportShortcutsToHTML2(KeymapModel paramKeymapModel, StringBuffer paramStringBuffer, Map<String, Map<ShortcutAction, Set<String>>> paramMap)
  {
    ArrayList localArrayList = new ArrayList(paramKeymapModel.getActionCategories());
    Collections.sort(localArrayList);
    XMLStorage.Attribs localAttribs = new XMLStorage.Attribs(true);
    for (String str : localArrayList)
    {
      XMLStorage.generateFolderStart(paramStringBuffer, "tr", localAttribs, "      ");
      localAttribs.add("colspan", Integer.toString(paramMap.size() + 1));
      localAttribs.add("rowspan", "1");
      XMLStorage.generateFolderStart(paramStringBuffer, "td", localAttribs, "        ");
      localAttribs = new XMLStorage.Attribs(true);
      XMLStorage.generateFolderStart(paramStringBuffer, "h3", localAttribs, "        ");
      paramStringBuffer.append(str);
      XMLStorage.generateFolderEnd(paramStringBuffer, "h3", "        ");
      XMLStorage.generateFolderEnd(paramStringBuffer, "td", "        ");
      XMLStorage.generateFolderEnd(paramStringBuffer, "tr", "      ");
1 2 3 4 5 6 7

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