I want to create a ‘new project’ wizard for my application. The first page of this wizard is simply the instance of org.eclipse.ui.dialogs.WizardNewProjectCreationPage. I want to import some system files to current project in the second wizard page. I found that org.eclipse.ui.dialogs.WizardResourceImportPage is quite close to my thougts, but I can’t figour out how to inherit this class and produce a simple file import page.
Can anyone offer an example of doing this? Thanks!
I also tried to test it like below (overrided getFileProvider too), but the file tree shows only the checkbox but no filename.
protected ITreeContentProvider getFolderProvider()
{
// TODO Auto-generated method stub
return new WorkbenchContentProvider()
{
public Object[] getChildren( Object o )
{
if ( o instanceof java.io.File )
return FileSystemStructureProvider.INSTANCE.getChildren( o ).toArray();
else
return new Object[]{new java.io.File("C:\\temp")};
}
public boolean hasChildren( Object o )
{
if ( o instanceof java.io.File )
return FileSystemStructureProvider.INSTANCE.isFolder( o );
else
return false;
}
};
}
WizardResourceImportPageis abstract, you can extend it and implement the three abstract methods. I’d have a look atWizardFileSystemResourceImportPage1which is working implementation ofWizardResourceImportPageand either study that code or copy and paste source from that class to my own.Edit
You’re example from above only shows blank labels because
WizardResourceImportPageuses aWorkbenchLabelProviderand this label provider will return""if the ‘content’ object (Filein your case) is not adaptable.Look at the
createFileSelectionGroupmethod. Maybe it’s enough to implement your ownLabelProviderforFileobjects and callselectionGroup.setTreeProviders(ITreeContentProvider, ILabelProvider)to make it work withFileitems in the tree. The standard implementions seems to work with (eclipse) file resources only.