Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2016-11-04 17:37:48 +0000
committerAndrey Loskutov2016-11-04 20:18:45 +0000
commitbf7292ed40eab1e600437a7521a99864c98299ad (patch)
treef44347b408186df22740428859a2bbb4e29588a1 /bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
parentf60954ba88fb4b106af2fd6056f69c93a54110b6 (diff)
downloadeclipse.platform.team-bf7292ed40eab1e600437a7521a99864c98299ad.tar.gz
eclipse.platform.team-bf7292ed40eab1e600437a7521a99864c98299ad.tar.xz
eclipse.platform.team-bf7292ed40eab1e600437a7521a99864c98299ad.zip
Change-Id: I2ed3512c294b06e85a63fab90a0934e611339e31 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
index 1ee887caa..3215be92f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
@@ -25,33 +25,33 @@ import org.eclipse.core.runtime.*;
public class AddFromHistoryAction extends BaseCompareAction {
-
+
private static final String BUNDLE_NAME= "org.eclipse.compare.internal.AddFromHistoryAction"; //$NON-NLS-1$
public AddFromHistoryAction() {
// empty default implementation
}
-
+
protected boolean isEnabled(ISelection selection) {
return Utilities.getResources(selection).length == 1;
}
protected void run(ISelection selection) {
-
+
ResourceBundle bundle= ResourceBundle.getBundle(BUNDLE_NAME);
String title= Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
+
Shell parentShell= CompareUIPlugin.getShell();
AddFromHistoryDialog dialog= null;
Object[] s= Utilities.getResources(selection);
-
+
for (int i= 0; i < s.length; i++) {
Object o= s[i];
if (o instanceof IContainer) {
IContainer container= (IContainer) o;
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(parentShell);
+
+ ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(parentShell);
IProgressMonitor pm= pmdialog.getProgressMonitor();
IFile[] states= null;
try {
@@ -59,24 +59,24 @@ public class AddFromHistoryAction extends BaseCompareAction {
} catch (CoreException ex) {
pm.done();
}
-
+
// There could be a recently deleted file at the same path as
// the container. If such a file is the only one to restore, we
// should not suggest to restore it, so set states to null.
if (states.length == 1 && states[0].getFullPath().equals(container.getFullPath()))
states = null;
-
+
if (states == null || states.length <= 0) {
String msg= Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
MessageDialog.openInformation(parentShell, title, msg);
return;
}
-
+
if (dialog == null) {
dialog= new AddFromHistoryDialog(parentShell, bundle);
dialog.setHelpContextId(ICompareContextIds.ADD_FROM_HISTORY_DIALOG);
}
-
+
if (dialog.select(container, states)) {
AddFromHistoryDialog.HistoryInput[] selected = dialog
.getSelected();
@@ -96,7 +96,7 @@ public class AddFromHistoryAction extends BaseCompareAction {
}
}
}
-
+
void createContainers(IResource resource) throws CoreException {
IContainer container= resource.getParent();
if (container instanceof IFolder) {
@@ -107,22 +107,22 @@ public class AddFromHistoryAction extends BaseCompareAction {
}
}
}
-
+
private void updateWorkspace(final ResourceBundle bundle, Shell shell,
final AddFromHistoryDialog.HistoryInput[] selected)
throws InvocationTargetException, InterruptedException {
-
+
WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
public void execute(IProgressMonitor pm) throws InvocationTargetException {
try {
String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$
pm.beginTask(taskName, selected.length);
-
+
for (int i= 0; i < selected.length; i++) {
IFile file= selected[i].fFile;
IFileState fileState= selected[i].fFileState;
createContainers(file);
-
+
SubProgressMonitor subMonitor= new SubProgressMonitor(pm, 1);
try {
file.create(fileState.getContents(), false, subMonitor);
@@ -137,8 +137,8 @@ public class AddFromHistoryAction extends BaseCompareAction {
}
}
};
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
+
+ ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
+ pmdialog.run(false, true, operation);
}
}

Back to the top