org.eclipse.ui.workbench_3.104.0.v20130204-164612

;
      stringBuffer.append(defined);
      stringBuffer.append(',');
      stringBuffer.append(id);
      stringBuffer.append(',');
      stringBuffer.append(name);
      stringBuffer.append(']');
      string = stringBuffer.toString();
    }
    return string;
  }
  
  public String getDescription()
    throws NotDefinedException
  {
    if (!defined) {
      throw new NotDefinedException();
    }
    return description;
  }
  
  public boolean setDescription(String description)
  {
    if (!Util.equals(description, this.description))
    {
      this.description = description;
      hashCode = HASH_INITIAL;
      string = null;
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.Category
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import org.eclipse.ui.activities.ICategoryActivityBinding;
import org.eclipse.ui.internal.util.Util;

public final class CategoryActivityBinding
  implements ICategoryActivityBinding
{
  private static final int HASH_FACTOR = 89;
  private static final int HASH_INITIAL = CategoryActivityBinding.class
    .getName().hashCode();
  private String activityId;
  private String categoryId;
  private transient int hashCode = HASH_INITIAL;
  private transient String string;
  
  public CategoryActivityBinding(String activityId, String categoryId)
  {
    if ((activityId == null) || (categoryId == null)) {
      throw new NullPointerException();
    }
    this.activityId = activityId;
    this.categoryId = categoryId;
  }
  
  public int compareTo(Object object)
  {
    CategoryActivityBinding castedObject = (CategoryActivityBinding)object;
    int compareTo = Util.compare(activityId, activityId);
    if (compareTo == 0) {
      compareTo = Util.compare(categoryId, categoryId);
    }
    return compareTo;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof CategoryActivityBinding)) {
      return false;
    }
    CategoryActivityBinding castedObject = (CategoryActivityBinding)object;
    if (!Util.equals(activityId, activityId)) {
      return false;
    }
    return Util.equals(categoryId, categoryId);
  }
  
  public String getActivityId()
  {
    return activityId;
  }
  
  public String getCategoryId()
  {
    return categoryId;
  }
  
  public int hashCode()
  {
    if (hashCode == HASH_INITIAL)
    {
      hashCode = (hashCode * 89 + Util.hashCode(activityId));
      hashCode = (hashCode * 89 + Util.hashCode(categoryId));
      if (hashCode == HASH_INITIAL) {
        hashCode += 1;
      }
    }
    return hashCode;
  }
  
  public String toString()
  {
    if (string == null)
    {
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append('[');
      stringBuffer.append(activityId);
      stringBuffer.append(',');
      stringBuffer.append(categoryId);
      stringBuffer.append(']');
      string = stringBuffer.toString();
    }
    return string;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.CategoryActivityBinding
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.ui.internal.util.Util;

public final class CategoryActivityBindingDefinition
{
  private static final int HASH_FACTOR = 89;
  private static final int HASH_INITIAL = CategoryActivityBindingDefinition.class
    .getName().hashCode();
  private String activityId;
  private String categoryId;
  
  static Map categoryActivityBindingDefinitionsByCategoryId(Collection categoryActivityBindingDefinitions)
  {
    if (categoryActivityBindingDefinitions == null) {
      throw new NullPointerException();
    }
    Map map = new HashMap();
    Iterator iterator = categoryActivityBindingDefinitions.iterator();
    while (iterator.hasNext())
    {
      Object object = iterator.next();
      
      Util.assertInstance(object, 
        CategoryActivityBindingDefinition.class);
      CategoryActivityBindingDefinition categoryActivityBindingDefinition = (CategoryActivityBindingDefinition)object;
      String categoryId = categoryActivityBindingDefinition
        .getCategoryId();
      if (categoryId != null)
      {
        Collection categoryActivityBindingDefinitions2 = 
          (Collection)map.get(categoryId);
        if (categoryActivityBindingDefinitions2 == null)
        {
          categoryActivityBindingDefinitions2 = new HashSet();
          map.put(categoryId, categoryActivityBindingDefinitions2);
        }
        categoryActivityBindingDefinitions2.add(categoryActivityBindingDefinition);
      }
    }
    return map;
  }
  
  private transient int hashCode = HASH_INITIAL;
  private String sourceId;
  private transient String string;
  
  public CategoryActivityBindingDefinition(String activityId, String categoryId, String sourceId)
  {
    this.activityId = activityId;
    this.categoryId = categoryId;
    this.sourceId = sourceId;
  }
  
  public int compareTo(Object object)
  {
    CategoryActivityBindingDefinition castedObject = (CategoryActivityBindingDefinition)object;
    int compareTo = Util.compare(activityId, activityId);
    if (compareTo == 0)
    {
      compareTo = Util.compare(categoryId, categoryId);
      if (compareTo == 0) {
        compareTo = Util.compare(sourceId, sourceId);
      }
    }
    return compareTo;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof CategoryActivityBindingDefinition)) {
      return false;
    }
    CategoryActivityBindingDefinition castedObject = (CategoryActivityBindingDefinition)object;
    if (!Util.equals(activityId, activityId)) {
      return false;
    }
    if (!Util.equals(categoryId, categoryId)) {
      return false;
    }
    return Util.equals(sourceId, sourceId);
  }
  
  public String getActivityId()
  {
    return activityId;
  }
  
  public String getCategoryId()
  {
    return categoryId;
  }
  
  public String getSourceId()
  {
    return sourceId;
  }
  
  public int hashCode()
  {
    if (hashCode == HASH_INITIAL)
    {
      hashCode = (hashCode * 89 + Util.hashCode(activityId));
      hashCode = (hashCode * 89 + Util.hashCode(categoryId));
      hashCode = (hashCode * 89 + Util.hashCode(sourceId));
      if (hashCode == HASH_INITIAL) {
        hashCode += 1;
      }
    }
    return hashCode;
  }
  
  public String toString()
  {
    if (string == null)
    {
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append('[');
      stringBuffer.append(activityId);
      stringBuffer.append(',');
      stringBuffer.append(categoryId);
      stringBuffer.append(',');
      stringBuffer.append(sourceId);
      stringBuffer.append(']');
      string = stringBuffer.toString();
    }
    return string;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.CategoryActivityBindingDefinition
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.ui.internal.util.Util;

public final class CategoryDefinition
  implements Comparable
{
  private static final int HASH_FACTOR = 89;
  private static final int HASH_INITIAL = CategoryDefinition.class.getName()
    .hashCode();
  
  static Map categoryDefinitionsById(Collection categoryDefinitions, boolean allowNullIds)
  {
    if (categoryDefinitions == null) {
      throw new NullPointerException();
    }
    Map map = new HashMap();
    Iterator iterator = categoryDefinitions.iterator();
    while (iterator.hasNext())
    {
      Object object = iterator.next();
      Util.assertInstance(object, CategoryDefinition.class);
      CategoryDefinition categoryDefinition = (CategoryDefinition)object;
      String id = categoryDefinition.getId();
      if ((allowNullIds) || (id != null)) {
        map.put(id, categoryDefinition);
      }
    }
    return map;
  }
  
  static Map categoryDefinitionsByName(Collection categoryDefinitions, boolean allowNullNames)
  {
    if (categoryDefinitions == null) {
      throw new NullPointerException();
    }
    Map map = new HashMap();
    Iterator iterator = categoryDefinitions.iterator();
    while (iterator.hasNext())
    {
      Object object = iterator.next();
      Util.assertInstance(object, CategoryDefinition.class);
      CategoryDefinition categoryDefinition = (CategoryDefinition)object;
      String name = categoryDefinition.getName();
      if ((allowNullNames) || (name != null))
      {
        Collection categoryDefinitions2 = (Collection)map.get(name);
        if (categoryDefinitions2 == null)
        {
          categoryDefinitions2 = new HashSet();
          map.put(name, categoryDefinitions2);
        }
        categoryDefinitions2.add(categoryDefinition);
      }
    }
    return map;
  }
  
  private transient int hashCode = HASH_INITIAL;
  private String id;
  private String name;
  private String sourceId;
  private transient String string;
  private String description;
  
  public CategoryDefinition(String id, String name, String sourceId, String description)
  {
    this.id = id;
    this.name = name;
    this.sourceId = sourceId;
    this.description = description;
  }
  
  public int compareTo(Object object)
  {
    CategoryDefinition castedObject = (CategoryDefinition)object;
    int compareTo = Util.compare(id, id);
    if (compareTo == 0)
    {
      compareTo = Util.compare(name, name);
      if (compareTo == 0) {
        compareTo = Util.compare(sourceId, sourceId);
      }
    }
    return compareTo;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof CategoryDefinition)) {
      return false;
    }
    CategoryDefinition castedObject = (CategoryDefinition)object;
    if (!Util.equals(id, id)) {
      return false;
    }
    if (!Util.equals(name, name)) {
      return false;
    }
    return Util.equals(sourceId, sourceId);
  }
  
  public String getId()
  {
    return id;
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getSourceId()
  {
    return sourceId;
  }
  
  public int hashCode()
  {
    if (hashCode == HASH_INITIAL)
    {
      hashCode = (hashCode * 89 + Util.hashCode(id));
      hashCode = (hashCode * 89 + Util.hashCode(name));
      hashCode = (hashCode * 89 + Util.hashCode(sourceId));
      if (hashCode == HASH_INITIAL) {
        hashCode += 1;
      }
    }
    return hashCode;
  }
  
  public String toString()
  {
    if (string == null)
    {
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append('[');
      stringBuffer.append(id);
      stringBuffer.append(',');
      stringBuffer.append(name);
      stringBuffer.append(',');
      stringBuffer.append(sourceId);
      stringBuffer.append(']');
      string = stringBuffer.toString();
    }
    return string;
  }
  
  public String getDescription()
  {
    return description;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.CategoryDefinition
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.io.IOException;
import org.eclipse.core.runtime.IExtensionDelta;
import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.IRegistryChangeListener;

class ExtensionActivityRegistry$1
  implements IRegistryChangeListener
{
  ExtensionActivityRegistry$1(ExtensionActivityRegistry paramExtensionActivityRegistry) {}
  
  public void registryChanged(IRegistryChangeEvent registryChangeEvent)
  {
    IExtensionDelta[] extensionDeltas = registryChangeEvent
      .getExtensionDeltas("org.eclipse.ui", 
      "activities");
    if (extensionDeltas.length != 0) {
      try
      {
        ExtensionActivityRegistry.access$0(this$0);
      }
      catch (IOException localIOException) {}
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.ExtensionActivityRegistry.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionDelta;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.util.ConfigurationElementMemento;
import org.eclipse.ui.statushandlers.StatusManager;

final class ExtensionActivityRegistry
  extends AbstractActivityRegistry
{
  private List activityRequirementBindingDefinitions;
  private List activityDefinitions;
  private List activityPatternBindingDefinitions;
  private List categoryActivityBindingDefinitions;
  private List categoryDefinitions;
  private List defaultEnabledActivities;
  private IExtensionRegistry extensionRegistry;
  
  ExtensionActivityRegistry(IExtensionRegistry extensionRegistry)
  {
    if (extensionRegistry == null) {
      throw new NullPointerException();
    }
    this.extensionRegistry = extensionRegistry;
    
    this.extensionRegistry
      .addRegistryChangeListener(new IRegistryChangeListener()
      {
        public void registryChanged(IRegistryChangeEvent registryChangeEvent)
        {
          IExtensionDelta[] extensionDeltas = registryChangeEvent
            .getExtensionDeltas("org.eclipse.ui", 
            "activities");
          if (extensionDeltas.length != 0) {
            try
            {
              ExtensionActivityRegistry.this.load();
            }
            catch (IOException localIOException) {}
          }
        }
      });
    try
    {
      load();
    }
    catch (IOException localIOException) {}
  }
  
  private String getNamespace(IConfigurationElement configurationElement)
  {
    String namespace = null;
    if (configurationElement != null)
    {
      IExtension extension = configurationElement.getDeclaringExtension();
      if (extension != null) {
        namespace = extension.getNamespace();
      }
    }
    return namespace;
  }
  
  private ActivityDefinition getActivityDefinitionById(String id)
  {
    int size = activityDefinitions.size();
    for (int i = 0; i < size; i++)
    {
      ActivityDefinition activityDef = 
        (ActivityDefinition)activityDefinitions.get(i);
      if (activityDef.getId().equals(id)) {
        return activityDef;
      }
    }
    return null;
  }
  
  private void load()
    throws IOException
  {
    if (activityRequirementBindingDefinitions == null) {
      activityRequirementBindingDefinitions = new ArrayList();
    } else {
      activityRequirementBindingDefinitions.clear();
    }
    if (activityDefinitions == null) {
      activityDefinitions = new ArrayList();
    } else {
      activityDefinitions.clear();
    }
    if (activityPatternBindingDefinitions == null) {
      activityPatternBindingDefinitions = new ArrayList();
    } else {
      activityPatternBindingDefinitions.clear();
    }
    if (categoryActivityBindingDefinitions == null) {
      categoryActivityBindingDefinitions = new ArrayList();
    } else {
      categoryActivityBindingDefinitions.clear();
    }
    if (categoryDefinitions == null) {
      categoryDefinitions = new ArrayList();
    } else {
      categoryDefinitions.clear();
    }
    if (defaultEnabledActivities == null) {
      defaultEnabledActivities = new ArrayList();
    } else {
      defaultEnabledActivities.clear();
    }
    IConfigurationElement[] configurationElements = extensionRegistry
      .getConfigurationElementsFor("org.eclipse.ui.activities");
    for (int i = 0; i < configurationElements.length; i++)
    {
      IConfigurationElement configurationElement = configurationElements[i];
      String name = configurationElement.getName();
      if ("activityRequirementBinding".equals(name)) {
        readActivityRequirementBindingDefinition(configurationElement);
      } else if ("activity".equals(name)) {
        readActivityDefinition(configurationElement);
      } else if ("activityPatternBinding".equals(name)) {
        readActivityPatternBindingDefinition(configurationElement);
      } else if ("categoryActivityBinding".equals(name)) {
        readCategoryActivityBindingDefinition(configurationElement);
      } else if ("category".equals(name)) {
        readCategoryDefinition(configurationElement);
      } else if ("defaultEnablement".equals(name)) {
        readDefaultEnablement(configurationElement);
      }
    }
    for (int i = 0; i < defaultEnabledActivities.size();)
    {
      String id = (String)defaultEnabledActivities.get(i);
      ActivityDefinition activityDef = getActivityDefinitionById(id);
      if ((activityDef != null) && (activityDef.getEnabledWhen() != null))
      {
        defaultEnabledActivities.remove(i);
        
        StatusManager.getManager()
          .handle(
          new Status(
          2, 
          "org.eclipse.ui", 
          "Default enabled activity declarations will be ignored (id: " + id + ")"));
      }
      else
      {
        i++;
      }
    }
    Iterator i = activityRequirementBindingDefinitions.iterator();
    while (i.hasNext())
    {
      ActivityRequirementBindingDefinition bindingDef = 
        (ActivityRequirementBindingDefinition)i.next();
      ActivityDefinition activityDef = getActivityDefinitionById(bindingDef
        .getRequiredActivityId());
      if ((activityDef != null) && (activityDef.getEnabledWhen() != null))
      {
        i.remove();
        
        StatusManager.getManager()
          .handle(
          new Status(
          2, 
          "org.eclipse.ui", 
          "Expression activity cannot have requirements (id: " + activityDef.getId() + ")"));
      }
      else
      {
        activityDef = getActivityDefinitionById(bindingDef.getActivityId());
        if ((activityDef != null) && (activityDef.getEnabledWhen() != null))
        {
          i.remove();
          
          StatusManager.getManager()
            .handle(
            new Status(
            2, 
            "org.eclipse.ui", 
            "Expression activity cannot be required (id: " + activityDef.getId() + ")"));
        }
      }
    }
    boolean activityRegistryChanged = false;
    if (!activityRequirementBindingDefinitions.equals(activityRequirementBindingDefinitions))
    {
      activityRequirementBindingDefinitions = 
        Collections.unmodifiableList(new ArrayList(activityRequirementBindingDefinitions));
      activityRegistryChanged = true;
    }
    if (!activityDefinitions.equals(activityDefinitions))
    {
      activityDefinitions = 
        Collections.unmodifiableList(new ArrayList(activityDefinitions));
      activityRegistryChanged = true;
    }
    if (!activityPatternBindingDefinitions.equals(activityPatternBindingDefinitions))
    {
      activityPatternBindingDefinitions = 
        Collections.unmodifiableList(new ArrayList(activityPatternBindingDefinitions));
      activityRegistryChanged = true;
    }
    if (!categoryActivityBindingDefinitions.equals(categoryActivityBindingDefinitions))
    {
      categoryActivityBindingDefinitions = 
        Collections.unmodifiableList(new ArrayList(categoryActivityBindingDefinitions));
      activityRegistryChanged = true;
    }
    if (!categoryDefinitions.equals(categoryDefinitions))
    {
      categoryDefinitions = 
        Collections.unmodifiableList(new ArrayList(categoryDefinitions));
      activityRegistryChanged = true;
    }
    if (!defaultEnabledActivities.equals(defaultEnabledActivities))
    {
      defaultEnabledActivities = 
        Collections.unmodifiableList(new ArrayList(defaultEnabledActivities));
      activityRegistryChanged = true;
    }
    if (activityRegistryChanged) {
      fireActivityRegistryChanged();
    }
  }
  
  private void readDefaultEnablement(IConfigurationElement configurationElement)
  {
    String enabledActivity = 
      Persistence.readDefaultEnablement(new ConfigurationElementMemento(
      configurationElement));
    if (enabledActivity != null) {
      defaultEnabledActivities.add(enabledActivity);
    }
  }
  
  private void readActivityRequirementBindingDefinition(IConfigurationElement configurationElement)
  {
    ActivityRequirementBindingDefinition activityRequirementBindingDefinition = 
      Persistence.readActivityRequirementBindingDefinition(
      new ConfigurationElementMemento(configurationElement), 
      getNamespace(configurationElement));
    if (activityRequirementBindingDefinition != null) {
      activityRequirementBindingDefinitions.add(activityRequirementBindingDefinition);
    }
  }
  
  private void readActivityDefinition(IConfigurationElement configurationElement)
  {
    ActivityDefinition activityDefinition = 
      Persistence.readActivityDefinition(new ConfigurationElementMemento(
      configurationElement), 
      getNamespace(configurationElement));
    if (activityDefinition != null)
    {
      IConfigurationElement[] enabledWhen = configurationElement
        .getChildren("enabledWhen");
      if (enabledWhen.length == 1)
      {
        IConfigurationElement[] expElement = enabledWhen[0]
          .getChildren();
        if (expElement.length == 1) {
          try
          {
            Expression expression = 
              ExpressionConverter.getDefault().perform(expElement[0]);
            activityDefinition.setEnabledWhen(expression);
          }
          catch (CoreException e)
          {
            StatusManager.getManager().handle(e, WorkbenchPlugin.PI_WORKBENCH);
          }
        }
      }
      activityDefinitions.add(activityDefinition);
    }
  }
  
  private void readActivityPatternBindingDefinition(IConfigurationElement configurationElement)
  {
    ActivityPatternBindingDefinition activityPatternBindingDefinition = 
      Persistence.readActivityPatternBindingDefinition(
      new ConfigurationElementMemento(configurationElement), 
      getNamespace(configurationElement));
    if (activityPatternBindingDefinition != null) {
      activityPatternBindingDefinitions.add(activityPatternBindingDefinition);
    }
  }
  
  private void readCategoryActivityBindingDefinition(IConfigurationElement configurationElement)
  {
    CategoryActivityBindingDefinition categoryActivityBindingDefinition = 
      Persistence.readCategoryActivityBindingDefinition(
      new ConfigurationElementMemento(configurationElement), 
      getNamespace(configurationElement));
    if (categoryActivityBindingDefinition != null) {
      categoryActivityBindingDefinitions.add(categoryActivityBindingDefinition);
    }
  }
  
  private void readCategoryDefinition(IConfigurationElement configurationElement)
  {
    CategoryDefinition categoryDefinition = 
      Persistence.readCategoryDefinition(new ConfigurationElementMemento(
      configurationElement), 
      getNamespace(configurationElement));
    if (categoryDefinition != null) {
      categoryDefinitions.add(categoryDefinition);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.ExtensionActivityRegistry
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.List;

public abstract interface IActivityRegistry
{
  public abstract void addActivityRegistryListener(IActivityRegistryListener paramIActivityRegistryListener);
  
  public abstract List getActivityRequirementBindingDefinitions();
  
  public abstract List getActivityDefinitions();
  
  public abstract List getActivityPatternBindingDefinitions();
  
  public abstract List getCategoryActivityBindingDefinitions();
  
  public abstract List getCategoryDefinitions();
  
  public abstract List getDefaultEnabledActivities();
  
  public abstract void removeActivityRegistryListener(IActivityRegistryListener paramIActivityRegistryListener);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.IActivityRegistry
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

public abstract interface IActivityRegistryListener
{
  public abstract void activityRegistryChanged(ActivityRegistryEvent paramActivityRegistryEvent);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.IActivityRegistryListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.ui.activities.IIdentifier;
import org.eclipse.ui.activities.IIdentifierListener;
import org.eclipse.ui.activities.IdentifierEvent;
import org.eclipse.ui.internal.util.Util;

final class Identifier
  implements IIdentifier
{
  private static final int HASH_FACTOR = 89;
  private static final int HASH_INITIAL = Identifier.class.getName()
    .hashCode();
  private static final Set<Identifier> strongReferences = new HashSet();
  private Set<String> activityIds = Collections.emptySet();
  private transient String[] activityIdsAsArray = new String[0];
  private boolean enabled;
  private transient int hashCode = HASH_INITIAL;
  private String id;
  private ListenerList identifierListeners;
  private transient String string;
  
  Identifier(String id)
  {
    if (id == null) {
      throw new NullPointerException();
    }
    this.id = id;
  }
  
  public void addIdentifierListener(IIdentifierListener identifierListener)
  {
    if (identifierListener == null) {
      throw new NullPointerException();
    }
    if (identifierListeners == null) {
      identifierListeners = new ListenerList();
    }
    identifierListeners.add(identifierListener);
    strongReferences.add(this);
  }
  
  public int compareTo(Object object)
  {
    Identifier castedObject = (Identifier)object;
    int compareTo = Util.compare(activityIdsAsArray, 
      activityIdsAsArray);
    if (compareTo == 0)
    {
      compareTo = Util.compare(enabled, enabled);
      if (compareTo == 0) {
        compareTo = Util.compare(id, id);
      }
    }
    return compareTo;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof Identifier)) {
      return false;
    }
    Identifier castedObject = (Identifier)object;
    if (!Util.equals(activityIds, activityIds)) {
      return false;
    }
    if (!Util.equals(enabled, enabled)) {
      return false;
    }
    return Util.equals(id, id);
  }
  
  void fireIdentifierChanged(IdentifierEvent identifierEvent)
  {
    if (identifierEvent == null) {
      throw new NullPointerException();
    }
    if (identifierListeners != null)
    {
      Object[] listeners = identifierListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        Object listener = listeners[i];
        ((IIdentifierListener)listener).identifierChanged(identifierEvent);
      }
    }
  }
  
  public Set<String> getActivityIds()
  {
    return activityIds;
  }
  
  public String getId()
  {
    return id;
  }
  
  public int hashCode()
  {
    if (hashCode == HASH_INITIAL)
    {
      hashCode = (hashCode * 89 + Util.hashCode(activityIds));
      hashCode = (hashCode * 89 + Util.hashCode(enabled));
      hashCode = (hashCode * 89 + Util.hashCode(id));
      if (hashCode == HASH_INITIAL) {
        hashCode += 1;
      }
    }
    return hashCode;
  }
  
  public boolean isEnabled()
  {
    return enabled;
  }
  
  public void removeIdentifierListener(IIdentifierListener identifierListener)
  {
    if (identifierListener == null) {
      throw new NullPointerException();
    }
    if (identifierListeners != null)
    {
      identifierListeners.remove(identifierListener);
      if (identifierListeners.isEmpty()) {
        strongReferences.remove(this);
      }
    }
  }
  
  boolean setActivityIds(Set<String> activityIds)
  {
    activityIds = Util.safeCopy(activityIds, String.class);
    if (!Util.equals(activityIds, this.activityIds))
    {
      this.activityIds = activityIds;
      activityIdsAsArray = ((String[])this.activityIds.toArray(new String[this.activityIds.size()]));
      hashCode = HASH_INITIAL;
      string = null;
      return true;
    }
    return false;
  }
  
  boolean setEnabled(boolean enabled)
  {
    if (enabled != this.enabled)
    {
      this.enabled = enabled;
      hashCode = HASH_INITIAL;
      string = null;
      return true;
    }
    return false;
  }
  
  public String toString()
  {
    if (string == null)
    {
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append('[');
      stringBuffer.append(activityIds);
      stringBuffer.append(',');
      stringBuffer.append(enabled);
      stringBuffer.append(',');
      stringBuffer.append(id);
      stringBuffer.append(']');
      string = stringBuffer.toString();
    }
    return string;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.Identifier
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.ui.activities.IActivity;
import org.eclipse.ui.activities.IActivityManager;
import org.eclipse.ui.activities.ICategory;
import org.eclipse.ui.activities.ICategoryActivityBinding;

public final class InternalActivityHelper
{
  public static Set getActivityIdsForCategory(IActivityManager activityManager, ICategory category)
  {
    Set bindings = category.getCategoryActivityBindings();
    Set activityIds = new HashSet();
    for (Iterator i = bindings.iterator(); i.hasNext();)
    {
      ICategoryActivityBinding binding = 
        (ICategoryActivityBinding)i.next();
      String id = binding.getActivityId();
      if (activityManager.getActivity(id).getExpression() == null) {
        activityIds.add(id);
      }
    }
    return activityIds;
  }
  
  private static boolean isEnabled(IActivityManager activityManager, String categoryId)
  {
    ICategory category = activityManager.getCategory(categoryId);
    if (category.isDefined())
    {
      Set activityIds = getActivityIdsForCategory(activityManager, 
        category);
      if (activityManager.getEnabledActivityIds().containsAll(activityIds)) {
        return true;
      }
    }
    return false;
  }
  
  public static Set getEnabledCategories(IActivityManager activityManager)
  {
    Set definedCategoryIds = activityManager.getDefinedCategoryIds();
    Set enabledCategories = new HashSet();
    for (Iterator i = definedCategoryIds.iterator(); i.hasNext();)
    {
      String categoryId = (String)i.next();
      if (isEnabled(activityManager, categoryId)) {
        enabledCategories.add(categoryId);
      }
    }
    return enabledCategories;
  }
  
  public static Set getPartiallyEnabledCategories(IActivityManager activityManager)
  {
    Set definedCategoryIds = activityManager.getDefinedCategoryIds();
    Set partialCategories = new HashSet();
    for (Iterator i = definedCategoryIds.iterator(); i.hasNext();)
    {
      String categoryId = (String)i.next();
      if (isPartiallyEnabled(activityManager, categoryId)) {
        partialCategories.add(categoryId);
      }
    }
    return partialCategories;
  }
  
  private static boolean isPartiallyEnabled(IActivityManager activityManager, String categoryId)
  {
    Set activityIds = getActivityIdsForCategory(activityManager, 
      activityManager.getCategory(categoryId));
    int foundCount = 0;
    for (Iterator i = activityIds.iterator(); i.hasNext();)
    {
      String activityId = (String)i.next();
      if (activityManager.getEnabledActivityIds().contains(activityId)) {
        foundCount++;
      }
    }
    return (foundCount > 0) && (foundCount != activityIds.size());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.InternalActivityHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

class MutableActivityManager$1
  implements IActivityRegistryListener
{
  MutableActivityManager$1(MutableActivityManager paramMutableActivityManager) {}
  
  public void activityRegistryChanged(ActivityRegistryEvent activityRegistryEvent)
  {
    MutableActivityManager.access$0(this$0, false);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.MutableActivityManager.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.Map;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.activities.IActivity;

class MutableActivityManager$2
  implements IPropertyChangeListener
{
  MutableActivityManager$2(MutableActivityManager paramMutableActivityManager) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if (MutableActivityManager.access$1(this$0)) {
      return;
    }
    Object nv = event.getNewValue();
    boolean enabledWhen = nv == null ? false : ((Boolean)nv)
      .booleanValue();
    String id = event.getProperty();
    IActivity activity = (IActivity)MutableActivityManager.access$2(this$0).get(id);
    if (activity.isEnabled() != enabledWhen) {
      if (enabledWhen) {
        MutableActivityManager.access$3(this$0, id);
      } else {
        MutableActivityManager.access$4(this$0, id);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.MutableActivityManager.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.progress.UIJob;

class MutableActivityManager$3$1
  extends UIJob
{
  MutableActivityManager$3$1(MutableActivityManager.3 param3, String $anonymous0, Map paramMap)
  {
    super($anonymous0);
  }
  
  public IStatus runInUIThread(IProgressMonitor monitor)
  {
    MutableActivityManager.access$7(MutableActivityManager.3.access$0(this$1), val$identifierEventsByIdentifierId);
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.MutableActivityManager.3.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.activities.IdentifierEvent;
import org.eclipse.ui.progress.UIJob;

class MutableActivityManager$3
  extends Job
{
  MutableActivityManager$3(MutableActivityManager paramMutableActivityManager, String $anonymous0)
  {
    super($anonymous0);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    while (!MutableActivityManager.access$5(this$0).isEmpty())
    {
      Identifier identifier = (Identifier)MutableActivityManager.access$5(this$0).remove(0);
      Set activityIds = new HashSet();
      Iterator iterator = MutableActivityManager.access$6(this$0).iterator();
      while (iterator.hasNext())
      {
        String activityId = (String)iterator.next();
        Activity activity = (Activity)this$0.getActivity(activityId);
        if (activity.isMatch(identifier.getId())) {
          activityIds.add(activityId);
        }
      }
      boolean activityIdsChanged = identifier.setActivityIds(activityIds);
      if (activityIdsChanged)
      {
        IdentifierEvent identifierEvent = new IdentifierEvent(identifier, activityIdsChanged, 
          false);
        final Map identifierEventsByIdentifierId = new HashMap(1);
        identifierEventsByIdentifierId.put(identifier.getId(), 
          identifierEvent);
        UIJob notifyJob = new UIJob("Identifier Update Job")
        {
          public IStatus runInUIThread(IProgressMonitor monitor)
          {
            MutableActivityManager.access$7(this$0, identifierEventsByIdentifierId);
            return Status.OK_STATUS;
          }
        };
        notifyJob.setSystem(true);
        notifyJob.schedule();
      }
    }
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.activities.MutableActivityManager.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.activities;

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.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.ActivityEvent;
import org.eclipse.ui.activities.ActivityManagerEvent;
import org.eclipse.ui.activities.CategoryEvent;
import org.eclipse.ui.activities.IActivity;
import org.eclipse.ui.activities.IActivityPatternBinding;
import org.eclipse.ui.activities.IActivityRequirementBinding;
import org.eclipse.ui.activities.ICategory;
import org.eclipse.ui.activities.ICategoryActivityBinding;
import org.eclipse.ui.activities.IIdentifier;
import org.eclipse.ui.activities.IMutableActivityManager;
import org.eclipse.ui.activities.ITriggerPointAdvisor;
import org.eclipse.ui.activities.IdentifierEvent;
import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.services.IEvaluationReference;
import org.eclipse.ui.services.IEvaluationService;

public final class MutableActivityManager
  extends AbstractActivityManager
  implements IMutableActivityManager, Cloneable
{
  private Map activitiesById = new HashMap();
  private Map activityRequirementBindingsByActivityId = new HashMap();
  private Map activityDefinitionsById = new HashMap();
  private Map activityPatternBindingsByActivityId = new HashMap();
  private IActivityRegistry activityRegistry;
  private Map categoriesById = new HashMap();
  private Map categoryActivityBindingsByCategoryId = new HashMap();
  private Map categoryDefinitionsById = new HashMap();
  private Set definedActivityIds = new HashSet();
  private Set definedCategoryIds = new HashSet();
  private Set enabledActivityIds = new HashSet();
  private Map identifiersById = new HashMap();
  private boolean addingEvaluationListener = false;
  private List deferredIdentifiers = Collections.synchronizedList(new LinkedList());
  private Job deferredIdentifierJob = null;
  private final IActivityRegistryListener activityRegistryListener = new IActivityRegistryListener()
  {
    public void activityRegistryChanged(ActivityRegistryEvent activityRegistryEvent)
    {
      MutableActivi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179

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-2019. Infinite Loop Ltd