|
Lines 70-79
Link Here
|
| 70 |
* David McKnight (IBM) - [323299] [files] remote file view adapter needs to use the latest version of IRemoteFile |
70 |
* David McKnight (IBM) - [323299] [files] remote file view adapter needs to use the latest version of IRemoteFile |
| 71 |
* David McKnight (IBM) - [324192] Cannot open a renamed file |
71 |
* David McKnight (IBM) - [324192] Cannot open a renamed file |
| 72 |
* David McKnight (IBM) - [341244] folder selection input to unlocked Remote Systems Details view sometimes fails |
72 |
* David McKnight (IBM) - [341244] folder selection input to unlocked Remote Systems Details view sometimes fails |
|
|
73 |
* Rick Sawyer (IBM) - [376535] RSE does not respect editor overrides |
| 73 |
*******************************************************************************/ |
74 |
*******************************************************************************/ |
| 74 |
|
75 |
|
| 75 |
package org.eclipse.rse.internal.files.ui.view; |
76 |
package org.eclipse.rse.internal.files.ui.view; |
| 76 |
import java.io.File; |
77 |
import java.io.File; |
|
|
78 |
import java.lang.reflect.Method; |
| 77 |
import java.text.MessageFormat; |
79 |
import java.text.MessageFormat; |
| 78 |
import java.util.ArrayList; |
80 |
import java.util.ArrayList; |
| 79 |
import java.util.Date; |
81 |
import java.util.Date; |
|
Lines 93-98
Link Here
|
| 93 |
import org.eclipse.core.runtime.Platform; |
95 |
import org.eclipse.core.runtime.Platform; |
| 94 |
import org.eclipse.core.runtime.Status; |
96 |
import org.eclipse.core.runtime.Status; |
| 95 |
import org.eclipse.core.runtime.SubProgressMonitor; |
97 |
import org.eclipse.core.runtime.SubProgressMonitor; |
|
|
98 |
import org.eclipse.core.runtime.content.IContentType; |
| 96 |
import org.eclipse.core.runtime.jobs.Job; |
99 |
import org.eclipse.core.runtime.jobs.Job; |
| 97 |
import org.eclipse.jface.action.MenuManager; |
100 |
import org.eclipse.jface.action.MenuManager; |
| 98 |
import org.eclipse.jface.action.Separator; |
101 |
import org.eclipse.jface.action.Separator; |
|
Lines 196-206
Link Here
|
| 196 |
import org.eclipse.swt.dnd.Clipboard; |
199 |
import org.eclipse.swt.dnd.Clipboard; |
| 197 |
import org.eclipse.swt.widgets.Display; |
200 |
import org.eclipse.swt.widgets.Display; |
| 198 |
import org.eclipse.swt.widgets.Shell; |
201 |
import org.eclipse.swt.widgets.Shell; |
|
|
202 |
import org.eclipse.ui.IEditorDescriptor; |
| 203 |
import org.eclipse.ui.IEditorInput; |
| 199 |
import org.eclipse.ui.IEditorPart; |
204 |
import org.eclipse.ui.IEditorPart; |
| 200 |
import org.eclipse.ui.IEditorRegistry; |
205 |
import org.eclipse.ui.IEditorRegistry; |
| 201 |
import org.eclipse.ui.ISharedImages; |
206 |
import org.eclipse.ui.ISharedImages; |
| 202 |
import org.eclipse.ui.IWorkbench; |
207 |
import org.eclipse.ui.IWorkbench; |
| 203 |
import org.eclipse.ui.PlatformUI; |
208 |
import org.eclipse.ui.PlatformUI; |
|
|
209 |
import org.eclipse.ui.ide.IDE; |
| 210 |
import org.eclipse.ui.part.FileEditorInput; |
| 204 |
import org.eclipse.ui.progress.IElementCollector; |
211 |
import org.eclipse.ui.progress.IElementCollector; |
| 205 |
import org.eclipse.ui.views.properties.IPropertyDescriptor; |
212 |
import org.eclipse.ui.views.properties.IPropertyDescriptor; |
| 206 |
import org.eclipse.ui.views.properties.PropertyDescriptor; |
213 |
import org.eclipse.ui.views.properties.PropertyDescriptor; |
|
Lines 505-510
Link Here
|
| 505 |
IRemoteFile file = (IRemoteFile) element; |
512 |
IRemoteFile file = (IRemoteFile) element; |
| 506 |
if (file.isFile() || file.isArchive()) // hack to show zips without folder icons |
513 |
if (file.isFile() || file.isArchive()) // hack to show zips without folder icons |
| 507 |
{ |
514 |
{ |
|
|
515 |
// bug #376535 - need to respect editor overrides |
| 516 |
IFile localFile = getLocalResource(file); |
| 517 |
if (localFile != null) { |
| 518 |
IEditorDescriptor editorDesc = getEditorRegistry().getDefaultEditor(file.getName(), IDE.guessContentType(localFile)); |
| 519 |
// Using reflection in case IDE is older version, without this method |
| 520 |
//editorDesc = IDE.overrideDefaultEditorAssociation(new FileEditorInput(localFile), IDE.guessContentType(localFile), editorDesc); |
| 521 |
Class clazz = IDE.class; |
| 522 |
try { |
| 523 |
Class parmtypes[] = {IEditorInput.class, IContentType.class, IEditorDescriptor.class}; |
| 524 |
Method method = clazz.getMethod("overrideDefaultEditorAssociation", parmtypes); //$NON-NLS-1$ |
| 525 |
if (method != null) { |
| 526 |
Object args[] = {new FileEditorInput(localFile), IDE.guessContentType(localFile), editorDesc}; |
| 527 |
editorDesc = (IEditorDescriptor) method.invoke(null, args); |
| 528 |
} |
| 529 |
} catch (Exception e) { |
| 530 |
} |
| 531 |
|
| 532 |
if (editorDesc != null) { |
| 533 |
ImageDescriptor image = editorDesc.getImageDescriptor(); |
| 534 |
if (image != null) { |
| 535 |
return image; |
| 536 |
} |
| 537 |
} |
| 538 |
} |
| 539 |
|
| 508 |
return getEditorRegistry().getImageDescriptor(file.getName()); |
540 |
return getEditorRegistry().getImageDescriptor(file.getName()); |
| 509 |
} |
541 |
} |
| 510 |
else |
542 |
else |
|
Lines 533-538
Link Here
|
| 533 |
} |
565 |
} |
| 534 |
|
566 |
|
| 535 |
/** |
567 |
/** |
|
|
568 |
* Get the local cache of the remote file, or <code>null</code> if none. |
| 569 |
* @param remoteFile the remote file. |
| 570 |
* @return the local cached resource, or <code>null</code> if none. |
| 571 |
*/ |
| 572 |
private IFile getLocalResource(IRemoteFile remoteFile) |
| 573 |
{ |
| 574 |
return (IFile)UniversalFileTransferUtility.getTempFileFor(remoteFile); |
| 575 |
} |
| 576 |
|
| 577 |
/** |
| 536 |
* Return the label for this object. Uses getName() on the remote file object. |
578 |
* Return the label for this object. Uses getName() on the remote file object. |
| 537 |
*/ |
579 |
*/ |
| 538 |
public String getText(Object element) |
580 |
public String getText(Object element) |
|
Lines 3359-3365
Link Here
|
| 3359 |
|
3401 |
|
| 3360 |
// open new editor for correct replica |
3402 |
// open new editor for correct replica |
| 3361 |
editable = getEditableRemoteObject(remoteFile); |
3403 |
editable = getEditableRemoteObject(remoteFile); |
| 3362 |
} |
3404 |
} |
|
|
3405 |
|
| 3406 |
/* Commenting out - no longer needed with fix to bug #376535 |
| 3407 |
if (editable instanceof SystemEditableRemoteFile){ |
| 3408 |
SystemEditableRemoteFile edit = (SystemEditableRemoteFile)editable; |
| 3409 |
IEditorDescriptor oldDescriptor = edit.getEditorDescriptor(); |
| 3410 |
IEditorDescriptor curDescriptor = null; |
| 3411 |
IFile file = editable.getLocalResource(); |
| 3412 |
|
| 3413 |
if (file == null || !file.exists()){ |
| 3414 |
curDescriptor = registry.getDefaultEditor(remoteFile.getName()); |
| 3415 |
} |
| 3416 |
if (curDescriptor == null){ |
| 3417 |
try { |
| 3418 |
curDescriptor = IDE.getEditorDescriptor(file); |
| 3419 |
} catch (PartInitException e) { |
| 3420 |
curDescriptor = IDE.getDefaultEditor(file); |
| 3421 |
} |
| 3422 |
} |
| 3423 |
if (oldDescriptor != curDescriptor){ |
| 3424 |
edit.setEditorDescriptor(curDescriptor); |
| 3425 |
} |
| 3426 |
} |
| 3427 |
*/ |
| 3363 |
|
3428 |
|
| 3364 |
try |
3429 |
try |
| 3365 |
{ |
3430 |
{ |