public final boolean equals(final Object object) {
    if (object instanceof SelectionEnabler) {
      final SelectionEnabler that = (SelectionEnabler) object;
      return Util.equals(this.classes, that.classes)
          && Util.equals(this.enablementExpression, that.enablementExpression)
          && Util.equals(this.mode, that.mode);
    }

    return false;
  }
Esempio n. 2
0
 /**
  * Tests the receiver and the object for equality
  *
  * @param object object to compare the receiver to
  * @return true=the object equals the receiver, the name is the same. false otherwise
  */
 public boolean equals(Object object) {
   if (this == object) {
     return true;
   }
   if (object instanceof WorkingSet) {
     WorkingSet workingSet = (WorkingSet) object;
     return Util.equals(workingSet.getName(), getName())
         && Util.equals(workingSet.getElementsArray(), getElementsArray())
         && Util.equals(workingSet.getId(), getId());
   }
   return false;
 }
  protected void setImageDescriptor(ImageDescriptor descriptor) {
    if (Util.equals(imageDescriptor, descriptor)) {
      return;
    }

    Image oldImage = image;
    ImageDescriptor oldDescriptor = imageDescriptor;
    image = null;
    imageDescriptor = descriptor;

    // Don't queue events triggered by image changes. We'll dispose the image
    // immediately after firing the event, so we need to fire it right away.
    immediateFirePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
    if (queueEvents) {
      // If there's a PROP_TITLE event queued, remove it from the queue because
      // we've just fired it.
      queuedEvents.clear(IWorkbenchPartConstants.PROP_TITLE);
    }

    // If we had allocated the old image, deallocate it now (AFTER we fire the property change
    // -- listeners may need to clean up references to the old image)
    if (oldImage != null) {
      JFaceResources.getResources().destroy(oldDescriptor);
    }
  }
  protected void setContentDescription(String newContentDescription) {
    if (Util.equals(contentDescription, newContentDescription)) {
      return;
    }

    contentDescription = newContentDescription;
    firePropertyChange(IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION);
  }
  protected void setPartName(String newPartName) {
    if (Util.equals(partName, newPartName)) {
      return;
    }

    partName = newPartName;
    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
  }
  protected void setTitle(String newTitle) {
    if (Util.equals(title, newTitle)) {
      return;
    }

    title = newTitle;
    firePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
  }
  protected void setToolTip(String newToolTip) {
    if (Util.equals(tooltip, newToolTip)) {
      return;
    }

    tooltip = newToolTip;
    firePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
  }
 /**
  * Sets or clears the title tool tip text of this part. Clients should call this method instead of
  * overriding <code>getTitleToolTip</code>
  *
  * @param toolTip the new tool tip text, or <code>null</code> to clear
  */
 protected void setTitleToolTip(String toolTip) {
   toolTip = Util.safeString(toolTip);
   // Do not send changes if they are the same
   if (Util.equals(this.toolTip, toolTip)) {
     return;
   }
   this.toolTip = toolTip;
   firePropertyChange(IWorkbenchPart.PROP_TITLE);
 }
  /**
   * Sets or clears the title of this part. Clients should call this method instead of overriding
   * getTitle.
   *
   * <p>This may change a title that was previously set using setPartName or setContentDescription.
   *
   * @deprecated new code should use setPartName and setContentDescription
   * @param title the title, or <code>null</code> to clear
   */
  protected void setTitle(String title) {
    title = Util.safeString(title);

    // Do not send changes if they are the same
    if (Util.equals(this.title, title)) {
      return;
    }
    this.title = title;
    firePropertyChange(IWorkbenchPart.PROP_TITLE);
  }
Esempio n. 10
0
  public boolean setDescription(String description) {
    if (!Util.equals(description, this.description)) {
      this.description = description;
      hashCode = HASH_INITIAL;
      string = null;
      return true;
    }

    return false;
  }
Esempio n. 11
0
  boolean setName(String name) {
    if (!Util.equals(name, this.name)) {
      this.name = name;
      hashCode = HASH_INITIAL;
      string = null;
      return true;
    }

    return false;
  }
Esempio n. 12
0
  void internalSetContentDescription(String description) {
    Assert.isNotNull(description);

    // Do not send changes if they are the same
    if (Util.equals(contentDescription, description)) {
      return;
    }
    this.contentDescription = description;

    firePropertyChange(IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION);
  }
Esempio n. 13
0
  @Override
  public boolean equals(Object object) {
    if (!(object instanceof Category)) {
      return false;
    }

    final Category castedObject = (Category) object;
    if (!Util.equals(categoryActivityBindings, castedObject.categoryActivityBindings)) {
      return false;
    }

    if (!Util.equals(defined, castedObject.defined)) {
      return false;
    }

    if (!Util.equals(id, castedObject.id)) {
      return false;
    }

    return Util.equals(name, castedObject.name);
  }
Esempio n. 14
0
  void internalSetPartName(String partName) {
    partName = Util.safeString(partName);

    Assert.isNotNull(partName);

    // Do not send changes if they are the same
    if (Util.equals(this.partName, partName)) {
      return;
    }
    this.partName = partName;

    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
  }
Esempio n. 15
0
  void setDefaultTitle() {
    String description = getContentDescription();
    String name = getPartName();
    String newTitle = name;

    if (!Util.equals(description, "")) { // $NON-NLS-1$
      newTitle =
          MessageFormat.format(
              WorkbenchMessages.get().WorkbenchPart_AutoTitleFormat,
              new String[] {name, description});
    }

    setTitle(newTitle);
  }
Esempio n. 16
0
  boolean setCategoryActivityBindings(Set categoryActivityBindings) {
    categoryActivityBindings =
        Util.safeCopy(categoryActivityBindings, ICategoryActivityBinding.class);

    if (!Util.equals(categoryActivityBindings, this.categoryActivityBindings)) {
      this.categoryActivityBindings = categoryActivityBindings;
      this.categoryActivityBindingsAsArray =
          (ICategoryActivityBinding[])
              this.categoryActivityBindings.toArray(
                  new ICategoryActivityBinding[this.categoryActivityBindings.size()]);
      hashCode = HASH_INITIAL;
      string = null;
      return true;
    }

    return false;
  }
Esempio n. 17
0
  public void addMap(IPropertyMap toAdd) {
    Set keySet = toAdd.keySet();

    // Update any existing attributes
    for (Iterator iter = keySet().iterator(); iter.hasNext(); ) {
      String key = (String) iter.next();

      PropertyInfo localInfo = (PropertyInfo) values.get(key);
      // Shouldn't be null, but just in case...
      if (localInfo != null) {
        // If the attribute exists in the new map
        if (toAdd.propertyExists(key)) {
          // Determine if the value is common
          Object value = toAdd.getValue(key, Object.class);

          if (!Util.equals(value, toAdd.getValue(key, Object.class))) {
            // Set the value to null if not common
            localInfo.value = null;
          }

          // The attribute must be common in both the receiver and the new map to be common
          // everywhere
          localInfo.commonAttribute = localInfo.commonAttribute && toAdd.isCommonProperty(key);
        } else {
          // If the attribute doesn't exist in the new map, it cannot be common
          localInfo.commonAttribute = false;
        }
      }
    }

    // Add any new attributes that exist in the target
    for (Iterator iter = keySet.iterator(); iter.hasNext(); ) {
      String element = (String) iter.next();

      PropertyInfo localInfo = (PropertyInfo) values.get(element);
      if (localInfo == null) {
        Object value = toAdd.getValue(element, Object.class);

        boolean isCommon = toAdd.isCommonProperty(element);

        localInfo = new PropertyInfo(value, isCommon);
        values.put(element, localInfo);
      }
    }
  }
  public final void actionSetsChanged(final ActionSetsEvent event) {
    final IActionSetDescriptor[] newActionSets = event.getNewActionSets();
    if (!Util.equals(newActionSets, activeActionSets)) {
      //			if (DEBUG) {
      //				final StringBuffer message = new StringBuffer();
      //				message.append("Action sets changed to ["); //$NON-NLS-1$
      //				if (newActionSets != null) {
      //					for (int i = 0; i < newActionSets.length; i++) {
      //						message.append(newActionSets[i].getLabel());
      //						if (i < newActionSets.length - 1) {
      //							message.append(", "); //$NON-NLS-1$
      //						}
      //					}
      //				}
      //				message.append(']');
      //				logDebuggingInfo(message.toString());
      //			}

      activeActionSets = newActionSets;
      fireSourceChanged(
          ISources.ACTIVE_ACTION_SETS, ISources.ACTIVE_ACTION_SETS_NAME, activeActionSets);
    }
  }
Esempio n. 19
0
 /**
  * Set the title string for this part.
  *
  * @param titleLabel the title string. Must not be <code>null</code>.
  * @since 3.2
  */
 protected void setTitle(String titleLabel) {
   Assert.isNotNull(titleLabel);
   if (Util.equals(this.titleLabel, titleLabel)) return;
   this.titleLabel = titleLabel;
   firePropertyChange(IIntroPart.PROP_TITLE);
 }