Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.ui.workbench.texteditor/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java41
2 files changed, 17 insertions, 25 deletions
diff --git a/org.eclipse.ui.workbench.texteditor/META-INF/MANIFEST.MF b/org.eclipse.ui.workbench.texteditor/META-INF/MANIFEST.MF
index b47973b0b40..d0542af7efe 100644
--- a/org.eclipse.ui.workbench.texteditor/META-INF/MANIFEST.MF
+++ b/org.eclipse.ui.workbench.texteditor/META-INF/MANIFEST.MF
@@ -24,7 +24,6 @@ Require-Bundle:
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)",
org.eclipse.ui;bundle-version="[3.3.0,4.0.0)"
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
index c3d6155ca14..00cbdef91c2 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
@@ -12,6 +12,10 @@ package org.eclipse.ui.texteditor.templates;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -50,13 +54,6 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
@@ -1206,13 +1203,12 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
if (path == null)
return;
-
- IFileStore fileStore= EFS.getLocalFileSystem().getStore(new Path(path));
try {
TemplateReaderWriter reader= new TemplateReaderWriter();
- if (fileStore.fetchInfo().exists()) {
- InputStream input= new BufferedInputStream(fileStore.openInputStream(EFS.NONE, null));
+ File file= new File(path);
+ if (file.exists()) {
+ InputStream input= new BufferedInputStream(new FileInputStream(file));
try {
TemplatePersistenceData[] datas= reader.read(input, null);
for (int i= 0; i < datas.length; i++) {
@@ -1232,7 +1228,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
fTableViewer.setAllChecked(false);
fTableViewer.setCheckedElements(getEnabledTemplates());
- } catch (CoreException e) {
+ } catch (FileNotFoundException e) {
openReadErrorDialog();
} catch (IOException e) {
openReadErrorDialog();
@@ -1260,31 +1256,28 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
if (path == null)
return;
- IFileStore fileStore= EFS.getLocalFileSystem().getStore(new Path(path));
- IFileInfo fileInfo= fileStore.fetchInfo();
+ File file= new File(path);
- if (fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN)) {
+ if (file.isHidden()) {
String title= TextEditorTemplateMessages.TemplatePreferencePage_export_error_title;
- String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_hidden, fileStore.toString());
+ String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_hidden, file.getAbsolutePath());
MessageDialog.openError(getShell(), title, message);
return;
}
- if (fileInfo.exists() && fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY)) {
+ if (file.exists() && !file.canWrite()) {
String title= TextEditorTemplateMessages.TemplatePreferencePage_export_error_title;
- String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_canNotWrite, fileStore.toString());
+ String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_canNotWrite, file.getAbsolutePath());
MessageDialog.openError(getShell(), title, message);
return;
}
- if (!fileInfo.exists() || confirmOverwrite(fileStore)) {
+ if (!file.exists() || confirmOverwrite(file)) {
OutputStream output= null;
try {
- output= new BufferedOutputStream(fileStore.openOutputStream(EFS.NONE, null));
+ output= new BufferedOutputStream(new FileOutputStream(file));
TemplateReaderWriter writer= new TemplateReaderWriter();
writer.save(templates, output);
- } catch (CoreException e) {
- openWriteErrorDialog();
} catch (IOException e) {
openWriteErrorDialog();
} finally {
@@ -1299,10 +1292,10 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
}
}
- private boolean confirmOverwrite(IFileStore fileStore) {
+ private boolean confirmOverwrite(File file) {
return MessageDialog.openQuestion(getShell(),
TextEditorTemplateMessages.TemplatePreferencePage_export_exists_title,
- NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_exists_message, fileStore.toString()));
+ NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_exists_message, file.getAbsolutePath()));
}
private void remove() {

Back to the top