| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
package org.homeunix.thecave.buddi.view.menu.menus; |
| 5 | |
|
| 6 | |
import java.util.List; |
| 7 | |
|
| 8 | |
import org.homeunix.thecave.buddi.i18n.keys.MenuKeys; |
| 9 | |
import org.homeunix.thecave.buddi.model.prefs.PrefsModel; |
| 10 | |
import org.homeunix.thecave.buddi.plugin.BuddiPluginFactory; |
| 11 | |
import org.homeunix.thecave.buddi.plugin.api.BuddiImportPlugin; |
| 12 | |
import org.homeunix.thecave.buddi.view.menu.items.PluginMenuEntry; |
| 13 | |
|
| 14 | |
import ca.digitalcave.moss.swing.MossDocumentFrame; |
| 15 | |
import ca.digitalcave.moss.swing.MossFrame; |
| 16 | |
import ca.digitalcave.moss.swing.MossMenu; |
| 17 | |
|
| 18 | |
public class FileImportMenu extends MossMenu { |
| 19 | |
public static final long serialVersionUID = 0; |
| 20 | |
|
| 21 | |
public FileImportMenu(MossFrame frame) { |
| 22 | 5975 | super(frame, PrefsModel.getInstance().getTranslator().get(MenuKeys.MENU_FILE_IMPORT)); |
| 23 | 5975 | } |
| 24 | |
|
| 25 | |
@SuppressWarnings("unchecked") |
| 26 | |
@Override |
| 27 | |
public void updateMenus() { |
| 28 | 42468 | this.removeAll(); |
| 29 | |
|
| 30 | 42468 | for (BuddiImportPlugin plugin : (List<BuddiImportPlugin>) BuddiPluginFactory.getPlugins(BuddiImportPlugin.class)) { |
| 31 | 0 | if (getFrame() instanceof MossDocumentFrame) |
| 32 | 0 | this.add(new PluginMenuEntry((MossDocumentFrame) getFrame(), plugin)); |
| 33 | |
} |
| 34 | |
|
| 35 | 42468 | this.setEnabled(getFrame() instanceof MossDocumentFrame && this.getComponentCount() > 0); |
| 36 | |
|
| 37 | 42468 | super.updateMenus(); |
| 38 | 42468 | } |
| 39 | |
} |