Package devplugin

Examples of devplugin.ContextMenuIf


          if ((includingDisabledItems) || (!disabledList.contains(LeaveFullScreenMenuItem.getInstance()))) {
            ifList.add(LeaveFullScreenMenuItem.getInstance());
            lastWasSeparator = false;
          }
        } else {
          ContextMenuIf item = getContextMenuIfForId(element);
          if ((item != null) && (includingDisabledItems || !disabledList.contains(item))) {
            lastWasSeparator = false;
            ifList.add(item);
          }
        }
View Full Code Here


   * @param markDefaultIf True if the default context menu interfaces should be highlighted.
   * @return The menu items of the context menu.
   */
  public JMenu createContextMenuItems(ContextMenuIf callerIf, Program program, boolean markDefaultIf) {
    ArrayList<JMenuItem> items = new ArrayList<JMenuItem>();
    ContextMenuIf leftSingleClickIf = getInstance().getLeftSingleClickIf();
    ContextMenuIf defaultIf = getInstance().getDefaultContextMenuIf();
    ContextMenuIf middleClickIf = getInstance().getMiddleClickIf();
    ContextMenuIf middleDoubleClickIf = getInstance().getMiddleDoubleClickIf();
    ContextMenuIf[] menuIfArr = getInstance().getAvailableContextMenuIfs(false, true);

    JMenu rootMenu = new JMenu();
   
    for (ContextMenuIf element : menuIfArr) {
      ContextMenuIf menuIf = element;

      boolean equalsPlugin = false;

      if ((callerIf != null) && (callerIf.getId().equals(menuIf.getId()))) {
        equalsPlugin = true;
      }

      if (menuIf instanceof SeparatorMenuItem) {
        if (rootMenu.getMenuComponentCount() > 0) {
          rootMenu.addSeparator();
        }
      } else if (menuIf instanceof ConfigMenuItem) {
        JMenuItem item = new JMenuItem(menuIf.toString());
        item.setIcon(TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL));
        item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
        item.addActionListener(new ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            MainFrame.getInstance().showSettingsDialog(SettingsItem.CONTEXTMENU);
          };
        });
        rootMenu.add(item);
      } else if (menuIf instanceof LeaveFullScreenMenuItem) {
        if (MainFrame.getInstance().isFullScreenMode()) {
          JMenuItem item = new JMenuItem(menuIf.toString());
          item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
          item.setIcon(TVBrowserIcons.fullScreen(TVBrowserIcons.SIZE_SMALL));
          item.addActionListener(new ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
              if (MainFrame.getInstance().isFullScreenMode()) {
                MainFrame.getInstance().switchFullscreenMode();
              }
            };
          });
          rootMenu.add(item);
        }
      } else if (!equalsPlugin) {
        ActionMenu actionMenu = menuIf.getContextMenuActions(program);
        if (actionMenu != null) {
          JMenuItem menuItem = MenuUtil.createMenuItem(actionMenu);
          items.add(menuItem);
          if (menuIf == leftSingleClickIf && markDefaultIf && !menuIf.equals(DoNothingContextMenuItem.getInstance())) {
            ((JMenuItem)getLastFirstMenuEntry(menuItem)).setForeground(new Color(0,90,0));
          }
          else if (menuIf == middleDoubleClickIf && markDefaultIf && !menuIf.equals(DoNothingContextMenuItem.getInstance())) {
            ((JMenuItem)getLastFirstMenuEntry(menuItem)).setForeground(new Color(0,0,160));
          }
          if (menuIf == defaultIf && menuIf == middleClickIf && markDefaultIf && !menuIf.equals(DoNothingContextMenuItem.getInstance())) {
            ((JMenuItem)getLastFirstMenuEntry(menuItem)).setFont(MenuUtil.CONTEXT_MENU_BOLDITALICFONT);
          }
          else if (menuIf == defaultIf && markDefaultIf && !menuIf.equals(DoNothingContextMenuItem.getInstance())) {
            ((JMenuItem)getLastFirstMenuEntry(menuItem)).setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);
          }
          else if (menuIf == middleClickIf && markDefaultIf && !menuIf.equals(DoNothingContextMenuItem.getInstance())) {
            ((JMenuItem)getLastFirstMenuEntry(menuItem)).setFont(MenuUtil.CONTEXT_MENU_ITALICFONT);
          }

          rootMenu.add(menuItem);
        }
View Full Code Here

    if (disabled == null) {
      return list;
    }
   
    for (String element : disabled) {
      ContextMenuIf item = getContextMenuIfForId(element);
      if (item != null) {
        list.add(item);
      }
    }
   
View Full Code Here

    if (program == null) {
      // Nothing to do
      return;
    }
   
    ContextMenuIf leftSingleClickIf = ContextMenuManager.getInstance().getLeftSingleClickIf();
    if (leftSingleClickIf == null) {
      return;
    }

    if ((caller != null&& (leftSingleClickIf.getId().equals(caller.getId()))) {
      return;
    }

    handleAction(program, leftSingleClickIf.getContextMenuActions(program));
  }
View Full Code Here

  public void handleProgramSingleCtrlClick(Program program, ContextMenuIf caller) {
    if (program == null) {
      return;
    }
   
    ContextMenuIf clickInterface = ContextMenuManager.getInstance().getLeftSingleCtrlClickIf();
    if (clickInterface == null) {
      return;
    }

    if ((caller != null&& (clickInterface.getId().equals(caller.getId()))) {
      return;
    }

    handleAction(program, clickInterface.getContextMenuActions(program));
  }
View Full Code Here

    if (program == null) {
      // Nothing to do
      return;
    }
   
    ContextMenuIf defaultContextMenuIf =
      ContextMenuManager.getInstance().getDefaultContextMenuIf();

    if (defaultContextMenuIf == null) {
      return;
    }

    if ((caller != null&& (defaultContextMenuIf.getId().equals(caller.getId()))) {
      return;
    }

    handleAction(program, defaultContextMenuIf.getContextMenuActions(program));
  }
View Full Code Here

    if (program == null) {
      // Nothing to do
      return;
    }

    ContextMenuIf middleClickIf
      = ContextMenuManager.getInstance().getMiddleClickIf();

    if (middleClickIf == null) {
      return;
    }

    if ((caller != null&& (middleClickIf.getId().equals(caller.getId()))) {
      return;
    }

    handleAction(program, middleClickIf.getContextMenuActions(program));
  }
View Full Code Here

    if (program == null) {
      // Nothing to do
      return;
    }

    ContextMenuIf middleDoubleClickIf
      = ContextMenuManager.getInstance().getMiddleDoubleClickIf();

    if (middleDoubleClickIf == null) {
      return;
    }
   
    if ((caller != null&& (middleDoubleClickIf.getId().equals(caller.getId()))) {
      return;
    }

    handleAction(program, middleDoubleClickIf.getContextMenuActions(program));
  }
View Full Code Here

      @Override
      public void mouseReleased(MouseEvent evt) {
        if (evt.getX() < mSelectionWidth) {
          int index = mList.getList().locationToIndex(evt.getPoint());
          if (index != -1) {
            ContextMenuIf item = (ContextMenuIf) mList.getList().getModel().getElementAt(index);
            if (!mDeactivatedItems.remove(item)) {
              mDeactivatedItems.add(item);
            }

            mList.repaint();
View Full Code Here

    Object[] o = mList.getItems();

    ArrayList<String> pluginIDsList = new ArrayList<String>();
    String[] orderIDs = new String[o.length];
    for (int i = 0; i < o.length; i++) {
      ContextMenuIf menuIf = (ContextMenuIf) o[i];
      orderIDs[i] = menuIf.getId();
      if (menuIf instanceof PluginProxy) {
        pluginIDsList.add(menuIf.getId());
      }
    }

    String[] pluginIDs = new String[pluginIDsList.size()];
    pluginIDsList.toArray(pluginIDs);
View Full Code Here

TOP

Related Classes of devplugin.ContextMenuIf

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.