Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-10-26 18:56:25 +0000
committerMichael Valenta2004-10-26 18:56:25 +0000
commit1f71cebd0ae21007c1ba7d82238919ea25607b16 (patch)
treeae4afa99cc89462b1ba98dcf46bb527797f2ef0d
parent59f0781e9895708d123de2194289614201386bba (diff)
downloadeclipse.platform.team-1f71cebd0ae21007c1ba7d82238919ea25607b16.tar.gz
eclipse.platform.team-1f71cebd0ae21007c1ba7d82238919ea25607b16.tar.xz
eclipse.platform.team-1f71cebd0ae21007c1ba7d82238919ea25607b16.zip
Bug 75438 Show Annotations not working for *.exsd files
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java56
4 files changed, 47 insertions, 43 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java
index f47b0a82d..ff813c717 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java
@@ -10,13 +10,14 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.core.client;
-public class Annotate extends AbstractMessageCommand {
-
/**
* The CVS Annotate Command.
* Answers a resource with each line annotated with the revision the line
* was added/changed and the user making the change.
*/
+public class Annotate extends AbstractMessageCommand {
+
+ public static final Object FORCE_BINARY_ANNOTATE = new LocalOption("-F"); //$NON-NLS-1$
protected Annotate() { }
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
index 9f72e4402..e7e190b74 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
@@ -14,10 +14,9 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -49,10 +48,28 @@ public class ShowAnnotationAction extends WorkspaceAction {
final String revision= getRevision(cvsResource);
if (revision == null)
return;
- new ShowAnnotationOperation(getTargetPart(), cvsResource, revision).run();
+ boolean binary = isBinary(cvsResource);
+ if (binary) {
+ if (!MessageDialog.openQuestion(getShell(), Policy.bind("ShowAnnotationAction.2"), Policy.bind("ShowAnnotationAction.3", cvsResource.getName()))) { //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ }
+ new ShowAnnotationOperation(getTargetPart(), cvsResource, revision, binary).run();
}
- /**
+ private boolean isBinary(ICVSResource cvsResource) {
+ if (cvsResource.isFolder()) return false;
+ try {
+ byte[] syncBytes = ((ICVSFile)cvsResource).getSyncBytes();
+ if (syncBytes == null)
+ return false;
+ return ResourceSyncInfo.isBinary(syncBytes);
+ } catch (CVSException e) {
+ return false;
+ }
+ }
+
+ /**
* Ony enabled for single resource selection
*/
protected boolean isEnabled() throws TeamException {
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 519a8ce17..0a5c2d135 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
@@ -1070,6 +1070,8 @@ SafeUpdateAction.warnFilesWithConflictsDescription=Some conflicting files cannot
Error.unableToShowSyncView=Error opening Synchronize View. Please ensure that the Team plugin is installed correctly.
ShowAnnotationAction.1=Unexpected response from CVS Server: {0}
+ShowAnnotationAction.2=Annotate Binary File?
+ShowAnnotationAction.3=File {0} is marked as a binary file. The CVS annotation operation only works properly for files that contain text. Do you wish to continue?
UpdateAction.jobName=CVS Update
MergeUpdateAction.jobName=CVS Merge
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
index dd85c51f1..cf33ca6e5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
@@ -11,49 +11,30 @@
package org.eclipse.team.internal.ccvs.ui.operations;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.variants.IResourceVariant;
-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.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.client.Annotate;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.client.*;
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.listeners.AnnotateListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.AnnotateView;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.*;
/**
* An operation to fetch the annotations for a file from the repository and
@@ -63,11 +44,14 @@ public class ShowAnnotationOperation extends CVSOperation {
final private ICVSResource fCVSResource;
final private String fRevision;
+ private final boolean binary;
- public ShowAnnotationOperation(IWorkbenchPart part, ICVSResource cvsResource, String revision) {
+ public ShowAnnotationOperation(IWorkbenchPart part, ICVSResource cvsResource, String revision, boolean binary) {
super(part);
fCVSResource= cvsResource;
fRevision= revision;
+ this.binary = binary;
+
}
/* (non-Javadoc)
@@ -159,14 +143,14 @@ public class ShowAnnotationOperation extends CVSOperation {
final Command.QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
try {
CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- final Command.LocalOption[] localOption;
- if (revision == null) {
- localOption = Command.NO_LOCAL_OPTIONS;
- } else {
- localOption = new Command.LocalOption[1];
- localOption[0] = Annotate.makeRevisionOption(revision);
+ List localOptions = new ArrayList();
+ if (revision != null) {
+ localOptions.add(Annotate.makeRevisionOption(revision));
+ }
+ if (binary) {
+ localOptions.add(Annotate.FORCE_BINARY_ANNOTATE);
}
- final IStatus status = Command.ANNOTATE.execute(session, Command.NO_GLOBAL_OPTIONS, localOption, new ICVSResource[]{cvsResource}, listener, Policy.subMonitorFor(monitor, 90));
+ final IStatus status = Command.ANNOTATE.execute(session, Command.NO_GLOBAL_OPTIONS, (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]), new ICVSResource[]{cvsResource}, listener, Policy.subMonitorFor(monitor, 90));
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
}

Back to the top