1 | /******************************************************************************* |
2 | * Copyright (c) 2009 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.pde.api.tools.internal.search; |
12 | |
13 | import org.eclipse.pde.api.tools.internal.provisional.descriptors.IComponentDescriptor; |
14 | import org.eclipse.pde.api.tools.internal.provisional.descriptors.IMemberDescriptor; |
15 | |
16 | /** |
17 | * Used to visit an API use scan. This visitor visits each referenced component in |
18 | * a use scan, by each component that refers to it, by each reference. |
19 | */ |
20 | public class UseScanVisitor { |
21 | |
22 | /** |
23 | * Start visiting an API use scan |
24 | */ |
25 | public void visitScan() { |
26 | } |
27 | |
28 | /** |
29 | * Ends visiting an API use scan |
30 | */ |
31 | public void endVisitScan() { |
32 | } |
33 | |
34 | /** |
35 | * Visits the given component and returns whether to visit components referencing |
36 | * this component. |
37 | * <p> |
38 | * Components in a scan are visited in alphabetical order. |
39 | * </p> |
40 | * |
41 | * @param target API component to which references exist |
42 | * @return whether to visit components that reference this component |
43 | */ |
44 | public boolean visitComponent(IComponentDescriptor target) { |
45 | return true; |
46 | } |
47 | |
48 | /** |
49 | * End visiting a component that was referenced by others |
50 | * |
51 | * @param target the component that was visited |
52 | */ |
53 | public void endVisit(IComponentDescriptor target) { |
54 | } |
55 | |
56 | /** |
57 | * Visits a component that makes references to the current target component being visited |
58 | * and returns whether to visit individual references. |
59 | * <p> |
60 | * Referencing components in a scan are visited in alphabetical order within the |
61 | * current target component. |
62 | * </p> |
63 | * |
64 | * @param component the component that references the current target component |
65 | * @return whether to visit reference members within the component |
66 | */ |
67 | public boolean visitReferencingComponent(IComponentDescriptor component) { |
68 | return true; |
69 | } |
70 | |
71 | /** |
72 | * Ends visiting a component that made references to the current target component. |
73 | * |
74 | * @param component that component that was visited |
75 | */ |
76 | public void endVisitReferencingComponent(IComponentDescriptor component) { |
77 | } |
78 | |
79 | /** |
80 | * Visits a referenced member and returns whether to visit reference locations |
81 | * |
82 | * @param referencedMember the member that was referenced |
83 | * @return whether to visit individual reference locations |
84 | */ |
85 | public boolean visitMember(IMemberDescriptor referencedMember) { |
86 | return true; |
87 | } |
88 | |
89 | /** |
90 | * End visits a referenced member |
91 | * |
92 | * @param referencedMember the member that was referenced |
93 | */ |
94 | public void endVisitMember(IMemberDescriptor referencedMember) { |
95 | |
96 | } |
97 | |
98 | /** |
99 | * Visits a reference to the current member. |
100 | * |
101 | * @param refKind the kind of {@link org.eclipse.pde.api.tools.internal.provisional.builder.IReference} |
102 | * @param fromMember describes the member the reference was made from |
103 | * @param lineNumber the line number the reference was on or -1 if unknown |
104 | * @param visibility see {@link org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers} |
105 | */ |
106 | public void visitReference(int refKind, IMemberDescriptor fromMember, int lineNumber, int visibility) { |
107 | |
108 | } |
109 | |
110 | } |