datasourceeditor.java

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

JAVA
118
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/datasource/editor/DataSourceEditor.java,v 1.2 2004/12/29 09:45:30 wang_j Exp $
 * $Revision: 1.2 $
 * $Date: 2004/12/29 09:45:30 $
 *
 * ====================================================================
 *
 * 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.datasource.editor;

import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.pde.internal.ui.editor.*;

import com.webpump.ui.datasource.data.*;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;
import com.webpump.ui.base.gui.*;
import com.webpump.ui.base.data.*;
/**
 * Class for the datasource editor.
 * 
 * @author zhang_tx
 * @version 2.0.0 2004-2-2
 */
public class DataSourceEditor extends BaseEditor{
	/** A project which contains the resource file */
	private IProject m_objProject;
	private String m_strPrefix = "";

	
	public DataSourceEditor(){
		super();
	}
	
	/**
	 * Create the resource model for the file.
	 * @param file
	 */
	protected BaseModel createResourceModel(IFile file)
		throws CoreException
	{
		this.m_objFile  = file;
		DataSourceModel objDataSourceModel = WebpumpIDEPlugin.getDataSourceModelToSQL(file,true);
		m_strPrefix = (file.getLocation().removeLastSegments(2)).toString();
		return objDataSourceModel;
	}
	/**
	 * Create pages on this editor
	 */
	protected void createPages() {
		firstPageId = MacroResource.DATASOURCE_EDITOR_EDITORID;
		formWorkbook.setFirstPageSelected(false);
		//Create an object of the DataSourcePage whose name is "DataSource编辑?"
		DataSourcePage datasourcePage =
			new DataSourcePage(this, 
			                   (WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_EDITOR_FIRSTPAGE_NAME)));
			
		//Add the datasource page to the editor, whose ID is "DataSource编辑?"			
		addPage((WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_EDITOR_FIRSTPAGE_NAME)), datasourcePage);
		//Add a new page of SoucePage on this editor, whose ID is "源代?"
		addPage((WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_EDITOR_SECONDPAGE_NAME)), 
		         new BaseSourcePage(this,(WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_EDITOR_SECONDPAGE_NAME))));
	}


	/**
	 * Create the model for the input file
	 * @param input
	 */
	protected Object createModel(Object input) throws CoreException {
	
		//Create the resource model if the input is an instance of IFile
		if(input instanceof IFile){
			m_strPrefix = (((IFile)input).getLocation().removeLastSegments(2)).toString();
			return createResourceModel((IFile)input);
		}
			
		//Create the storage model if the input is an instance of IStorage
		if (input instanceof IStorage)
			return createStorageModel((IStorage) input);		
		else
			return null;
			
	}
	
	/**
	 * Get the Page whose ID is "DataSource编辑?"
	 */
	public IPDEEditorPage getHomePage() {

		return getPage((WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_EDITOR_FIRSTPAGE_NAME)));
	}
	
	/**
	 * Get the Source Page ID "源代?"
	 */
	protected String getSourcePageId() {

		return (WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_EDITOR_SECONDPAGE_NAME));
	}
	
	public String getProjectPath(){
		return m_strPrefix;
	}
}

⌨️ 快捷键说明

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