org.eclipse.swt.custom.CTabFolder2Adapter Java Examples

The following examples show how to use org.eclipse.swt.custom.CTabFolder2Adapter. 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: SWTTabFolder.java    From tuxguitar with GNU Lesser General Public License v2.1 6 votes vote down vote up
public SWTTabFolder(SWTContainer<? extends Composite> container, boolean showClose) {
	super(new CTabFolder(container.getControl(), SWT.TOP), container);
	
	this.tabs = new ArrayList<SWTTabItem>();
	this.closeListener = new UICloseListenerManager();
	this.selectionListener = new SWTSelectionListenerManager(this);
	this.showClose = showClose;
	this.getControl().setTabHeight(TAB_HEIGHT);
	this.getControl().addCTabFolder2Listener(new CTabFolder2Adapter() {
		public void close(CTabFolderEvent event) {
			onTabClose(event);
		}
	});
	this.getControl().addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			onTabSelected();
		}
	});
}
 
Example #2
Source File: DbTab.java    From Rel with Apache License 2.0 6 votes vote down vote up
private void doConnectionResultConversion(String message, String dbURL) {
	setImage(IconLoader.loadIcon("DatabaseIcon"));

	setStatus("Requires conversion to the current database format.");

	showConversion(message, dbURL.substring("db:".length()));

	Core.getTabFolder().addCTabFolder2Listener(new CTabFolder2Adapter() {
		public void close(CTabFolderEvent event) {
			if (event.item == DbTab.this)
				DbTab.this.close();
		}
	});

	Core.createNewTabIfNeeded();
}
 
Example #3
Source File: ComponentTitledBorder.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent
 * @param controller
 * @param title
 * @param id
 */
public ComponentTitledBorder(Composite parent, Controller controller, String title, String id){

    folder = new CTabFolder(parent, SWT.TOP | SWT.BORDER | SWT.FLAT);
    folder.setUnselectedCloseVisible(false);
    folder.setSimple(false);
    
    // Create help button
    if (controller != null) SWTUtil.createHelpButton(controller, folder, id);

    // Prevent closing
    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(final CTabFolderEvent event) {
            event.doit = false;
        }
    });
    
    // Create general tab
    tab = new CTabItem(folder, SWT.NULL);
    tab.setText(title);
    tab.setShowClose(false);

    folder.setSelection(tab);
}
 
Example #4
Source File: DbTab.java    From Rel with Apache License 2.0 5 votes vote down vote up
private void doConnectionResultSuccess(DbConnection client, String dbURL, boolean permanent) {
	Core.updateRecentlyUsedDatabaseList(dbURL);
	
	setImage(IconLoader.loadIcon("DatabaseIcon"));

	setStatus("Ok");
	toolBarMode.setEnabled(true);

	refresh();

	if (tltmModeRel.getSelection())
		showRel();
	else if (tltmModeRev.getSelection())
		showRev();
	else if (tltmModeCmd.getSelection())
		showCmd();
	else {
		// default mode
		if (Preferences.getPreferenceBoolean(PreferencePageGeneral.DEFAULT_CMD_MODE)) {
			tltmModeCmd.setSelection(true);
			showCmd();
		} else {
			tltmModeRel.setSelection(true);
			showRel();
		}
	}

	Core.getTabFolder().addCTabFolder2Listener(new CTabFolder2Adapter() {
		public void close(CTabFolderEvent event) {
			if (event.item == DbTab.this)
				DbTab.this.close();
		}
	});

	Core.createNewTabIfNeeded();
}
 
Example #5
Source File: JframeApp.java    From jframe with Apache License 2.0 5 votes vote down vote up
/**
 * @param content
 */
private void createTabFolder(Composite content) {
    CTabFolder folder = new CTabFolder(content, SWT.BORDER | SWT.BOTTOM);
    // folder.setSimple(false);
    // folder.setUnselectedImageVisible(false);
    // folder.setUnselectedCloseVisible(false);
    // folder.setMinimizeVisible(true);
    // folder.setMaximizeVisible(true);
    // configuration
    CTabItem startTab = new CTabItem(folder, SWT.NONE);
    startTab.setText("TAB1");
    Composite config = createMonitorConfig(folder);
    startTab.setControl(config);

    // monitor info
    CTabItem item = new CTabItem(folder, SWT.NONE);
    item.setText("TAB2");
    Text text = new Text(folder, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    text.setEditable(false);
    showRecvMsg(text);
    item.setControl(text);

    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(CTabFolderEvent event) {
            // if (event.item.equals(specialItem)) {
            // event.doit = false;
            // }
        }
    });
    folder.setSelection(item);

}
 
Example #6
Source File: ComponentTitledFolder.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent
 * @param controller
 * @param bar
 * @param id
 * @param bottom
 * @param hasHidingMenu
 */
public ComponentTitledFolder(Composite parent, 
                             Controller controller, 
                             ComponentTitledFolderButtonBar bar, 
                             String id, 
                             Map<Composite, String> helpids,
                             boolean bottom,
                             boolean hasHidingMenu){

    int flags = SWT.BORDER | SWT.FLAT;
    if (bottom) flags |= SWT.BOTTOM;
    else flags |= SWT.TOP;
    
    this.hasHidingMenu = hasHidingMenu;
    
    this.folder = new CTabFolder(parent, flags);
    this.folder.setUnselectedCloseVisible(false);
    this.folder.setSimple(false);
    
    // Create help button
    if (bar != null || controller != null) {
        if (bar == null) SWTUtil.createHelpButton(controller, folder, id, helpids);
        else createBar(controller, folder, bar);
    }

    // Prevent closing
    this.folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(final CTabFolderEvent event) {
            event.doit = false;
        }
    });
}
 
Example #7
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 );

}