Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-02-23 03:43:54 -0500
committerWilliam Chen2012-02-23 03:45:13 -0500
commit81a02a6fb32a772a6f77deb8270ecb797b44c1e1 (patch)
treeeaca3dc26674cfc219d071f6f70a9cf520653b54
parente2177d1ac6b3d7bb9cb45f26277e86654afa7c05 (diff)
downloadorg.eclipse.tcf-81a02a6fb32a772a6f77deb8270ecb797b44c1e1.tar.gz
org.eclipse.tcf-81a02a6fb32a772a6f77deb8270ecb797b44c1e1.tar.xz
org.eclipse.tcf-81a02a6fb32a772a6f77deb8270ecb797b44c1e1.zip
Target Explorer: Refactoring: Fix some bad smells found by FindBugs.
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeComparator.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeLabelProvider.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeElementComparator.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeNodeComparator.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FileTypeComparator.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeComparator.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeLabelProvider.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/SizeComparator.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/LocalFileSaveable.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/MergeTypedElement.java11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/handlers/OpenWithMenu.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfInputStream.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfOutputStream.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLConnection.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/PersistenceManager.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/model/FSTreeNode.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java5
17 files changed, 39 insertions, 67 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeComparator.java
index 647248142..7b9453c85 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeComparator.java
@@ -15,6 +15,7 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The comparator for the tree column "Date Accessed".
*/
public class AccessTimeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeLabelProvider.java
index 89f946615..5761eb328 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/AccessTimeLabelProvider.java
@@ -19,8 +19,6 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The label provider for the tree column "Date Accessed".
*/
public class AccessTimeLabelProvider extends LabelProvider {
- // The date formatter.
- private static final SimpleDateFormat DATE_ACCESSED_FORMAT = new SimpleDateFormat("M/d/yyyy h:mm aa"); //$NON-NLS-1$
/*
* (non-Javadoc)
@@ -33,7 +31,8 @@ public class AccessTimeLabelProvider extends LabelProvider {
// Pending nodes does not have column texts at all
if(node.isPendingNode()) return ""; //$NON-NLS-1$
if (node.attr != null) {
- return DATE_ACCESSED_FORMAT.format(new Date(node.attr.atime));
+ SimpleDateFormat dateFormat = new SimpleDateFormat("M/d/yyyy h:mm aa"); //$NON-NLS-1$
+ return dateFormat.format(new Date(node.attr.atime));
}
}
return ""; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeElementComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeElementComparator.java
index 7ddb7010e..36b574369 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeElementComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeElementComparator.java
@@ -15,6 +15,7 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The comparator for the tree column "name".
*/
public class FSTreeElementComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeNodeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeNodeComparator.java
index 95beb2ff3..bc04ed5ea 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeNodeComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FSTreeNodeComparator.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.internal.columns;
+import java.io.Serializable;
import java.util.Comparator;
import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
@@ -16,7 +17,8 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
/**
* The base comparator for all the file system tree column.
*/
-public abstract class FSTreeNodeComparator implements Comparator<FSTreeNode> {
+public abstract class FSTreeNodeComparator implements Comparator<FSTreeNode>, Serializable {
+ private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FileTypeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FileTypeComparator.java
index ed7aa8ff6..de7da2360 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FileTypeComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/FileTypeComparator.java
@@ -15,6 +15,7 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The comparator for the tree column "type".
*/
public class FileTypeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeComparator.java
index 4d71aa607..75c7e1e46 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeComparator.java
@@ -15,6 +15,7 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The comparator for the tree column "Date Modified".
*/
public class ModificationTimeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeLabelProvider.java
index 2f9bedbf2..25c1687bd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/ModificationTimeLabelProvider.java
@@ -19,8 +19,6 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The label provider for the tree column "Date Modified".
*/
public class ModificationTimeLabelProvider extends LabelProvider {
- // The date formatter.
- private static final SimpleDateFormat DATE_MODIFIED_FORMAT = new SimpleDateFormat("M/d/yyyy h:mm aa"); //$NON-NLS-1$
/*
* (non-Javadoc)
@@ -33,7 +31,8 @@ public class ModificationTimeLabelProvider extends LabelProvider {
// Pending nodes does not have column texts at all
if (node.isPendingNode()) return ""; //$NON-NLS-1$
if (node.attr != null) {
- return DATE_MODIFIED_FORMAT.format(new Date(node.attr.mtime));
+ SimpleDateFormat dateFormat = new SimpleDateFormat("M/d/yyyy h:mm aa"); //$NON-NLS-1$
+ return dateFormat.format(new Date(node.attr.mtime));
}
}
return ""; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/SizeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/SizeComparator.java
index f94bc4a0b..c786836da 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/SizeComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/columns/SizeComparator.java
@@ -15,6 +15,7 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
* The comparator for the tree column "size".
*/
public class SizeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/LocalFileSaveable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/LocalFileSaveable.java
index 0265000ca..dae76ab1d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/LocalFileSaveable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/LocalFileSaveable.java
@@ -268,10 +268,10 @@ public class LocalFileSaveable extends Saveable implements
if (document != null) {
Object otherDocument = ((Saveable) obj).getAdapter(IDocument.class);
- if (document == null && otherDocument == null)
+ if (otherDocument == null)
return false;
- return document != null && document.equals(otherDocument);
+ return document.equals(otherDocument);
}
if (obj instanceof LocalFileSaveable) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/MergeTypedElement.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/MergeTypedElement.java
index 0524461b6..f1e0c3bfa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/MergeTypedElement.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/compare/MergeTypedElement.java
@@ -56,15 +56,14 @@ public abstract class MergeTypedElement extends BufferedContent implements IType
*/
@Override
public String getType() {
- if (node.isDirectory())
- return ITypedElement.FOLDER_TYPE;
if (node != null) {
+ if (node.isDirectory()) {
+ return ITypedElement.FOLDER_TYPE;
+ }
String s = node.name;
int dot = s.lastIndexOf('.');
- if (dot != -1)
- s = s.substring(dot + 1);
- if (s != null)
- return s;
+ if (dot != -1) s = s.substring(dot + 1);
+ if (s != null) return s;
}
return ITypedElement.UNKNOWN_TYPE;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/handlers/OpenWithMenu.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/handlers/OpenWithMenu.java
index 6187426a0..8eec29599 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/handlers/OpenWithMenu.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/handlers/OpenWithMenu.java
@@ -332,7 +332,7 @@ public class OpenWithMenu extends ContributionItem {
return defaultDescriptor;
}
- IEditorDescriptor editorDesc = defaultDescriptor;
+ IEditorDescriptor editorDesc = null;
// next check the OS for in-place editor (OLE on Win32)
if (registry.isSystemInPlaceEditorAvailable(node.name)) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfInputStream.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfInputStream.java
index ed339278c..036848127 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfInputStream.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfInputStream.java
@@ -42,9 +42,6 @@ public class TcfInputStream extends InputStream {
// The chunk size of the reading buffer.
int chunk_size = 0;
- // File reading timeout.
- int timeout;
-
// The URL Connection
TcfURLConnection connection;
@@ -77,15 +74,6 @@ public class TcfInputStream extends InputStream {
this.chunk_size = chunk_size;
}
- /**
- * Set the timeout for reading a file.
- *
- * @param timeout the timeout in milliseconds.
- */
- void setTimeout(int readTimeout) {
- this.timeout = readTimeout;
- }
-
/*
* (non-Javadoc)
*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfOutputStream.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfOutputStream.java
index cd7aedb1a..df2da1fe3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfOutputStream.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfOutputStream.java
@@ -37,14 +37,8 @@ public class TcfOutputStream extends OutputStream {
// The current error during writing.
Exception ERROR;
- // The chunk size of the writing buffer.
- int chunk_size = 0;
-
// The URL Connection
TcfURLConnection connection;
-
- // The timeout for writing data.
- int timeout;
/**
* Create a TCF output stream connected the specified peer with specified
* path to the remote resource.
@@ -71,20 +65,10 @@ public class TcfOutputStream extends OutputStream {
*/
public TcfOutputStream(TcfURLConnection connection, int chunk_size) {
this.connection = connection;
- this.chunk_size = chunk_size;
buffer = new byte[chunk_size];
offset = 0;
}
- /**
- * Set the timeout for writing a file.
- *
- * @param timeout The timeout for writing a file.
- */
- void setTimeout(int timeout){
- this.timeout = timeout;
- }
-
/* (non-Javadoc)
* @see java.io.OutputStream#write(int)
*/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLConnection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLConnection.java
index 21ea2574e..0bb59f075 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLConnection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLConnection.java
@@ -211,11 +211,9 @@ public class TcfURLConnection extends URLConnection {
openFile();
if (doInput) {
inputStream = new TcfInputStream(this);
- inputStream.setTimeout(getReadTimeout());
}
if (doOutput) {
outputStream = new TcfOutputStream(this);
- outputStream.setTimeout(getReadTimeout());
}
connected = true;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/PersistenceManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/PersistenceManager.java
index 7ee6eed36..ae70ad389 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/PersistenceManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/PersistenceManager.java
@@ -27,6 +27,7 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import org.eclipse.core.runtime.Platform;
@@ -287,16 +288,17 @@ public class PersistenceManager {
private void saveContentTypes() {
XMLMemento memento = XMLMemento.createWriteRoot(CONTENT_TYPE_ROOT);
IMemento mResolved = memento.createChild(ELEMENT_RESOLVED);
- for (URI key : resolved.keySet()) {
- IContentType iContentType = resolved.get(key);
+ for (Entry<URI, IContentType> entry : resolved.entrySet()) {
IMemento mResolvable = mResolved.createChild(ELEMENT_RESOLVABLE);
+ URI key = entry.getKey();
mResolvable.putString(ATTR_URI, key.toString());
+ IContentType iContentType = entry.getValue();
mResolvable.putString(ATTR_CONTENT_TYPE, iContentType.getId());
}
IMemento mUnresolved = memento.createChild(ELEMENT_UNRESOLVED);
- for (URI key : unresolved.keySet()) {
+ for (Entry<URI, URI> entry : unresolved.entrySet()) {
IMemento mUnresolvable = mUnresolved.createChild(ELEMENT_UNRESOLVABLE);
- mUnresolvable.putString(ATTR_URI, key.toString());
+ mUnresolvable.putString(ATTR_URI, entry.getKey().toString());
}
writeMemento(memento, CONTENT_TYPE_FILE);
}
@@ -363,11 +365,11 @@ public class PersistenceManager {
*/
private void savePersistentProperties() {
XMLMemento memento = XMLMemento.createWriteRoot(PERSISTENT_ROOT);
- for (URI key : properties.keySet()) {
- Map<QualifiedName, String> nodeProperties = properties.get(key);
- if (!nodeProperties.keySet().isEmpty()) {
+ for (Entry<URI, Map<QualifiedName, String>> entry : properties.entrySet()) {
+ Map<QualifiedName, String> nodeProperties = entry.getValue();
+ if (!nodeProperties.isEmpty()) {
IMemento mFile = memento.createChild(ELEMENT_FILE);
- mFile.putString(ATTR_URI, key.toString());
+ mFile.putString(ATTR_URI, entry.getKey().toString());
saveFileProperties(mFile, nodeProperties);
}
}
@@ -381,11 +383,12 @@ public class PersistenceManager {
* @param properties The file properties.
*/
private void saveFileProperties(IMemento memento, Map<QualifiedName, String> properties) {
- for (QualifiedName name : properties.keySet()) {
+ for (Entry<QualifiedName, String> entry : properties.entrySet()) {
+ QualifiedName name = entry.getKey();
IMemento mProperty = memento.createChild(ELEMENT_PROPERTY);
mProperty.putString(ATTR_QUALIFIER, name.getQualifier());
mProperty.putString(ATTR_LOCAL_NAME, name.getLocalName());
- mProperty.putString(ATTR_VALUE, properties.get(name));
+ mProperty.putString(ATTR_VALUE, entry.getValue());
}
}
@@ -479,9 +482,8 @@ public class PersistenceManager {
*/
private void saveTimestamps() {
Properties properties = new Properties();
- for (URI key : timestamps.keySet()) {
- Long timestamp = timestamps.get(key);
- properties.setProperty(key.toString(), timestamp.toString());
+ for (Entry<URI, Long> entry : timestamps.entrySet()) {
+ properties.setProperty(entry.getKey().toString(), entry.getValue().toString());
}
File location = CacheManager.getInstance().getCacheRoot();
File fTimestamp = new File(location, TIMESTAMP_FILE);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/model/FSTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/model/FSTreeNode.java
index 39abe9701..8d543d4b3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/model/FSTreeNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/model/FSTreeNode.java
@@ -609,12 +609,7 @@ public final class FSTreeNode extends PlatformObject implements Cloneable, IPeer
public void setName(String name) {
String oldName = this.name;
this.name = name;
- if(oldName == null) {
- if(name != null) {
- firePropertyChange(new PropertyChangeEvent(this, "name", oldName, name)); //$NON-NLS-1$
- }
- }
- else if(!oldName.equals(name)) {
+ if(name == null && oldName != null || name != null && !name.equals(oldName)) {
firePropertyChange(new PropertyChangeEvent(this, "name", oldName, name)); //$NON-NLS-1$
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java
index 7c77d007b..b734b7381 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java
@@ -14,6 +14,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
@@ -171,8 +172,8 @@ public class CallbackMonitor {
*/
private synchronized IStatus getCurrentStatus() {
List<IStatus> list = new ArrayList<IStatus>();
- for (Object key : locks.keySet()) {
- IStatus status = locks.get(key);
+ for (Entry<Object, IStatus>entry : locks.entrySet()) {
+ IStatus status = entry.getValue();
if (status == null) return null;
list.add(status);
}

Back to the top