[問題] 關於wizardPage的用法
我先前在研究wizard時,都是用範例看跑出來的結果,現在我自己寫了一個繼承wizardPage
的calss然在先前的範例上用"add(nweWiardPage);"加入我自己寫的page,但是run的
結果總會出現"no arguments"的錯誤訊息,以下是我的程式碼,想問說我是缺少了什
麼東西嗎QQ~~~~謝謝>"<
package org.eclipse.vlsi_cad_tool_helper.wizards;
import java.io.File;
import javax.swing.JFileChooser;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
public class DC_readDesign extends WizardPage{
/**
*
* */
IWorkbench workbench;
IStructuredSelection selection;
private Text fileField;
private Button open;
//private Button cancel;
private File []files;
public DC_readDesign(String pageName) {
super(pageName);
// TODO Auto-generated constructor stub
super.setTitle("step-1");
super.setDescription("input your all designs");
}
/***
*
* */
public DC_readDesign(IWorkbench workbench, IStructuredSelection selection) {
super("Page1");
setTitle("Your Holiday");
setDescription("Select the details of your holiday");
this.workbench = workbench;
this.selection = selection;
}
//add component
public void createControl(Composite parent) {
// TODO Auto-generated method stub
parent.setLayout(new RowLayout());
fileField = new Text(parent, SWT.SINGLE | SWT.BORDER);
fileField.setEditable(false);
open = new Button(parent, SWT.PUSH);
open.setText("Browse...");
open.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e)
{
int status = JFileChooser.CANCEL_OPTION;
/*
* use property
*/
JFileChooser choose = new JFileChooser(".");
choose.setMultiSelectionEnabled(true);
status = choose.showOpenDialog(null);
if (status == JFileChooser.APPROVE_OPTION)
{
files = choose.getSelectedFiles();
fileField.setText(files[0].getParent());
for(int i=1; i<files.length ; i++)
fileField.append(";"+files[i].getParent());
}
}
});
//cancel = new Button(parent, SWT.PUSH);
}
public String []getFileNames()
{
String []names = new String[files.length];
for(int i=0; i<files.length ; i++)
names[i] = files[i].getName();
return names;
}
public String []getPathes()
{
String []pathes = new String[files.length];
for(int i=0; i<files.length ; i++)
pathes[i] = files[i].getParent();
return pathes;
}
public int getNumFiles()
{
return files.length;
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.229.134.104
Eclipse 近期熱門文章
PTT數位生活區 即時熱門文章
-4
30