org.eclipse.swt.widgets.Composite#addMouseListener ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Composite#addMouseListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: APICloud-Studio   文件: TitaniumUpdatePopup.java
protected Control createDialogArea(Composite parent)
{
	dialogArea = new Composite(parent, SWT.NONE);
	dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	dialogArea.setLayout(layout);
	dialogArea.addMouseListener(clickListener);

	// The "click to update" label
	Label infoLabel = new Label(dialogArea, SWT.NONE);
	infoLabel.setText(MessageFormat.format(EplMessages.TitaniumUpdatePopup_update_detail,
			EclipseUtil.getStudioPrefix()));
	infoLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
	infoLabel.addMouseListener(clickListener);

	return dialogArea;

}
 
源代码2 项目: APICloud-Studio   文件: GenericInfoPopupDialog.java
@Override
protected Control createDialogArea(Composite parent)
{
	Composite main = new Composite(parent, SWT.NONE);
	main.setLayout(GridLayoutFactory.swtDefaults().create());
	main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	if (clickListener != null)
	{
		main.addMouseListener(clickListener);
	}

	Label infoLabel = new Label(main, SWT.WRAP);
	infoLabel.setText(message);
	infoLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	if (clickListener != null)
	{
		infoLabel.addMouseListener(clickListener);
	}

	return main;
}
 
源代码3 项目: workspacemechanic   文件: AbstractPopup.java
public void open() {
  shell.setLayout(new FillLayout());
  shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
  shell.setBackground(backgroundColor);
  Composite top = new Group(shell, SWT.NONE);
  // Closes when clicking in some whitespace, but not enough.
  // TODO(konigsberg): close when clicking anywhere but whitespace.
  top.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseUp(MouseEvent e) {
      close();
    }
  });

  initializeLayout(top);

  Composite titleBar = new Composite(top, SWT.NONE);
  initializeLayout(titleBar);
  createTitleBar(titleBar);

  Composite popupArea = new Composite(top, SWT.NONE);
  initializeLayout(popupArea);
  createContents(popupArea);

  shell.pack();

  setPosition(shell);
  shell.setVisible(true);
  if (displayTimeMillis > 0) {
    display.timerExec(displayTimeMillis, new Runnable() {
      public void run() {
        close();
      }
    });
  }
}
 
源代码4 项目: tracecompass   文件: TmfRawEventViewer.java
/**
 * Create the text area and add listeners
 */
private void createTextArea(int style) {
    fScrolledComposite = new ScrolledComposite(this, style);
    fScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fTextArea = new Composite(fScrolledComposite, SWT.NONE);
    fTextArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fScrolledComposite.setContent(fTextArea);
    fScrolledComposite.setExpandHorizontal(true);
    fScrolledComposite.setExpandVertical(true);
    fScrolledComposite.setAlwaysShowScrollBars(true);
    fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    fScrolledComposite.addControlListener(this);

    GridLayout textAreaGridLayout = new GridLayout();
    textAreaGridLayout.marginHeight = 0;
    textAreaGridLayout.marginWidth = 0;
    fTextArea.setLayout(textAreaGridLayout);

    fStyledText = new StyledText(fTextArea, SWT.READ_ONLY);
    fStyledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    initializeFonts();
    initializeColors();
    PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(this);

    fStyledText.addCaretListener(this);
    fStyledText.addMouseMoveListener(this);
    fStyledText.addMouseTrackListener(this);
    fStyledText.addMouseWheelListener(this);
    /* disable mouse scroll of horizontal scroll bar */
    fStyledText.addListener(SWT.MouseWheel, event -> event.doit = false);
    fStyledText.addKeyListener(this);

    fTextArea.setBackground(fStyledText.getBackground());
    fTextArea.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e) {
            fTextArea.setFocus();
        }
    });
}
 
源代码5 项目: birt   文件: SwtRendererImpl.java
public final void setProperty( final String sProperty, final Object oValue )
{
	if ( sProperty.equals( IDeviceRenderer.UPDATE_NOTIFIER ) )
	{
		_iun = (IUpdateNotifier) oValue;
		iv.reset( );
		iv.setUpdateNotifier( _iun );

		cleanUpTriggers( );
		Object obj = _iun.peerInstance( );

		if ( obj instanceof Composite )
		{
			Composite jc = (Composite) obj;

			if ( _eh != null )
			{
				// We can't promise to remove all the old swtEventHandler
				// due to SWT limitation here, so be sure to just attach the
				// update_notifier only to one renderer.

				jc.removeMouseListener( _eh );
				jc.removeMouseMoveListener( _eh );
				jc.removeMouseTrackListener( _eh );
				jc.removeKeyListener( _eh );
				jc.removeFocusListener( _eh );

				_eh.dispose( );
			}

			_eh = new SwtEventHandler( iv, _lhmAllTriggers, _iun, getULocale( ) );
			
			jc.addMouseListener( _eh );
			jc.addMouseMoveListener( _eh );
			jc.addMouseTrackListener( _eh );
			jc.addKeyListener( _eh );
			jc.addFocusListener( _eh );
		}
	}
	else if ( sProperty.equals( IDeviceRenderer.GRAPHICS_CONTEXT ) )
	{
		_gc = (GC) oValue;

		if ( R31Enhance.isR31Available( ) )
		{
			Region rg = new Region( );
			_gc.getClipping( rg );

			R31Enhance.setAdvanced( _gc, true, rg );
			R31Enhance.setAntialias( _gc, SWT.ON );
			R31Enhance.setTextAntialias( _gc, SWT.ON );

			rg.dispose( );
		}
		_ids.setGraphicsContext(_gc );

		logger.log( ILogger.INFORMATION,
				Messages.getString( "SwtRendererImpl.info.graphics.context",//$NON-NLS-1$
						new Object[]{
								_gc.getClass( ).getName( ), _gc
						},
						getULocale( ) ) );
	}
	else if ( sProperty.equals( IDeviceRenderer.DPI_RESOLUTION ) )
	{
		getDisplayServer( ).setDpiResolution( ( (Integer) oValue ).intValue( ) );
	}
	else if ( sProperty.equals( IDeviceRenderer.EXPECTED_BOUNDS ) )
	{
		Bounds bo = (Bounds)oValue;
		int x = (int)Math.round( bo.getLeft( ) );
		int y = (int)Math.round( bo.getTop( ) );
		int width = (int)Math.round( bo.getWidth( ) );
		int height = (int)Math.round( bo.getHeight( ) );
		this._gc.setClipping( x, y, width, height );
	}
}