sqleditor.java

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

JAVA
98
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/sql/SQLEditor.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.sql;

import java.io.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.internal.ui.editor.IPDEEditorPage;
import com.webpump.ui.base.data.*;
import com.webpump.ui.base.gui.*;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;

/**
 * Class for editor to edit SQL.
 * 
 * @author luo_sa
 * @version 2.0.0 2004-2-24
 */
public class SQLEditor extends BaseEditor {
       
    /**
     * Parse the properties'info to Data Model
     */
    protected BaseModel createResourceModel(IFile file) {
        
        this.m_objFile = file;
        InputStream stream = null;
        
        try {
            //读文?内容
            stream = file.getContents(false);       
        } catch (CoreException e1) {
            WebpumpIDEPlugin.log(e1);
        }
        
        BaseModel objModel = new SQLModel();
        
        try {
            objModel.load(stream, false);
        } catch (Exception e) {
            WebpumpIDEPlugin.log(e);    
        }
        
        try {
            stream.close();
        } catch(IOException e) {
            WebpumpIDEPlugin.log(e);    
        }       
        return objModel;              
    }
    
    /**
     * Create pages of the editor 
     */
    protected void createPages() {
        
        firstPageId = MacroResource.SQLEDITOR_EDITOR_ID;
        formWorkbook.setFirstPageSelected(false);
        SQLPage objSqlPage = new SQLPage(this, WebpumpIDEPlugin.getResourceString(MacroResource.SQLEDITOR_EDITOR_NAME));         
        addPage(MacroResource.SQLEDITOR_EDITOR_ID, objSqlPage);
        addPage(MacroResource.EDITOR_SOURCE_PAGE_ID, new BaseSourcePage(this, WebpumpIDEPlugin.getResourceString(MacroResource.EDITOR_SOURCE_PAGE_NAME)));       
    }
    
    /**
     * Return the editor's defaut page.
     */
    public IPDEEditorPage getHomePage() {     
        return getPage(MacroResource.SQLEDITOR_EDITOR_ID);
    }
    
    /**
     * Return the editor's source page.
     */
    protected String getSourcePageId() {
        return MacroResource.EDITOR_SOURCE_PAGE_ID;
    }

}

⌨️ 快捷键说明

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