org-eclipse-core-commands-3.6.0

16:39:24.059 INFO  jd.cli.Main - Decompiling org-eclipse-core-commands-3.6.0.jar
package org.eclipse.core.commands;

import org.eclipse.core.commands.common.EventManager;

public abstract class AbstractHandler
  extends EventManager
  implements IHandler2
{
  private boolean baseEnabled = true;
  
  public void addHandlerListener(IHandlerListener handlerListener)
  {
    addListenerObject(handlerListener);
  }
  
  public void dispose() {}
  
  protected void fireHandlerChanged(HandlerEvent handlerEvent)
  {
    if (handlerEvent == null) {
      throw new NullPointerException();
    }
    Object[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      IHandlerListener listener = (IHandlerListener)listeners[i];
      listener.handlerChanged(handlerEvent);
    }
  }
  
  public boolean isEnabled()
  {
    return baseEnabled;
  }
  
  protected void setBaseEnabled(boolean state)
  {
    if (baseEnabled == state) {
      return;
    }
    baseEnabled = state;
    fireHandlerChanged(new HandlerEvent(this, true, false));
  }
  
  public void setEnabled(Object evaluationContext) {}
  
  public boolean isHandled()
  {
    return true;
  }
  
  protected boolean hasListeners()
  {
    return isListenerAttached();
  }
  
  public void removeHandlerListener(IHandlerListener handlerListener)
  {
    removeListenerObject(handlerListener);
  }
  
  public abstract Object execute(ExecutionEvent paramExecutionEvent)
    throws ExecutionException;
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.AbstractHandler
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public abstract class AbstractHandlerWithState
  extends AbstractHandler
  implements IObjectWithState, IStateListener
{
  private Map states = null;
  
  public void addState(String stateId, State state)
  {
    if (state == null) {
      throw new NullPointerException("Cannot add a null state");
    }
    if (states == null) {
      states = new HashMap(3);
    }
    states.put(stateId, state);
    state.addListener(this);
    handleStateChange(state, null);
  }
  
  public final State getState(String stateId)
  {
    if ((states == null) || (states.isEmpty())) {
      return null;
    }
    return (State)states.get(stateId);
  }
  
  public final String[] getStateIds()
  {
    if ((states == null) || (states.isEmpty())) {
      return null;
    }
    Set stateIds = states.keySet();
    return (String[])stateIds.toArray(new String[stateIds.size()]);
  }
  
  public void removeState(String stateId)
  {
    if (stateId == null) {
      throw new NullPointerException("Cannot remove a null state");
    }
    State state = (State)states.get(stateId);
    if (state != null)
    {
      state.removeListener(this);
      if (states != null)
      {
        states.remove(state);
        if (states.isEmpty()) {
          states = null;
        }
      }
    }
  }
  
  public abstract void handleStateChange(State paramState, Object paramObject);
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.AbstractHandlerWithState
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

public abstract class AbstractParameterValueConverter
{
  public abstract Object convertToObject(String paramString)
    throws ParameterValueConversionException;
  
  public abstract String convertToString(Object paramObject)
    throws ParameterValueConversionException;
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.AbstractParameterValueConverter
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.core.commands.common.HandleObject;
import org.eclipse.core.commands.common.NamedHandleObject;
import org.eclipse.core.internal.commands.util.Util;

public final class Category
  extends NamedHandleObject
{
  private Collection categoryListeners;
  
  Category(String id)
  {
    super(id);
  }
  
  public final void addCategoryListener(ICategoryListener categoryListener)
  {
    if (categoryListener == null) {
      throw new NullPointerException();
    }
    if (categoryListeners == null) {
      categoryListeners = new ArrayList();
    }
    if (!categoryListeners.contains(categoryListener)) {
      categoryListeners.add(categoryListener);
    }
  }
  
  public final void define(String name, String description)
  {
    if (name == null) {
      throw new NullPointerException(
        "The name of a command cannot be null");
    }
    boolean definedChanged = !defined;
    defined = true;
    
    boolean nameChanged = !Util.equals(this.name, name);
    this.name = name;
    
    boolean descriptionChanged = !Util.equals(this.description, 
      description);
    this.description = description;
    
    fireCategoryChanged(new CategoryEvent(this, definedChanged, 
      descriptionChanged, nameChanged));
  }
  
  private final void fireCategoryChanged(CategoryEvent categoryEvent)
  {
    if (categoryEvent == null) {
      throw new NullPointerException();
    }
    if (categoryListeners != null)
    {
      Iterator listenerItr = categoryListeners.iterator();
      while (listenerItr.hasNext())
      {
        ICategoryListener listener = (ICategoryListener)listenerItr
          .next();
        listener.categoryChanged(categoryEvent);
      }
    }
  }
  
  public final void removeCategoryListener(ICategoryListener categoryListener)
  {
    if (categoryListener == null) {
      throw new NullPointerException();
    }
    if (categoryListeners != null) {
      categoryListeners.remove(categoryListener);
    }
  }
  
  public String toString()
  {
    if (string == null)
    {
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append("Category(");
      stringBuffer.append(id);
      stringBuffer.append(',');
      stringBuffer.append(name);
      stringBuffer.append(',');
      stringBuffer.append(description);
      stringBuffer.append(',');
      stringBuffer.append(defined);
      stringBuffer.append(')');
      string = stringBuffer.toString();
    }
    return string;
  }
  
  public void undefine()
  {
    string = null;
    
    boolean definedChanged = defined;
    defined = false;
    
    boolean nameChanged = name != null;
    name = null;
    
    boolean descriptionChanged = description != null;
    description = null;
    
    fireCategoryChanged(new CategoryEvent(this, definedChanged, 
      descriptionChanged, nameChanged));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.Category
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import org.eclipse.core.commands.common.AbstractNamedHandleEvent;

public final class CategoryEvent
  extends AbstractNamedHandleEvent
{
  private final Category category;
  
  public CategoryEvent(Category category, boolean definedChanged, boolean descriptionChanged, boolean nameChanged)
  {
    super(definedChanged, descriptionChanged, nameChanged);
    if (category == null) {
      throw new NullPointerException();
    }
    this.category = category;
  }
  
  public final Category getCategory()
  {
    return category;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.CategoryEvent
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import org.eclipse.core.runtime.ISafeRunnable;

class Command$1
  implements ISafeRunnable
{
  final Command this$0;
  private final ICommandListener val$listener;
  private final CommandEvent val$commandEvent;
  
  Command$1(Command paramCommand, ICommandListener paramICommandListener, CommandEvent paramCommandEvent)
  {
    this$0 = paramCommand;val$listener = paramICommandListener;val$commandEvent = paramCommandEvent;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.commandChanged(val$commandEvent);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.Command.1
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

class Command$2
  implements IHandlerListener
{
  final Command this$0;
  
  Command$2(Command paramCommand)
  {
    this$0 = paramCommand;
  }
  
  public void handlerChanged(HandlerEvent handlerEvent)
  {
    boolean enabledChanged = handlerEvent.isEnabledChanged();
    boolean handledChanged = handlerEvent.isHandledChanged();
    Command.access$0(this$0, new CommandEvent(this$0, false, 
      false, false, handledChanged, false, false, false, 
      false, enabledChanged));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.Command.2
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import org.eclipse.core.commands.common.EventManager;
import org.eclipse.core.commands.common.HandleObject;
import org.eclipse.core.commands.common.NamedHandleObject;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.util.Tracing;
import org.eclipse.core.internal.commands.util.Util;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;

public final class Command
  extends NamedHandleObjectWithState
  implements Comparable
{
  public static boolean DEBUG_COMMAND_EXECUTION = false;
  public static boolean DEBUG_HANDLERS = false;
  public static String DEBUG_HANDLERS_COMMAND_ID = null;
  private Category category = null;
  private transient ListenerList executionListeners = null;
  private transient IHandler handler = null;
  private String helpContextId;
  private IParameter[] parameters = null;
  private ParameterType returnType = null;
  private IHandlerListener handlerListener;
  
  Command(String id)
  {
    super(id);
  }
  
  public final void addCommandListener(ICommandListener commandListener)
  {
    if (commandListener == null) {
      throw new NullPointerException("Cannot add a null command listener");
    }
    addListenerObject(commandListener);
  }
  
  public final void addExecutionListener(IExecutionListener executionListener)
  {
    if (executionListener == null) {
      throw new NullPointerException(
        "Cannot add a null execution listener");
    }
    if (executionListeners == null) {
      executionListeners = new ListenerList(1);
    }
    executionListeners.add(executionListener);
  }
  
  public void addState(String id, State state)
  {
    super.addState(id, state);
    state.setId(id);
    if ((handler instanceof IObjectWithState)) {
      ((IObjectWithState)handler).addState(id, state);
    }
  }
  
  public final int compareTo(Object object)
  {
    Command castedObject = (Command)object;
    int compareTo = Util.compare(category, category);
    if (compareTo == 0)
    {
      compareTo = Util.compare(defined, defined);
      if (compareTo == 0)
      {
        compareTo = Util.compare(description, description);
        if (compareTo == 0)
        {
          compareTo = Util.compare(handler, handler);
          if (compareTo == 0)
          {
            compareTo = Util.compare(id, id);
            if (compareTo == 0)
            {
              compareTo = Util.compare(name, name);
              if (compareTo == 0) {
                compareTo = Util.compare(parameters, 
                  parameters);
              }
            }
          }
        }
      }
    }
    return compareTo;
  }
  
  public final void define(String name, String description, Category category)
  {
    define(name, description, category, null);
  }
  
  public final void define(String name, String description, Category category, IParameter[] parameters)
  {
    define(name, description, category, parameters, null);
  }
  
  public final void define(String name, String description, Category category, IParameter[] parameters, ParameterType returnType)
  {
    define(name, description, category, parameters, returnType, null);
  }
  
  public final void define(String name, String description, Category category, IParameter[] parameters, ParameterType returnType, String helpContextId)
  {
    if (name == null) {
      throw new NullPointerException(
        "The name of a command cannot be null");
    }
    if (category == null) {
      throw new NullPointerException(
        "The category of a command cannot be null");
    }
    boolean definedChanged = !defined;
    defined = true;
    
    boolean nameChanged = !Util.equals(this.name, name);
    this.name = name;
    
    boolean descriptionChanged = !Util.equals(this.description, 
      description);
    this.description = description;
    
    boolean categoryChanged = !Util.equals(this.category, category);
    this.category = category;
    
    boolean parametersChanged = !Util.equals(this.parameters, 
      parameters);
    this.parameters = parameters;
    
    boolean returnTypeChanged = !Util.equals(this.returnType, 
      returnType);
    this.returnType = returnType;
    
    boolean helpContextIdChanged = !Util.equals(this.helpContextId, 
      helpContextId);
    this.helpContextId = helpContextId;
    
    fireCommandChanged(new CommandEvent(this, categoryChanged, 
      definedChanged, descriptionChanged, false, nameChanged, 
      parametersChanged, returnTypeChanged, helpContextIdChanged));
  }
  
  /**
   * @deprecated
   */
  public final Object execute(ExecutionEvent event)
    throws ExecutionException, NotHandledException
  {
    firePreExecute(event);
    IHandler handler = this.handler;
    if ((handler != null) && (handler.isHandled())) {
      try
      {
        Object returnValue = handler.execute(event);
        firePostExecuteSuccess(returnValue);
        return returnValue;
      }
      catch (ExecutionException e)
      {
        firePostExecuteFailure(e);
        throw e;
      }
    }
    NotHandledException e = new NotHandledException(
      "There is no handler to execute. " + getId());
    fireNotHandled(e);
    throw e;
  }
  
  public final Object executeWithChecks(ExecutionEvent event)
    throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException
  {
    firePreExecute(event);
    IHandler handler = this.handler;
    if (!isDefined())
    {
      NotDefinedException exception = new NotDefinedException(
        "Trying to execute a command that is not defined. " + 
        getId());
      fireNotDefined(exception);
      throw exception;
    }
    if ((handler != null) && (handler.isHandled()))
    {
      setEnabled(event.getApplicationContext());
      if (!isEnabled())
      {
        NotEnabledException exception = new NotEnabledException(
          "Trying to execute the disabled command " + getId());
        fireNotEnabled(exception);
        throw exception;
      }
      try
      {
        Object returnValue = handler.execute(event);
        firePostExecuteSuccess(returnValue);
        return returnValue;
      }
      catch (ExecutionException e)
      {
        firePostExecuteFailure(e);
        throw e;
      }
    }
    NotHandledException e = new NotHandledException(
      "There is no handler to execute for command " + getId());
    fireNotHandled(e);
    throw e;
  }
  
  private final void fireCommandChanged(CommandEvent commandEvent)
  {
    if (commandEvent == null) {
      throw new NullPointerException("Cannot fire a null event");
    }
    Object[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      ICommandListener listener = (ICommandListener)listeners[i];
      SafeRunner.run(new ISafeRunnable()
      {
        private final ICommandListener val$listener;
        private final CommandEvent val$commandEvent;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$listener.commandChanged(val$commandEvent);
        }
      });
    }
  }
  
  private final void fireNotDefined(NotDefinedException e)
  {
    if (DEBUG_COMMAND_EXECUTION) {
      Tracing.printTrace("COMMANDS", "execute >>> not defined: id=" + 
        getId() + "; exception=" + e);
    }
    if (executionListeners != null)
    {
      Object[] listeners = executionListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListenerWithChecks))
        {
          IExecutionListenerWithChecks listener = (IExecutionListenerWithChecks)object;
          listener.notDefined(getId(), e);
        }
      }
    }
  }
  
  private final void fireNotEnabled(NotEnabledException e)
  {
    if (DEBUG_COMMAND_EXECUTION) {
      Tracing.printTrace("COMMANDS", "execute >>> not enabled: id=" + 
        getId() + "; exception=" + e);
    }
    if (executionListeners != null)
    {
      Object[] listeners = executionListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListenerWithChecks))
        {
          IExecutionListenerWithChecks listener = (IExecutionListenerWithChecks)object;
          listener.notEnabled(getId(), e);
        }
      }
    }
  }
  
  private final void fireNotHandled(NotHandledException e)
  {
    if (DEBUG_COMMAND_EXECUTION) {
      Tracing.printTrace("COMMANDS", "execute >>> not handled: id=" + 
        getId() + "; exception=" + e);
    }
    if (executionListeners != null)
    {
      Object[] listeners = executionListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        IExecutionListener listener = (IExecutionListener)listeners[i];
        listener.notHandled(getId(), e);
      }
    }
  }
  
  private final void firePostExecuteFailure(ExecutionException e)
  {
    if (DEBUG_COMMAND_EXECUTION) {
      Tracing.printTrace("COMMANDS", "execute >>> failure: id=" + 
        getId() + "; exception=" + e);
    }
    if (executionListeners != null)
    {
      Object[] listeners = executionListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        IExecutionListener listener = (IExecutionListener)listeners[i];
        listener.postExecuteFailure(getId(), e);
      }
    }
  }
  
  private final void firePostExecuteSuccess(Object returnValue)
  {
    if (DEBUG_COMMAND_EXECUTION) {
      Tracing.printTrace("COMMANDS", "execute >>> success: id=" + 
        getId() + "; returnValue=" + 
        returnValue);
    }
    if (executionListeners != null)
    {
      Object[] listeners = executionListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        IExecutionListener listener = (IExecutionListener)listeners[i];
        listener.postExecuteSuccess(getId(), returnValue);
      }
    }
  }
  
  private final void firePreExecute(ExecutionEvent event)
  {
    if (DEBUG_COMMAND_EXECUTION) {
      Tracing.printTrace("COMMANDS", "execute >>> starting: id=" + 
        getId() + "; event=" + event);
    }
    if (executionListeners != null)
    {
      Object[] listeners = executionListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        IExecutionListener listener = (IExecutionListener)listeners[i];
        listener.preExecute(getId(), event);
      }
    }
  }
  
  public final Category getCategory()
    throws NotDefinedException
  {
    if (!isDefined()) {
      throw new NotDefinedException(
        "Cannot get the category from an undefined command. " + 
        id);
    }
    return category;
  }
  
  public final IHandler getHandler()
  {
    return handler;
  }
  
  final String getHelpContextId()
  {
    return helpContextId;
  }
  
  public final IParameter getParameter(String parameterId)
    throws NotDefinedException
  {
    if (!isDefined()) {
      throw new NotDefinedException(
        "Cannot get a parameter from an undefined command. " + 
        id);
    }
    if (parameters == null) {
      return null;
    }
    for (int i = 0; i < parameters.length; i++)
    {
      IParameter parameter = parameters[i];
      if (parameter.getId().equals(parameterId)) {
        return parameter;
      }
    }
    return null;
  }
  
  public final IParameter[] getParameters()
    throws NotDefinedException
  {
    if (!isDefined()) {
      throw new NotDefinedException(
        "Cannot get the parameters from an undefined command. " + 
        id);
    }
    if ((parameters == null) || (parameters.length == 0)) {
      return null;
    }
    IParameter[] returnValue = new IParameter[parameters.length];
    System.arraycopy(parameters, 0, returnValue, 0, parameters.length);
    return returnValue;
  }
  
  public final ParameterType getParameterType(String parameterId)
    throws NotDefinedException
  {
    IParameter parameter = getParameter(parameterId);
    if ((parameter instanceof ITypedParameter))
    {
      ITypedParameter parameterWithType = (ITypedParameter)parameter;
      return parameterWithType.getParameterType();
    }
    return null;
  }
  
  public final ParameterType getReturnType()
    throws NotDefinedException
  {
    if (!isDefined()) {
      throw new NotDefinedException(
        "Cannot get the return type of an undefined command. " + 
        id);
    }
    return returnType;
  }
  
  public final boolean isEnabled()
  {
    if (handler == null) {
      return false;
    }
    try
    {
      return handler.isEnabled();
    }
    catch (Exception e)
    {
      if (DEBUG_HANDLERS)
      {
        Tracing.printTrace("HANDLERS", "Handler " + handler + " for " + 
          id + " threw unexpected exception");
        e.printStackTrace(System.out);
      }
    }
    return false;
  }
  
  public void setEnabled(Object evaluationContext)
  {
    if ((handler instanceof IHandler2)) {
      ((IHandler2)handler).setEnabled(evaluationContext);
    }
  }
  
  public final boolean isHandled()
  {
    if (handler == null) {
      return false;
    }
    return handler.isHandled();
  }
  
  public final void removeCommandListener(ICommandListener commandListener)
  {
    if (commandListener == null) {
      throw new NullPointerException(
        "Cannot remove a null command listener");
    }
    removeListenerObject(commandListener);
  }
  
  public final void removeExecutionListener(IExecutionListener executionListener)
  {
    if (executionListener == null) {
      throw new NullPointerException(
        "Cannot remove a null execution listener");
    }
    if (executionListeners != null)
    {
      executionListeners.remove(executionListener);
      if (executionListeners.isEmpty()) {
        executionListeners = null;
      }
    }
  }
  
  public void removeState(String stateId)
  {
    if ((handler instanceof IObjectWithState)) {
      ((IObjectWithState)handler).removeState(stateId);
    }
    super.removeState(stateId);
  }
  
  public final boolean setHandler(IHandler handler)
  {
    if (Util.equals(handler, this.handler)) {
      return false;
    }
    String[] stateIds = getStateIds();
    if (stateIds != null) {
      for (int i = 0; i < stateIds.length; i++)
      {
        String stateId = stateIds[i];
        if ((this.handler instanceof IObjectWithState)) {
          ((IObjectWithState)this.handler).removeState(stateId);
        }
        if ((handler instanceof IObjectWithState))
        {
          State stateToAdd = getState(stateId);
          ((IObjectWithState)handler).addState(stateId, stateToAdd);
        }
      }
    }
    boolean enabled = isEnabled();
    if (this.handler != null) {
      this.handler.removeHandlerListener(getHandlerListener());
    }
    this.handler = handler;
    if (this.handler != null) {
      this.handler.addHandlerListener(getHandlerListener());
    }
    string = null;
    if ((DEBUG_HANDLERS) && (
      (DEBUG_HANDLERS_COMMAND_ID == null) || 
      (DEBUG_HANDLERS_COMMAND_ID.equals(id))))
    {
      StringBuffer buffer = new StringBuffer("Command('");
      buffer.append(id);
      buffer.append("') has changed to ");
      if (handler == null)
      {
        buffer.append("no handler");
      }
      else
      {
        buffer.append('\'');
        buffer.append(handler);
        buffer.append("' as its handler");
      }
      Tracing.printTrace("HANDLERS", buffer.toString());
    }
    fireCommandChanged(new CommandEvent(this, false, false, false, true, 
      false, false, false, false, enabled ^ isEnabled()));
    
    return true;
  }
  
  private IHandlerListener getHandlerListener()
  {
    if (handlerListener == null) {
      handlerListener = new IHandlerListener()
      {
        public void handlerChanged(HandlerEvent handlerEvent)
        {
          boolean enabledChanged = handlerEvent.isEnabledChanged();
          boolean handledChanged = handlerEvent.isHandledChanged();
          Command.this.fireCommandChanged(new CommandEvent(Command.this, false, 
            false, false, handledChanged, false, false, false, 
            false, enabledChanged));
        }
      };
    }
    return handlerListener;
  }
  
  public final String toString()
  {
    if (string == null)
    {
      StringWriter sw = new StringWriter();
      BufferedWriter buffer = new BufferedWriter(sw);
      try
      {
        buffer.write("Command(");
        buffer.write(id);
        buffer.write(44);
        buffer.write(name == null ? "" : name);
        buffer.write(44);
        buffer.newLine();
        buffer.write("\t\t");
        buffer.write(description == null ? "" : description);
        buffer.write(44);
        buffer.newLine();
        buffer.write("\t\t");
        buffer.write(category == null ? "" : category.toString());
        buffer.write(44);
        buffer.newLine();
        buffer.write("\t\t");
        buffer.write(handler == null ? "" : handler.toString());
        buffer.write(44);
        buffer.newLine();
        buffer.write("\t\t");
        buffer.write(parameters == null ? "" : parameters.toString());
        buffer.write(44);
        buffer.write(returnType == null ? "" : returnType.toString());
        buffer.write(44);
        buffer.write(defined);
        buffer.write(41);
        buffer.flush();
      }
      catch (IOException localIOException) {}
      string = sw.toString();
    }
    return string;
  }
  
  public final void undefine()
  {
    boolean enabledChanged = isEnabled();
    
    string = null;
    
    boolean definedChanged = defined;
    defined = false;
    
    boolean nameChanged = name != null;
    name = null;
    
    boolean descriptionChanged = description != null;
    description = null;
    
    boolean categoryChanged = category != null;
    category = null;
    
    boolean parametersChanged = parameters != null;
    parameters = null;
    
    boolean returnTypeChanged = returnType != null;
    returnType = null;
    
    String[] stateIds = getStateIds();
    if (stateIds != null) {
      if ((handler instanceof IObjectWithState))
      {
        IObjectWithState handlerWithState = (IObjectWithState)handler;
        for (int i = 0; i < stateIds.length; i++)
        {
          String stateId = stateIds[i];
          handlerWithState.removeState(stateId);
          
          State state = getState(stateId);
          removeState(stateId);
          state.dispose();
        }
      }
      else
      {
        for (int i = 0; i < stateIds.length; i++)
        {
          String stateId = stateIds[i];
          State state = getState(stateId);
          removeState(stateId);
          state.dispose();
        }
      }
    }
    fireCommandChanged(new CommandEvent(this, categoryChanged, 
      definedChanged, descriptionChanged, false, nameChanged, 
      parametersChanged, returnTypeChanged, false, enabledChanged));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.Command
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import org.eclipse.core.commands.common.AbstractBitSetEvent;
import org.eclipse.core.commands.common.AbstractNamedHandleEvent;

public final class CommandEvent
  extends AbstractNamedHandleEvent
{
  private static final int CHANGED_CATEGORY = 4;
  private static final int CHANGED_HANDLED = 8;
  private static final int CHANGED_PARAMETERS = 16;
  private static final int CHANGED_RETURN_TYPE = 32;
  private static final int CHANGED_HELP_CONTEXT_ID = 64;
  private static final int CHANGED_ENABLED = 128;
  private final Command command;
  
  public CommandEvent(Command command, boolean categoryChanged, boolean definedChanged, boolean descriptionChanged, boolean handledChanged, boolean nameChanged, boolean parametersChanged)
  {
    this(command, categoryChanged, definedChanged, descriptionChanged, handledChanged, nameChanged, parametersChanged, false);
  }
  
  public CommandEvent(Command command, boolean categoryChanged, boolean definedChanged, boolean descriptionChanged, boolean handledChanged, boolean nameChanged, boolean parametersChanged, boolean returnTypeChanged)
  {
    this(command, categoryChanged, definedChanged, descriptionChanged, handledChanged, nameChanged, parametersChanged, returnTypeChanged, false);
  }
  
  public CommandEvent(Command command, boolean categoryChanged, boolean definedChanged, boolean descriptionChanged, boolean handledChanged, boolean nameChanged, boolean parametersChanged, boolean returnTypeChanged, boolean helpContextIdChanged)
  {
    this(command, categoryChanged, definedChanged, descriptionChanged, handledChanged, nameChanged, parametersChanged, returnTypeChanged, helpContextIdChanged, false);
  }
  
  public CommandEvent(Command command, boolean categoryChanged, boolean definedChanged, boolean descriptionChanged, boolean handledChanged, boolean nameChanged, boolean parametersChanged, boolean returnTypeChanged, boolean helpContextIdChanged, boolean enabledChanged)
  {
    super(definedChanged, descriptionChanged, nameChanged);
    if (command == null) {
      throw new NullPointerException();
    }
    this.command = command;
    if (categoryChanged) {
      changedValues |= 0x4;
    }
    if (handledChanged) {
      changedValues |= 0x8;
    }
    if (parametersChanged) {
      changedValues |= 0x10;
    }
    if (returnTypeChanged) {
      changedValues |= 0x20;
    }
    if (helpContextIdChanged) {
      changedValues |= 0x40;
    }
    if (enabledChanged) {
      changedValues |= 0x80;
    }
  }
  
  public final Command getCommand()
  {
    return command;
  }
  
  public final boolean isCategoryChanged()
  {
    return (changedValues & 0x4) != 0;
  }
  
  public final boolean isHandledChanged()
  {
    return (changedValues & 0x8) != 0;
  }
  
  public final boolean isHelpContextIdChanged()
  {
    return (changedValues & 0x40) != 0;
  }
  
  public final boolean isParametersChanged()
  {
    return (changedValues & 0x10) != 0;
  }
  
  public final boolean isReturnTypeChanged()
  {
    return (changedValues & 0x20) != 0;
  }
  
  public final boolean isEnabledChanged()
  {
    return (changedValues & 0x80) != 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.CommandEvent
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.ListenerList;

final class CommandManager$ExecutionListener
  implements IExecutionListenerWithChecks
{
  final CommandManager this$0;
  
  private CommandManager$ExecutionListener(CommandManager paramCommandManager)
  {
    this$0 = paramCommandManager;
  }
  
  CommandManager$ExecutionListener(CommandManager paramCommandManager, ExecutionListener paramExecutionListener)
  {
    this(paramCommandManager);
  }
  
  public void notDefined(String commandId, NotDefinedException exception)
  {
    if (CommandManager.access$0(this$0) != null)
    {
      Object[] listeners = CommandManager.access$0(this$0).getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListenerWithChecks))
        {
          IExecutionListenerWithChecks listener = (IExecutionListenerWithChecks)object;
          listener.notDefined(commandId, exception);
        }
      }
    }
  }
  
  public void notEnabled(String commandId, NotEnabledException exception)
  {
    if (CommandManager.access$0(this$0) != null)
    {
      Object[] listeners = CommandManager.access$0(this$0).getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListenerWithChecks))
        {
          IExecutionListenerWithChecks listener = (IExecutionListenerWithChecks)object;
          listener.notEnabled(commandId, exception);
        }
      }
    }
  }
  
  public final void notHandled(String commandId, NotHandledException exception)
  {
    if (CommandManager.access$0(this$0) != null)
    {
      Object[] listeners = CommandManager.access$0(this$0).getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListener))
        {
          IExecutionListener listener = (IExecutionListener)object;
          listener.notHandled(commandId, exception);
        }
      }
    }
  }
  
  public final void postExecuteFailure(String commandId, ExecutionException exception)
  {
    if (CommandManager.access$0(this$0) != null)
    {
      Object[] listeners = CommandManager.access$0(this$0).getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListener))
        {
          IExecutionListener listener = (IExecutionListener)object;
          listener.postExecuteFailure(commandId, exception);
        }
      }
    }
  }
  
  public final void postExecuteSuccess(String commandId, Object returnValue)
  {
    if (CommandManager.access$0(this$0) != null)
    {
      Object[] listeners = CommandManager.access$0(this$0).getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListener))
        {
          IExecutionListener listener = (IExecutionListener)object;
          listener.postExecuteSuccess(commandId, returnValue);
        }
      }
    }
  }
  
  public final void preExecute(String commandId, ExecutionEvent event)
  {
    if (CommandManager.access$0(this$0) != null)
    {
      Object[] listeners = CommandManager.access$0(this$0).getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object object = listeners[i];
        if ((object instanceof IExecutionListener))
        {
          IExecutionListener listener = (IExecutionListener)object;
          listener.preExecute(commandId, event);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.commands.CommandManager.ExecutionListener
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.commands;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import org.eclipse.core.commands.common.AbstractHandleObjectEvent;
import org.eclipse.core.commands.common.EventManager;
import org.eclipse.core.commands.common.HandleObject;
import org.eclipse.core.commands.common.HandleObjectManager;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.ListenerList;

public final class CommandManager
  extends HandleObjectManager
  implements ICategoryListener, ICommandListener, IParameterTypeListener
{
  public static final String AUTOGENERATED_CATEGORY_ID = "org.eclipse.core.commands.categories.autogenerated";
  static final char ESCAPE_CHAR = '%';
  static final char ID_VALUE_CHAR = '=';
  static final char PARAMETER_END_CHAR = ')';
  static final char PARAMETER_SEPARATOR_CHAR = ',';
  static final char PARAMETER_START_CHAR = '(';
  
  private final class ExecutionListener
    implements IExecutionListenerWithChecks
  {
    ExecutionListener(ExecutionListener paramExecutionListener)
    {
      this();
    }
    
    public void notDefined(String commandId, NotDefinedException exception)
    {
      if (executionListeners != null)
      {
        Object[] listeners = executionListeners.getListeners();
        for (int i = 0; i < listeners.length; i++)
        {
          Object object = listeners[i];
          if ((object instanceof IExecutionListenerWithChecks))
          {
            IExecutionListenerWithChecks listener = (IExecutionListenerWithChecks)object;
            listener.notDefined(commandId, exception);
          }
        }
      }
    }
    
    public void notEnabled(String commandId, NotEnabledException exception)
    {
      if (executionListeners != null)
      {
        Object[] listeners = executionListeners.getListeners();
        for (int i = 0; i < listeners.length; i++)
        {
          Object object = listeners[i];
          if ((object instanceof IExecutionListenerWithChecks))
          {
            IExecutionListenerWithChecks listener = (IExecutionListenerWithChecks)object;
            listener.notEnabled(commandId, exception);
          }
        }
      }
    }
    
    public final void notHandled(String commandId, NotHandledException exception)
    {
      if (executionListeners != null)
      {
        Object[] listeners = executionListeners.getListeners();
        for (int i = 0; i < listeners.length; i++)
        {
          Object object = listeners[i];
          if ((object instanceof IExecutionListener))
          {
            IExecutionListener listener = (IExecutionListener)object;
            listener.notHandled(commandId, exception);
          }
        }
      }
    }
    
    public final void postExecuteFailure(String commandId, ExecutionException exception)
    {
      if (executionListeners != null)
      {
        Object[] listeners = executionListeners.getListeners();
        for (int i = 0; i < listeners.length; i++)
        {
          Object object = listeners[i];
          if ((object instanceof IExecutionListener))
          {
            IExecutionListener listener = (IExecutionListener)object;
            listener.postExecuteFailure(commandId, exception);
          }
        }
      }
    }
    
    public final void postExecuteSuccess(String commandId, Object returnValue)
    {
      if (executionListeners != null)
      {
        Object[] listeners = executionListeners.getListeners();
        for (int i = 0; i < listeners.length; i++)
        {
          Object object = listeners[i];
          if ((object instanceof IExecutionListener))
          {
            IExecutionListener listener = (IExecutionListener)object;
            listener.postExecuteSuccess(commandId, returnValue);
          }
        }
      }
    }
    
    public final void preExecute(String commandId, ExecutionEvent event)
    {
      if (executionListeners != null)
      {
        Object[] listeners = executionListeners.getListeners();
        for (int i = 0; i < listeners.length; i++)
        {
          Object object = listeners[i];
          if ((object instanceof IExecutionListener))
          {
            IExecutionListener listener = (IExecutionListener)object;
            listener.preExecute(commandId, event);
          }
        }
      }
    
1 2 3 4 5

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