blob: 09500b19bde14fc82228a71b51571d8238c30115 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.pde.internal.runtime.registry;
import java.util.Vector;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
import org.eclipse.ui.views.properties.*;
public class ExtensionPropertySource extends RegistryPropertySource {
private IExtension extension;
public static final String P_NAME = "name"; //$NON-NLS-1$
public static final String P_ID = "id"; //$NON-NLS-1$
public static final String P_POINT = "point"; //$NON-NLS-1$
public static final String KEY_POINT = "RegistryView.extensionPR.point"; //$NON-NLS-1$
public static final String KEY_ID = "RegistryView.extensionPR.id"; //$NON-NLS-1$
public static final String KEY_NAME = "RegistryView.extensionPR.name"; //$NON-NLS-1$
public ExtensionPropertySource(IExtension extension) {
this.extension = extension;
}
public IPropertyDescriptor[] getPropertyDescriptors() {
Vector result = new Vector();
result.addElement(new PropertyDescriptor(P_NAME, PDERuntimePlugin.getResourceString(KEY_NAME)));
result.addElement(new PropertyDescriptor(P_ID, PDERuntimePlugin.getResourceString(KEY_ID)));
result.addElement(new PropertyDescriptor(P_POINT, PDERuntimePlugin.getResourceString(KEY_POINT)));
return toDescriptorArray(result);
}
public Object getPropertyValue(Object name) {
if (name.equals(P_NAME))
return extension.getLabel();
if (name.equals(P_ID))
return extension.getUniqueIdentifier();
if (name.equals(P_POINT))
return extension.getExtensionPointUniqueIdentifier();
return null;
}
}