View | Details | Raw Unified | Return to bug 13221 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java (+2 lines)
Lines 28-33 Link Here
28
import org.eclipse.jface.resource.JFaceResources;
28
import org.eclipse.jface.resource.JFaceResources;
29
import org.eclipse.osgi.util.NLS;
29
import org.eclipse.osgi.util.NLS;
30
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.SWT;
31
import org.eclipse.swt.dnd.FileTransfer;
31
import org.eclipse.swt.graphics.Color;
32
import org.eclipse.swt.graphics.Color;
32
import org.eclipse.swt.layout.GridLayout;
33
import org.eclipse.swt.layout.GridLayout;
33
import org.eclipse.swt.widgets.Composite;
34
import org.eclipse.swt.widgets.Composite;
Lines 192-197 Link Here
192
        configurer.addEditorAreaTransfer(EditorInputTransfer
193
        configurer.addEditorAreaTransfer(EditorInputTransfer
193
                .getInstance());
194
                .getInstance());
194
        configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
195
        configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
196
        configurer.addEditorAreaTransfer(FileTransfer.getInstance());
195
        configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
197
        configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
196
        configurer
198
        configurer
197
                .configureEditorAreaDropListener(new EditorAreaDropAdapter(
199
                .configureEditorAreaDropListener(new EditorAreaDropAdapter(
(-)src/org/eclipse/ui/ide/IDE.java (-13 / +76 lines)
Lines 16-23 Link Here
16
import java.util.Iterator;
16
import java.util.Iterator;
17
import java.util.List;
17
import java.util.List;
18
18
19
import org.eclipse.osgi.util.NLS;
20
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Shell;
23
19
import org.eclipse.core.filesystem.EFS;
24
import org.eclipse.core.filesystem.EFS;
20
import org.eclipse.core.filesystem.IFileStore;
25
import org.eclipse.core.filesystem.IFileStore;
26
27
import org.eclipse.core.runtime.CoreException;
28
import org.eclipse.core.runtime.IAdaptable;
29
import org.eclipse.core.runtime.IStatus;
30
import org.eclipse.core.runtime.MultiStatus;
31
import org.eclipse.core.runtime.Platform;
32
import org.eclipse.core.runtime.QualifiedName;
33
import org.eclipse.core.runtime.SafeRunner;
34
import org.eclipse.core.runtime.content.IContentDescription;
35
import org.eclipse.core.runtime.content.IContentType;
36
import org.eclipse.core.runtime.content.IContentTypeMatcher;
37
21
import org.eclipse.core.resources.IFile;
38
import org.eclipse.core.resources.IFile;
22
import org.eclipse.core.resources.IMarker;
39
import org.eclipse.core.resources.IMarker;
23
import org.eclipse.core.resources.IResource;
40
import org.eclipse.core.resources.IResource;
Lines 32-54 Link Here
32
import org.eclipse.core.resources.mapping.ResourceMapping;
49
import org.eclipse.core.resources.mapping.ResourceMapping;
33
import org.eclipse.core.resources.mapping.ResourceMappingContext;
50
import org.eclipse.core.resources.mapping.ResourceMappingContext;
34
import org.eclipse.core.resources.mapping.ResourceTraversal;
51
import org.eclipse.core.resources.mapping.ResourceTraversal;
35
import org.eclipse.core.runtime.CoreException;
52
36
import org.eclipse.core.runtime.IAdaptable;
37
import org.eclipse.core.runtime.IStatus;
38
import org.eclipse.core.runtime.MultiStatus;
39
import org.eclipse.core.runtime.Platform;
40
import org.eclipse.core.runtime.QualifiedName;
41
import org.eclipse.core.runtime.SafeRunner;
42
import org.eclipse.core.runtime.content.IContentDescription;
43
import org.eclipse.core.runtime.content.IContentType;
44
import org.eclipse.core.runtime.content.IContentTypeMatcher;
45
import org.eclipse.jface.dialogs.ErrorDialog;
53
import org.eclipse.jface.dialogs.ErrorDialog;
46
import org.eclipse.jface.dialogs.IDialogConstants;
54
import org.eclipse.jface.dialogs.IDialogConstants;
47
import org.eclipse.jface.util.SafeRunnable;
55
import org.eclipse.jface.util.SafeRunnable;
48
import org.eclipse.jface.viewers.IStructuredSelection;
56
import org.eclipse.jface.viewers.IStructuredSelection;
49
import org.eclipse.osgi.util.NLS;
57
50
import org.eclipse.swt.widgets.Composite;
51
import org.eclipse.swt.widgets.Shell;
52
import org.eclipse.ui.IEditorDescriptor;
58
import org.eclipse.ui.IEditorDescriptor;
53
import org.eclipse.ui.IEditorInput;
59
import org.eclipse.ui.IEditorInput;
54
import org.eclipse.ui.IEditorPart;
60
import org.eclipse.ui.IEditorPart;
Lines 1049-1054 Link Here
1049
		return editor;
1055
		return editor;
1050
	}
1056
	}
1051
1057
1058
    /**
1059
     * Opens an editor on the given IFileStore object.
1060
     * <p>
1061
     * Unlike the other <code>openEditor</code> methods, this one
1062
     * can be used to open files that reside outside the workspace
1063
     * resource set.
1064
     * </p>
1065
     * <p>
1066
     * If the page already has an editor open on the target object then that
1067
     * editor is brought to front; otherwise, a new editor is opened.
1068
     * </p>
1069
     * 
1070
     * @param page
1071
     *            the page in which the editor will be opened
1072
     * @param fileStore 
1073
     *            the IFileStore representing the file to open
1074
     * @return an open editor or <code>null</code> if an external editor was opened
1075
     * @exception PartInitException
1076
     *                if the editor could not be initialized
1077
     * @see org.eclipse.ui.IWorkbenchPage#openEditor(IEditorInput, String)
1078
     * @since 3.3
1079
     */
1080
	public static IEditorPart openEditorOnFileStore(IWorkbenchPage page, IFileStore fileStore) throws PartInitException {
1081
        //sanity checks
1082
        if (page == null) {
1083
			throw new IllegalArgumentException();
1084
		}
1085
1086
        IEditorInput input = getEditorInput(fileStore);
1087
        String editorId = getEditorId(fileStore);
1088
        
1089
        // open the editor on the file
1090
        return page.openEditor(input, editorId);
1091
    }
1092
1093
    /**
1094
     * Get the id of the editor associated with the given <code>IFileStore</code>.
1095
     * 
1096
	 * @param workbench
1097
	 * 	         the Workbench to use to determine the appropriate editor's id 
1098
     * @param fileStore
1099
     *           the <code>IFileStore</code> representing the file for which the editor id is desired
1100
	 * @return the id of the appropriate editor
1101
	 * @since 3.3
1102
	 */
1103
	private static String getEditorId(IFileStore fileStore) {
1104
		IEditorDescriptor descriptor;
1105
		try {
1106
			descriptor = IDE.getEditorDescriptor(fileStore.getName());
1107
		} catch (PartInitException e) {
1108
			return null;
1109
		}
1110
		if (descriptor != null)
1111
			return descriptor.getId();
1112
		return null;
1113
	}
1114
1052
	/**
1115
	/**
1053
	 * Save all dirty editors in the workbench whose editor input is a child
1116
	 * Save all dirty editors in the workbench whose editor input is a child
1054
	 * resource of one of the <code>IResource</code>'s provided. Opens a
1117
	 * resource of one of the <code>IResource</code>'s provided. Opens a
(-)src/org/eclipse/ui/internal/ide/EditorAreaDropAdapter.java (-1 / +20 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-24 Link Here
11
11
12
package org.eclipse.ui.internal.ide;
12
package org.eclipse.ui.internal.ide;
13
13
14
import org.eclipse.core.filesystem.EFS;
15
import org.eclipse.core.filesystem.IFileStore;
14
import org.eclipse.core.resources.IFile;
16
import org.eclipse.core.resources.IFile;
15
import org.eclipse.core.resources.IMarker;
17
import org.eclipse.core.resources.IMarker;
16
import org.eclipse.core.resources.IResource;
18
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.runtime.Assert;
19
import org.eclipse.core.runtime.Assert;
18
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.Path;
19
import org.eclipse.swt.dnd.DND;
22
import org.eclipse.swt.dnd.DND;
20
import org.eclipse.swt.dnd.DropTargetAdapter;
23
import org.eclipse.swt.dnd.DropTargetAdapter;
21
import org.eclipse.swt.dnd.DropTargetEvent;
24
import org.eclipse.swt.dnd.DropTargetEvent;
25
import org.eclipse.swt.dnd.FileTransfer;
22
import org.eclipse.swt.widgets.Display;
26
import org.eclipse.swt.widgets.Display;
23
import org.eclipse.ui.IEditorDescriptor;
27
import org.eclipse.ui.IEditorDescriptor;
24
import org.eclipse.ui.IEditorInput;
28
import org.eclipse.ui.IEditorInput;
Lines 119-124 Link Here
119
            }
123
            }
120
        }
124
        }
121
125
126
        /* Open Editor for file from local file system */
127
        else if (FileTransfer.getInstance().isSupportedType(
128
                event.currentDataType)) {
129
            Assert.isTrue(event.data instanceof String[]);
130
            String[] paths = (String[]) event.data;
131
            for (int i = 0; i < paths.length; i++) {
132
            	IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(paths[i]));
133
            	try {
134
					IDE.openEditorOnFileStore(page, fileStore);
135
				} catch (PartInitException e) {
136
					// silently ignore problems opening the editor
137
				}
138
            }
139
        }
140
122
    }
141
    }
123
142
124
    /**
143
    /**

Return to bug 13221