1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

[325502] The default editor for a file is not updated when opened in RSE explorer

This commit is contained in:
David McKnight 2010-09-17 15:57:25 +00:00
parent 97683f3e3a
commit 3b97e86fcc
2 changed files with 21 additions and 17 deletions

View file

@ -40,6 +40,7 @@
* David McKnight (IBM) - [284420] nullprogressmonitor is needed
* David McKnight (IBM) - [310215] SystemEditableRemoteFile.open does not behave as expected
* David McKnight (IBM) - [324519] SystemEditableRemoteFile throws NPE when used in headless mode
* David McKnight (IBM) - [325502] The default editor for a file is not updated when opened in RSE explorer
*******************************************************************************/
package org.eclipse.rse.files.ui.resources;
@ -2013,4 +2014,22 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
return remoteFile.isStale();
}
/**
* Get the editor descriptor to be associated with the remote file
* @return the editor descriptor associated with this remote file
* @since 3.3
*/
public IEditorDescriptor getEditorDescriptor(){
return _editorDescriptor;
}
/**
* Set the editor descriptor to be associated with the remote file
* @param descriptor the new editor descriptor
* @since 3.3
*/
public void setEditorDescriptor(IEditorDescriptor descriptor){
_editorDescriptor = descriptor;
}
}

View file

@ -874,23 +874,8 @@ public class SystemRemoteEditManager
// fall through and let the new editable get created
}
else {
if (descriptor != null){
// using reflection to change descriptor since there's
// no API right now
try {
Class cls = editable.getClass();
Field[] fields = cls.getDeclaredFields();
for (int i = 0; i < fields.length; i++){
Field fld = fields[i];
String name= fld.getName();
if (name.equals("_editorDescriptor")){ //$NON-NLS-1$
fld.setAccessible(true);
fld.set(editable, descriptor);
}
}
}
catch (Exception e){
}
if (descriptor != null){ // update the editor descriptor
editable.setEditorDescriptor(descriptor);
}
return editable;
}