KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > schema > CompositorPropertySource


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.ui.editor.schema;
12
13 import org.eclipse.pde.internal.core.schema.*;
14 import org.eclipse.ui.views.properties.*;
15 import org.eclipse.pde.internal.core.ischema.*;
16 import org.eclipse.pde.internal.ui.*;
17
18 public class CompositorPropertySource extends GrammarPropertySource {
19     public static final String JavaDoc P_KIND = "kind"; //$NON-NLS-1$
20
public CompositorPropertySource(ISchemaCompositor obj) {
21     super(obj);
22 }
23 public IPropertyDescriptor[] getPropertyDescriptors() {
24     if (descriptors == null) {
25         descriptors = super.getPropertyDescriptorsVector();
26         PropertyDescriptor cdesc =
27             createComboBoxPropertyDescriptor(P_KIND, PDEUIMessages.SchemaEditor_CompositorPR_kind, ISchemaCompositor.kindTable);
28         if (cdesc instanceof ComboBoxPropertyDescriptor)
29             ((ComboBoxPropertyDescriptor) cdesc).setLabelProvider(
30                 new ComboProvider(P_KIND, ISchemaCompositor.kindTable));
31         descriptors.addElement(cdesc);
32     }
33     return toDescriptorArray(descriptors);
34 }
35 public Object JavaDoc getPropertyValue(Object JavaDoc name) {
36     ISchemaCompositor compositor = (ISchemaCompositor)getSourceObject();
37     if (name.equals(P_KIND)) {
38         return new Integer JavaDoc(compositor.getKind());
39     }
40     return super.getPropertyValue(name);
41 }
42 public void setPropertyValue(String JavaDoc name, Object JavaDoc value) {
43     SchemaCompositor compositor = (SchemaCompositor)getSourceObject();
44     
45     if (name.equals(P_KIND)) {
46         compositor.setKind(((Integer JavaDoc)value).intValue());
47     }
48     else super.setPropertyValue(name, value);
49 }
50 }
51
Popular Tags