Java Code Examples for org.eclipse.swt.custom.CTabFolder#addListener()

The following examples show how to use org.eclipse.swt.custom.CTabFolder#addListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainPanel.java    From Rel with Apache License 2.0 5 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public MainPanel(Composite parent, int style) {
	super(parent, style);
	setLayout(new FormLayout());

	getShell().addListener(SWT.Close, e -> LogWin.remove());
	getShell().addListener(SWT.Move, e -> Preferences.setPreference(rectPrefName, getShell().getBounds()));
	getShell().addListener(SWT.Resize, e -> Preferences.setPreference(rectPrefName, getShell().getBounds()));

	// Install logging
	LogWin.install(parent);

	// Install platform logging and UI error trapping
	new CrashTrap(getShell(), Version.getVersion());
	
	Rectangle rect = Preferences.getPreferenceRectangle(rectPrefName);
	if (rect.height > 0 && rect.width > 0)
		getShell().setBounds(rect);

	tabFolder = new CTabFolder(this, SWT.None);
	FormData fd_tabFolder = new FormData();
	fd_tabFolder.top = new FormAttachment(0);
	fd_tabFolder.left = new FormAttachment(0);
	fd_tabFolder.right = new FormAttachment(100);
	tabFolder.setLayoutData(fd_tabFolder);
	tabFolder.setSelectionBackground(
			Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
	tabFolder.addListener(SWT.Selection, e -> setStatus(((DbTab) tabFolder.getSelection()).getStatus()));

	statusPanel = new StatusPanel(this, SWT.None);
	FormData fd_statusPanel = new FormData();
	fd_statusPanel.left = new FormAttachment(0);
	fd_statusPanel.right = new FormAttachment(100);
	fd_statusPanel.bottom = new FormAttachment(100);
	statusPanel.setLayoutData(fd_statusPanel);

	fd_tabFolder.bottom = new FormAttachment(statusPanel);
	
	layout();
}
 
Example 2
Source File: HopDataOrchestrationPerspective.java    From hop with Apache License 2.0 4 votes vote down vote up
@Override public void initialize( HopGui hopGui, Composite parent ) {
  this.hopGui = hopGui;
  this.parent = parent;

  PropsUi props = PropsUi.getInstance();

  composite = new Composite( parent, SWT.NONE );
  //composite.setBackground( GuiResource.getInstance().getColorBackground() );
  FormLayout layout = new FormLayout();
  //layout.marginLeft = props.getMargin();
  //layout.marginTop = props.getMargin();
  layout.marginRight = props.getMargin();
  layout.marginBottom = props.getMargin();
  composite.setLayout( layout );

  formData = new FormData();
  formData.left = new FormAttachment( 0, 0 );
  formData.top = new FormAttachment( 0, 0 );
  formData.right = new FormAttachment( 100, 0 );
  formData.bottom = new FormAttachment( 100, 0 );
  composite.setLayoutData( formData );

  // A tab folder covers the complete area...
  //
  tabFolder = new CTabFolder( composite, SWT.MULTI | SWT.BORDER );
  props.setLook( tabFolder, Props.WIDGET_STYLE_TAB );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( 100, 0 );
  fdLabel.top = new FormAttachment( 0, 0 );
  fdLabel.bottom = new FormAttachment( 100, 0 );
  tabFolder.setLayoutData( fdLabel );

  tabFolder.addCTabFolder2Listener( new CTabFolder2Adapter() {
    @Override public void close( CTabFolderEvent event ) {
      handleTabCloseEvent( event );
    }
  } );
  tabFolder.addListener( SWT.Selection, event -> handTabSelectionEvent( event ) );

  // Support reorder tab item
  new TabFolderReorder( tabFolder );

}