1 19 20 package org.netbeans.modules.projectimport.eclipse.wizard; 21 22 import java.awt.Component ; 23 import java.beans.PropertyChangeEvent ; 24 import java.beans.PropertyChangeListener ; 25 import java.io.File ; 26 import java.util.Set ; 27 import org.netbeans.modules.projectimport.eclipse.EclipseUtils; 28 import org.openide.WizardDescriptor; 29 import org.openide.WizardValidationException; 30 31 36 final class ProjectWizardPanel extends ImporterWizardPanel implements 37 PropertyChangeListener , WizardDescriptor.ValidatingPanel { 38 39 private ProjectSelectionPanel panel; 40 41 42 ProjectWizardPanel() { 43 panel = new ProjectSelectionPanel(); 44 panel.addPropertyChangeListener(this); 45 initPanel(panel, 1); 46 } 47 48 public Component getComponent() { 49 return panel; 50 } 51 52 public void propertyChange(PropertyChangeEvent evt) { 53 if ("errorMessage".equals(evt.getPropertyName())) { setErrorMessage((String ) evt.getNewValue()); 55 } 56 } 57 58 Set getProjects() { 60 return panel.getProjects(); 61 } 62 63 int getNumberOfImportedProject() { 64 return panel.getNumberOfImportedProject(); 65 } 66 67 String getDestination() { 68 return panel.getDestination(); 69 } 70 71 void loadProjects(String workspaceDir) { 72 panel.loadProjects(workspaceDir); 73 } 74 75 public void validate() throws WizardValidationException { 76 String dest = panel.getDestination(); 77 if (!new File (dest).isAbsolute() || !EclipseUtils.isWritable(dest)) { 78 String message = ProjectImporterWizard.getMessage( 79 "MSG_CannotCreateProjectInFolder", dest); setErrorMessage(message); 81 throw new WizardValidationException(panel, message, null); 82 } 83 } 84 } 85 | Popular Tags |