Search in sources :

Example 1 with ConfigurationWizardMainPage

use of org.tigris.subversion.subclipse.ui.wizards.ConfigurationWizardMainPage in project subclipse by subclipse.

the class SharingWizard method addPages.

/**
 * add pages
 */
public void addPages() {
    ImageDescriptor sharingImage = SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_WIZBAN_SHARE);
    if (project.getLocation() == null) {
        CannotSharePage cannotSharePage = new CannotSharePage("cannotSharePage", Policy.bind("SharingWizard.importTitle"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        project);
        addPage(cannotSharePage);
    } else if (doesSVNDirectoryExist()) {
        // if .svn directory exists, we add the autoconnect page
        autoconnectPage = new ConfigurationWizardAutoconnectPage("autoconnectPage", Policy.bind("SharingWizard.autoConnectTitle"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        projectStatus);
        autoconnectPage.setProject(project);
        autoconnectPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.autoConnectTitleDescription"));
        addPage(autoconnectPage);
    } else {
        try {
            ISVNLocalFolder localFolder = SVNWorkspaceRoot.getSVNFolderFor(project);
            if (localFolder instanceof LocalFolder) {
                IFolder[] svnFolders = ((LocalFolder) localFolder).getSVNFolders(null, false);
                if (svnFolders.length > 0) {
                    warningPage = new SvnFoldersExistWarningPage("warningPage", Policy.bind("SharingWizard.importTitle"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
                    svnFolders);
                    // $NON-NLS-1$
                    warningPage.setDescription(Policy.bind("SharingWizard.svnFolderExists"));
                    addPage(warningPage);
                // Remember to update getNextPage.
                }
            }
        } catch (SVNException e) {
            SVNUIPlugin.openError(getShell(), null, null, e, SVNUIPlugin.PERFORM_SYNC_EXEC);
        }
        // otherwise we add :
        // - the repository selection page
        // - any contributed repository source pages
        // - the create location page
        // - the module selection page
        // - the finish page
        IRunnableWithProgress runnable = new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                locations = SVNUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations(monitor);
            }
        };
        try {
            new ProgressMonitorDialog(getShell()).run(true, false, runnable);
        } catch (Exception e) {
            SVNUIPlugin.openError(getShell(), null, null, e, SVNUIPlugin.LOG_TEAM_EXCEPTIONS);
        }
        locationPage = new RepositorySelectionPage("importPage", Policy.bind("SharingWizard.importTitle"), // $NON-NLS-1$ //$NON-NLS-2$
        sharingImage);
        locationPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.importTitleDescription"));
        addPage(locationPage);
        ISVNRepositorySourceProvider[] repositorySourceProviders = null;
        try {
            repositorySourceProviders = SVNUIPlugin.getRepositorySourceProviders();
        } catch (Exception e) {
        }
        if (repositorySourceProviders != null && repositorySourceProviders.length > 0) {
            repositorySourceProviderPage = new ConfigurationWizardRepositorySourceProviderPage("source", Policy.bind("NewLocationWizard.heading"), SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_WIZBAN_NEW_LOCATION), // $NON-NLS-1$ //$NON-NLS-2$
            repositorySourceProviders);
            repositorySourceProviderPage.setDescription(// $NON-NLS-1$
            Policy.bind("NewLocationWizard.0"));
            addPage(repositorySourceProviderPage);
            for (ISVNRepositorySourceProvider repositorySourceProvider : repositorySourceProviders) {
                SVNRepositoryProviderWizardPage wizardPage = repositorySourceProvider.getWizardPage();
                addPage(wizardPage);
                wizardPageMap.put(repositorySourceProvider, wizardPage);
            }
        }
        createLocationPage = new ConfigurationWizardMainPage("createLocationPage", Policy.bind("SharingWizard.enterInformation"), // $NON-NLS-1$ //$NON-NLS-2$
        sharingImage);
        createLocationPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.enterInformationDescription"));
        addPage(createLocationPage);
        createLocationPage.setDialogSettings(getDialogSettings());
        ISVNRepositoryLocationProvider repositoryLocationProvider = new ISVNRepositoryLocationProvider() {

            public ISVNRepositoryLocation getLocation() throws TeamException {
                return SharingWizard.this.getLocation();
            }

            public IProject getProject() {
                return SharingWizard.this.getProject();
            }
        };
        directoryPage = new DirectorySelectionPage("modulePage", Policy.bind("SharingWizard.enterModuleName"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        repositoryLocationProvider);
        directoryPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.enterModuleNameDescription"));
        addPage(directoryPage);
        finishPage = new SharingWizardFinishPage("finishPage", Policy.bind("SharingWizard.readyToFinish"), sharingImage, // $NON-NLS-1$ //$NON-NLS-2$
        repositoryLocationProvider);
        finishPage.setDescription(// $NON-NLS-1$
        Policy.bind("SharingWizard.readyToFinishDescription"));
        addPage(finishPage);
    }
}
Also used : ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ConfigurationWizardMainPage(org.tigris.subversion.subclipse.ui.wizards.ConfigurationWizardMainPage) SVNException(org.tigris.subversion.subclipse.core.SVNException) SVNRepositoryProviderWizardPage(org.tigris.subversion.subclipse.ui.wizards.SVNRepositoryProviderWizardPage) ConfigurationWizardRepositorySourceProviderPage(org.tigris.subversion.subclipse.ui.wizards.ConfigurationWizardRepositorySourceProviderPage) InvocationTargetException(java.lang.reflect.InvocationTargetException) CoreException(org.eclipse.core.runtime.CoreException) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IOException(java.io.IOException) IProject(org.eclipse.core.resources.IProject) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) ISVNLocalFolder(org.tigris.subversion.subclipse.core.ISVNLocalFolder) ISVNLocalFolder(org.tigris.subversion.subclipse.core.ISVNLocalFolder) LocalFolder(org.tigris.subversion.subclipse.core.resources.LocalFolder) ISVNRepositorySourceProvider(org.tigris.subversion.subclipse.ui.ISVNRepositorySourceProvider) TeamException(org.eclipse.team.core.TeamException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Aggregations

IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 TeamException (org.eclipse.team.core.TeamException)1 ISVNLocalFolder (org.tigris.subversion.subclipse.core.ISVNLocalFolder)1 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1 LocalFolder (org.tigris.subversion.subclipse.core.resources.LocalFolder)1 ISVNRepositorySourceProvider (org.tigris.subversion.subclipse.ui.ISVNRepositorySourceProvider)1 ConfigurationWizardMainPage (org.tigris.subversion.subclipse.ui.wizards.ConfigurationWizardMainPage)1 ConfigurationWizardRepositorySourceProviderPage (org.tigris.subversion.subclipse.ui.wizards.ConfigurationWizardRepositorySourceProviderPage)1 SVNRepositoryProviderWizardPage (org.tigris.subversion.subclipse.ui.wizards.SVNRepositoryProviderWizardPage)1