Skip to main content
summaryrefslogtreecommitdiffstats
blob: b50ff3b7a7cdd1e1b22f79015f01f5945941c6b2 (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
/*******************************************************************************
 * Copyright (c) 2014 TwelveTone LLC 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:
 * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730
 *******************************************************************************/

package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator;

import java.util.regex.Pattern;

import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData;

/**
 * A contribution collector encompassing the current target platform.<br />
 * Uses FilterEx for bundle, package, and location filtering
 *
 * @author Steven Spungin
 *
 */
public class TargetPlatformIconContributionCollector extends TargetPlatformContributionCollector {

	protected TargetPlatformIconContributionCollector(String cacheName) {
		super(cacheName);
	}

	static final Pattern pattern = Pattern.compile("(.*/)?([^/]+\\.(jpg|jpeg|png|gif))"); //$NON-NLS-1$
	protected static TargetPlatformIconContributionCollector instance;

	static public TargetPlatformIconContributionCollector getInstance() {
		if (instance == null) {
			instance = new TargetPlatformIconContributionCollector(
				Messages.TargetPlatformIconContributionCollector_images);
		}
		return instance;
	}

	@Override
	protected Pattern getFilePattern() {
		return pattern;
	}

	@Override
	protected ContributionData makeData(Entry e) {
		final ContributionData data = new ContributionData(e.bundleSymName, null, "Java", e.path + e.name); //$NON-NLS-1$
		data.installLocation = e.installLocation;
		data.resourceRelativePath = data.iconPath;
		return data;
	}

}

Back to the top