KickJava   Java API By Example, From Geeks To Geeks.

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


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 execution notifications. These
20  * include before-the-fact notification of perform, undo and redo refactoring
21  * operations as well as after-the-fact notification of the above refactoring
22  * operations.
23  * <p>
24  * Refactoring execution listeners must be prepared to receive notifications
25  * from a background thread. Any UI access occurring inside the implementation
26  * must be properly synchronized using the techniques specified by the client's
27  * widget library.
28  * </p>
29  * <p>
30  * Note: this class is not intended to be instantiated by clients.
31  * </p>
32  *
33  * @see IRefactoringExecutionListener
34  * @see IRefactoringHistoryService
35  *
36  * @since 3.2
37  */

38 public final class RefactoringExecutionEvent {
39
40     /** Event type indicating that a refactoring is about to be performed (value 4) */
41     public static final int ABOUT_TO_PERFORM= 4;
42
43     /** Event type indicating that a refactoring is about to be redone (value 6) */
44     public static final int ABOUT_TO_REDO= 6;
45
46     /** Event type indicating that a refactoring is about to be undone (value 5) */
47     public static final int ABOUT_TO_UNDO= 5;
48
49     /** Event type indicating that a refactoring has been performed (value 1) */
50     public static final int PERFORMED= 1;
51
52     /** Event type indicating that a refactoring has been performed (value 3) */
53     public static final int REDONE= 3;
54
55     /** Event type indicating that a refactoring has been undone (value 2) */
56     public static final int UNDONE= 2;
57
58     /** The refactoring descriptor proxy */
59     private final RefactoringDescriptorProxy fProxy;
60
61     /** The refactoring history service */
62     private final IRefactoringHistoryService fService;
63
64     /** The event type */
65     private final int fType;
66
67     /**
68      * Creates a new refactoring execution event.
69      *
70      * @param service
71      * the refactoring history service
72      * @param type
73      * the event type
74      * @param proxy
75      * the refactoring descriptor proxy
76      */

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

97     public RefactoringDescriptorProxy getDescriptor() {
98         return fProxy;
99     }
100
101     /**
102      * Returns the event type.
103      *
104      * @return the event type
105      */

106     public int getEventType() {
107         return fType;
108     }
109
110     /**
111      * Returns the refactoring history service
112      *
113      * @return the refactoring history service
114      */

115     public IRefactoringHistoryService getHistoryService() {
116         return fService;
117     }
118 }
119
Popular Tags