|
From: Mikael P. <er...@us...> - 2012-02-16 07:37:45
|
Update of /cvsroot/eclipse-ccase/net.sourceforge.eclipseccase/src/net/sourceforge/eclipseccase
In directory vz-cvs-4.sog:/tmp/cvs-serv10175/src/net/sourceforge/eclipseccase
Modified Files:
Tag: mike_diff_checkin
StateCacheFactory.java ClearCaseProvider.java
PreventCheckoutHelper.java ClearCaseModificationHandler.java
MoveHandler.java
Log Message:
Merged from HEAD
Index: ClearCaseProvider.java
===================================================================
RCS file: /cvsroot/eclipse-ccase/net.sourceforge.eclipseccase/src/net/sourceforge/eclipseccase/ClearCaseProvider.java,v
retrieving revision 1.72
retrieving revision 1.72.2.1
diff -C2 -d -r1.72 -r1.72.2.1
*** ClearCaseProvider.java 21 Nov 2011 11:10:56 -0000 1.72
--- ClearCaseProvider.java 16 Feb 2012 07:37:43 -0000 1.72.2.1
***************
*** 16,20 ****
--- 16,24 ----
import java.text.MessageFormat;
import java.util.*;
+ import java.util.regex.Matcher;
+ import java.util.regex.Pattern;
+
import net.sourceforge.clearcase.ClearCase;
+ import net.sourceforge.clearcase.ClearCaseCLIImpl;
import net.sourceforge.clearcase.ClearCaseElementState;
import net.sourceforge.clearcase.ClearCaseException;
***************
*** 84,91 ****
--- 88,105 ----
public static final String NO_ACTIVITY = "No activity in view";
+ public static final String UNRESERVED = "unreserved";
+
+ public static final String RESERVED = "reserved";
+
+ // is used to keep track of which views that has a file checked out when
+ // doing a move.
+ public static final ArrayList<String> checkedOutInOtherView = new ArrayList<String>();
+
boolean refreshResources = true;
private OperationListener opListener = null;
+ private boolean isTest = false;
+
public ClearCaseProvider() {
super();
***************
*** 399,402 ****
--- 413,461 ----
}
+ /**
+ * Parsers single/multiple line/-s of output. Type.java Predecessor:
+ * /main/dev/0 View:eraonel_w12b2 Status: unreserved
+ *
+ * @param element
+ * @return
+ */
+ public boolean isCheckedOutInAnyView(String element) {
+ //UCM we do not need to know of another stream co.
+ if(ClearCasePreferences.isUCM()){
+ return false;
+ }
+
+ boolean isCheckedoutInOtherView = false;
+ checkedOutInOtherView.clear();
+ HashMap<Integer, String> args = new HashMap<Integer, String>();
+ args
+ .put(Integer.valueOf(ClearCase.FORMAT),
+ "%En\tPredecessor: %[version_predecessor]p\tView: %Tf\tStatus: %Rf\n");
+ String[] output = ClearCasePlugin.getEngine().findCheckouts(
+ ClearCase.FORMAT, args, new String[] { element });
+ // Check if line ends with these keywords.
+ Pattern pattern = Pattern.compile(".*View:\\s(.*)\\sStatus:.*");
+
+ if (output.length > 0 ) {
+ // we have file checked-out in other view.
+ isCheckedoutInOtherView = true;
+ for (int i = 0; i < output.length; i++) {
+ String line = output[i];
+ Matcher matcher = pattern.matcher(line);
+ if (matcher.find()) {
+ // Adding information to user.Filter out current view.
+ String view = matcher.group(1);
+ if (!view.equals(getViewName(element))) {
+ checkedOutInOtherView.add(view);
+ }
+ }
+
+ }
+
+ }
+
+ return isCheckedoutInOtherView;
+ }
+
public static String getViewName(IResource resource) {
if (resource == null || resource.getProject() == null)
***************
*** 578,583 ****
}
! return new ArrayList<String>(
! Arrays.asList(new String[] { NO_ACTIVITY }));
}
--- 637,642 ----
}
! return new ArrayList<String>(Arrays
! .asList(new String[] { NO_ACTIVITY }));
}
***************
*** 634,641 ****
public ClearCaseElementState createActivity(String headline,
String activitySelector, String path) throws ClearCaseException {
! ClearCaseElementState[] cces = ClearCasePlugin.getEngine()
! .createActivity(
! ClearCase.HEADLINE | ClearCase.FORCE | ClearCase.NSET,
! headline, activitySelector, path);
if (cces != null) {
return cces[0];
--- 693,699 ----
public ClearCaseElementState createActivity(String headline,
String activitySelector, String path) throws ClearCaseException {
! ClearCaseElementState[] cces = ClearCasePlugin.getEngine().mkActivity(
! ClearCase.HEADLINE | ClearCase.FORCE | ClearCase.NSET,
! headline, activitySelector, path);
if (cces != null) {
return cces[0];
***************
*** 653,657 ****
public String getCurrentStream() {
! return ClearCasePlugin.getEngine().getStream(ClearCase.SHORT, null);
}
--- 711,722 ----
public String getCurrentStream() {
! String result = "";
! String[] output = ClearCasePlugin.getEngine().getStream(
! ClearCase.SHORT, null);
! if (output != null && output.length > 0) {
! result = output[0];
!
! }
! return result;
}
***************
*** 670,688 ****
/**
! * Retrives a list of activitySelectors for a specific view Command returns
! * a string of: activity:<activityId>@/vobs/$pvob,
! * activity:<activityId>@/vobs/$pvob, activity: ...
*
! * @return list of activitySelectors
*/
public String[] getActivitySelectors(String view) {
! String[] result = new String[] { "" };
HashMap<Integer, String> args = new HashMap<Integer, String>();
args.put(Integer.valueOf(ClearCase.FORMAT), "%[activities]CXp");
args.put(Integer.valueOf(ClearCase.VIEW), view);
! String output = ClearCasePlugin.getEngine().getStream(
ClearCase.FORMAT | ClearCase.VIEW, args);
! if (output != null && output.length() > 0) {
! result = output.split(", ");
}
--- 735,756 ----
/**
! * getStream() returns an array but contains one or no element.If we have
! * actvities in stream we have one element.
! * activity:<activityId>@/vobs/$pvob,activity:<activityId>@/vobs/$pvob,
! * activity: ... All activities are on one line.
*
! * @return array of activities or an empty array.
*/
public String[] getActivitySelectors(String view) {
! String[] result = new String[] {};
HashMap<Integer, String> args = new HashMap<Integer, String>();
args.put(Integer.valueOf(ClearCase.FORMAT), "%[activities]CXp");
args.put(Integer.valueOf(ClearCase.VIEW), view);
!
! String[] output = ClearCasePlugin.getEngine().getStream(
ClearCase.FORMAT | ClearCase.VIEW, args);
!
! if (output != null && output.length == 1) {
! result = output[0].split(", ");
}
***************
*** 708,711 ****
--- 776,780 ----
public IStatus move(IResource source, IResource destination,
IProgressMonitor monitor) {
+ int returnCode = 1;// Used in messge dialog.
try {
monitor.beginTask("Moving " + source.getFullPath() + " to "
***************
*** 718,737 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not under source control!",
new Object[] { source.getFullPath()
.toString() }), null);
IStatus result = OK_STATUS;
-
- // boolean sourceParentCoBeforeOp =
- // isCheckedOut(source.getParent());
- // boolean targetParentCoBoforeOp = isCheckedOut(destination
- // .getParent());
-
ClearCaseElementState[] state = null;
if (ClearCasePreferences.isAutoCheckinParentAfterMoveAllowed()) {
state = ClearCasePlugin.getEngine()
! .move(source.getLocation().toOSString(),
destination.getLocation().toOSString(),
getComment(),
--- 787,821 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not under source control!",
new Object[] { source.getFullPath()
.toString() }), null);
IStatus result = OK_STATUS;
ClearCaseElementState[] state = null;
+
+ if (isCheckedOutInAnyView(source.getLocation().toOSString())) {
+
+ StringBuffer sb = new StringBuffer();
+ for (String view : checkedOutInOtherView) {
+ sb.append(view + "\t");
+ }
+ // Open message dialog and ask if we want to continue.
+ returnCode = showMessageDialog(
+ "File Checkedout in Other View ",
+ "File checkedout in the following views: "
+ + sb.toString()+"\n"
+ + " Do you still want to move, "
+ + source.getName() + "?");
+ if(returnCode != 0){
+ return cancelCheckout(source,monitor, opListener);
+ }
+ }
+
if (ClearCasePreferences.isAutoCheckinParentAfterMoveAllowed()) {
state = ClearCasePlugin.getEngine()
! .move(
! source.getLocation().toOSString(),
destination.getLocation().toOSString(),
getComment(),
***************
*** 762,765 ****
--- 846,850 ----
} finally {
setComment("");
+ monitor.done();
}
}
***************
*** 919,941 ****
File target = new File(cache.getSymbolicLinkTarget());
if (!target.isAbsolute()) {
! target = null != cache.getPath() ? new File(
! cache.getPath()).getParentFile() : null;
if (null != target) {
! target = new File(target,
! cache.getSymbolicLinkTarget());
}
}
if (null != target && target.exists()) {
! IPath targetLocation = new Path(
! target.getAbsolutePath());
IResource[] resources = null;
if (target.isDirectory()) {
resources = ResourcesPlugin.getWorkspace()
! .getRoot()
! .findContainersForLocation(targetLocation);
} else {
resources = ResourcesPlugin.getWorkspace()
! .getRoot()
! .findFilesForLocation(targetLocation);
}
if (null != resources) {
--- 1004,1026 ----
File target = new File(cache.getSymbolicLinkTarget());
if (!target.isAbsolute()) {
! target = null != cache.getPath() ? new File(cache
! .getPath()).getParentFile() : null;
if (null != target) {
! target = new File(target, cache
! .getSymbolicLinkTarget());
}
}
if (null != target && target.exists()) {
! IPath targetLocation = new Path(target
! .getAbsolutePath());
IResource[] resources = null;
if (target.isDirectory()) {
resources = ResourcesPlugin.getWorkspace()
! .getRoot().findContainersForLocation(
! targetLocation);
} else {
resources = ResourcesPlugin.getWorkspace()
! .getRoot().findFilesForLocation(
! targetLocation);
}
if (null != resources) {
***************
*** 945,951 ****
.getClearCaseProvider(foundResource);
if (null != provider) {
! StateCacheFactory.getInstance()
! .get(foundResource)
! .updateAsync(false);
// after the target is updated, we must
// update the
--- 1030,1035 ----
.getClearCaseProvider(foundResource);
if (null != provider) {
! StateCacheFactory.getInstance().get(
! foundResource).updateAsync(false);
// after the target is updated, we must
// update the
***************
*** 982,986 ****
TeamException.UNABLE,
MessageFormat
! .format("Resource \"{0}\" is already under source control!",
new Object[] { resource
.getFullPath().toString() }),
--- 1066,1071 ----
TeamException.UNABLE,
MessageFormat
! .format(
! "Resource \"{0}\" is already under source control!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1119,1123 ****
ClearCaseElementState state = ClearCasePlugin
.getEngine()
! .add(resource.getLocation().toOSString(),
false,
getComment(),
--- 1204,1209 ----
ClearCaseElementState state = ClearCasePlugin
.getEngine()
! .add(
! resource.getLocation().toOSString(),
false,
getComment(),
***************
*** 1248,1252 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1334,1339 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1303,1307 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1390,1395 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1311,1316 ****
if (result.isOK()) {
ClearCasePlugin.getEngine()
! .delete(new String[] { resource.getLocation()
! .toOSString() }, getComment(),
ClearCase.RECURSIVE | ClearCase.KEEP,
opListener);
--- 1399,1405 ----
if (result.isOK()) {
ClearCasePlugin.getEngine()
! .delete(
! new String[] { resource.getLocation()
! .toOSString() }, getComment(),
ClearCase.RECURSIVE | ClearCase.KEEP,
opListener);
***************
*** 1350,1354 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1439,1444 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1384,1390 ****
ID,
TeamException.NOT_CHECKED_IN,
! MessageFormat.format(
! Messages.getString("ClearCasePlugin.error.checkin.identicalPredecessor"),
! new Object[] { cce.getElements() }),
null);
break;
--- 1474,1483 ----
ID,
TeamException.NOT_CHECKED_IN,
! MessageFormat
! .format(
! Messages
! .getString("ClearCasePlugin.error.checkin.identicalPredecessor"),
! new Object[] { cce
! .getElements() }),
null);
break;
***************
*** 1394,1400 ****
ID,
TeamException.NOT_CHECKED_IN,
! MessageFormat.format(
! Messages.getString("ClearCasePlugin.error.checkin.elementHasCheckouts"),
! new Object[] { cce.getElements() }),
null);
break;
--- 1487,1496 ----
ID,
TeamException.NOT_CHECKED_IN,
! MessageFormat
! .format(
! Messages
! .getString("ClearCasePlugin.error.checkin.elementHasCheckouts"),
! new Object[] { cce
! .getElements() }),
null);
break;
***************
*** 1406,1412 ****
String latestVersion = resource.getLocation()
.toOSString()
! + "@@"
! + branchName
! + "LATEST";
ClearCaseElementState myState = ClearCasePlugin
--- 1502,1506 ----
String latestVersion = resource.getLocation()
.toOSString()
! + "@@" + branchName + "LATEST";
ClearCaseElementState myState = ClearCasePlugin
***************
*** 1422,1432 ****
if (returnCode == 0) {
// Yes continue checkin
! ClearCasePlugin
! .getEngine()
! .checkin(
! new String[] { targetElement
! .getPath() },
! getComment(),
! ClearCase.PTIME, opListener);
}
--- 1516,1523 ----
if (returnCode == 0) {
// Yes continue checkin
! ClearCasePlugin.getEngine().checkin(
! new String[] { targetElement
! .getPath() }, getComment(),
! ClearCase.PTIME, opListener);
}
***************
*** 1437,1444 ****
ID,
TeamException.CONFLICT,
! MessageFormat.format(
! Messages.getString("ClearCasePlugin.error.checkin.mergeLatestProblem"),
! new Object[] { cce
! .getElements() }), null);
}
--- 1528,1538 ----
ID,
TeamException.CONFLICT,
! MessageFormat
! .format(
! Messages
! .getString("ClearCasePlugin.error.checkin.mergeLatestProblem"),
! new Object[] { cce
! .getElements() }),
! null);
}
***************
*** 1450,1456 ****
ID,
TeamException.NOT_CHECKED_IN,
! MessageFormat.format(
! Messages.getString("ClearCasePlugin.error.checkin.unknown"),
! new Object[] { cce.getElements() }),
null);
--- 1544,1553 ----
ID,
TeamException.NOT_CHECKED_IN,
! MessageFormat
! .format(
! Messages
! .getString("ClearCasePlugin.error.checkin.unknown"),
! new Object[] { cce
! .getElements() }),
null);
***************
*** 1478,1482 ****
try {
int returnCode = 1;// Used for message dialogs.
! monitor.beginTask("Checking out " + resource.getFullPath(), 100);
StateCache cache = getCache(resource);
final StateCache targetElement = getFinalTargetElement(cache);
--- 1575,1581 ----
try {
int returnCode = 1;// Used for message dialogs.
! monitor
! .beginTask("Checking out " + resource.getFullPath(),
! 100);
StateCache cache = getCache(resource);
final StateCache targetElement = getFinalTargetElement(cache);
***************
*** 1490,1494 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1589,1594 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1540,1545 ****
// Yes continue checking out but
// unreserved.
! ClearCasePlugin
! .getEngine()
.checkout(
new String[] { targetElement
--- 1640,1644 ----
// Yes continue checking out but
// unreserved.
! ClearCasePlugin.getEngine()
.checkout(
new String[] { targetElement
***************
*** 1571,1577 ****
ID,
TeamException.UNABLE,
! MessageFormat.format(
! Messages.getString("ClearCasePlugin.error.checkin.unknown"),
! new Object[] { cce.getElements() }),
null);
--- 1670,1679 ----
ID,
TeamException.UNABLE,
! MessageFormat
! .format(
! Messages
! .getString("ClearCasePlugin.error.checkin.unknown"),
! new Object[] { cce
! .getElements() }),
null);
***************
*** 1612,1616 ****
TeamException.NOT_AUTHORIZED,
MessageFormat
! .format("Resource \"{0}\" is not a Hijacked ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1714,1719 ----
TeamException.NOT_AUTHORIZED,
MessageFormat
! .format(
! "Resource \"{0}\" is not a Hijacked ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1631,1635 ****
if (keep.exists()) {
keep.renameTo(new File(resource.getLocation()
! .toOSString() + ".keep"));
}
} catch (Exception e) {
--- 1734,1739 ----
if (keep.exists()) {
keep.renameTo(new File(resource.getLocation()
! .toOSString()
! + ".keep"));
}
} catch (Exception e) {
***************
*** 1676,1680 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1780,1785 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1699,1705 ****
IProgressMonitor monitor) {
try {
! monitor.beginTask(
! "Changing checkout to unreserved "
! + resource.getFullPath(), 100);
// Sanity check - can't update something that is not part of
--- 1804,1809 ----
IProgressMonitor monitor) {
try {
! monitor.beginTask("Changing checkout to unreserved "
! + resource.getFullPath(), 100);
// Sanity check - can't update something that is not part of
***************
*** 1711,1715 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1815,1820 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1735,1741 ****
IProgressMonitor monitor) {
try {
! monitor.beginTask(
! "Changing checkout to reserved "
! + resource.getFullPath(), 100);
// Sanity check - can't update something that is not part of
--- 1840,1845 ----
IProgressMonitor monitor) {
try {
! monitor.beginTask("Changing checkout to reserved "
! + resource.getFullPath(), 100);
// Sanity check - can't update something that is not part of
***************
*** 1747,1751 ****
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format("Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
--- 1851,1856 ----
TeamException.NO_REMOTE_RESOURCE,
MessageFormat
! .format(
! "Resource \"{0}\" is not a ClearCase element!",
new Object[] { resource
.getFullPath().toString() }),
***************
*** 1829,1834 ****
throw new TeamException(new MultiStatus(
multiStatus.getPlugin(), multiStatus.getCode(),
! multiStatus.getChildren(), message,
! multiStatus.getException()));
}
// Cause all the resource changes to be broadcast to listeners.
--- 1934,1939 ----
throw new TeamException(new MultiStatus(
multiStatus.getPlugin(), multiStatus.getCode(),
! multiStatus.getChildren(), message, multiStatus
! .getException()));
}
// Cause all the resource changes to be broadcast to listeners.
***************
*** 1874,1879 ****
// multi-status.
MultiStatus multiStatus = new MultiStatus(status.getPlugin(),
! status.getCode(), status.getMessage(),
! status.getException());
// The next level will be one less than the current level...
int childDepth = (depth == IResource.DEPTH_ONE) ? IResource.DEPTH_ZERO
--- 1979,1984 ----
// multi-status.
MultiStatus multiStatus = new MultiStatus(status.getPlugin(),
! status.getCode(), status.getMessage(), status
! .getException());
// The next level will be one less than the current level...
int childDepth = (depth == IResource.DEPTH_ONE) ? IResource.DEPTH_ZERO
***************
*** 2280,2283 ****
--- 2385,2413 ----
ClearCasePlugin.getEngine().get(ClearCase.TO, args, versionToCopy);
}
+
+ /**
+ * Method is used for a rename refactoring when the file to be renamed have been checkedout.
+ * When the file is checked out in another view and the user don't want to proceed we cancel checkout
+ * and return fail status. This is due to undo operation is not working.
+ * @param resource
+ * @param monitor
+ * @param opListener
+ * @return
+ */
+ private IStatus cancelCheckout(IResource resource,IProgressMonitor monitor,OperationListener opListener){
+ //uncheckout since we do not want to checkout.
+ ClearCasePlugin.getEngine().uncheckout(new String[] { resource.getLocation().toOSString() }, ClearCase.NONE, opListener);
+ updateState(resource, IResource.DEPTH_ZERO,
+ new SubProgressMonitor(monitor, 10));
+ return new Status(
+ IStatus.ERROR,
+ ID,
+ TeamException.CONFLICT,
+ MessageFormat
+ .format(
+ "Cancelled move operation for \"{0}\"!",
+ new Object[] { resource.getFullPath()
+ .toString() }), null);
+ }
}
Index: ClearCaseModificationHandler.java
===================================================================
RCS file: /cvsroot/eclipse-ccase/net.sourceforge.eclipseccase/src/net/sourceforge/eclipseccase/ClearCaseModificationHandler.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** ClearCaseModificationHandler.java 9 Nov 2011 08:58:15 -0000 1.4
--- ClearCaseModificationHandler.java 16 Feb 2012 07:37:43 -0000 1.4.2.1
***************
*** 141,150 ****
*/
private IStatus checkout(final IFile[] files) {
!
if (ClearCasePreferences.isCheckoutAutoNever())
return CANCEL;
!
! //For UCM we already have a checkout dialog. So dialog only for non-ucm.
! if (!ClearCasePreferences.isCheckoutAutoAlways() && !ClearCasePreferences.isUCM()) {
CheckoutQuestionRunnable checkoutQuestion = new CheckoutQuestionRunnable();
getDisplay().syncExec(checkoutQuestion);
--- 141,149 ----
*/
private IStatus checkout(final IFile[] files) {
!
if (ClearCasePreferences.isCheckoutAutoNever())
return CANCEL;
!
! if (!ClearCasePreferences.isCheckoutAutoAlways()) {
CheckoutQuestionRunnable checkoutQuestion = new CheckoutQuestionRunnable();
getDisplay().syncExec(checkoutQuestion);
***************
*** 160,164 ****
"Checkout operation failed, operation was cancelled by user.");
}
-
ClearCaseProvider provider = getProvider(files);
--- 159,162 ----
***************
*** 263,313 ****
return checkout(new IFile[] { file });
}
!
! // protected boolean isPreventedFromCheckOut(Shell shell, ClearCaseProvider provider, IResource[] resources,boolean silent) {
! // for (final IResource resource : resources) {
! //
! // if (provider.isPreventCheckout(resource) && !silent) {
! // PreventCheckoutQuestion question = new PreventCheckoutQuestion(resource);
! // PlatformUI.getWorkbench().getDisplay().syncExec(question);
! // if (question.isRemember()) {
! // ClearCasePreferences.setSilentPrevent();
! // }
! // return true;
! // }else if(provider.isPreventCheckout(resource) && silent){
! // //show no message.
! // return true;
! // }
! // }
! //
! // return false;
! // }
! //
! // public class PreventCheckoutQuestion implements Runnable {
! // private IResource resource;
! //
! // private int result;
! //
! // private boolean remember;
! //
! // public PreventCheckoutQuestion(IResource resource) {
! // this.resource = resource;
! // }
! //
! // public void run() {
! // MessageDialogWithToggle checkoutQuestion = new MessageDialogWithToggle(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.getString("ClearCaseModificationHandler.infoDialog.title"), null, Messages.getString("ClearCaseModificationHandler.infoDialog.message.part1")+resource.getName()+" "+Messages.getString("ClearCaseModificationHandler.infoDialog.message.part2"), MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0, "Skip this dialog in the future!", false);
! // checkoutQuestion.open();
! // result = checkoutQuestion.getReturnCode();
! // remember = checkoutQuestion.getToggleState();
! // }
! //
! // public int getResult() {
! // return result;
! // }
! //
! // public boolean isRemember() {
! // return remember;
! // }
! //
! // }
}
\ No newline at end of file
--- 261,318 ----
return checkout(new IFile[] { file });
}
!
! // protected boolean isPreventedFromCheckOut(Shell shell, ClearCaseProvider
! // provider, IResource[] resources,boolean silent) {
! // for (final IResource resource : resources) {
! //
! // if (provider.isPreventCheckout(resource) && !silent) {
! // PreventCheckoutQuestion question = new PreventCheckoutQuestion(resource);
! // PlatformUI.getWorkbench().getDisplay().syncExec(question);
! // if (question.isRemember()) {
! // ClearCasePreferences.setSilentPrevent();
! // }
! // return true;
! // }else if(provider.isPreventCheckout(resource) && silent){
! // //show no message.
! // return true;
! // }
! // }
! //
! // return false;
! // }
! //
! // public class PreventCheckoutQuestion implements Runnable {
! // private IResource resource;
! //
! // private int result;
! //
! // private boolean remember;
! //
! // public PreventCheckoutQuestion(IResource resource) {
! // this.resource = resource;
! // }
! //
! // public void run() {
! // MessageDialogWithToggle checkoutQuestion = new
! // MessageDialogWithToggle(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
! // Messages.getString("ClearCaseModificationHandler.infoDialog.title"),
! // null,
! // Messages.getString("ClearCaseModificationHandler.infoDialog.message.part1")+resource.getName()+" "+Messages.getString("ClearCaseModificationHandler.infoDialog.message.part2"),
! // MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0,
! // "Skip this dialog in the future!", false);
! // checkoutQuestion.open();
! // result = checkoutQuestion.getReturnCode();
! // remember = checkoutQuestion.getToggleState();
! // }
! //
! // public int getResult() {
! // return result;
! // }
! //
! // public boolean isRemember() {
! // return remember;
! // }
! //
! // }
}
\ No newline at end of file
Index: StateCacheFactory.java
===================================================================
RCS file: /cvsroot/eclipse-ccase/net.sourceforge.eclipseccase/src/net/sourceforge/eclipseccase/StateCacheFactory.java,v
retrieving revision 1.54
retrieving revision 1.54.2.1
diff -C2 -d -r1.54 -r1.54.2.1
*** StateCacheFactory.java 14 Nov 2011 12:09:49 -0000 1.54
--- StateCacheFactory.java 16 Feb 2012 07:37:43 -0000 1.54.2.1
***************
*** 681,685 ****
for (int i = 0; i < projectDeltas.length; i++) {
IResourceDelta projectDelta = projectDeltas[i];
!
// filter only shared projects
if (RepositoryProvider.isShared((IProject) projectDelta
--- 681,691 ----
for (int i = 0; i < projectDeltas.length; i++) {
IResourceDelta projectDelta = projectDeltas[i];
!
! //Fix for bug 3487493.
! //check if the resource is attached to clearcase if not continue with next resource
! //this is to avoid projects shared with other repository.
! if(ClearCaseProvider.getClearCaseProvider(projectDelta.getResource()) == null)
! continue;
!
// filter only shared projects
if (RepositoryProvider.isShared((IProject) projectDelta
Index: PreventCheckoutHelper.java
===================================================================
RCS file: /cvsroot/eclipse-ccase/net.sourceforge.eclipseccase/src/net/sourceforge/eclipseccase/PreventCheckoutHelper.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** PreventCheckoutHelper.java 12 Oct 2011 10:28:27 -0000 1.1
--- PreventCheckoutHelper.java 16 Feb 2012 07:37:43 -0000 1.1.2.1
***************
*** 6,11 ****
import org.eclipse.core.resources.IResource;
- import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
--- 6,13 ----
+ import java.util.ArrayList;
+ import java.util.Arrays;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.ui.PlatformUI;
***************
*** 16,20 ****
public class PreventCheckoutHelper {
! public static boolean isPreventedFromCheckOut(Shell shell, ClearCaseProvider provider, IResource[] resources,boolean silent) {
for (final IResource resource : resources) {
--- 18,22 ----
public class PreventCheckoutHelper {
! public static boolean isPreventedFromCheckOut(ClearCaseProvider provider, IResource[] resources, boolean silent) {
for (final IResource resource : resources) {
***************
*** 35,39 ****
}
!
}
--- 37,50 ----
}
! public static IResource[] isCheckedOut(ClearCaseProvider provider, IResource[] resources){
! ArrayList<IResource> toBeCheckedout = new ArrayList<IResource>(Arrays.asList(resources));
! for (final IResource resource : resources) {
! if(provider.isCheckedOut(resource)){
! toBeCheckedout.remove(resource);
! }
!
! }
! return (IResource[])toBeCheckedout.toArray( new IResource[toBeCheckedout.size() ]);
! }
}
Index: MoveHandler.java
===================================================================
RCS file: /cvsroot/eclipse-ccase/net.sourceforge.eclipseccase/src/net/sourceforge/eclipseccase/MoveHandler.java,v
retrieving revision 1.25
retrieving revision 1.25.4.1
diff -C2 -d -r1.25 -r1.25.4.1
*** MoveHandler.java 22 Dec 2010 14:53:39 -0000 1.25
--- MoveHandler.java 16 Feb 2012 07:37:43 -0000 1.25.4.1
***************
*** 1,6 ****
--- 1,9 ----
package net.sourceforge.eclipseccase;
+ import java.text.MessageFormat;
import java.util.LinkedList;
+ import net.sourceforge.clearcase.ClearCaseError;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
***************
*** 18,21 ****
--- 21,26 ----
public class MoveHandler implements IMoveDeleteHook {
+
+ public static final String ID = "net.sourceforge.eclipseccase.MoveHandler"; //$NON-NLS-1$
ClearCaseProvider provider;
***************
*** 266,275 ****
}
! return true;
!
} finally {
provider.refreshResources = true;
monitor.done();
}
}
}
--- 271,288 ----
}
! //return true;
! }catch(ClearCaseError e){
! tree.failed(new Status(
! IStatus.ERROR,
! ID,
! TeamException.UNABLE
! ,"An Error occurred! "+e.getMessage(), e));
!
} finally {
provider.refreshResources = true;
monitor.done();
}
+
+ return true;
}
}
|