Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java')
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java176
1 files changed, 88 insertions, 88 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java
index bf7cd3a64a..605d75000b 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java
@@ -27,99 +27,99 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
public class SourcesFileDownloadHyperlink implements IHyperlink {
- private String fileName;
- private IFile original;
- private IRegion region;
+ private String fileName;
+ private IFile original;
+ private IRegion region;
- /**
- * Creates hyperlink for the following file name, region and file whether
- * the file name is found.
- *
- * @param original
- * The file where the reference to this file name is.
- * @param fileName
- * The name of the file to open.
- * @param region
- * The hyperlink region.
- */
- public SourcesFileDownloadHyperlink(IFile original, String fileName,
- IRegion region) {
- this.fileName = fileName;
- this.original = original;
- this.region = region;
- }
+ /**
+ * Creates hyperlink for the following file name, region and file whether
+ * the file name is found.
+ *
+ * @param original
+ * The file where the reference to this file name is.
+ * @param fileName
+ * The name of the file to open.
+ * @param region
+ * The hyperlink region.
+ */
+ public SourcesFileDownloadHyperlink(IFile original, String fileName,
+ IRegion region) {
+ this.fileName = fileName;
+ this.original = original;
+ this.region = region;
+ }
- /**
- * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkRegion()
- */
- @Override
- public IRegion getHyperlinkRegion() {
- return region;
- }
+ /**
+ * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkRegion()
+ */
+ @Override
+ public IRegion getHyperlinkRegion() {
+ return region;
+ }
- /**
- * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkText()
- */
- @Override
- public String getHyperlinkText() {
- return NLS.bind(Messages.SourcesFileHyperlink_1, fileName);
- }
+ /**
+ * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkText()
+ */
+ @Override
+ public String getHyperlinkText() {
+ return NLS.bind(Messages.SourcesFileHyperlink_1, fileName);
+ }
- /**
- * @see org.eclipse.jface.text.hyperlink.IHyperlink#getTypeLabel()
- */
- @Override
- public String getTypeLabel() {
- return null;
- }
+ /**
+ * @see org.eclipse.jface.text.hyperlink.IHyperlink#getTypeLabel()
+ */
+ @Override
+ public String getTypeLabel() {
+ return null;
+ }
- /**
- * Tries to open the given file name looking for it in the current directory
- * and in ../SOURCES.
- *
- * @see org.eclipse.jface.text.hyperlink.IHyperlink#open()
- */
- @Override
- public void open() {
- IContainer container = original.getParent();
- IResource saveFolder = container.getParent().findMember(
- IRPMConstants.SOURCES_FOLDER);
- if (saveFolder == null) {
- saveFolder = container.findMember(original.getFullPath()
- .removeLastSegments(1));
- }
- if (saveFolder == null) {
- saveFolder = container.findMember("/"); //$NON-NLS-1$
- }
- try {
- URL url = new URL(fileName);
- URLConnection connection = url.openConnection();
- String savedFileName = fileName
- .substring(fileName.lastIndexOf('/') + 1);
- IFile savedFile = original.getProject().getFile(
- saveFolder.getProjectRelativePath().append(savedFileName));
- if (savedFile.exists()) {
- MessageBox mb = new MessageBox(Display.getCurrent()
- .getActiveShell(), SWT.ICON_QUESTION | SWT.OK
- | SWT.CANCEL);
- mb.setText(Messages.SourcesFileDownloadHyperlink_0);
- mb.setMessage(NLS.bind(Messages.SourcesFileDownloadHyperlink_1,
- savedFileName));
- int rc = mb.open();
- if (rc == SWT.OK) {
- new DownloadJob(savedFile, connection).schedule();
- }
+ /**
+ * Tries to open the given file name looking for it in the current directory
+ * and in ../SOURCES.
+ *
+ * @see org.eclipse.jface.text.hyperlink.IHyperlink#open()
+ */
+ @Override
+ public void open() {
+ IContainer container = original.getParent();
+ IResource saveFolder = container.getParent().findMember(
+ IRPMConstants.SOURCES_FOLDER);
+ if (saveFolder == null) {
+ saveFolder = container.findMember(original.getFullPath()
+ .removeLastSegments(1));
+ }
+ if (saveFolder == null) {
+ saveFolder = container.findMember("/"); //$NON-NLS-1$
+ }
+ try {
+ URL url = new URL(fileName);
+ URLConnection connection = url.openConnection();
+ String savedFileName = fileName
+ .substring(fileName.lastIndexOf('/') + 1);
+ IFile savedFile = original.getProject().getFile(
+ saveFolder.getProjectRelativePath().append(savedFileName));
+ if (savedFile.exists()) {
+ MessageBox mb = new MessageBox(Display.getCurrent()
+ .getActiveShell(), SWT.ICON_QUESTION | SWT.OK
+ | SWT.CANCEL);
+ mb.setText(Messages.SourcesFileDownloadHyperlink_0);
+ mb.setMessage(NLS.bind(Messages.SourcesFileDownloadHyperlink_1,
+ savedFileName));
+ int rc = mb.open();
+ if (rc == SWT.OK) {
+ new DownloadJob(savedFile, connection).schedule();
+ }
- } else {
- new DownloadJob(savedFile, connection).schedule();
- }
- } catch (IOException e) {
- MessageBox mb = new MessageBox(Display.getCurrent()
- .getActiveShell(), SWT.ICON_WARNING | SWT.OK);
- mb.setMessage(Messages.SourcesFileDownloadHyperlink_2);
- mb.setText(Messages.SourcesFileDownloadHyperlink_3);
- mb.open();
- }
- }
+ } else {
+ new DownloadJob(savedFile, connection).schedule();
+ }
+ } catch (IOException e) {
+ MessageBox mb = new MessageBox(Display.getCurrent()
+ .getActiveShell(), SWT.ICON_WARNING | SWT.OK);
+ mb.setMessage(Messages.SourcesFileDownloadHyperlink_2);
+ mb.setText(Messages.SourcesFileDownloadHyperlink_3);
+ mb.open();
+ }
+ }
} \ No newline at end of file

Back to the top