Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-04-26 13:55:41 +0000
committerMichael Valenta2007-04-26 13:55:41 +0000
commitfb549380d52f8db918560036ad55b092df22e686 (patch)
treebf5a7eba556689ad736e798e41654685b90db8a8 /bundles/org.eclipse.compare
parent15c41e5be6a40acf93137ded7655c1425765a5dd (diff)
downloadeclipse.platform.team-fb549380d52f8db918560036ad55b092df22e686.tar.gz
eclipse.platform.team-fb549380d52f8db918560036ad55b092df22e686.tar.xz
eclipse.platform.team-fb549380d52f8db918560036ad55b092df22e686.zip
Bug 149444 [Patch] Apply Patch wizard should select 'Clipboard' if it contains a valid patch
Diffstat (limited to 'bundles/org.eclipse.compare')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java93
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java93
2 files changed, 60 insertions, 126 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
index 5c77263e7..3ca1f774c 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
@@ -12,64 +12,32 @@
*******************************************************************************/
package org.eclipse.compare.internal.patch;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import com.ibm.icu.text.MessageFormat;
+import java.io.*;
import org.eclipse.compare.internal.ICompareContextIds;
import org.eclipse.compare.internal.Utilities;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
+import org.eclipse.ui.views.navigator.ResourceComparator;
+import com.ibm.icu.text.MessageFormat;
/* package */ class InputPatchPage extends WizardPage {
@@ -451,7 +419,7 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
fTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
fTreeViewer.setContentProvider(new WorkbenchContentProvider());
- fTreeViewer.setSorter(new ResourceSorter(ResourceSorter.NAME));
+ fTreeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
fTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
}
@@ -746,29 +714,28 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
}
}
}
- } else {
- // check out clipboard contents
- Reader reader= null;
- Control c= getControl();
- if (c != null) {
- Clipboard clipboard= new Clipboard(c.getDisplay());
- Object o= clipboard.getContents(TextTransfer.getInstance());
- clipboard.dispose();
- try {
- if (o instanceof String) {
- reader= new StringReader((String) o);
- if (isPatchFile(reader)) {
- setInputButtonState(CLIPBOARD);
- return true;
- }
+ }
+ // check out clipboard contents
+ Reader reader = null;
+ Control c = getControl();
+ if (c != null) {
+ Clipboard clipboard = new Clipboard(c.getDisplay());
+ Object o = clipboard.getContents(TextTransfer.getInstance());
+ clipboard.dispose();
+ try {
+ if (o instanceof String) {
+ reader = new StringReader((String) o);
+ if (isPatchFile(reader)) {
+ setInputButtonState(CLIPBOARD);
+ return true;
}
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException x) {
- // silently ignored
- }
+ }
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException x) {
+ // silently ignored
}
}
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
index 5c77263e7..3ca1f774c 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
@@ -12,64 +12,32 @@
*******************************************************************************/
package org.eclipse.compare.internal.patch;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import com.ibm.icu.text.MessageFormat;
+import java.io.*;
import org.eclipse.compare.internal.ICompareContextIds;
import org.eclipse.compare.internal.Utilities;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
+import org.eclipse.ui.views.navigator.ResourceComparator;
+import com.ibm.icu.text.MessageFormat;
/* package */ class InputPatchPage extends WizardPage {
@@ -451,7 +419,7 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
fTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
fTreeViewer.setContentProvider(new WorkbenchContentProvider());
- fTreeViewer.setSorter(new ResourceSorter(ResourceSorter.NAME));
+ fTreeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
fTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
}
@@ -746,29 +714,28 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
}
}
}
- } else {
- // check out clipboard contents
- Reader reader= null;
- Control c= getControl();
- if (c != null) {
- Clipboard clipboard= new Clipboard(c.getDisplay());
- Object o= clipboard.getContents(TextTransfer.getInstance());
- clipboard.dispose();
- try {
- if (o instanceof String) {
- reader= new StringReader((String) o);
- if (isPatchFile(reader)) {
- setInputButtonState(CLIPBOARD);
- return true;
- }
+ }
+ // check out clipboard contents
+ Reader reader = null;
+ Control c = getControl();
+ if (c != null) {
+ Clipboard clipboard = new Clipboard(c.getDisplay());
+ Object o = clipboard.getContents(TextTransfer.getInstance());
+ clipboard.dispose();
+ try {
+ if (o instanceof String) {
+ reader = new StringReader((String) o);
+ if (isPatchFile(reader)) {
+ setInputButtonState(CLIPBOARD);
+ return true;
}
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException x) {
- // silently ignored
- }
+ }
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException x) {
+ // silently ignored
}
}
}

Back to the top