Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2007-12-21 15:53:19 -0500
committerpelder2007-12-21 15:53:19 -0500
commit21a16b3356053ce7ac6dfdf9f6d6774861149f21 (patch)
treeaa0eeafe8c5b00fe5e18c9f5e2f438d6a9689f76
parentd7a02dc07ef527ea7b743e15d24271395022d35a (diff)
downloadorg.eclipse.jet-21a16b3356053ce7ac6dfdf9f6d6774861149f21.tar.gz
org.eclipse.jet-21a16b3356053ce7ac6dfdf9f6d6774861149f21.tar.xz
org.eclipse.jet-21a16b3356053ce7ac6dfdf9f6d6774861149f21.zip
Undo accidental commit of incomplete changes
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java67
1 files changed, 5 insertions, 62 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java
index 969f8b4..65b8234 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java
@@ -17,7 +17,6 @@ package org.eclipse.jet.taglib.workspace;
import java.io.BufferedInputStream;
-import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -213,19 +212,14 @@ public final class ActionsUtil
}
monitor.worked(1);
- // Step 4: check if contents have changed...
- boolean contentsChanged = checkForContentChange(file, source);
-
// Step 5: write the contents - we created the file in step 1, so we only need to set its proper contents
- if(contentsChanged) {
- file.setContents(source, false, true, new SubProgressMonitor(monitor, 2));
- }
+ file.setContents(source, false, true, new SubProgressMonitor(monitor, 2));
// RuntimeLoggerContextExtender.log(context, fileMessage, tagInfo, templatePath);
// Step 6: Apply generated file properties...
file.setDerived(derived);
- return contentsChanged;
+ return true;
}
catch (UnsupportedEncodingException e)
{
@@ -241,55 +235,6 @@ public final class ActionsUtil
}
}
- private static boolean checkForContentChange(IFile file, InputStream source) throws CoreException
- {
- boolean changed = false;
- if(!file.exists())
- {
- return changed;
- }
- InputStream existing = null;
- try {
- existing = new BufferedInputStream(file.getContents());
-
- final int bufferSize = 8196;
- byte[] srcBuffer = new byte[bufferSize];
- byte[] tgtBuffer = new byte[bufferSize];
-
- while(true) {
- int srcRead = source.read(srcBuffer);
- int tgtRead = existing.read(tgtBuffer);
- if(tgtRead != srcRead) {
- changed = true;
- break;
- } else if(srcRead == -1) {
- changed = srcRead != -1;
- break;
- } else if(!Arrays.equals(srcBuffer, tgtBuffer)) {
- changed = true;
- break;
- }
- }
- if(changed) {
- // rewind to the beginning, so we can write it
- source.reset();
- }
- }
- catch (IOException e)
- {
- changed = true; // couldn't read -- assume we must write
- } finally {
- if(existing != null) {
- try {
- existing.close();
- } catch(IOException e) {
- // ignore
- }
- }
- }
- return changed;
- }
-
/**
* Ensure that a folder exists by creating it and any of its parents if necessary.
* @param folder the folder to ensure exists.
@@ -409,15 +354,13 @@ public final class ActionsUtil
reader = new InputStreamReader(input);
}
- final int buffer_size = 8192;
- final BufferedReader bufferedReader = new BufferedReader(reader, buffer_size);
StringBuffer inputContents = new StringBuffer();
- char readChars[] = new char [buffer_size];
- for (int read = bufferedReader.read(readChars); read != -1; read = bufferedReader.read(readChars))
+ char readChars[] = new char [1024];
+ for (int read = reader.read(readChars); read != -1; read = reader.read(readChars))
{
inputContents.append(readChars, 0, read);
}
- bufferedReader.close();
+ reader.close();
input.close();
return inputContents.toString();
}

Back to the top