diff options
author | Michael Valenta | 2004-12-10 18:42:38 +0000 |
---|---|---|
committer | Michael Valenta | 2004-12-10 18:42:38 +0000 |
commit | bb180d8058ed211932add2bcc2cf98af3252b261 (patch) | |
tree | a2b683e4d19ba74a2c0fd9802838878ec21ab53e /bundles/org.eclipse.team.cvs.ui/src/org | |
parent | 8b690f7f21f64619918abf54163f68c13e9d7f13 (diff) | |
download | eclipse.platform.team-bb180d8058ed211932add2bcc2cf98af3252b261.tar.gz eclipse.platform.team-bb180d8058ed211932add2bcc2cf98af3252b261.tar.xz eclipse.platform.team-bb180d8058ed211932add2bcc2cf98af3252b261.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org')
4 files changed, 94 insertions, 36 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MappingSelectionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MappingSelectionDialog.java new file mode 100644 index 000000000..5885b18a7 --- /dev/null +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MappingSelectionDialog.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.internal.ccvs.ui.actions; + +import org.eclipse.core.resources.mapping.ResourceMapping; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter; +import org.eclipse.team.internal.ui.dialogs.DetailsDialog; + +/** + * Dialog that will display any mappings that contain resources whose + * sync state match the provided filter. + */ +public class MappingSelectionDialog extends DetailsDialog { + + private final ResourceMapping[] mappings; + private final FastSyncInfoFilter resourceFilter; + + public MappingSelectionDialog(Shell parentShell, String dialogTitle, ResourceMapping[] mappings, FastSyncInfoFilter resourceFilter) { + super(parentShell, dialogTitle); + this.mappings = mappings; + this.resourceFilter = resourceFilter; + } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected void createMainDialogArea(Composite parent) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected Composite createDropDownDialogArea(Composite parent) { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements() + */ + protected void updateEnablements() { + // TODO Auto-generated method stub + + } + + /** + * @return + */ + public ResourceMapping[] promtpToSelectMappings() { + if (hasMatchingMappings()) { + int code = open(); + if (code == OK) { + // TODO: + return; + } + } + return new ResourceMapping[0]; + } + +} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java index 849356f12..6143ae87a 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java @@ -10,28 +10,23 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.actions; -import org.eclipse.core.resources.IResource; -import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator; -import org.eclipse.team.internal.ccvs.ui.Policy; +import org.eclipse.core.resources.mapping.ResourceMapping; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter; +import org.eclipse.team.core.synchronize.SyncInfo; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter; import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation; import org.eclipse.team.internal.ccvs.ui.operations.TagOperation; -import org.eclipse.team.internal.ui.dialogs.IPromptCondition; -import org.eclipse.team.internal.ui.dialogs.PromptingDialog; public class TagLocalAction extends TagAction { - IResource[] resources; + ResourceMapping[] mappings; protected boolean performPrompting() { // Prompt for any uncommitted changes - PromptingDialog prompt = new PromptingDialog(getShell(), getSelectedResources(), - getPromptCondition(), Policy.bind("TagAction.uncommittedChangesTitle"));//$NON-NLS-1$ - try { - resources = prompt.promptForMultiple(); - } catch(InterruptedException e) { - return false; - } - if(resources.length == 0) { + mappings = getCVSResourceMappings(); + MappingSelectionDialog dialog = new MappingSelectionDialog(getShell(), "Tag Uncommitted Changes?", mappings, getResourceFilter()); + mappings = dialog.promtpToSelectMappings(); + if(mappings.length == 0) { // nothing to do return false; } @@ -39,22 +34,14 @@ public class TagLocalAction extends TagAction { return true; } - protected ITagOperation createTagOperation() { - return new TagOperation(getTargetPart(), getCVSResourceMappings()); - } - - /** - * Note: This method is designed to be overridden by test cases. - */ - protected IPromptCondition getPromptCondition() { - return new IPromptCondition() { - public boolean needsPrompt(IResource resource) { - return CVSLightweightDecorator.isDirty(resource); - } - public String promptMessage(IResource resource) { - return Policy.bind("TagAction.uncommittedChanges", resource.getName());//$NON-NLS-1$ - } - }; - } + private FastSyncInfoFilter getResourceFilter() { + // Return a filter that selects outgoing changes + return new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING }); + } + protected ITagOperation createTagOperation() { + if (mappings == null) + mappings = getCVSResourceMappings(); + return new TagOperation(getTargetPart(), mappings); + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java index 53037149d..ad384958d 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java @@ -58,7 +58,7 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction { * within a CVS managed project */ protected ResourceMapping[] getCVSResourceMappings() { - return getSelectedResourceMappers(CVSProviderPlugin.getTypeId()); + return getSelectedResourceMappings(CVSProviderPlugin.getTypeId()); } /** diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java index 1ffa1c7f1..73f91d081 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java @@ -26,14 +26,13 @@ import org.eclipse.team.internal.ccvs.ui.Policy; /** * Tag source that gets its tags from the projects exist in the workspace - * and are mapped to the same repository as the seed project */ public class LocalProjectTagSource extends TagSource { public static TagSource create(IProject seedProject) { try { ICVSRemoteFolder seedFolder = ((ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(seedProject)); - ICVSRemoteFolder[] remoteFolders = getProjectRemoteFolders(seedFolder.getRepository()); + ICVSRemoteFolder[] remoteFolders = getProjectRemoteFolders(); if (remoteFolders.length == 1) { // There are no other projects to get tags from so return null return null; @@ -57,7 +56,7 @@ public class LocalProjectTagSource extends TagSource { /* * Return the list of remote folders for the projects in the workspace mapped to the given repository */ - private static ICVSRemoteFolder[] getProjectRemoteFolders(ICVSRepositoryLocation repository) { + private static ICVSRemoteFolder[] getProjectRemoteFolders() { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); List result = new ArrayList(); for (int i = 0; i < projects.length; i++) { @@ -65,7 +64,7 @@ public class LocalProjectTagSource extends TagSource { try { if (project.isAccessible() && RepositoryProvider.isShared(project)) { ICVSRemoteFolder remote = (ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(project); - if (remote != null && remote.getRepository().equals(repository)) { + if (remote != null) { result.add(remote); } } |