KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > core > refactoring > history > RefactoringHistoryEvent


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 package org.eclipse.ltk.core.refactoring.history;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
16 import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
17
18 /**
19  * Event object to communicate refactoring history notifications. These include
20  * the addition and removal of refactoring descriptors to the global refactoring
21  * history index.
22  * <p>
23  * Refactoring history listeners must be prepared to receive notifications from
24  * a background thread. Any UI access occurring inside the implementation must
25  * be properly synchronized using the techniques specified by the client's
26  * widget library.
27  * </p>
28  * <p>
29  * Note: this class is not intended to be instantiated by clients.
30  * </p>
31  *
32  * @see IRefactoringHistoryListener
33  * @see IRefactoringHistoryService
34  *
35  * @since 3.2
36  */

37 public final class RefactoringHistoryEvent {
38
39     /**
40      * Event type indicating that a refactoring descriptor has been added to its
41      * associated history (value 4)
42      */

43     public static final int ADDED= 4;
44
45     /**
46      * Event type indicating that a refactoring descriptor has been deleted from
47      * its associated history (value 3)
48      */

49     public static final int DELETED= 3;
50
51     /**
52      * Event type indicating that a refactoring descriptor has been popped from
53      * the history stack (value 2)
54      */

55     public static final int POPPED= 2;
56
57     /**
58      * Event type indicating that a refactoring descriptor has been pushed to
59      * the history stack (value 1)
60      */

61     public static final int PUSHED= 1;
62
63     /** The refactoring descriptor proxy */
64     private final RefactoringDescriptorProxy fProxy;
65
66     /** The refactoring history service */
67     private final IRefactoringHistoryService fService;
68
69     /** The event type */
70     private final int fType;
71
72     /**
73      * Creates a new refactoring history event.
74      *
75      * @param service
76      * the refactoring history service
77      * @param type
78      * the event type
79      * @param proxy
80      * the refactoring descriptor proxy
81      */

82     public RefactoringHistoryEvent(final IRefactoringHistoryService service, final int type, final RefactoringDescriptorProxy proxy) {
83         Assert.isNotNull(service);
84         Assert.isNotNull(proxy);
85         fService= service;
86         fType= type;
87         fProxy= proxy;
88     }
89
90     /**
91      * Returns the refactoring descriptor proxy.
92      * <p>
93      * Depending on the event, this proxy may refer to an inexisting refactoring
94      * and cannot be resolved to a refactoring descriptor. Clients should also
95      * be prepared to receive notifications for unknown refactorings, which are
96      * discriminated by their special id
97      * {@link RefactoringDescriptor#ID_UNKNOWN};
98      * </p>
99      *
100      * @return the refactoring descriptor proxy
101      */

102     public RefactoringDescriptorProxy getDescriptor() {
103         return fProxy;
104     }
105
106     /**
107      * Returns the event type.
108      *
109      * @return the event type
110      */

111     public int getEventType() {
112         return fType;
113     }
114
115     /**
116      * Returns the refactoring history service.
117      *
118      * @return the refactoring history service
119      */

120     public IRefactoringHistoryService getHistoryService() {
121         return fService;
122     }
123 }
124
Popular Tags