Skip to main content
summaryrefslogtreecommitdiffstats
blob: a7fd6cdf893285ad1b013a3d6870898bfa57574c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*******************************************************************************
 * Copyright (c) 2010 BestSolution.at and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
 *     Steven Spungin <steven@spungin.tv> - Bug 424730
 ******************************************************************************/
package org.eclipse.e4.tools.emf.ui.common;

import org.eclipse.core.resources.IProject;

public interface IClassContributionProvider {
	public class ContributionData {
		public final String bundleName;
		public final String className;
		public final String sourceType;
		public final String iconPath;

		/**
		 * This is used if the resource is not contained in a referenced bundle,
		 * not a bundle, or not a project. It can be a jar file or a folder.
		 */
		public String installLocation;
		/**
		 * Path to the resource relative to the installLocation
		 */
		public String resourceRelativePath;

		public ContributionData(String bundleName, String className, String sourceType, String iconPath) {
			this.bundleName = bundleName;
			this.className = className;
			this.sourceType = sourceType;
			this.iconPath = iconPath;
		}
	}

	public class Filter {
		public final IProject project;
		public final String namePattern;
		public int maxResults;
		public Object userData;

		public Filter(IProject project, String namePattern) {
			this.project = project;
			this.namePattern = namePattern;
		}
	}

	public interface ContributionResultHandler {
		// hints for flags paramter
		/**
		 * There are more results to display, but the amount is not known
		 */
		static public final int MORE_UNKNOWN = -1;
		/**
		 * The operation was canceled. There may be additional results.
		 */
		static public final int MORE_CANCELED = -2;

		public void result(ContributionData data);

		/**
		 * This method is called at the end of a search. If the search
		 * terminated because maxResults was exceeded, the hint parameter will
		 * contain the number of additional results, or MORE_UNKNOWN if there
		 * are an unspecified number of additional results.
		 *
		 * If the search was cancelled, the hint will be MORE_CANCELED
		 *
		 * If there are no additional results, hint will be 0
		 */
		public void moreResults(int hint, Filter filter);
	}

	public void findContribution(Filter filter, ContributionResultHandler handler);
}

Back to the top