X-Git-Url: http://git.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java
index 709a80a..d03b7b3 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/util/Resources.java
@@ -37,46 +37,56 @@ public class Resources {
/**
* Checks if the given resource is in sync with the underlying file system.
- *
- * @param resource the resource to be checked
+ *
+ * @param resource
+ * the resource to be checked
* @return IStatus status describing the check's result. If status.
- * isOK()
returns true
then the resource is in sync
+ * isOK()
+ * returns true
then the resource is in sync
*/
public static IStatus checkInSync(IResource resource) {
- return checkInSync(new IResource[] {resource});
+ return checkInSync(new IResource[] { resource });
}
/**
* Checks if the given resources are in sync with the underlying file
* system.
- *
- * @param resources the resources to be checked
+ *
+ * @param resources
+ * the resources to be checked
* @return IStatus status describing the check's result. If status.
- * isOK()
returns true
then the resources are in sync
+ * isOK()
+ * returns true
then the resources are in sync
*/
public static IStatus checkInSync(IResource[] resources) {
- IStatus result= null;
- for (int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
+ IStatus result = null;
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
if (!resource.isSynchronized(IResource.DEPTH_INFINITE)) {
- result= addOutOfSync(result, resource);
+ result = addOutOfSync(result, resource);
}
}
if (result != null)
return result;
- return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
+ return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(),
+ IStatus.OK, "", null); //$NON-NLS-1$
}
/**
* Makes the given resource committable. Committable means that it is
* writeable and that its content hasn't changed by calling
* validateEdit
for the given resource on IWorkspace.
- *
- * @param resource the resource to be checked
- * @param context the context passed to validateEdit
- * @return status describing the method's result. If status.isOK()
returns true
then the resources are committable.
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
+ *
+ * @param resource
+ * the resource to be checked
+ * @param context
+ * the context passed to validateEdit
+ * @return status describing the method's result. If
+ * status.isOK()
returns true
then the
+ * resources are committable.
+ *
+ * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[],
+ * java.lang.Object)
*/
public static IStatus makeCommittable(IResource resource, Object context) {
return makeCommittable(new IResource[] { resource }, context);
@@ -87,66 +97,78 @@ public class Resources {
* resources are writeable and that the content of the resources hasn't
* changed by calling validateEdit
for a given file on
* IWorkspace.
- *
- * @param resources the resources to be checked
- * @param context the context passed to validateEdit
+ *
+ * @param resources
+ * the resources to be checked
+ * @param context
+ * the context passed to validateEdit
* @return IStatus status describing the method's result. If status.
- * isOK()
returns true
then the add resources are
- * committable
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
+ * isOK()
+ * returns true
then the add resources are
+ * committable
+ *
+ * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[],
+ * java.lang.Object)
*/
public static IStatus makeCommittable(IResource[] resources, Object context) {
- List readOnlyFiles= new ArrayList();
- for (int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (resource.getType() == IResource.FILE && resource.getResourceAttributes().isReadOnly())
+ List readOnlyFiles = new ArrayList();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (resource.getType() == IResource.FILE
+ && resource.getResourceAttributes().isReadOnly())
readOnlyFiles.add(resource);
}
if (readOnlyFiles.size() == 0)
- return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
+ return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(),
+ IStatus.OK, "", null); //$NON-NLS-1$
- Map oldTimeStamps= createModificationStampMap(readOnlyFiles);
- IStatus status= ResourcesPlugin.getWorkspace().validateEdit(
- (IFile[]) readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]), context);
+ Map oldTimeStamps = createModificationStampMap(readOnlyFiles);
+ IStatus status = ResourcesPlugin.getWorkspace().validateEdit(
+ (IFile[]) readOnlyFiles
+ .toArray(new IFile[readOnlyFiles.size()]), context);
if (!status.isOK())
return status;
- IStatus modified= null;
- Map newTimeStamps= createModificationStampMap(readOnlyFiles);
- for (Iterator iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) {
- IFile file= (IFile) iter.next();
+ IStatus modified = null;
+ Map newTimeStamps = createModificationStampMap(readOnlyFiles);
+ for (Iterator iter = oldTimeStamps.keySet().iterator(); iter.hasNext();) {
+ IFile file = (IFile) iter.next();
if (!oldTimeStamps.get(file).equals(newTimeStamps.get(file)))
- modified= addModified(modified, file);
+ modified = addModified(modified, file);
}
if (modified != null)
return modified;
- return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
+ return new Status(IStatus.OK, PHPeclipsePlugin.getPluginId(),
+ IStatus.OK, "", null); //$NON-NLS-1$
}
- private static Map createModificationStampMap(List files){
- Map map= new HashMap();
- for (Iterator iter= files.iterator(); iter.hasNext(); ) {
- IFile file= (IFile)iter.next();
+ private static Map createModificationStampMap(List files) {
+ Map map = new HashMap();
+ for (Iterator iter = files.iterator(); iter.hasNext();) {
+ IFile file = (IFile) iter.next();
map.put(file, new Long(file.getModificationStamp()));
}
return map;
}
private static IStatus addModified(IStatus status, IFile file) {
- IStatus entry= PHPUIStatus.createError(
- IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
- CorextMessages.getFormattedString("Resources.fileModified", file.getFullPath().toString()), //$NON-NLS-1$
- null);
+ IStatus entry = PHPUIStatus
+ .createError(
+ IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
+ CorextMessages
+ .getFormattedString(
+ "Resources.fileModified", file.getFullPath().toString()), //$NON-NLS-1$
+ null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
- ((MultiStatus)status).add(entry);
+ ((MultiStatus) status).add(entry);
return status;
} else {
- MultiStatus result= new MultiStatus(PHPeclipsePlugin.getPluginId(),
- IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
- CorextMessages.getString("Resources.modifiedResources"), null); //$NON-NLS-1$
+ MultiStatus result = new MultiStatus(
+ PHPeclipsePlugin.getPluginId(),
+ IJavaStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
+ CorextMessages.getString("Resources.modifiedResources"), null); //$NON-NLS-1$
result.add(status);
result.add(entry);
return result;
@@ -154,22 +176,23 @@ public class Resources {
}
private static IStatus addOutOfSync(IStatus status, IResource resource) {
- IStatus entry= new Status(
- IStatus.ERROR,
- ResourcesPlugin.PI_RESOURCES,
- IResourceStatus.OUT_OF_SYNC_LOCAL,
- CorextMessages.getFormattedString("Resources.outOfSync", resource.getFullPath().toString()), //$NON-NLS-1$
- null);
+ IStatus entry = new Status(
+ IStatus.ERROR,
+ ResourcesPlugin.PI_RESOURCES,
+ IResourceStatus.OUT_OF_SYNC_LOCAL,
+ CorextMessages
+ .getFormattedString(
+ "Resources.outOfSync", resource.getFullPath().toString()), //$NON-NLS-1$
+ null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
- ((MultiStatus)status).add(entry);
+ ((MultiStatus) status).add(entry);
return status;
} else {
- MultiStatus result= new MultiStatus(
- ResourcesPlugin.PI_RESOURCES,
- IResourceStatus.OUT_OF_SYNC_LOCAL,
- CorextMessages.getString("Resources.outOfSyncResources"), null); //$NON-NLS-1$
+ MultiStatus result = new MultiStatus(ResourcesPlugin.PI_RESOURCES,
+ IResourceStatus.OUT_OF_SYNC_LOCAL, CorextMessages
+ .getString("Resources.outOfSyncResources"), null); //$NON-NLS-1$
result.add(status);
result.add(entry);
return result;
@@ -177,9 +200,9 @@ public class Resources {
}
public static String[] getLocationOSStrings(IResource[] resources) {
- List result= new ArrayList(resources.length);
- for (int i= 0; i < resources.length; i++) {
- IPath location= resources[i].getLocation();
+ List result = new ArrayList(resources.length);
+ for (int i = 0; i < resources.length; i++) {
+ IPath location = resources[i].getLocation();
if (location != null)
result.add(location.toOSString());
}