本文整理汇总了Java中org.eclipse.core.runtime.IConfigurationElement.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java IConfigurationElement.getAttribute方法的具体用法?Java IConfigurationElement.getAttribute怎么用?Java IConfigurationElement.getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.IConfigurationElement
的用法示例。
在下文中一共展示了IConfigurationElement.getAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWizardElement
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
protected WizardElement createWizardElement(IConfigurationElement config) {
String name = config.getAttribute(WizardElement.ATT_NAME);
String id = config.getAttribute(WizardElement.ATT_ID);
String className = config.getAttribute(WizardElement.ATT_CLASS);
if (name == null || id == null || className == null)
return null;
WizardElement element = new WizardElement(config);
element.id = id;
String imageName = config.getAttribute(WizardElement.ATT_ICON);
if (imageName != null) {
String pluginID = config.getNamespaceIdentifier();
Image image = PDEPlugin.getDefault().getLabelProvider().getImageFromPlugin(pluginID, imageName);
element.setImage(image);
}
return element;
}
示例2: readExtensions
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private static void readExtensions(Map<Class<? extends IScanPathModel>, Class<? extends IPointGenerator<?>>> gens,
Map<String, GeneratorInfo> tids) throws CoreException {
if (Platform.getExtensionRegistry()!=null) {
final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.generator");
for (IConfigurationElement e : eles) {
final IPointGenerator<?> generator = (IPointGenerator<?>)e.createExecutableExtension("class");
final IScanPathModel model = (IScanPathModel)e.createExecutableExtension("model");
final Class<? extends IScanPathModel> modelClass = model.getClass();
@SuppressWarnings("unchecked")
final Class<? extends IPointGenerator<?>> generatorClass = (Class<? extends IPointGenerator<?>>) generator.getClass();
gens.put(modelClass, generatorClass);
final GeneratorInfo info = new GeneratorInfo();
info.setModelClass(model.getClass());
info.setGeneratorClass(generator.getClass());
info.setLabel(e.getAttribute("label"));
info.setDescription(e.getAttribute("description"));
String id = e.getAttribute("id");
tids.put(id, info);
}
}
}
示例3: createConnection
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public static ConnectionService createConnection ( final ConnectionInformation info, final Integer autoReconnectDelay, final boolean lazyActivation )
{
if ( info == null )
{
return null;
}
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( Activator.EXTP_CONNECTON_CREATOR ) )
{
final String interfaceName = ele.getAttribute ( "interface" );
final String driverName = ele.getAttribute ( "driver" );
if ( interfaceName == null || driverName == null )
{
continue;
}
if ( interfaceName.equals ( info.getInterface () ) && driverName.equals ( info.getDriver () ) )
{
final ConnectionService service = createConnection ( info, ele, autoReconnectDelay, lazyActivation );
if ( service != null )
{
return service;
}
}
}
return null;
}
示例4: list
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public static List<StyleGeneratorInformation> list ()
{
final List<StyleGeneratorInformation> result = new LinkedList<StyleGeneratorInformation> ();
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_STYLE_GENERATOR ) )
{
if ( !ELE_STYLE_GENERATOR.equals ( ele.getName () ) )
{
continue;
}
final String id = ele.getAttribute ( "id" ); //$NON-NLS-1$
final String name = ele.getAttribute ( "name" ); //$NON-NLS-1$
final String description = getText ( ele.getChildren ( "description" ) ); //$NON-NLS-1$
result.add ( new StyleGeneratorInformation ( id, name, description ) );
}
return result;
}
示例5: convertMonitor
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private static MonitorViewConfiguration convertMonitor ( final IConfigurationElement ele )
{
try
{
final String id = ele.getAttribute ( "id" ); //$NON-NLS-1$
final String monitorQueryId = ele.getAttribute ( "monitorQueryId" ); //$NON-NLS-1$
final String connectionString = ele.getAttribute ( "connectionString" ); //$NON-NLS-1$
final ConnectionType connectionType = ConnectionType.valueOf ( ele.getAttribute ( "connectionType" ) ); //$NON-NLS-1$
final String label = ele.getAttribute ( "label" ); //$NON-NLS-1$
final List<ColumnProperties> columns = parseColumnSettings ( ele.getAttribute ( "columns" ) ); //$NON-NLS-1$
return new MonitorViewConfiguration ( id, monitorQueryId, connectionString, connectionType, label, columns );
}
catch ( final Exception e )
{
logger.warn ( "Failed to convert monitor configuration: {}", ele ); //$NON-NLS-1$
return null;
}
}
示例6: createIcons
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private void createIcons() {
icons = new HashMap<String, Image>(7);
final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.generator");
for (IConfigurationElement e : eles) {
final String identity = e.getAttribute("id");
final String icon = e.getAttribute("icon");
if (icon !=null) {
final String cont = e.getContributor().getName();
final Bundle bundle= Platform.getBundle(cont);
final URL entry = bundle.getEntry(icon);
final ImageDescriptor des = ImageDescriptor.createFromURL(entry);
icons.put(identity, des.createImage());
}
}
}
示例7: openView
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public static DetailView openView ( final String id, final Map<String, String> properties ) throws CoreException
{
logger.info ( "Searching view: {}", id ); //$NON-NLS-1$
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_DETAIL_VIEW ) )
{
final String cfgId = ele.getAttribute ( "id" ); //$NON-NLS-1$
logger.debug ( "Checking: {}", cfgId ); //$NON-NLS-1$
if ( cfgId != null && cfgId.equals ( id ) )
{
return createDetailView ( id, ele, properties );
}
}
return null;
}
示例8: convertAlarmNotifier
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private static AlarmNotifierConfiguration convertAlarmNotifier ( final IConfigurationElement ele )
{
try
{
final String connectionId = ele.getAttribute ( "connectionId" ); //$NON-NLS-1$
final String prefix = ele.getAttribute ( "prefix" ) == null ? "ae.server.info" : ele.getAttribute ( "prefix" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ $NON-NLS-2$
final URL soundFile = Platform.getBundle ( ele.getContributor ().getName () ).getEntry ( ele.getAttribute ( "soundFile" ) ); //$NON-NLS-1$
final ParameterizedCommand ackAlarmsAvailableCommand = convertCommand ( ele.getChildren ( "ackAlarmsAvailableCommand" )[0] ); //$NON-NLS-1$
final ParameterizedCommand alarmsAvailableCommand = convertCommand ( ele.getChildren ( "alarmsAvailableCommand" )[0] ); //$NON-NLS-1$
return new AlarmNotifierConfiguration ( connectionId, prefix, soundFile, ackAlarmsAvailableCommand, alarmsAvailableCommand );
}
catch ( final Exception e )
{
logger.warn ( "Failed to convert alarm notifier configuration: {}", ele ); //$NON-NLS-1$
return null;
}
}
示例9: createConnections
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private void createConnections ()
{
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( "org.eclipse.scada.core.ui.connection.provider.connectionInstance" ) )
{
if ( !"connectionInstance".equals ( ele.getName () ) )
{
continue;
}
final String id = ele.getAttribute ( "servicePid" );
final String uri = ele.getAttribute ( "uri" );
final String autoReconnect = ele.getAttribute ( "autoReconnect" );
createConnection ( id, uri, autoReconnect );
}
}
示例10: initialize
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
* Read information from extensions defined in plugin.xml files
*/
private void initialize() {
if (isInitialized) {
throw new IllegalStateException("may invoke method initialize() only once");
}
isInitialized = true;
final IExtensionRegistry registry = RegistryFactory.getRegistry();
if (registry != null) {
final IExtension[] extensions = registry.getExtensionPoint(SUBGENERATORS_EXTENSIONS_POINT_ID)
.getExtensions();
for (IExtension extension : extensions) {
final IConfigurationElement[] configElems = extension.getConfigurationElements();
for (IConfigurationElement elem : configElems) {
try {
String fileExtensions = elem.getAttribute(ATT_FILE_EXTENSIONS);
List<String> fileExtensionList = Splitter.on(',').trimResults().omitEmptyStrings()
.splitToList(fileExtensions);
ISubGenerator generator = (ISubGenerator) elem
.createExecutableExtension(ATT_SUB_GENERATOR_CLASS);
for (String fileExtension : fileExtensionList) {
register(generator, fileExtension);
}
} catch (Exception ex) {
LOGGER.error(
"Error while reading extensions for extension point "
+ SUBGENERATORS_EXTENSIONS_POINT_ID,
ex);
}
}
}
}
}
示例11: getLanguageURI
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
* @param languageId
* @return the URI of the given language or null if no such language exists in the registry
*/
public static String getLanguageURI(String languageId){
IConfigurationElement[] melangeLanguages = Platform
.getExtensionRegistry().getConfigurationElementsFor(
"fr.inria.diverse.melange.language");
for (IConfigurationElement lang : melangeLanguages) {
if(lang.getAttribute("id").equals(languageId)){
return lang.getAttribute("uri");
}
}
return null;
}
示例12: getLanguageNameForURI
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
* Note: in some situations, the same uri can be declared for several languages ! (for example using external keyword)
* this is usually a deployment issue
* @param uri
* @return the first language with the given URI or null if no such language exists in the registry
*/
public static String getLanguageNameForURI(String uri){
IConfigurationElement[] melangeLanguages = Platform
.getExtensionRegistry().getConfigurationElementsFor(
"fr.inria.diverse.melange.language");
for (IConfigurationElement lang : melangeLanguages) {
if(lang.getAttribute("uri").equals(uri)){
return lang.getAttribute("id");
}
}
return null;
}
示例13: getLanguageNamesForURI
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public static List<String> getLanguageNamesForURI(String uri){
List<String> languagesNames = new ArrayList<String>();
IConfigurationElement[] melangeLanguages = Platform
.getExtensionRegistry().getConfigurationElementsFor(
"fr.inria.diverse.melange.language");
for (IConfigurationElement lang : melangeLanguages) {
if(lang.getAttribute("uri").equals(uri)){
String id = lang.getAttribute("id");
if(!languagesNames.contains(id)){
languagesNames.add(id);
}
}
}
return languagesNames;
}
示例14: getModelType
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
* Return the ModelType for 'language' or null if not found
*/
public static String getModelType(String language){
IConfigurationElement[] melangeLanguages = Platform
.getExtensionRegistry().getConfigurationElementsFor(
"fr.inria.diverse.melange.language");
for (IConfigurationElement lang : melangeLanguages) {
if (lang.getAttribute("id").equals(language)) {
return lang.getAttribute("modeltypeId");
}
}
return null;
}
示例15: initializeDefaultPreferences
import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences ()
{
String defaultTimeZone = TimeZone.getDefault ().getID ();
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_CFG_ID ) )
{
if ( !Activator.TIME_ZONE_KEY.equals ( ele.getName () ) )
{
continue;
}
defaultTimeZone = ele.getAttribute ( "id" ); //$NON-NLS-1$
}
final Preferences node = DefaultScope.INSTANCE.getNode ( Activator.PLUGIN_ID );
node.put ( Activator.TIME_ZONE_KEY, defaultTimeZone );
}