001/* 002 * Copyright 2010-2015 Institut Pasteur. 003 * 004 * This file is part of Icy. 005 * 006 * Icy is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Icy is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with Icy. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package icy.imagej.patches; 020 021import icy.imagej.ImageJWrapper; 022import icy.main.Icy; 023 024import ij.ImageJ; 025import ij.Menus; 026 027/** 028 * Overrides {@link Menus} methods. 029 * 030 * @author Stephane Dallongeville 031 */ 032@SuppressWarnings("unused") 033public class MenusMethods 034{ 035 private MenusMethods() 036 { 037 // prevent instantiation of utility class 038 } 039 040 /** Appends {@link Menus#installUserPlugin(String, boolean)}. */ 041 public static void installUserPlugin(final Menus obj, String className, boolean force) 042 { 043 final ImageJWrapper ijw = Icy.getMainInterface().getImageJ(); 044 045 if (ijw != null) 046 ijw.menuChanged(); 047 } 048 049 /** Appends {@link Menus#updateMenus()}. */ 050 public static void updateMenus() 051 { 052 final ImageJWrapper ijw = Icy.getMainInterface().getImageJ(); 053 054 if (ijw != null) 055 ijw.menuChanged(); 056 } 057 058 /** Appends {@link Menus#updateWindowMenuItem(String, String)}. */ 059 public static synchronized void updateWindowMenuItem(String oldLabel, String newLabel) 060 { 061 final ImageJWrapper ijw = Icy.getMainInterface().getImageJ(); 062 063 if (ijw != null) 064 ijw.menuChanged(); 065 } 066 067 /** Appends {@link Menus#addOpenRecentItem(String)}. */ 068 public static synchronized void addOpenRecentItem(String path) 069 { 070 final ImageJWrapper ijw = Icy.getMainInterface().getImageJ(); 071 072 if (ijw != null) 073 ijw.menuChanged(); 074 } 075 076 /** Appends {@link Menus#installPlugin(String, char, String, String, ImageJ)}. */ 077 public static int installPlugin(String plugin, char menuCode, String command, String shortcut, ImageJ ij, int result) 078 { 079 final ImageJWrapper ijw = Icy.getMainInterface().getImageJ(); 080 081 if (ijw != null) 082 ijw.menuChanged(); 083 084 return result; 085 } 086}