}
});
ClickUtils.createLabel(classGroup, ClickPlugin.getString("wizard.newPage.pageClassGroup.package"));
ContentAssistField packageField = new ContentAssistField(classGroup, SWT.BORDER,
new TextControlCreator(), new TextContentAdapter(), packageAssistProvider,
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0]);
packageName = (Text)packageField.getControl();
packageField.getLayoutControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if(selection instanceof IPackageFragment){
packageName.setText(((IPackageFragment)selection).getElementName());
} else if(initPackage!=null && initPackage.length()!=0){
packageName.setText(initPackage);
} else if(getProject()!=null){
String pagesPackage = ClickUtils.getPagePackageName(getProject());
if(pagesPackage != null){
packageName.setText(pagesPackage);
}
}
packageName.addModifyListener(new ModifyListener(){
public void modifyText(ModifyEvent e){
validate();
}
});
browsePackage = new Button(classGroup, SWT.PUSH);
browsePackage.setText(ClickPlugin.getString("action.browse"));
browsePackage.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent evt){
IRunnableContext context= new BusyIndicatorRunnableContext();
int style = PackageSelectionDialog.F_REMOVE_DUPLICATES |
PackageSelectionDialog.F_SHOW_PARENTS |
PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE;
JavaSearchScope scope = new JavaSearchScope();
try {
IJavaProject project = JavaCore.create(getProject());
scope.add((JavaProject)project, JavaSearchScope.SOURCES, new HashSet<Integer>(2, 1));
} catch(Exception ex){
ClickPlugin.log(ex);
}
PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, style, scope);
dialog.setMultipleSelection(false);
if(dialog.open()==PackageSelectionDialog.OK){
Object[] result = dialog.getResult();
if(result.length >= 1){
IPackageFragment fragment = (IPackageFragment)result[0];
packageName.setText(fragment.getElementName());
}
}
}
});
ClickUtils.createLabel(classGroup, ClickPlugin.getString("wizard.newPage.pageClassGroup.classname"));
Composite classField = FieldAssistUtils.createNullDecoratedPanel(classGroup, false);
className = new Text(classField, SWT.BORDER);
classField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
className.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if(initClassName!=null){
className.setText(initClassName);
}
className.addModifyListener(new ModifyListener(){
public void modifyText(ModifyEvent e){
validate();
}
});
ClickUtils.createLabel(classGroup, "");
ClickUtils.createLabel(classGroup, ClickPlugin.getString("wizard.newPage.pageClassGroup.superclass"));
ContentAssistField superClassField = new ContentAssistField(classGroup, SWT.BORDER,
new TextControlCreator(), new TextContentAdapter(), typeAssistProvider,
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0]);
superClass = (Text)superClassField.getControl();
superClassField.getLayoutControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
superClass.setText(settings.get(NewClickPageWizard.SUPERCLASS));
superClass.addModifyListener(new ModifyListener(){