performsection.java

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

JAVA
123
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/sql/PerformSection.java,v 1.1.1.1 2004/07/01 09:07:52 wang_j Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/07/01 09:07:52 $
 *
 * ====================================================================
 *
 * 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 org.eclipse.core.resources.IFile;
import org.eclipse.pde.internal.ui.editor.PDEFormSection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.update.ui.forms.internal.*;
import com.webpump.ui.base.gui.BasePage;
import com.webpump.ui.datasource.data.DataSourceModel;
import com.webpump.ui.datasource.data.SourceList;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;

/**
 * Class for section to show results of executing sql.
 * 
 * @author luo_sa
 * @version 2.0.0 2004-2-24
 */
public class PerformSection extends PDEFormSection {
    
    /** table for showing */
    private Table m_objTable;
    
    /** performing button */
    private Button m_buttonPerform;
    
	/** a Combo used to select database */
	private CCombo m_comboConnectDataBase;
	    
    /**
     * Constructor
     * 
     * @param page
     */
    public PerformSection(BasePage page) {
        
        super(page);        
        setHeaderText(WebpumpIDEPlugin.getResourceString(MacroResource.PERFORMSECTION_HEADER_TEXT));
    }
    
    /**
     * Create layout of this section.
     */
    public Composite createClient(Composite parent, FormWidgetFactory factory) {
        
        Composite container = factory.createComposite(parent);
        container.setLayout(new GridLayout());        
        {
        	
        	
			final Composite composite = factory.createComposite(container, SWT.NONE);
			final GridLayout gridLayout = new GridLayout();
			gridLayout.makeColumnsEqualWidth = true;
			gridLayout.numColumns = 8;
			composite.setLayout(gridLayout);
			final GridData gridData = new GridData(GridData.FILL_BOTH);
			gridData.horizontalSpan = 9;
			composite.setLayoutData(gridData);
			{
				final Label label = factory.createLabel(composite,WebpumpIDEPlugin.getResourceString(MacroResource.CONNECTDATABASESECTION_SELECT_DATABASE), SWT.NONE);
				final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
				gridData_1.horizontalSpan = 2;
				label.setLayoutData(gridData_1);				
			}
			{            
				m_comboConnectDataBase = new CCombo(composite, SWT.Selection|SWT.BORDER);
				final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
				gridData_1.horizontalSpan = 2;
				m_comboConnectDataBase.setLayoutData(gridData_1);
				m_comboConnectDataBase.addSelectionListener(new SelectionAdapter() { 
					public void widgetSelected(SelectionEvent e) {
						SQLSection objSqlSection = ((SQLForm) (getFormPage().getForm())).getSqlSection();
						if (objSqlSection.getShowSQLText().getText().length() > 0) {
							PerformSection objPerformSection =  ((SQLForm)(getFormPage().getForm())).getPerformSection();
							objPerformSection.getPerformButton().setEnabled(true);
						}
					}
	
				});
				m_comboConnectDataBase.pack();
				m_comboConnectDataBase.setBackground(factory.getBackgroundColor());
				m_comboConnectDataBase.setForeground(factory.getForegroundColor());	
			}
			
			{
				final Composite composite_1 = factory.createComposite(composite, SWT.NONE);
				final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_END);
				gridData_1.horizontalSpan = 4;
				composite_1.setLayoutData(gridData_1);
				final GridLayout gridLayout_1 = new GridLayout();
				gridLayout_1.numColumns = 5;
				composite_1.setLayout(gridLayout_1);
				{
					m_buttonPerform = factory.createButton(composite_1, WebpumpIDEPlugin.getResourceString(MacroResource.PERFORMSECTION_PERFORM), SWT.NONE);
					m_buttonPerform.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END|GridData.GRAB_HORIZONTAL));
					//按钮按下执行SQL

⌨️ 快捷键说明

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