Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 38c9af71d40dc27a674919ed5ae999cc90830d5c (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
/*******************************************************************************
 * Copyright (c) 2012 Wind River Systems, Inc. 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:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/

package org.eclipse.tcf.te.runtime.persistence.delegates;

import java.util.Map;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;

/**
 * General path variable delegate that can be configured directly in the contributions.
 *
 * To set the list of handled keys you have to use the <code>class</code> and <code>parameter</code> tags
 * with <b>keysToHandle</b> as parameter name and a comma separated list of handled keys
 * (i.e. "file,directory") as parameter value.
 */
public class PathVariableDelegate extends AbstractPathVariableDelegate {

	private String[] keysToHandle = new String[0];

	/* (non-Javadoc)
	 * @see org.eclipse.tcf.te.runtime.persistence.AbstractPathVariableDelegate#isPathKey(java.lang.String)
	 */
	@Override
	protected boolean isPathKey(String key) {
		return true;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.tcf.te.runtime.persistence.AbstractVariableDelegate#getKeysToHandle()
	 */
	@Override
	protected String[] getKeysToHandle() {
		return keysToHandle;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
	 */
	@Override
	public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
		if (data instanceof Map) {
			String keys = (String)((Map<?,?>)data).get("keysToHandle"); //$NON-NLS-1$
			if (keys != null) {
				keysToHandle = keys.split("\\w*,\\w*"); //$NON-NLS-1$
			}
		}
	}
}

Back to the top