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
|
/*******************************************************************************
* Copyright (c) 2010, 2013 Oracle. 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:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.common.core.internal.utility;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jpt.common.core.JptCommonCoreMessages;
import org.eclipse.osgi.util.NLS;
/**
* {@link IConfigurationElement} utility methods.
*/
public class ConfigurationElementTools {
/**
* Return a helpful message indicating the specified attribute is missing
* from the specified element.
*/
public static String buildMissingAttributeMessage(IConfigurationElement element, String attributeName) {
return bind(JptCommonCoreMessages.REGISTRY_MISSING_ATTRIBUTE,
attributeName,
element.getName(),
element.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
element.getContributor().getName()
);
}
/**
* Return a helpful message indicating the specified attribute
* from the specified element has an invalid value.
*/
public static String buildInvalidValueMessage(IConfigurationElement element, String attributeName, String invalidValue) {
return bind(JptCommonCoreMessages.REGISTRY_INVALID_VALUE,
invalidValue,
attributeName,
element.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
element.getContributor().getName()
);
}
private static String bind(String msg, Object... args) {
return NLS.bind(msg, args);
}
private ConfigurationElementTools() {
super();
throw new UnsupportedOperationException();
}
}
|