ダイアログ その 2
TitleAreaDialog の派生クラスの名前は CreateJarDialog にしようと思ったのですが、Create が動詞なんですよね。そういえば、CreateJarActionDelegate なんて名前をつけてしまった。やっぱり、CreatingJarActionDelegate かなぁ。
とりあえず、CreateJarDialog にしておいて、後で気にくわなかったら変更しようと思います。
まずは、昨日の状態のままクラスを独立させました。
public class CreateJarDialog extends TitleAreaDialog { private IJavaProject project; private Text jarFilenameText; private Text titleText; private Text mainClassText; private Text iconFilenameText; private Text configFilenameText; public CreateJarDialog(Shell shell, IJavaProject project) { super(shell); this.project = project; IProject p = project.getProject(); System.out.println("Default: " + Platform.getLocation().toOSString()); System.out.println("Default: " + p.getLocation().toOSString()); System.out.println("Default: " + p.getLocation()); System.out.println("Path: " + project.getPath().toPortableString()); System.out.println("Path: " + p.getFile(project.getPath().toPortableString())); System.out.println("Path: " + p.getFolder(project.getPath().toPortableString())); } public Control createDialogArea(Composite parent) { setTitle("Create JAR File."); setMessage("Fill in the form.", IMessageProvider.NONE); return super.createDialogArea(parent); } protected void createButtonsForButtonBar(Composite parent) { createButton( parent, IDialogConstants.OK_ID, "Create", true); createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); } }
CreateJarActionDelegate クラスの run メソッドはこうなっています。
public void run(IAction action) { CreateJarDialog dialog = new CreateJarDialog(shell, project); if (dialog.open() == IDialogConstants.OK_ID) { createJar(dialog); } }
createJar メソッドはまだ空っぽです。
明日からは、ここにいろいろくっつけていきます。