1 11 package org.eclipse.team.internal.ccvs.ui.wizards; 12 13 14 import org.eclipse.core.resources.IProject; 15 import org.eclipse.jface.dialogs.Dialog; 16 import org.eclipse.jface.resource.ImageDescriptor; 17 import org.eclipse.swt.SWT; 18 import org.eclipse.swt.layout.GridData; 19 import org.eclipse.swt.widgets.*; 20 import org.eclipse.team.core.TeamException; 21 import org.eclipse.team.internal.ccvs.core.ICVSFolder; 22 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 23 import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; 24 import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; 25 import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; 26 import org.eclipse.team.internal.ccvs.ui.*; 27 import org.eclipse.ui.PlatformUI; 28 29 35 public class ConfigurationWizardAutoconnectPage extends CVSWizardPage { 36 private boolean validate = true; 37 private FolderSyncInfo info; 38 ICVSRepositoryLocation location; 39 40 public ConfigurationWizardAutoconnectPage(String pageName, String title, ImageDescriptor titleImage) { 41 super(pageName, title, titleImage); 42 } 43 44 47 public void createControl(Composite parent) { 48 Composite composite = createComposite(parent, 2, false); 49 setControl(composite); 50 51 PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARING_AUTOCONNECT_PAGE); 53 54 Label description = new Label(composite, SWT.WRAP); 55 GridData data = new GridData(); 56 data.horizontalSpan = 2; 57 data.widthHint = 350; 58 description.setLayoutData(data); 59 description.setText(CVSUIMessages.ConfigurationWizardAutoconnectPage_description); 60 61 if (location == null) return; 62 63 createLabel(composite, ""); createLabel(composite, ""); 67 createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_user); 68 createLabel(composite, location.getUsername()); 69 createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_host); 70 createLabel(composite, location.getHost()); 71 createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_port); 72 int port = location.getPort(); 73 if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) { 74 createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_default); 75 } else { 76 createLabel(composite, "" + port); } 78 createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_connectionType); 79 createLabel(composite, location.getMethod().getName()); 80 createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_repositoryPath); 81 createLabel(composite, location.getRootDirectory()); 82 createLabel(composite, CVSUIMessages.ConfigurationWizardAutoconnectPage_module); 83 createLabel(composite, info.getRepository()); 84 85 createLabel(composite, ""); createLabel(composite, ""); 89 final Button check = new Button(composite, SWT.CHECK); 90 data = new GridData(); 91 data.horizontalSpan = 2; 92 check.setText(CVSUIMessages.ConfigurationWizardAutoconnectPage_validate); 93 check.addListener(SWT.Selection, new Listener() { 94 public void handleEvent(Event event) { 95 validate = check.getSelection(); 96 } 97 }); 98 check.setSelection(true); 99 Dialog.applyDialogFont(parent); 100 } 101 102 public FolderSyncInfo getFolderSyncInfo() { 103 return info; 104 } 105 public boolean getValidate() { 106 return validate; 107 } 108 public boolean setProject(IProject project) { 109 try { 110 ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project); 111 info = folder.getFolderSyncInfo(); 112 if (info == null) { 113 CVSUIPlugin.openError(null, CVSUIMessages.ConfigurationWizardAutoconnectPage_noSyncInfo, CVSUIMessages.ConfigurationWizardAutoconnectPage_noCVSDirectory, null); return false; 116 } 117 location = CVSRepositoryLocation.fromString(info.getRoot()); 118 return true; 119 } catch (TeamException e) { 120 CVSUIPlugin.openError(null, null, null, e); 121 return false; 122 } 123 } 124 125 129 public ICVSRepositoryLocation getLocation() { 130 return location; 131 } 132 133 } 134 | Popular Tags |