basepropertysource.java

来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 138 行

JAVA
138
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/base/gui/BasePropertySource.java,v 1.1.1.1 2004/07/01 09:07:40 wang_j Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/07/01 09:07:40 $
 *
 * ====================================================================
 *
 * The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
 *
 * Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
 *                        IT Forest Corporation
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 * You shall not disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into with
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 */
package com.webpump.ui.base.gui;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.views.properties.*;

import com.webpump.ui.base.data.*;

/**
 * Class for base of property source
 */
public class BasePropertySource extends BasePropertySourceObject {
    /** descriptors of the property sheet*/
	protected PropertyDescriptor[] descriptors;

    /**
     * Class for property label provider
     */
	public class PropertyLabelProvider extends LabelProvider {
        /** image of the label*/
		private Image image;
        
        /** name of the label*/
		private String name;
        
        /**
          * constructor
          * @param name
          * @param image
          */
		public PropertyLabelProvider(String name, Image image) {
			this.image = image;
			this.name = name;
		}
        
        /**
         * get text of the label after choose
         * @param obj
         * @return text of the label String
         */
		public String getText(Object obj) {
			Object value = getPropertyValue(name);
			return value != null ? value.toString() : "";
		}
        
        /**
         * get image of the label after choose
         * @param obj
         * @return image Image
         */
		public Image getImage(Object obj) {
			return image;
		}
	}

    /**
     * constructor
     * @param objBaseObject
     */
	public BasePropertySource(BaseObject objBaseObject) {
		super(objBaseObject);
	}

    /**
     * get editable value
     * @return value Object
     */
	public Object getEditableValue() {
		return null;
	}

    /**
     * get base object
     * @return object BaseObject
     */
	public BaseObject getBaseObject() {
		return object;
	}

    /**
     * get Property descriptors
     * @return Property descriptors IPropertyDescriptor[]
     */
	public IPropertyDescriptor[] getPropertyDescriptors() {
		return null;
	}

    /**
     * get property value according the name of the property
     * @return property value Object
     */
	public Object getPropertyValue(Object name) {
		return "";
	}

    /**
     * set property value according the name of the property
     * @param name of the property
     * @param value of the property
     */
	public void setPropertyValue(Object name, Object value) {
	}

    /**
     * is property set 
     * @param id Object
     */
	public boolean isPropertySet(Object id) {
		return false;
	}

    /**
     * reset property value
     * @param id Object
     */
	public void resetPropertyValue(Object id) {
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?