Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation Philippe Ombredanne - bug 84808 /
 
 package org.eclipse.team.internal.ccvs.ui.wizards;
 
 import java.util.List;
 
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.events.SelectionAdapter;
 import  org.eclipse.swt.events.SelectionEvent;
 import  org.eclipse.swt.layout.GridData;
 import  org.eclipse.swt.widgets.*;
This page allows the user to select the target parent container for the folders being checked out.
 
 public class CheckoutAsProjectSelectionPage extends CVSWizardPage {
 	
 	public static final String NAME = "CheckoutAsProjectSelectionPage"//$NON-NLS-1$
 	
 	private TreeViewer tree;
 	private Text nameField;
 	private Combo filterList;
 	
 	private IResource selection;
 	private String folderName;
 	private int filter;

Constructor for CheckoutIntoProjectSelectionPage.

Parameters:
pageName
title
titleImage
 
 	public CheckoutAsProjectSelectionPage(ImageDescriptor titleImageICVSRemoteFolder[] remoteFolders) {
 		this. = remoteFolders;
 	}

Returns:
 
 	private boolean isSingleFolder() {
 		return . == 1;
 	}
 	
 	/*
 	 * For the single folder case, return the name of the folder
 	 */
 	private String getInputFolderName() {
 	}
 	
 	private String getRepository() throws CVSException {
 	}

See also:
org.eclipse.jface.dialogs.IDialogPage.createControl(org.eclipse.swt.widgets.Composite)
 
 	public void createControl(Composite parent) {
 		Composite compositecreateComposite(parent, 2, false);
 		setControl(composite);
 		
 		
 		if (isSingleFolder()) {
 			 = createTextField(composite);
 			.addListener(SWT.Modify, new Listener() {
 				public void handleEvent(Event event) {
 					 = .getText();
 				}
 			});
		}
		 = createResourceSelectionTree(composite. | ., 2 /* horizontal span */);
			public void selectionChanged(SelectionChangedEvent event) {
			}
		});
		Composite filterComposite = createComposite(composite, 2, false);
		GridData data = new GridData();
		data.verticalAlignment = GridData.FILL;
		data.horizontalAlignment = GridData.FILL;
		data.horizontalSpan = 2;
		filterComposite.setLayoutData(data);
		 = createCombo(filterComposite);
		.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
			}
		});
		createWrappingLabel(composite"", 0, 2); //$NON-NLS-1$
		.getControl().setFocus();
        Dialog.applyDialogFont(parent);
	}

Method initializeValues.
	private void initializeValues() {
		if (isSingleFolder()) {
		}
		.setInput(ResourcesPlugin.getWorkspace().getRoot());
		 = 0;
	}
		ISelection sel = event.getSelection();
		if (sel.isEmpty()) {
			this. = null;
else if (sel instanceof IStructuredSelection) {
		}
	}

Method updateWidgetEnablement.
	private void updateWidgetEnablements() {
			return;
		}
		boolean complete =  != null && .getType() != .;
		setPageComplete(complete);
	}

Returns the selection.

Returns:
IResource
	public IResource getSelection() {
		return ;
	}
	private void updateTreeContents(int selected) {
		try {
			if (selected == 0) {
else if (selected == 1) {
else if (selected == 2) {
			}
catch (CVSException e) {
			CVSUIPlugin.log(e);
		}
	}

Method getValidTargetProjects returns the set of projects that match the provided criteria.

Returns:
IResource
	private IProject[] getProjects(String rootboolean unsharedthrows CVSException {
		List validTargets = new ArrayList();
		try {
			IResource[] projects = ResourcesPlugin.getWorkspace().getRoot().members();
			for (int i = 0; i < projects.lengthi++) {
				IResource resource = projects[i];
				if (resource instanceof IProject) {
					IProject project = (IProjectresource;
					if (project.isAccessible()) {
						RepositoryProvider provider = RepositoryProvider.getProvider(project);
						if (provider == null && unshared) {
							validTargets.add(project);
else if (provider != null && provider.getID().equals(CVSProviderPlugin.getTypeId())) {
							ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(project);
							FolderSyncInfo info = cvsFolder.getFolderSyncInfo();
							if (root != null && info != null && root.equals(info.getRoot())) {
								validTargets.add(project);
							}
						}
					}
				}
			}
catch (CoreException e) {
			throw CVSException.wrapException(e);
		}
		return (IProject[]) validTargets.toArray(new IProject[validTargets.size()]);
	}
			return ((IContainer)getSelection()).getFolder(new Path(null));
else {
			return null;
		}
	}
	}
	private void handleFilterSelection() {
		 = .getSelectionIndex();
	}
New to GrepCode? Check out our FAQ X