Package nl.lxtreme.ols.client.actionmanager

Examples of nl.lxtreme.ols.client.actionmanager.IActionManager


   * @return
   */
  private JPopupMenu createPopup( final Point aPoint, final Point aLocationOnScreen, final Cursor aHoveredCursor,
      final boolean aShowCursorSection )
  {
    IActionManager actionMgr = this.controller.getActionManager();

    final JPopupMenu contextMenu = new JPopupMenu();

    // when an action is selected, we *no* longer know where the point was
    // where the user clicked. Therefore, we need to store it separately
    // for later use...
    contextMenu.putClientProperty( "mouseLocation", aPoint );

    boolean elementAdded = false;

    if ( aHoveredCursor == null )
    {
      final IUIElement element = findUIElement( aPoint );
      if ( element == null )
      {
        // Not above a cursor, nor above a signal element...
        return null;
      }

      contextMenu.add( new ShowManagerViewAction( this.controller ) );

      contextMenu.addSeparator();

      if ( element instanceof ElementGroup )
      {
        ElementGroup group = ( ElementGroup )element;

        contextMenu
            .add( new SetSignalGroupVisibilityAction( this.controller, group, SignalElementType.DIGITAL_SIGNAL ) );
        contextMenu.add( new SetSignalGroupVisibilityAction( this.controller, group, SignalElementType.GROUP_SUMMARY ) );
        contextMenu.add( new SetSignalGroupVisibilityAction( this.controller, group, SignalElementType.ANALOG_SIGNAL ) );
      }
      else
      {
        SignalElement signalElement = ( SignalElement )element;

        contextMenu.add( new EditSignalElementPropertiesAction( this.controller, element, aLocationOnScreen ) );

        contextMenu.addSeparator();

        contextMenu.add( new SetSignalElementVisibilityAction( this.controller, signalElement ) );

        if ( signalElement.isDigitalSignal() )
        {
          contextMenu.add( new RemoveChannelAnnotations( this.controller, signalElement ) );
        }
      }

      elementAdded = true;
    }

    if ( aShowCursorSection )
    {
      if ( elementAdded )
      {
        contextMenu.addSeparator();
      }

      addCursorActions( contextMenu, aHoveredCursor, aPoint );
    }

    contextMenu.addSeparator();

    contextMenu.add( actionMgr.getAction( DeleteAllCursorsAction.ID ) );

    return contextMenu;
  }
View Full Code Here

TOP

Related Classes of nl.lxtreme.ols.client.actionmanager.IActionManager

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.