org.eclipse.ui.commands.CommandManagerEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of workbench Show documentation
Show all versions of workbench Show documentation
This plug-in contains the bulk of the Workbench implementation, and depends on JFace, SWT, and Core Runtime. It cannot be used independently from org.eclipse.ui. Workbench client plug-ins should not depend directly on this plug-in.
The newest version!
/*******************************************************************************
* Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.commands;
import java.util.Set;
import org.eclipse.ui.internal.util.Util;
/**
* An instance of this class describes changes to an instance of
* ICommandManager
.
*
* This class is not intended to be extended by clients.
*
*
* @since 3.0
* @see ICommandManagerListener#commandManagerChanged(CommandManagerEvent)
* @see org.eclipse.core.commands.CommandManagerEvent
* @deprecated Please use the "org.eclipse.core.commands" plug-in instead.
*/
public final class CommandManagerEvent {
/**
* Whether the set of active contexts has changed.
*/
private final boolean activeContextIdsChanged;
/**
* Whether the active key configuration has changed.
*/
private final boolean activeKeyConfigurationIdChanged;
/**
* Whether the locale has changed.
*/
private final boolean activeLocaleChanged;
/**
* Whether the platform has changed.
*/
private final boolean activePlatformChanged;
/**
* Whether the command manager has changed.
*/
private final ICommandManager commandManager;
/**
* Whether the list of defined categories has changed.
*/
private final boolean definedCategoryIdsChanged;
/**
* Whether the list of defined commands has changed.
*/
private final boolean definedCommandIdsChanged;
/**
* Whether the list of defined key configurations has changed.
*/
private final boolean definedKeyConfigurationIdsChanged;
/**
* The set of the defined categories before the change occurred. This is a
* set of strings (category identifiers).
*/
private final Set previouslyDefinedCategoryIds;
/**
* The set of the defined commands before the change occurred. This is a
* set of strings (command identifiers).
*/
private final Set previouslyDefinedCommandIds;
/**
* The set of the defined key configurations before the change occurred.
* This is a set of strings (key configuration identifiers).
*/
private final Set previouslyDefinedKeyConfigurationIds;
/**
* Creates a new instance of this class.
*
* @param commandManager
* the instance of the interface that changed.
* @param activeContextIdsChanged
* true, iff the activeContextIdsChanged property changed.
* @param activeKeyConfigurationIdChanged
* true, iff the activeKeyConfigurationIdChanged property
* changed.
* @param activeLocaleChanged
* true, iff the activeLocaleChanged property changed.
* @param activePlatformChanged
* true, iff the activePlatformChanged property changed.
* @param definedCategoryIdsChanged
* true, iff the definedCategoryIdsChanged property changed.
* @param definedCommandIdsChanged
* true, iff the definedCommandIdsChanged property changed.
* @param definedKeyConfigurationIdsChanged
* true, iff the definedKeyConfigurationIdsChanged property
* changed.
* @param previouslyDefinedCategoryIds
* the set of identifiers to previously defined categories. This
* set may be empty. If this set is not empty, it must only
* contain instances of String
. This set must be
* null
if definedCategoryIdsChanged is
* false
and must not be null if
* definedCategoryIdsChanged is true
.
* @param previouslyDefinedCommandIds
* the set of identifiers to previously defined commands. This
* set may be empty. If this set is not empty, it must only
* contain instances of String
. This set must be
* null
if definedCommandIdsChanged is
* false
and must not be null if
* definedContextIdsChanged is true
.
* @param previouslyDefinedKeyConfigurationIds
* the set of identifiers to previously defined key
* configurations. This set may be empty. If this set is not
* empty, it must only contain instances of String
.
* This set must be null
if
* definedKeyConfigurationIdsChanged is false
and
* must not be null if definedKeyConfigurationIdsChanged is
* true
.
*/
public CommandManagerEvent(ICommandManager commandManager,
boolean activeContextIdsChanged,
boolean activeKeyConfigurationIdChanged,
boolean activeLocaleChanged, boolean activePlatformChanged,
boolean definedCategoryIdsChanged,
boolean definedCommandIdsChanged,
boolean definedKeyConfigurationIdsChanged,
Set previouslyDefinedCategoryIds, Set previouslyDefinedCommandIds,
Set previouslyDefinedKeyConfigurationIds) {
if (commandManager == null) {
throw new NullPointerException();
}
if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) {
throw new IllegalArgumentException();
}
if (!definedCommandIdsChanged && previouslyDefinedCommandIds != null) {
throw new IllegalArgumentException();
}
if (!definedKeyConfigurationIdsChanged
&& previouslyDefinedKeyConfigurationIds != null) {
throw new IllegalArgumentException();
}
if (definedCategoryIdsChanged) {
this.previouslyDefinedCategoryIds = Util.safeCopy(
previouslyDefinedCategoryIds, String.class);
} else {
this.previouslyDefinedCategoryIds = null;
}
if (definedCommandIdsChanged) {
this.previouslyDefinedCommandIds = Util.safeCopy(
previouslyDefinedCommandIds, String.class);
} else {
this.previouslyDefinedCommandIds = null;
}
if (definedKeyConfigurationIdsChanged) {
this.previouslyDefinedKeyConfigurationIds = Util.safeCopy(
previouslyDefinedKeyConfigurationIds, String.class);
} else {
this.previouslyDefinedKeyConfigurationIds = null;
}
this.commandManager = commandManager;
this.activeContextIdsChanged = activeContextIdsChanged;
this.activeKeyConfigurationIdChanged = activeKeyConfigurationIdChanged;
this.activeLocaleChanged = activeLocaleChanged;
this.activePlatformChanged = activePlatformChanged;
this.definedCategoryIdsChanged = definedCategoryIdsChanged;
this.definedCommandIdsChanged = definedCommandIdsChanged;
this.definedKeyConfigurationIdsChanged = definedKeyConfigurationIdsChanged;
}
/**
* Returns the instance of the interface that changed.
*
* @return the instance of the interface that changed. Guaranteed not to be
* null
.
*/
public ICommandManager getCommandManager() {
return commandManager;
}
/**
* Returns the set of identifiers to previously defined categories.
*
* @return the set of identifiers to previously defined categories. This set
* may be empty. If this set is not empty, it is guaranteed to only
* contain instances of String
. This set is
* guaranteed to be null
if
* haveDefinedCategoryIdsChanged() is false
and is
* guaranteed to not be null if haveDefinedCategoryIdsChanged() is
* true
.
*/
public Set getPreviouslyDefinedCategoryIds() {
return previouslyDefinedCategoryIds;
}
/**
* Returns the set of identifiers to previously defined commands.
*
* @return the set of identifiers to previously defined commands. This set
* may be empty. If this set is not empty, it is guaranteed to only
* contain instances of String
. This set is
* guaranteed to be null
if
* haveDefinedCommandIdsChanged() is false
and is
* guaranteed to not be null if haveDefinedCommandIdsChanged() is
* true
.
*/
public Set getPreviouslyDefinedCommandIds() {
return previouslyDefinedCommandIds;
}
/**
* Returns the set of identifiers to previously defined key conigurations.
*
* @return the set of identifiers to previously defined key configurations.
* This set may be empty. If this set is not empty, it is guaranteed
* to only contain instances of String
. This set is
* guaranteed to be null
if
* haveDefinedKeyConfigurationIdsChanged() is false
* and is guaranteed to not be null if
* haveDefinedKeyConfigurationIdsChanged() is true
.
*/
public Set getPreviouslyDefinedKeyConfigurationIds() {
return previouslyDefinedKeyConfigurationIds;
}
/**
* Returns whether or not the activeKeyConfigurationId property changed.
*
* @return true, iff the activeKeyConfigurationId property changed.
*/
public boolean hasActiveKeyConfigurationIdChanged() {
return activeKeyConfigurationIdChanged;
}
/**
* Returns whether or not the activeLocale property changed.
*
* @return true, iff the activeLocale property changed.
*/
public boolean hasActiveLocaleChanged() {
return activeLocaleChanged;
}
/**
* Returns whether or not the activePlatform property changed.
*
* @return true, iff the activePlatform property changed.
*/
public boolean hasActivePlatformChanged() {
return activePlatformChanged;
}
/**
* Returns whether or not the activeContextIds property changed.
*
* @return true, iff the activeContextIds property changed.
*/
public boolean haveActiveContextIdsChanged() {
return activeContextIdsChanged;
}
/**
* Returns whether or not the definedCategoryIds property changed.
*
* @return true, iff the definedCategoryIds property changed.
*/
public boolean haveDefinedCategoryIdsChanged() {
return definedCategoryIdsChanged;
}
/**
* Returns whether or not the definedCommandIds property changed.
*
* @return true, iff the definedCommandIds property changed.
*/
public boolean haveDefinedCommandIdsChanged() {
return definedCommandIdsChanged;
}
/**
* Returns whether or not the definedKeyConfigurationIds property changed.
*
* @return true, iff the definedKeyConfigurationIds property changed.
*/
public boolean haveDefinedKeyConfigurationIdsChanged() {
return definedKeyConfigurationIdsChanged;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy