⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gernatedialog.java

📁 生成与Oracle相关的Ibatis相关配置文件及Java源码
💻 JAVA
字号:
/*
 * Copyright (c) 2008 胜利油田胜利软件有限责任公司. All rights reserved.
 */
package com.victorysoft.code.ui;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

import com.victorysoft.code.base.CodeMakerConst;

/**
 * 
 * @author 于景洋
 * @newtime Oct 29, 2008,1:08:30 PM
 * @version 1.0
 * @see     
 * @since   JDK 1.5.0
 */
public class GernateDialog extends Dialog {

	private Text t_basedir;
	private Text t_project;
	private Button cx_ibatis;
	private Button cx_spring;
	private Button cx_factory;
	private Button cx_log4j;
	/**
	 * Create the dialog
	 * @param parentShell
	 */
	public GernateDialog(Shell parentShell) {
		super(parentShell);
	}

	/**
	 * Create contents of the dialog
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		final GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		container.setLayout(gridLayout);

		final Label l_project = new Label(container, SWT.NONE);
		l_project.setText("项目名称:");

		t_project = new Text(container, SWT.BORDER);
		final GridData gd_t_project = new GridData(SWT.FILL, SWT.CENTER, true, false);
		t_project.setLayoutData(gd_t_project);

		final Label l_basedir = new Label(container, SWT.NONE);
		l_basedir.setText("输出目录:");

		t_basedir = new Text(container, SWT.BORDER);
		final GridData gd_t_basedir = new GridData(SWT.FILL, SWT.CENTER, true, false);
		t_basedir.setLayoutData(gd_t_basedir);

		cx_ibatis = new Button(container, SWT.CHECK);
		final GridData gd_cx_ibatis = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		cx_ibatis.setLayoutData(gd_cx_ibatis);
		cx_ibatis.setText("生成Ibatis配置文件");

		cx_spring = new Button(container, SWT.CHECK);
		final GridData gd_cx_spring = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		cx_spring.setLayoutData(gd_cx_spring);
		cx_spring.setText("生成Spring配置文件");

		cx_factory = new Button(container, SWT.CHECK);
		final GridData gd_cx_factory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		cx_factory.setLayoutData(gd_cx_factory);
		cx_factory.setText("生成工厂类(Factory)");

		cx_log4j = new Button(container, SWT.CHECK);
		final GridData gd_cx_log4j = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		cx_log4j.setLayoutData(gd_cx_log4j);
		cx_log4j.setText("生成Log4j日志文件");
		
		t_project.setText(CodeMakerConst.project);
		t_basedir.setText(CodeMakerConst.basedir);
		cx_ibatis.setSelection(CodeMakerConst.isGenerateIbatis);
		cx_spring.setSelection(CodeMakerConst.isGenerateSpring);
		cx_factory.setSelection(CodeMakerConst.isGenerateFactory);
		cx_log4j.setSelection(CodeMakerConst.isGenerateLog4j);
		//
		return container;
	}

	/**
	 * Create contents of the button bar
	 * @param parent
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent) {
		createButton(parent, IDialogConstants.OK_ID, "确定",
				true);
		createButton(parent, IDialogConstants.CANCEL_ID,
				"取消", false);
	}

	/**
	 * Return the initial size of the dialog
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(337, 214);
	}
	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setText("生成设置");
	}
	protected void buttonPressed(int buttonId) {
		if (buttonId == IDialogConstants.OK_ID) {
			CodeMakerConst.project = t_project.getText();
			CodeMakerConst.basedir=t_basedir.getText();
			CodeMakerConst.isGenerateIbatis=cx_ibatis.getSelection();
			CodeMakerConst.isGenerateSpring=cx_spring.getSelection();
			CodeMakerConst.isGenerateFactory=cx_factory.getSelection();
			CodeMakerConst.isGenerateLog4j=cx_log4j.getSelection();
		}
		super.buttonPressed(buttonId);
	}

}

⌨️ 快捷键说明

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