Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2016-09-09 09:12:15 +0000
committerLars Vogel2016-09-09 09:12:15 +0000
commit258a2909bc894c32a1ead64dc71c275349ee63bb (patch)
tree2eb3e2df2f5e8e0556a7a345724aab0536dfcae2 /org.eclipse.ui.editors
parent17c9cb2d257048b6cbfc5a6c7afa89680da4864c (diff)
downloadeclipse.platform.text-258a2909bc894c32a1ead64dc71c275349ee63bb.tar.gz
eclipse.platform.text-258a2909bc894c32a1ead64dc71c275349ee63bb.tar.xz
eclipse.platform.text-258a2909bc894c32a1ead64dc71c275349ee63bb.zip
Revert "Bug 479523 - Replace usage of SubProgressMonitor with SubMonitor in eclipse.platform.text"
This was unintentially commited, I selected the wrong tab in the browser. Reverting. I want to commit this early M3 and not late M2. This reverts commit 17c9cb2d257048b6cbfc5a6c7afa89680da4864c. Change-Id: I7efae943288e94f34ca38b8b4bd87408dbea8208
Diffstat (limited to 'org.eclipse.ui.editors')
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java15
3 files changed, 44 insertions, 31 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java
index 47d1a8744..0efd80313 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java
@@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.resources.IFile;
@@ -172,19 +172,23 @@ public class FileBufferOperationAction extends Action implements IWorkbenchWindo
try {
int ticks= 100;
- SubMonitor subMonitor= SubMonitor.convert(monitor, fFileBufferOperation.getOperationName(), ticks);
- IPath[] locations;
- if (files != null) {
- ticks-= 30;
- locations= generateLocations(files, subMonitor.newChild(30));
- } else
- locations= new IPath[] { location };
-
- if (locations != null && locations.length > 0) {
- FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), getShell());
- runner.execute(locations, fileBufferOperation, subMonitor.newChild(ticks));
+ monitor.beginTask(fFileBufferOperation.getOperationName(), ticks);
+ try {
+ IPath[] locations;
+ if (files != null) {
+ ticks -= 30;
+ locations= generateLocations(files, new SubProgressMonitor(monitor, 30));
+ } else
+ locations= new IPath[] { location };
+
+ if (locations != null && locations.length > 0) {
+ FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), getShell());
+ runner.execute(locations, fileBufferOperation, new SubProgressMonitor(monitor, ticks));
+ }
+ status= Status.OK_STATUS;
+ } finally {
+ monitor.done();
}
- status= Status.OK_STATUS;
} catch (OperationCanceledException e) {
status= new Status(IStatus.CANCEL, EditorsUI.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java
index f9da142aa..63ee227c4 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java
@@ -28,7 +28,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.resources.IFile;
@@ -195,19 +195,23 @@ public class FileBufferOperationHandler extends AbstractHandler {
try {
int ticks= 100;
- SubMonitor subMonitor= SubMonitor.convert(monitor, fFileBufferOperation.getOperationName(), ticks);
- IPath[] locations;
- if (files != null) {
- ticks-= 30;
- locations= generateLocations(files, subMonitor.newChild(30));
- } else
- locations= new IPath[] { location };
-
- if (locations != null && locations.length > 0) {
- FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), getShell());
- runner.execute(locations, fileBufferOperation, subMonitor.newChild(ticks));
+ monitor.beginTask(fFileBufferOperation.getOperationName(), ticks);
+ try {
+ IPath[] locations;
+ if (files != null) {
+ ticks -= 30;
+ locations= generateLocations(files, new SubProgressMonitor(monitor, 30));
+ } else
+ locations= new IPath[] { location };
+
+ if (locations != null && locations.length > 0) {
+ FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), getShell());
+ runner.execute(locations, fileBufferOperation, new SubProgressMonitor(monitor, ticks));
+ }
+ status= Status.OK_STATUS;
+ } finally {
+ monitor.done();
}
- status= Status.OK_STATUS;
} catch (OperationCanceledException e) {
status= new Status(IStatus.CANCEL, EditorsUI.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
index cbf280756..61e86952e 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
@@ -37,7 +37,7 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
@@ -639,10 +639,15 @@ public class FileDocumentProvider extends StorageDocumentProvider {
}
} else {
- SubMonitor subMonitor= SubMonitor.convert(monitor, TextEditorMessages.FileDocumentProvider_task_saving, 2);
- ContainerCreator creator= new ContainerCreator(file.getWorkspace(), file.getParent().getFullPath());
- creator.createContainer(subMonitor.newChild(1));
- file.create(stream, false, subMonitor.newChild(1));
+ try {
+ monitor.beginTask(TextEditorMessages.FileDocumentProvider_task_saving, 2000);
+ ContainerCreator creator = new ContainerCreator(file.getWorkspace(), file.getParent().getFullPath());
+ creator.createContainer(new SubProgressMonitor(monitor, 1000));
+ file.create(stream, false, new SubProgressMonitor(monitor, 1000));
+ }
+ finally {
+ monitor.done();
+ }
}
} else {

Back to the top