📄 createlogicbeanpage.java
字号:
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/datasource/dialog/CreateLogicBeanPage.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.dialog;
import java.io.File;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import com.webpump.ui.datasource.editor.DataSourceTableSection;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;
import com.webpump.ui.project.ModuleInfo;
import com.webpump.ui.project.ModuleList;
import com.webpump.ui.project.ProjectInfo;
import com.webpump.ui.project.ProjectModel;
/**
* Create or modify ExceptionTable dialog's layout
*
* @author zhang_tx
* @version 2.0.0 2004-2-24
*/
public class CreateLogicBeanPage extends WizardPage {
private Combo m_objComboModuleSel;
//全部创建复选框控?
private Button m_buttonAllCreate;
//?新原有代?复选框控?
private Button m_buttonRecovery;
/** the table to show in the dialog */
private Table m_objTable;
private Text m_objText;
/** the table items in the dialog **/
private Vector m_objdata;
private String m_strPrefix = "";
private CreateLogicBeanPage self = this;
/**
* the contributor
*/
public CreateLogicBeanPage(String projectPath) {
super("wizardPage");
m_strPrefix = projectPath;
// set Title field
//setTitle("页面变量设置");
setTitle(WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_DIALOG_TITLE));
setPageComplete(false);
}
/**
* Set the dialog's layout
* @param parent Composite
*/
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
final GridLayout gridLayout_1 = new GridLayout();
gridLayout_1.marginHeight = 0;
gridLayout_1.makeColumnsEqualWidth=true;
gridLayout_1.numColumns = 4;
composite.setLayout(gridLayout_1);
setControl(composite);
{
{
final Label label = new Label(parent, SWT.NONE);
label.setText(WebpumpIDEPlugin.getResourceString(MacroResource.CREATESOURCEDIALOGVIEW_SELECT_MODEL));
final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 4;
label.setLayoutData(gridData);
}
{
m_objTable = new Table(composite, SWT.FULL_SELECTION|SWT.H_SCROLL|SWT.MULTI|SWT.DEFAULT|SWT.CHECK);
final GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 4;
m_objTable.setLayoutData(gridData);
m_objTable.setLinesVisible(true);
m_objTable.setHeaderVisible(true);
{
final TableColumn tableColumn = new TableColumn(m_objTable, SWT.NONE);
tableColumn.setWidth(100);
tableColumn.setText(WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_TABLEITEMA));
}
{
m_buttonAllCreate = new Button(composite, SWT.CHECK);
m_buttonAllCreate.setText(WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_ALL_CREATE));
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.horizontalSpan = 2;
m_buttonAllCreate.setLayoutData(gridData_1);
m_buttonAllCreate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e){
setItemCheck();
}
});
}
}
{
m_buttonRecovery = new Button(composite, SWT.CHECK);
m_buttonRecovery.setText(WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_COVER));
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.horizontalSpan = 2;
m_buttonRecovery.setLayoutData(gridData_1);
}
{
//属性??0 "Author"
final Label label = new Label(composite,SWT.LEFT);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.DATASOURCE_MODULE_SEL));
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.horizontalSpan = 1;
label.setLayoutData(gridData_1);
}
{
m_objComboModuleSel = new Combo(composite, SWT.READ_ONLY);
String []ComboText = getComboText();
WebpumpIDEPlugin.setComboxValue(m_objComboModuleSel,ComboText);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.horizontalSpan = 3;
m_objComboModuleSel.setLayoutData(gridData_1);
m_objComboModuleSel.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e){
if (m_objComboModuleSel.getText().trim().length() > 0) {
String strModulePath = m_strPrefix;
strModulePath += "/module/" + m_objComboModuleSel.getText();
File moduleFile = new File(strModulePath);
if(!moduleFile.exists()){
self.setDescription(WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_DIALOG_ALARM));
}
m_objText.setText( m_objComboModuleSel.getText()+".dbbean");
setPageComplete(true);
String textContent = m_objComboModuleSel.getText();
}
}
});
}
{
//属性??0 "Author"
final Label label = new Label(composite,SWT.NONE);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.DATASOURCE_TABLEITEMB));
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.horizontalSpan = 1;
label.setLayoutData(gridData_1);
}
{
m_objText = new Text(composite, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.horizontalSpan = 3;
m_objText.setLayoutData(gridData_1);
m_objText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e){
if (m_objComboModuleSel.getText().trim().length() > 0) {
String textContent = m_objText.getText();
MacroResource.MESSAGE_PARAM[0] = WebpumpIDEPlugin.getResourceString(MacroResource.DATASOURCE_PACKAGENAME);
MacroResource.MESSAGE_PARAM[1] = textContent;
IStatus val= JavaConventions.validatePackageName(textContent);
if (val.getSeverity() == IStatus.ERROR) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.ERROR_DESCRIPTION),MacroResource.MESSAGE_PARAM),ERROR); //$NON-NLS-1$
setPageComplete(false);
} else if (val.getSeverity() == IStatus.WARNING) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.WARN_DESCRIPTION),MacroResource.MESSAGE_PARAM),WARNING); //$NON-NLS-1$
// continue checking
} else{
setPageComplete(true);
setMessage("");
}
}
}
});
}
}
init();
}
private void setItemCheck()
{
for (int i = 0 ;i<m_objTable.getItemCount();i++)
{
if (m_buttonAllCreate.getSelection())
{
m_objTable.getItem(i).setChecked(true);
}
else
{
m_objTable.getItem(i).setChecked(false);
}
}
}
/** set the table item content
*
* @param newData the new data to show
*/
public void setData(Vector newData){
m_objdata = newData;
}
/**
* Init the page
*
*/
public void init() {
int index = 0;
for(int i=0;i<DataSourceTableSection.m_objtablename.size();i++){
TableItem tableitem0 = new TableItem(m_objTable,index++);
tableitem0.setText(0,(String)DataSourceTableSection.m_objtablename.get(i));
}
}
/** get the table
*
* @return Table
*/
public Table getTable(){
return m_objTable;
}
/**
* get recovery param
*
* @return boolean
*/
public boolean getParam()
{
return m_buttonRecovery.getSelection();
}
public String getModuleName(){
return m_objComboModuleSel.getText();
}
public String getPackageName(){
return m_objText.getText();
}
public String[] getComboText(){
IPath ProjectPath = new Path(m_strPrefix);
ProjectModel projectModel = WebpumpIDEPlugin.getProjectModelEx(ProjectPath,false);
ModuleList m_objModuleList = (ModuleList)((ProjectInfo)projectModel.getDataObject()).getChild()[0];
Object []m_objModuleInfo = m_objModuleList.getChild();
String ComboText[] = new String[m_objModuleInfo.length];
for(int i=0;i<m_objModuleInfo.length;i++){
ModuleInfo info = (ModuleInfo)m_objModuleInfo[i];
ComboText[i] = info.getModelInfo()[1];
}
return ComboText;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -