⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pagepropertysource.java

📁 一个eclipse插件源代码。用于web开发
💻 JAVA
字号:
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/module/editor/PagePropertySource.java,v 1.1.1.1 2004/07/01 09:07:50 wang_j Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/07/01 09:07:50 $
 *
 * ====================================================================
 *
 * 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.module.editor;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;

import com.webpump.ui.base.data.BaseObject;
import com.webpump.ui.base.gui.BasePropertySource;
import com.webpump.ui.module.model.Model;
import com.webpump.ui.module.model.Page;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;

/**
 * Class for property source of Page
 * 
 * @author shi_l
 * @version 2.0.0 2004-2-26
 */
public class PagePropertySource extends BasePropertySource {

	/** Id of page name shown in property sheet*/
	private final static String PAGE_NAME = "Name";

	/** Id of package name shown in property sheet*/
	private final static String PACKAGE_NAME = "Package";

	/** Id of base type shown in property sheet*/
	private final static String BASE_TYPE = "Basetype";

	/** Id of session check shown in property sheet*/
	private final static String SESSION_CHECK = "Sessioncheck";

	/**
	 * Class for property label provider
	 * 
	 * @author shi_l
	 * @version 2.0.0 2004-2-26
	 */
	public class PropertyLabelProvider extends LabelProvider {
		/** image of the label*/
		private Image image;

		/** name of the label*/
		private String name;

		/** type of the label*/
		private String type;

		/**
		 * constructor
		 * @param name
		 * @param image
		 * @param type
		 */
		public PropertyLabelProvider(String name, Image image, String type) {
			this.image = image;
			this.name = name;
			this.type = type;
		}

		/**
		 * get text of the label after choose
		 * @param obj
		 * @return text of the label String
		 */
		public String getText(Object obj) {
			Object value = getPropertyValue(name);
			if (value instanceof Integer) {
				if (type.equals("boolean")) {
					//boolean型显示true & false
					if (((Integer) value).intValue() == 1) {
						return "true";
					} else {
						return "false";
					}
				} else if (type.equals("basetype")) {
					//basetype型显示Error & Base
					if (((Integer) value).intValue() == 1) {
						return "Error";
					} else {
						return "Base";
					}
				}
			}
			return 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 PagePropertySource(BaseObject objBaseObject) {
		super(objBaseObject);
	}

	/**
	 * get property descriptors
	 * @return descriptors IPropertyDescriptor[]
	 */
	public IPropertyDescriptor[] getPropertyDescriptors() {
		if (descriptors == null) {
			descriptors = new PropertyDescriptor[4];

			//页面名称栏
			descriptors[0] =
				createModifiedPropertyDescriptor(
					PAGE_NAME,
					WebpumpIDEPlugin.getResourceString(MacroResource.MODULE_PAGE_NAME));

			//

⌨️ 快捷键说明

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