Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Dear all,
I would like to create Shortcuts (let's say F1 and F2) in order to open the first and second file that can be found in the File/Open Recent submenu. I figured out that I should create a plugin calling the RecentOpener class for this but have no clue on how to do it. So I thank you very much in advance for a little help. Best regards, Philippe -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Philippe,
Well, I have not tried, but it might work like the following: First you need the path+name of the recent file: String recentFile=openRecentMenu.getItem(i).getLabel(); where 'i' is 0 for the most recent and 1 for the file before. Then, if that file is not a blank String, you can use new RecentOpener(recentFile); Note that opening recentFile number 1 this way will put it on top of the 'recent' list, so it will become recentFile 0. If you want to leave the 'Open Recent' menu untouched, use IJ.open(recentFile); or ImagePlus imp = IJ.openImage(recentFile); Michael ________________________________________________________________ On Dec 13, 2012, at 15:52, Philippe CARL wrote: > Dear all, > > I would like to create Shortcuts (let's say F1 and F2) in order to open the > first and second file that can be found in the File/Open Recent submenu. > > I figured out that I should create a plugin calling the RecentOpener class > for this but have no clue on how to do it. > > So I thank you very much in advance for a little help. > > Best regards, > > Philippe -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Philippe,
oops, sorry, it should have been String recentFile=Menus.openRecentMenu.getItem(i).getLabel(); But I just noted that Menus.openRecentMenu is not public, thus not accessible from plugins. So my idea does not work unless Wayne would add a public method Menus.getOpenRecentMenu() (preferred, it would also allow plugins to manipulate the 'Open Recent' menu) or Menus.getOpenRecentMenuItem(int i) Michael ________________________________________________________________ On Dec 17, 2012, at 17:40, Michael Schmid wrote: > Hi Philippe, > > > Well, I have not tried, but it might work like the following: > > First you need the path+name of the recent file: > String recentFile=openRecentMenu.getItem(i).getLabel(); > where 'i' is 0 for the most recent and 1 for the file before. > > Then, if that file is not a blank String, you can use > new RecentOpener(recentFile); > > Note that opening recentFile number 1 this way will put it on top of the 'recent' list, so it will become recentFile 0. If you want to leave the 'Open Recent' menu untouched, use > IJ.open(recentFile); or > ImagePlus imp = IJ.openImage(recentFile); > > Michael > ________________________________________________________________ > > > On Dec 13, 2012, at 15:52, Philippe CARL wrote: > >> Dear all, >> >> I would like to create Shortcuts (let's say F1 and F2) in order to open the >> first and second file that can be found in the File/Open Recent submenu. >> >> I figured out that I should create a plugin calling the RecentOpener class >> for this but have no clue on how to do it. >> >> So I thank you very much in advance for a little help. >> >> Best regards, >> >> Philippe > ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |