001: /*******************************************************************************
002: * Copyright (c) 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: ******************************************************************************/package org.eclipse.ui.navigator;
011:
012: /**
013: *
014: * Determines if an extension is <i>active</i> within the context of a given
015: * viewer and manages the persistence of this information. If an extension is
016: * <i>active</i> then the extension will contribute functionality to the
017: * viewer. If an extension is not <i>active</i>, then the extension will not be
018: * given opportunities to contribute functionality to the given viewer. See
019: * {@link INavigatorContentService} for more detail on what states are
020: * associated with a content extension.
021: *
022: * @since 3.2
023: *
024: */
025: public interface INavigatorActivationService {
026:
027: /**
028: * Activate the extensions specified by the extensionIds array. Clients may
029: * also choose to disable all other extensions. The set of descriptors
030: * returned is the set that were activated as a result of this call. In the
031: * case of this method, that means that a descriptor will be returned for
032: * each extensionId in the array, regardless of whether that extension is
033: * already enabled.
034: *
035: * <p>
036: * Clients must call {@link #persistExtensionActivations()} to save the the
037: * activation state after activating or deactivating extensions.
038: * </p>
039: *
040: * @param extensionIds
041: * The list of extensions to activate
042: * @param toDeactivateAllOthers
043: * True will deactivate all other extensions; False will leave
044: * the other activations as-is
045: * @return A list of all INavigatorContentDescriptors that were activated as
046: * a result of this call. This will be the set of
047: * INavigatorContentDescriptors that corresponds exactly to the set
048: * of given extensionIds.
049: */
050: public INavigatorContentDescriptor[] activateExtensions(
051: String[] extensionIds, boolean toDeactivateAllOthers);
052:
053: /**
054: * Deactivate the extensions specified by the extensionIds. Clients may
055: * choose to activate all other extensions which are not explicitly
056: * disabled. If toActivateAllOthers is true, the array of returned
057: * descriptors will be the collection of all extensions not specified in the
058: * extensionIds array. If it is false, the array will be empty.
059: *
060: * <p>
061: * Clients must call {@link #persistExtensionActivations()} to save the the
062: * activation state after activating or deactivating extensions.
063: * </p>
064: *
065: * @param extensionIds
066: * The list of extensions to activate
067: * @param toActivateAllOthers
068: * True will activate all other extensions; False will leave the
069: * other activations as-is
070: * @return A list of all INavigatorContentDescriptors that were activated as
071: * a result of this call. If toActivateAllOthers is false, the
072: * result will be an empty array. Otherwise, it will be the set of
073: * all visible extensions minus those given in the 'extensionIds'
074: * parameter.
075: */
076: public INavigatorContentDescriptor[] deactivateExtensions(
077: String[] extensionIds, boolean toActivateAllOthers);
078:
079: /**
080: *
081: * Checks the known activation state for the given viewer id to determine if
082: * the given navigator extension is 'active'.
083: *
084: * @param aNavigatorExtensionId
085: * The unique identifier associated with a given extension.
086: *
087: * @return True if the extension is active in the context of the viewer id.
088: */
089: public boolean isNavigatorExtensionActive(
090: String aNavigatorExtensionId);
091:
092: /**
093: * Save the activation state of each content extension for the associated
094: * content service. Clients should persist the activation state after any
095: * call to {@link #activateExtensions(String[], boolean)} or
096: * {@link #deactivateExtensions(String[], boolean)}.
097: *
098: */
099: public void persistExtensionActivations();
100:
101: /**
102: * Request notification when the activation state changes.
103: *
104: * @param aListener
105: * An implementation of {@link IExtensionActivationListener}
106: */
107: public void addExtensionActivationListener(
108: IExtensionActivationListener aListener);
109:
110: /**
111: * No longer receive notification when activation state changes.
112: *
113: * @param aListener
114: * An implementation of {@link IExtensionActivationListener}
115: */
116: public void removeExtensionActivationListener(
117: IExtensionActivationListener aListener);
118: }
|