KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > core > refactoring > participants > ParticipantManager


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.participants;
12
13 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
14
15 /**
16  * Facade to access the rename, move, delete, create and copy participant
17  * extension point provided by the org.eclipse.ltk.core.refactoring plug-in.
18  * <p>
19  * Note: this class is not intended to be extended by clients.
20  * </p>
21  *
22  * @since 3.0
23  */

24 public class ParticipantManager {
25     
26     private ParticipantManager() {
27         // no instance
28
}
29     
30     //---- Rename participants ----------------------------------------------------------------
31

32     private static final String JavaDoc RENAME_PARTICIPANT_EXT_POINT= "renameParticipants"; //$NON-NLS-1$
33
private static ParticipantExtensionPoint fgRenameInstance=
34         new ParticipantExtensionPoint("Rename", RENAME_PARTICIPANT_EXT_POINT, RenameParticipant.class); //$NON-NLS-1$
35

36     /**
37      * Loads the rename participants for the given element.
38      *
39      * @param status a refactoring status to report status if problems occurred while
40      * loading the participants
41      * @param processor the processor that will own the participants
42      * @param element the element to be renamed
43      * @param arguments the rename arguments describing the rename
44      * @param affectedNatures an array of project natures affected by the refactoring
45      * @param shared a list of shared participants
46      *
47      * @return an array of rename participants
48      */

49     public static RenameParticipant[] loadRenameParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, RenameArguments arguments, String JavaDoc[] affectedNatures, SharableParticipants shared) {
50         return loadRenameParticipants(status, processor, element, arguments, null, affectedNatures, shared);
51     }
52     
53     /**
54      * Loads the rename participants for the given element.
55      *
56      * @param status a refactoring status to report status if problems occurred while
57      * loading the participants
58      * @param processor the processor that will own the participants
59      * @param element the element to be renamed
60      * @param arguments the rename arguments describing the rename
61      * @param filter a participant filter to exclude certain participants, or <code>null</code>
62      * if no filtering is desired
63      * @param affectedNatures an array of project natures affected by the refactoring
64      * @param shared a list of shared participants
65      *
66      * @return an array of rename participants
67      *
68      * @since 3.2
69      */

70     public static RenameParticipant[] loadRenameParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, RenameArguments arguments, IParticipantDescriptorFilter filter, String JavaDoc[] affectedNatures, SharableParticipants shared) {
71         RefactoringParticipant[] participants= fgRenameInstance.getParticipants(status, processor, element, arguments, filter, affectedNatures, shared);
72         RenameParticipant[] result= new RenameParticipant[participants.length];
73         System.arraycopy(participants, 0, result, 0, participants.length);
74         return result;
75     }
76     
77     //---- Move participants ----------------------------------------------------------------
78

79     private static final String JavaDoc MOVE_PARTICIPANT_EXT_POINT= "moveParticipants"; //$NON-NLS-1$
80
private static ParticipantExtensionPoint fgMoveExtensions=
81         new ParticipantExtensionPoint("Move", MOVE_PARTICIPANT_EXT_POINT, MoveParticipant.class); //$NON-NLS-1$
82

83     /**
84      * Loads the move participants for the given element.
85      *
86      * @param status a refactoring status to report status if problems occurred while
87      * loading the participants
88      * @param processor the processor that will own the participants
89      * @param element the element to be moved
90      * @param arguments the move arguments describing the move
91      * @param affectedNatures an array of project natures affected by the refactoring
92      * @param shared a list of shared participants
93      *
94      * @return an array of move participants
95      */

96     public static MoveParticipant[] loadMoveParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, MoveArguments arguments, String JavaDoc[] affectedNatures, SharableParticipants shared) {
97         return loadMoveParticipants(status, processor, element, arguments, null, affectedNatures, shared);
98     }
99
100     /**
101      * Loads the move participants for the given element.
102      *
103      * @param status a refactoring status to report status if problems occurred while
104      * loading the participants
105      * @param processor the processor that will own the participants
106      * @param element the element to be moved
107      * @param arguments the move arguments describing the move
108      * @param filter a participant filter to exclude certain participants, or <code>null</code>
109      * if no filtering is desired
110      * @param affectedNatures an array of project natures affected by the refactoring
111      * @param shared a list of shared participants
112      *
113      * @return an array of move participants
114      *
115      * @since 3.2
116      */

117     public static MoveParticipant[] loadMoveParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, MoveArguments arguments, IParticipantDescriptorFilter filter, String JavaDoc[] affectedNatures, SharableParticipants shared) {
118         RefactoringParticipant[] participants= fgMoveExtensions.getParticipants(status, processor, element, arguments, filter, affectedNatures, shared);
119         MoveParticipant[] result= new MoveParticipant[participants.length];
120         System.arraycopy(participants, 0, result, 0, participants.length);
121         return result;
122     }
123
124     //---- Delete participants ----------------------------------------------------------------
125

126     private static final String JavaDoc DELETE_PARTICIPANT_EXT_POINT= "deleteParticipants"; //$NON-NLS-1$
127
private static ParticipantExtensionPoint fgDeleteInstance=
128         new ParticipantExtensionPoint("Delete", DELETE_PARTICIPANT_EXT_POINT, DeleteParticipant.class); //$NON-NLS-1$
129

130     /**
131      * Loads the delete participants for the given element.
132      * @param status a refactoring status to report status if problems occurred while
133      * loading the participants
134      * @param processor the processor that will own the participants
135      * @param element the element to be deleted
136      * @param arguments the delete arguments describing the delete
137      * @param affectedNatures an array of project natures affected by the refactoring
138      * @param shared a list of shared participants
139      *
140      * @return an array of delete participants
141      */

142     public static DeleteParticipant[] loadDeleteParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, DeleteArguments arguments, String JavaDoc[] affectedNatures, SharableParticipants shared) {
143         return loadDeleteParticipants(status, processor, element, arguments, null, affectedNatures, shared);
144     }
145
146     /**
147      * Loads the delete participants for the given element.
148      * @param status a refactoring status to report status if problems occurred while
149      * loading the participants
150      * @param processor the processor that will own the participants
151      * @param element the element to be deleted
152      * @param arguments the delete arguments describing the delete
153      * @param filter a participant filter to exclude certain participants, or <code>null</code>
154      * if no filtering is desired
155      * @param affectedNatures an array of project natures affected by the refactoring
156      * @param shared a list of shared participants
157      *
158      * @return an array of delete participants
159      *
160      * @since 3.2
161      */

162     public static DeleteParticipant[] loadDeleteParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, DeleteArguments arguments, IParticipantDescriptorFilter filter, String JavaDoc[] affectedNatures, SharableParticipants shared) {
163         RefactoringParticipant[] participants= fgDeleteInstance.getParticipants(status, processor, element, arguments, filter, affectedNatures, shared);
164         DeleteParticipant[] result= new DeleteParticipant[participants.length];
165         System.arraycopy(participants, 0, result, 0, participants.length);
166         return result;
167     }
168
169     //---- Create participants ----------------------------------------------------------------
170

171     private static final String JavaDoc CREATE_PARTICIPANT_EXT_POINT= "createParticipants"; //$NON-NLS-1$
172
private static ParticipantExtensionPoint fgCreateInstance=
173         new ParticipantExtensionPoint("Create", CREATE_PARTICIPANT_EXT_POINT, CreateParticipant.class); //$NON-NLS-1$
174

175     /**
176      * Loads the create participants for the given element.
177      *
178      * @param status a refactoring status to report status if problems occurred while
179      * loading the participants
180      * @param processor the processor that will own the participants
181      * @param element the element to be created or a corresponding descriptor
182      * @param arguments the create arguments describing the create
183      * @param affectedNatures an array of project natures affected by the refactoring
184      * @param shared a list of shared participants
185      *
186      * @return an array of create participants
187      */

188     public static CreateParticipant[] loadCreateParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, CreateArguments arguments, String JavaDoc affectedNatures[], SharableParticipants shared) {
189         return loadCreateParticipants(status, processor, element, arguments, null, affectedNatures, shared);
190     }
191
192     /**
193      * Loads the create participants for the given element.
194      *
195      * @param status a refactoring status to report status if problems occurred while
196      * loading the participants
197      * @param processor the processor that will own the participants
198      * @param element the element to be created or a corresponding descriptor
199      * @param arguments the create arguments describing the create
200      * @param filter a participant filter to exclude certain participants, or <code>null</code>
201      * if no filtering is desired
202      * @param affectedNatures an array of project natures affected by the refactoring
203      * @param shared a list of shared participants
204      *
205      * @return an array of create participants
206      *
207      * @since 3.2
208      */

209     public static CreateParticipant[] loadCreateParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, CreateArguments arguments, IParticipantDescriptorFilter filter, String JavaDoc affectedNatures[], SharableParticipants shared) {
210         RefactoringParticipant[] participants= fgCreateInstance.getParticipants(status, processor, element, arguments, filter, affectedNatures, shared);
211         CreateParticipant[] result= new CreateParticipant[participants.length];
212         System.arraycopy(participants, 0, result, 0, participants.length);
213         return result;
214     }
215
216     //---- Copy participants ----------------------------------------------------------------
217

218     private static final String JavaDoc COPY_PARTICIPANT_EXT_POINT= "copyParticipants"; //$NON-NLS-1$
219
private static ParticipantExtensionPoint fgCopyInstance=
220         new ParticipantExtensionPoint("Copy", COPY_PARTICIPANT_EXT_POINT, CopyParticipant.class); //$NON-NLS-1$
221

222     /**
223      * Loads the copy participants for the given element.
224      *
225      * @param status a refactoring status to report status if problems occurred while
226      * loading the participants
227      * @param processor the processor that will own the participants
228      * @param element the element to be copied or a corresponding descriptor
229      * @param arguments the copy arguments describing the copy operation
230      * @param affectedNatures an array of project natures affected by the refactoring
231      * @param shared a list of shared participants
232      *
233      * @return an array of copy participants
234      *
235      * @since 3.1
236      */

237     public static CopyParticipant[] loadCopyParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, CopyArguments arguments, String JavaDoc affectedNatures[], SharableParticipants shared) {
238         return loadCopyParticipants(status, processor, element, arguments, null, affectedNatures, shared);
239     }
240
241     /**
242      * Loads the copy participants for the given element.
243      *
244      * @param status a refactoring status to report status if problems occurred while
245      * loading the participants
246      * @param processor the processor that will own the participants
247      * @param element the element to be copied or a corresponding descriptor
248      * @param arguments the copy arguments describing the copy operation
249      * @param filter a participant filter to exclude certain participants, or <code>null</code>
250      * if no filtering is desired
251      * @param affectedNatures an array of project natures affected by the refactoring
252      * @param shared a list of shared participants
253      *
254      * @return an array of copy participants
255      *
256      * @since 3.2
257      */

258     public static CopyParticipant[] loadCopyParticipants(RefactoringStatus status, RefactoringProcessor processor, Object JavaDoc element, CopyArguments arguments, IParticipantDescriptorFilter filter, String JavaDoc affectedNatures[], SharableParticipants shared) {
259         RefactoringParticipant[] participants= fgCopyInstance.getParticipants(status, processor, element, arguments, filter, affectedNatures, shared);
260         CopyParticipant[] result= new CopyParticipant[participants.length];
261         System.arraycopy(participants, 0, result, 0, participants.length);
262         return result;
263     }
264 }
Popular Tags