Example usage for org.eclipse.jface.util Util equals

List of usage examples for org.eclipse.jface.util Util equals

Introduction

In this page you can find the example usage for org.eclipse.jface.util Util equals.

Prototype

@Deprecated
public static boolean equals(final Object[] leftArray, final Object[] rightArray) 

Source Link

Document

Tests whether two arrays of objects are equal to each other.

Usage

From source file:com.rcpcompany.uibindings.internal.observables.RadioGroupValueObservableValue.java

License:Open Source License

/**
 * Selection changed.../*from   ww  w.  j  a  v  a2s.c  o  m*/
 */
protected void handleSelectionChanged() {
    final Object newValue = doGetValue();
    if (Util.equals(myCurrentValue, newValue))
        return;
    fireValueChange(Diffs.createValueDiff(myCurrentValue, myCurrentValue = newValue));
}

From source file:com.rcpcompany.uibindings.internal.observables.TextObservableValue.java

License:Open Source License

/**
 * Updates the value of this observable.
 * //from   w  w w  . ja v a 2  s  .co m
 * @param isModify the value is updated because of a modify event
 * @param force the update is immediately - i.e. it is not delayed
 */
protected void updateValue(boolean isModify, boolean force) {
    final String newValue = myAdapter.getText(myControl);

    cancelScheduledUpdate(); // if any

    if (isModify && myStrategy != TextCommitStrategy.ON_MODIFY && !force) {
        fireDelayedChange();

        if (!isStale) {
            isStale = true;
            fireStale();
        }

        scheduleUpdate();
        return;
    }

    if (!Util.equals(myOldValue, newValue)) {
        isStale = false;
        fireValueChange(Diffs.createValueDiff(myOldValue, myOldValue = newValue));
    }
}

From source file:com.rcpcompany.uibindings.internal.observables.TextObservableValue.java

License:Open Source License

@Override
protected void doSetValue(Object value) {
    updating = true;/* w w w  .  ja v a 2s  .c o m*/
    try {
        // Principle of least surprise: setValue overrides any pending
        // update from observable.
        isStale = false;
        cancelScheduledUpdate();

        if (value == null) {
            value = "";
        }
        myAdapter.setText(myControl, value.toString());

        if (!Util.equals(myOldValue, value)) {
            fireValueChange(Diffs.createValueDiff(myOldValue, value));
            myOldValue = value.toString();
        }
    } finally {
        updating = false;
    }
}

From source file:com.runwaysdk.manager.model.databinding.IDateObservableValue.java

License:Open Source License

protected void notifyIfChanged(Object oldValue, Object newValue) {
    if (!Util.equals(oldValue, newValue)) {
        fireValueChange(Diffs.createValueDiff(oldValue, newValue));
    }//from w  w  w  .j a  v a 2  s .com
}

From source file:org.eclipse.e4.demio.views.nav.ResourceNavigator.java

License:Open Source License

/**
 * Set the internal working set fields specific to the navigator.
 * //from w  w  w.  j  ava  2s  . co  m
 * @param workingSet
 *            the new working set
 * @since 3.2
 */
private boolean internalSetWorkingSet(IWorkingSet workingSet) {
    boolean refreshNeeded = !Util.equals(this.workingSet, workingSet);
    this.workingSet = workingSet;
    emptyWorkingSet = workingSet != null && workingSet.isAggregateWorkingSet() && workingSet.isEmpty();
    return refreshNeeded;
}

From source file:org.eclipse.e4.xwt.databinding.XWTObservableValue.java

License:Open Source License

protected void doSetValue(Object value) {
    updating = true;/*from  ww  w. j  a  v  a 2  s.com*/
    Object oldValue = doGetValue();
    value = convert(oldValue == null ? null : oldValue.getClass(), value);
    if (!Util.equals(oldValue, value)) {
        doSetApprovedValue(value);
        fireValueChange(Diffs.createValueDiff(oldValue, value));
        eventManager.dispatchEvent(new Event(observed, oldValue, value, getPath()));
    }
    updating = false;
}

From source file:org.eclipse.etrice.ui.layout.preferences.ETriceDomainModelElement.java

License:Open Source License

/**
 * Traverses the n-ary tree recursively from the invoking node and try to
 * find the given id.// ww  w.  jav a2  s.  c om
 * 
 * @param findId
 *            The id to be found
 * @return true, if id matches with any node of the tree (with root as the
 *         invoking node), otherwise false
 */
public boolean traverseModel(final String findId) {

    if (Util.equals(this.id, findId)) {
        return true;
    } else {
        TreeNode[] children = getChildren();
        if (children != null) {
            for (TreeNode child : children) {
                if (((ETriceDomainModelElement) child).traverseModel(findId))
                    return true;
            }
        }

        return false;
    }
}

From source file:org.eclipse.etrice.ui.layout.preferences.ETriceDomainModelElement.java

License:Open Source License

/**
 * {@inheritDoc}//w ww. j  a  va  2 s. co  m
 * 
 * @author jayant
 */
@Override
public boolean equals(final Object object) {
    if (object instanceof ETriceDomainModelElement) {
        return Util.equals(this.id, ((ETriceDomainModelElement) object).id);
    }

    return false;
}

From source file:org.eclipse.ui.internal.handlers.CommandLegacyActionWrapper.java

License:Open Source License

public final void setActionDefinitionId(final String id) {
    // Get the old values.
    final boolean oldChecked = isChecked();
    final String oldDescription = getDescription();
    final boolean oldEnabled = isEnabled();
    final boolean oldHandled = isHandled();
    final ImageDescriptor oldDefaultImage = getImageDescriptor();
    final ImageDescriptor oldDisabledImage = getDisabledImageDescriptor();
    final ImageDescriptor oldHoverImage = getHoverImageDescriptor();
    final String oldText = getText();

    // Update the command.
    final Command oldBaseCommand = command.getCommand();
    oldBaseCommand.removeCommandListener(commandListener);
    final ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class);
    final Command newBaseCommand = commandService.getCommand(id);
    command = new ParameterizedCommand(newBaseCommand, null);
    newBaseCommand.addCommandListener(commandListener);

    // Get the new values.
    final boolean newChecked = isChecked();
    final String newDescription = getDescription();
    final boolean newEnabled = isEnabled();
    final boolean newHandled = isHandled();
    final ImageDescriptor newDefaultImage = getImageDescriptor();
    final ImageDescriptor newDisabledImage = getDisabledImageDescriptor();
    final ImageDescriptor newHoverImage = getHoverImageDescriptor();
    final String newText = getText();

    // Fire property change events, as necessary.
    if (newChecked != oldChecked) {
        if (oldChecked) {
            firePropertyChange(IAction.CHECKED, Boolean.TRUE, Boolean.FALSE);
        } else {//  w  w  w  .j  av  a 2  s .  c  om
            firePropertyChange(IAction.CHECKED, Boolean.FALSE, Boolean.TRUE);
        }
    }

    if (!Util.equals(oldDescription, newDescription)) {
        firePropertyChange(IAction.DESCRIPTION, oldDescription, newDescription);
        firePropertyChange(IAction.TOOL_TIP_TEXT, oldDescription, newDescription);
    }

    if (newEnabled != oldEnabled) {
        if (oldEnabled) {
            firePropertyChange(IAction.ENABLED, Boolean.TRUE, Boolean.FALSE);
        } else {
            firePropertyChange(IAction.ENABLED, Boolean.FALSE, Boolean.TRUE);
        }
    }

    if (newHandled != oldHandled) {
        if (oldHandled) {
            firePropertyChange(IAction.HANDLED, Boolean.TRUE, Boolean.FALSE);
        } else {
            firePropertyChange(IAction.HANDLED, Boolean.FALSE, Boolean.TRUE);
        }
    }

    if (!Util.equals(oldDefaultImage, newDefaultImage)) {
        firePropertyChange(IAction.IMAGE, oldDefaultImage, newDefaultImage);
    }

    if (!Util.equals(oldDisabledImage, newDisabledImage)) {
        firePropertyChange(IAction.IMAGE, oldDisabledImage, newDisabledImage);
    }

    if (!Util.equals(oldHoverImage, newHoverImage)) {
        firePropertyChange(IAction.IMAGE, oldHoverImage, newHoverImage);
    }

    if (!Util.equals(oldText, newText)) {
        firePropertyChange(IAction.TEXT, oldText, newText);
    }
}

From source file:org.eclipse.ui.internal.handlers.CommandLegacyActionWrapper.java

License:Open Source License

public final void setDescription(final String text) {
    final State state = command.getCommand().getState(INamedHandleStateIds.DESCRIPTION);
    if (state instanceof TextState) {
        final String currentValue = (String) state.getValue();
        if (!Util.equals(text, currentValue)) {
            state.setValue(text);//from   w  w w  . j  av a2 s. c  om
        }
    }
}