KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > handlers > IHandlerActivation


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.ui.handlers;
13
14 import org.eclipse.core.commands.IHandler;
15 import org.eclipse.core.expressions.IEvaluationContext;
16 import org.eclipse.ui.internal.services.IEvaluationResultCache;
17
18 /**
19  * <p>
20  * A token representing the activation of a handler. This token can later be
21  * used to cancel that activation. Without this token, then handler will only
22  * become inactive if the component in which the handler was activated is
23  * destroyed.
24  * </p>
25  * <p>
26  * This interface is not intended to be implemented or extended by clients.
27  * </p>
28  *
29  * @since 3.1
30  * @see org.eclipse.ui.ISources
31  * @see org.eclipse.ui.ISourceProvider
32  */

33 public interface IHandlerActivation extends IEvaluationResultCache, Comparable JavaDoc {
34
35     /**
36      * The depth at which the root exists.
37      *
38      * @since 3.2
39      */

40     public static final int ROOT_DEPTH = 1;
41
42     /**
43      * Clears the cached computation of the <code>isActive</code> method, if
44      * any. This method is only intended for internal use. It provides a
45      * mechanism by which <code>ISourceProvider</code> events can invalidate
46      * state on a <code>IHandlerActivation</code> instance.
47      *
48      * @deprecated Use {@link IEvaluationResultCache#clearResult()} instead.
49      */

50     public void clearActive();
51
52     /**
53      * Returns the identifier of the command whose handler is being activated.
54      *
55      * @return The command identifier; never <code>null</code>.
56      */

57     public String JavaDoc getCommandId();
58
59     /**
60      * Returns the depth at which this activation was created within the
61      * services hierarchy. The root of the hierarchy is at a depth of
62      * <code>1</code>. This is used as the final tie-breaker in the event
63      * that no other method can be used to determine a winner.
64      *
65      * @return The depth at which the handler was inserted into the services
66      * hierarchy; should be a positive integer.
67      * @since 3.2
68      */

69     public int getDepth();
70
71     /**
72      * Returns the handler that should be activated.
73      *
74      * @return The handler; may be <code>null</code>.
75      */

76     public IHandler getHandler();
77
78     /**
79      * Returns the handler service from which this activation was requested.
80      * This is used to ensure that an activation can only be retracted from the
81      * same service which issued it.
82      *
83      * @return The handler service; never <code>null</code>.
84      */

85     public IHandlerService getHandlerService();
86
87     /**
88      * Returns whether this handler activation is currently active -- given the
89      * current state of the workbench. This method should cache its computation.
90      * The cache will be cleared by a call to <code>clearActive</code>.
91      *
92      * @param context
93      * The context in which this state should be evaluated; must not
94      * be <code>null</code>.
95      * @return <code>true</code> if the activation is currently active;
96      * <code>false</code> otherwise.
97      * @deprecated Use
98      * {@link IEvaluationResultCache#evaluate(IEvaluationContext)}
99      * instead.
100      */

101     public boolean isActive(IEvaluationContext context);
102 }
103
Popular Tags