Frank Knubben wrote:
In RDi 7.5 this class seems to have been replaced with the
QSYSEditableRemoteSourceFileMember
class so that is what I am using, with the same method, passing in the
read-only is true value.
But I am getting some strange results...most of the time the editor is
opened in browse mode as expected, but sometimes as soon as the source is
visible in the editor it is already marked as dirty and the asterisk is
visible to the left of the source file member name. And very occasionally
the asterisk is not visible at all, but when I close the editor the "Save
Resource" dialog pops up, indicating that the member has been change.
I've encountered this exact situation! And I resolved it.
How are you getting your editable remote object?
Here's (roughly) what I'm doing ...
IBMiConnection connection = getConnection();
IQSYSMember mbr = connection.getMember(sourceLibrary, sourceFile,
sourceMember, new NullProgressMonitor());
IAdaptable item = (IAdaptable)mbr;
ISystemRemoteElementAdapter adapter =
(ISystemRemoteElementAdapter) item .getAdapter(ISystemRemoteElementAdapter.class);
ISystemEditableRemoteObject remoteObject = adapter.getEditableRemoteObject(item);
QSYSEditableRemoteSourceFileMember editableMember =
(QSYSEditableRemoteSourceFileMember)remoteObject;
(appologies if this code doesn't work, it's being copied & pasted from a bunch of different routines).
IIRC, I found that trying to open the member for edit when it was already open for browse could cause problems. To that end, the following routines came in handy so I would just activate an existing editor (edit or browse) if it was already open.
protected final boolean isOpenInEditor(ISystemEditableRemoteObject editable)
throws CoreException {
int openStatus = editable.checkOpenInEditor();
boolean open = (openStatus != ISystemEditableRemoteObject.NOT_OPEN);
return open;
}
/**
* Activates the editor for a specific remote editable object.
*
* @param editable remote editable object to activate
*/
protected final void activateEditor(ISystemEditableRemoteObject editable) {
IEditorPart editor = editable.getEditorPart();
IWorkbenchPartSite site = editor.getSite();
IWorkbenchPage page = site.getPage();
page.activate(editor);
}
david
As an Amazon Associate we earn from qualifying purchases.