KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > runtime > registry > ExtensionPropertySource


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.runtime.registry;
12
13 import java.util.Vector JavaDoc;
14
15 import org.eclipse.core.runtime.IExtension;
16 import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
17 import org.eclipse.ui.views.properties.*;
18
19 public class ExtensionPropertySource extends RegistryPropertySource {
20     private IExtension extension;
21     public static final String JavaDoc P_NAME = "name"; //$NON-NLS-1$
22
public static final String JavaDoc P_ID = "id"; //$NON-NLS-1$
23
public static final String JavaDoc P_POINT = "point"; //$NON-NLS-1$
24
public ExtensionPropertySource(IExtension extension) {
25     this.extension = extension;
26 }
27 public IPropertyDescriptor[] getPropertyDescriptors() {
28     Vector JavaDoc result = new Vector JavaDoc();
29
30     result.addElement(new PropertyDescriptor(P_NAME, PDERuntimeMessages.RegistryView_extensionPR_name));
31     result.addElement(new PropertyDescriptor(P_ID, PDERuntimeMessages.RegistryView_extensionPR_id));
32     result.addElement(new PropertyDescriptor(P_POINT, PDERuntimeMessages.RegistryView_extensionPR_point));
33     return toDescriptorArray(result);
34 }
35 public Object JavaDoc getPropertyValue(Object JavaDoc name) {
36     if (name.equals(P_NAME))
37         return extension.getLabel();
38     if (name.equals(P_ID))
39         return extension.getUniqueIdentifier();
40     if (name.equals(P_POINT))
41         return extension.getExtensionPointUniqueIdentifier();
42     return null;
43 }
44 }
45
Popular Tags