Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-04-12 20:17:56 -0400
committerMichael Valenta2002-04-12 20:17:56 -0400
commit12829346d330fcd085bb836055cfe1eb9070bcd1 (patch)
treed0656bdc882c142d3cca370edc584593ff777faa
parentbce866cdee11509ebbe694e382aa2344142fa21e (diff)
downloadeclipse.platform.team-12829346d330fcd085bb836055cfe1eb9070bcd1.tar.gz
eclipse.platform.team-12829346d330fcd085bb836055cfe1eb9070bcd1.tar.xz
eclipse.platform.team-12829346d330fcd085bb836055cfe1eb9070bcd1.zip
*** empty log message ***MV_10890_branch
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties5
4 files changed, 144 insertions, 43 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java
new file mode 100644
index 000000000..1754edd0b
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class AvoidableMessageDialog extends MessageDialog {
+ Button dontShowAgain;
+ boolean dontShow;
+ boolean showOption;
+
+ public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ this(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex, true);
+ }
+
+ public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, boolean showOption) {
+ super(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
+ this.showOption = showOption;
+ }
+
+ protected Control createCustomArea(Composite composite) {
+ if ( ! showOption) return null;
+ dontShow = false;
+ dontShowAgain = new Button(composite, SWT.CHECK);
+ GridData data = new GridData();
+ data.horizontalIndent = 50;
+ dontShowAgain.setLayoutData(data);
+ dontShowAgain.setText(Policy.bind("AvoidableMessageDialog.dontShowAgain")); //$NON-NLS-1$
+ dontShowAgain.setSelection(dontShow);
+ dontShowAgain.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ dontShow = dontShowAgain.getSelection();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ });
+ return dontShowAgain;
+ }
+
+ public boolean isDontShowAgain() {
+ return dontShow;
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java
index fe0ffa308..fc1d5968e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java
@@ -47,46 +47,6 @@ public class CVSMoveDeleteHook implements IMoveDeleteHook {
public interface IRunnableWithShell {
public void run(Shell shell);
}
-
- public class MoveDeleteMessageDialog extends MessageDialog {
- Button dontShowAgain;
- boolean dontShow;
- boolean showOption;
-
- public MoveDeleteMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- this(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex, true);
- }
-
- public MoveDeleteMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, boolean showOption) {
- super(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
- this.showOption = showOption;
- }
-
- protected Control createCustomArea(Composite composite) {
- if ( ! showOption) return null;
- dontShow = false;
- dontShowAgain = new Button(composite, SWT.CHECK);
- GridData data = new GridData();
- data.horizontalIndent = 50;
- dontShowAgain.setLayoutData(data);
- dontShowAgain.setText(Policy.bind("CVSMoveDeleteHook.dontShowAgain")); //$NON-NLS-1$
- dontShowAgain.setSelection(dontShow);
- dontShowAgain.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- dontShow = dontShowAgain.getSelection();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
- return dontShowAgain;
- }
-
- public boolean isDontShowAgain() {
- return dontShow;
- }
- }
private void showDialog(final IRunnableWithShell runnable) {
Display.getDefault().syncExec(new Runnable() {
@@ -177,7 +137,7 @@ public class CVSMoveDeleteHook implements IMoveDeleteHook {
if ( ! performDelete[0]){
showDialog(new IRunnableWithShell() {
public void run(Shell shell) {
- MoveDeleteMessageDialog dialog = new MoveDeleteMessageDialog(
+ AvoidableMessageDialog dialog = new AvoidableMessageDialog(
shell,
title,
null, // accept the default window icon
@@ -237,7 +197,7 @@ public class CVSMoveDeleteHook implements IMoveDeleteHook {
dialogShown = true;
showDialog(new IRunnableWithShell() {
public void run(Shell shell) {
- MoveDeleteMessageDialog dialog = new MoveDeleteMessageDialog(
+ AvoidableMessageDialog dialog = new AvoidableMessageDialog(
shell,
title,
null, // accept the default window icon
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
index c1fe5140b..b5ebe4fbd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
@@ -13,21 +13,28 @@ import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
@@ -41,6 +48,55 @@ public class TagAction extends TeamAction {
// The previously remembered tag
private static String previousTag = ""; //$NON-NLS-1$
+ /**
+ * Copied from CVSDecorationRunnable
+ */
+ protected boolean isDirty(IResource resource) {
+ final CoreException DECORATOR_EXCEPTION = new CoreException(new Status(IStatus.OK, "id", 1, "", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ resource.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) throws CoreException {
+
+ // a project can't be dirty, continue with its children
+ if (resource.getType() == IResource.PROJECT) {
+ return true;
+ }
+
+ // if the resource does not exist in the workbench or on the file system, stop searching.
+ if(!resource.exists()) {
+ return false;
+ }
+
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ try {
+ if (!cvsResource.isManaged()) {
+ if (cvsResource.isIgnored()) {
+ return false;
+ } else {
+ // new resource, show as dirty
+ throw DECORATOR_EXCEPTION;
+ }
+ }
+ if (!cvsResource.isFolder()) {
+ if (((ICVSFile) cvsResource).isModified()) {
+ // file has changed, show as dirty
+ throw DECORATOR_EXCEPTION;
+ }
+ }
+ } catch (CVSException e) {
+ return true;
+ }
+ // no change -- keep looking in children
+ return true;
+ }
+ }, IResource.DEPTH_INFINITE, true);
+ } catch (CoreException e) {
+ //if our exception was caught, we know there's a dirty child
+ return e == DECORATOR_EXCEPTION;
+ }
+ return false;
+ }
+
/*
* @see IActionDelegate#run(IAction)
*/
@@ -49,6 +105,25 @@ public class TagAction extends TeamAction {
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
+ final IResource[] resources = getSelectedResources();
+ boolean isAnyDirty = false;
+ for (int i = 0; i < resources.length; i++) {
+ if(isDirty(resources[i])) {
+ isAnyDirty = true;
+ }
+ }
+
+ // Confirm tagging with locally modified resources
+ if (isAnyDirty) {
+ final Shell shell = getShell();
+ final boolean[] result = new boolean[] { false };
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ result[0] = MessageDialog.openConfirm(getShell(), Policy.bind("TagAction.uncommittedChangesTitle"), Policy.bind("TagAction.uncommittedChanges")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ if (!result[0]) return;
+ }
final String[] result = new String[1];
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index cb1b2c1d2..26e82888d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -26,6 +26,8 @@ AddToWorkspaceAction.confirmOverwrite=Confirm Overwrite
AutoDefineTagsAction.defineTags = Auto-discover tags
+AvoidableMessageDialog.dontShowAgain=Don't show this again
+
BranchWizard.createABranch=Creates a new CVS Branch
BranchWizard.title=Branch
BranchWizard.errorTagging=Error Tagging Resources
@@ -129,7 +131,6 @@ CVSMoveDeleteHook.deleteFolderTitle=Deletion of CVS Controlled Folder
CVSMoveDeleteHook.deleteFolderMessage=Folder ''{0}'' is under CVS control. Files are marked as outgoing deletions. The deletion of the folder and any subfolders will be postponed until you commit the file deletions.
CVSMoveDeleteHook.moveFolderTitle=Move of CVS Controlled Folder
CVSMoveDeleteHook.moveFolderMessage=Folder ''{0}'' is under CVS control. A move results in the deletion of the folder from its old location. In order to properly communicate this deletion to CVS, the old folder and any subfolders will remain and files contained in this folder will be marked as outgoing deletions. Any empty folders will be pruned when the deletions are committed.
-CVSMoveDeleteHook.dontShowAgain=Don't show this again
CVSMoveDeleteHook.Team_Private_Resource_1=Team Private Resource
CVSMoveDeleteHook.Deletion_of_team_private_resources_is_not_permitted_2=Deletion of team private resource ''{0}'' is not permitted
CVSMoveDeleteHook.folderDeletionFailure=Folder ''{0}'' was not deleted in order to properly communicate file deletions to CVS
@@ -482,6 +483,8 @@ TagAction.tagWarningTitle=Warnings Occured
TagAction.tagProblemsMessage=Problems reported during tag operation
TagAction.tagResources=Tag Resources
TagAction.enterTag=Please enter a version tag:
+TagAction.uncommittedChangesTitle=Uncommitted Changes
+TagAction.uncommittedChanges=You are tagging resources that have uncommitted changes. Would you like to continue?
UpdateAction.update=Problems encountered performing update
UpdateAction.updating=Updating...

Back to the top