KickJava   Java API By Example, From Geeks To Geeks.

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


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.ILibrary;
16 import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
17 import org.eclipse.ui.views.properties.*;
18
19 public class LibraryPropertySource extends RegistryPropertySource {
20     private ILibrary library;
21     public static final String JavaDoc P_PATH = "path"; //$NON-NLS-1$
22
public static final String JavaDoc P_EXPORTED = "exported"; //$NON-NLS-1$
23
public static final String JavaDoc P_FULLY_EXPORTED = "fully_exported"; //$NON-NLS-1$
24

25 public LibraryPropertySource(ILibrary library) {
26     this.library = library;
27 }
28 public IPropertyDescriptor[] getPropertyDescriptors() {
29     Vector JavaDoc result = new Vector JavaDoc();
30
31     result.addElement(new PropertyDescriptor(P_PATH, PDERuntimeMessages.RegistryView_libraryPR_path));
32     result.addElement(new PropertyDescriptor(P_EXPORTED, PDERuntimeMessages.RegistryView_libraryPR_exported));
33     result.addElement(new PropertyDescriptor(P_FULLY_EXPORTED, PDERuntimeMessages.RegistryView_libraryPR_fullyExported));
34     return toDescriptorArray(result);
35 }
36 public Object JavaDoc getPropertyValue(Object JavaDoc name) {
37     if (name.equals(P_PATH))
38         return library.getPath().toString();
39     if (name.equals(P_EXPORTED))
40         return library.isExported()?"true":"false"; //$NON-NLS-1$ //$NON-NLS-2$
41
if (name.equals(P_FULLY_EXPORTED))
42         return library.isFullyExported()?"true":"false"; //$NON-NLS-1$ //$NON-NLS-2$
43
return null;
44 }
45 }
46
Popular Tags