blob: b4ac0acf081de280b8da5c02419ae4163506c41b [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2016 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.dltk.core;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
public abstract class DLTKContributedExtension implements
IDLTKContributedExtension, IExecutableExtension {
private String description;
private String id;
private String name;
private String natureId;
private String propertyPageId;
private String preferencePageId;
private int priority;
@Override
public String getDescription() {
return description;
}
@Override
public String getId() {
return id;
}
@Override
public String getName() {
return name;
}
@Override
public String getNatureId() {
return natureId;
}
@Override
public String getPreferencePageId() {
return preferencePageId;
}
@Override
public int getPriority() {
return priority;
}
@Override
public String getPropertyPageId() {
return propertyPageId;
}
@Override
public void setInitializationData(IConfigurationElement config,
String propertyName, Object data) {
id = config.getAttribute(ID);
name = config.getAttribute(NAME);
description = config.getAttribute(DESCRIPTION);
priority = Integer.parseInt(config.getAttribute(PRIORITY));
propertyPageId = config.getAttribute(PROP_PAGE_ID);
preferencePageId = config.getAttribute(PREF_PAGE_ID);
// get the natureId from the parent
final Object parent = config.getParent();
if (parent instanceof IConfigurationElement)
natureId = ((IConfigurationElement) parent).getAttribute(NATURE_ID);
}
}