exceptiontabledialogpage.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 352 行
JAVA
352 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/exception/ExceptionTableDialogPage.java,v 1.1.1.1 2004/07/01 09:07:45 wang_j Exp $
* $Revision: 1.1.1.1 $
* $Date: 2004/07/01 09:07:45 $
*
* ====================================================================
*
* 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.exception;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.layout.GridData;
import com.webpump.ui.exception.data.*;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;
/**
* Create or modify ExceptionTable dialog's layout
*
* @author zhao_f
* @version 2.0.0 2004-2-13
*/
public class ExceptionTableDialogPage extends WizardPage{
/** a data object which stores the params got from the dialog*/
private ExceptionInfo m_objExceptionInfo;
/** a String group which stores the params got from the dialog*/
private String[] exceptionInfoParam = new String[6];
/** the text about handler*/
private Text m_strHandlerText;
/** the text about key*/
private Text m_strKeyText;
/** the text about name*/
private Text m_strNameText;
/** the text about path*/
private Text m_strPathText;
/** the text about scope*/
private Combo m_strScopeCombo;
/** the text about type*/
private Text m_strTypeText;
/**
* the constructor
*/
public ExceptionTableDialogPage( )
{
super(WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_WIZARD_PAGE));
//Set the title of the dialog page
setTitle(WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_DIALOG_PAGE_TITLE));
//set the description about the dialog under the title
setDescription(WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_DIALOG_PAGE_DESCRIPTION));
}
/**
* Set the dialog's layout
* @param parent Composite
*/
public void createControl(Composite parent){
final Composite area = new Composite(parent, SWT.NONE);
final GridLayout gridLayout = new GridLayout();
gridLayout.makeColumnsEqualWidth = true;
gridLayout.numColumns = 6;
area.setLayout(gridLayout);
setControl(area);
{
final Group group = new Group(area, SWT.NONE);
group.setText(WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_GROUP_TEXT));
final GridLayout gridLayout_1 = new GridLayout();
gridLayout_1.makeColumnsEqualWidth = true;
gridLayout_1.numColumns = 6;
group.setLayout(gridLayout_1);
final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
gridData.horizontalSpan = 6;
gridData.verticalSpan = 60;
group.setLayoutData(gridData);
{
final Label label = new Label(group, SWT.NONE);
final GridData gridData_1 = new GridData();
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 2;
label.setLayoutData(gridData_1);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_NAME));
}
{
m_strNameText = new Text(group, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 4;
m_strNameText.setLayoutData(gridData_1);
m_strNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validInput();
}
}
);
}
{
final Label label = new Label(group, SWT.NONE);
final GridData gridData_1 = new GridData();
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 2;
label.setLayoutData(gridData_1);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_TYPE));
}
{
m_strTypeText = new Text(group, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 4;
m_strTypeText.setLayoutData(gridData_1);
m_strTypeText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validInput();
}
}
);
}
{
final Label label = new Label(group, SWT.NONE);
final GridData gridData_1 = new GridData();
gridData_1.horizontalSpan = 2;
gridData_1.verticalSpan = 2;
label.setLayoutData(gridData_1);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_HANDLER));
}
{
m_strHandlerText = new Text(group, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 4;
m_strHandlerText.setLayoutData(gridData_1);
m_strHandlerText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validInput();
}
}
);
}
{
final Label label = new Label(group, SWT.NONE);
final GridData gridData_1 = new GridData();
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 2;
label.setLayoutData(gridData_1);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_PATH));
}
{
m_strPathText = new Text(group, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 4;
m_strPathText.setLayoutData(gridData_1);
m_strPathText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validInput();
}
}
);
}
{
final Label label = new Label(group, SWT.NONE);
final GridData gridData_1 = new GridData();
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 2;
label.setLayoutData(gridData_1);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_KEY));
}
{
m_strKeyText = new Text(group, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 4;
m_strKeyText.setLayoutData(gridData_1);
m_strKeyText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validInput();
}
}
);
}
{
final Label label = new Label(group, SWT.NONE);
final GridData gridData_1 = new GridData();
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 2;
label.setLayoutData(gridData_1);
label.setText(WebpumpIDEPlugin.getResourceLabelString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_SCOPE));
}
{
m_strScopeCombo = new Combo(group, SWT.READ_ONLY);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.verticalSpan = 2;
gridData_1.horizontalSpan = 4;
m_strScopeCombo.setLayoutData(gridData_1);
}
}
initData();
}
/**
* Initiate the page data
*/
public void initData(){
//Make the nameText uneditable when selecting "edit" button
if(ExceptionAllSection.enabled == true){
m_strNameText.setEnabled(false);
}
m_strNameText.setText(ExceptionAllSection.dialogParams[0]);
m_strKeyText.setText(ExceptionAllSection.dialogParams[1]);
m_strTypeText.setText(ExceptionAllSection.dialogParams[2]);
WebpumpIDEPlugin.setComboxValue(m_strScopeCombo,new String[]{"request","session"});
WebpumpIDEPlugin.setComboxSelect(m_strScopeCombo,ExceptionAllSection.dialogParams[3]);
m_strHandlerText.setText(ExceptionAllSection.dialogParams[4]);
m_strPathText.setText(ExceptionAllSection.dialogParams[5]);
}
/**
* Get the ExceptionInfo data object
*/
public ExceptionInfo getExceptionInfo(){
return m_objExceptionInfo;
}
/**
* Get the params in the dialog and stores them in the String group
*/
public String[] getParams(){
exceptionInfoParam[0] = m_strNameText.getText();
exceptionInfoParam[1] = m_strKeyText.getText();
exceptionInfoParam[2] = m_strTypeText.getText();
exceptionInfoParam[3] = m_strScopeCombo.getText();
exceptionInfoParam[4] = m_strHandlerText.getText();
exceptionInfoParam[5] = m_strPathText.getText();
return exceptionInfoParam;
}
/**
* Set the value of ExceptionInfo object
* @param objExceptionInfo
*/
public void setExceptionInfo(ExceptionInfo objExceptionInfo){
m_objExceptionInfo = objExceptionInfo;
}
private void validInput()
{
setMessage(WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_DIALOG_PAGE_DESCRIPTION),NONE);
setPageComplete(true);
MacroResource.MESSAGE_PARAM[0] = WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_NAME);
MacroResource.MESSAGE_PARAM[1] = m_strNameText.getText();
if (m_strNameText.getText().trim().length()<1) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.EMPTY_DESCRIPTION),MacroResource.MESSAGE_PARAM),ERROR); //$NON-NLS-1$
setPageComplete(false);
return;
}
IStatus val= JavaConventions.validateImportDeclaration(m_strTypeText.getText());
MacroResource.MESSAGE_PARAM[0] = WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_TYPE);
MacroResource.MESSAGE_PARAM[1] = m_strTypeText.getText();
if (val.getSeverity() == IStatus.ERROR) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.ERROR_DESCRIPTION),MacroResource.MESSAGE_PARAM),ERROR); //$NON-NLS-1$
setPageComplete(false);
return;
} else if (val.getSeverity() == IStatus.WARNING) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.WARN_DESCRIPTION),MacroResource.MESSAGE_PARAM),WARNING); //$NON-NLS-1$
}
val= JavaConventions.validateImportDeclaration(m_strHandlerText.getText());
MacroResource.MESSAGE_PARAM[0] = WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_HANDLER);
MacroResource.MESSAGE_PARAM[1] = m_strHandlerText.getText();
if (val.getSeverity() == IStatus.ERROR) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.ERROR_DESCRIPTION),MacroResource.MESSAGE_PARAM),ERROR); //$NON-NLS-1$
setPageComplete(false);
return;
} else if (val.getSeverity() == IStatus.WARNING) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.WARN_DESCRIPTION),MacroResource.MESSAGE_PARAM),WARNING); //$NON-NLS-1$
}
MacroResource.MESSAGE_PARAM[0] = WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_PATH);
MacroResource.MESSAGE_PARAM[1] = m_strPathText.getText();
if (m_strPathText.getText().trim().length()<1) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.EMPTY_DESCRIPTION),MacroResource.MESSAGE_PARAM),ERROR); //$NON-NLS-1$
setPageComplete(false);
return;
}
MacroResource.MESSAGE_PARAM[0] = WebpumpIDEPlugin.getResourceString(MacroResource.EXCEPTIONTABLEDIALOGPAGE_KEY);
MacroResource.MESSAGE_PARAM[1] = m_strKeyText.getText();
if (m_strKeyText.getText().trim().length()<1) {
setMessage(NewWizardMessages.getFormattedString(WebpumpIDEPlugin.getResourceString(MacroResource.EMPTY_DESCRIPTION),MacroResource.MESSAGE_PARAM),ERROR); //$NON-NLS-1$
setPageComplete(false);
return;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?