4/5/2023 0 Comments Jedit edite jar files% we get a or .DTContainer object endĬurrentFilename = char ( title. elementAt ( 0 ) % a .EditorViewContainer object getOpenDocuments % a įirstDoc = openDocs. % we get a .MLMultipleClientFrame object catch % Matlab 6 % Unfortunately, we can't get the Editor handle from the Desktop handle in Matlab 6: %desktop = .MLDesktop.getMLDesktop % So here's the workaround for Matlab 6: Of course, you can always continue to use the partially-documented/supported editorservices object that Mike Katz introduced last year (see his comment above).ĭesktop = com. I may also post about this in the upcoming months, since it needs much more space than a simple comment here, so stay tuned. I suggest using my CheckClass or UIInspect utilities if you want additional information about the supported properties, callbacks and methods. CaretPosition, Document, Language, Length, LongName, ShortName, Selection, Text, etc.). Once you get your desired document (a MatlabEditor reference), its functionality can be accessed via its MatlabEditor’s methods (bringToFront(), close(), goToLine(…), reload(), replaceText(…), setEditable(…) etc.) or properties (e.g. The jEditorApp.getActiveEditor() method returns the MatlabEditor object for the currently-edited document the other documents can be retrieved using jEditorApp.getOpenEditors(), which returns a of such MatlabEditors. Each edited document now has a separate .MatlabEditor object. The method names and parameters have also changed from those of the pre-R2010b Java class. What I said I know works when the editor is undocked which is not what I’m looking for! So I correct that: I don’t even know how to get the title of the active document in the editor when the editor is docked into the main windowĮditorservices = com. However I didn’t find the right callback property. What I need is to code a callback function to be triggered whenever I switch to another document in the editor. Thanks to now I know how to get the name of the active document and how to change the window title by accessing related java components. I’m thinking of a way to change the main window title to the name of the document I’m currently working on. I’m used to have the MATLAB editor docked into the main window, so all my working time in MATLAB is reported under the name of “MATLAB 7.8.0 (2009a)”. It recognizes the applications by their window caption. I have a time tracking software that records the time I spend on each application. I sent this question on MATLAB central but received no answer, so I post it here again in case you’ve not seen it! Care to try it? If you get stuck I can help out. I think it could be a great File Exchange utility. The reverse, setting bookmarks, could be done in a similar fashion, using the ‘toggle-bookmark’ action. So, the only way I could find is to loop over all the editor’s open files, and invoke the editor’s default action for (which is the ‘next-bookmark’ action reported by the EditorMacro utility) in a loop until you detect coming back to an earlier line number. In any case, I did not find a method to programmatically retrieve this list since the ExecutionPanel object does not expose any method to do so. I do not know whether the list of bookmarks are contained within this object, although I suspect they are. I discovered (via the FindJObj utility) that the bookmarks are displayed in a panel called ‘ExecutionArrowDisplay’ of class .ExecutionArrowDisplay$ExecutionPanel. Ruben – that was a hard question that kept me digging for hours.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |