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

The following examples show how to use org.eclipse.swt.custom.CTabFolder#setSimple() . 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: LogAnalysis.java    From AndroidRobot with Apache License 2.0 6 votes vote down vote up
public void createLogDetail() {
    tabFolderLogDetail = new CTabFolder(sashFormLog, SWT.CLOSE | SWT.BORDER);
    tabFolderLogDetail.setTabHeight(0);
    tabFolderLogDetail.marginHeight = 0;
    tabFolderLogDetail.marginWidth = 0;
    tabFolderLogDetail.setMaximizeVisible(false);
    tabFolderLogDetail.setMinimizeVisible(false);
    //tabFolderLogDetail.setSelectionBackground(new Color(display, new RGB(153, 186, 243)));
    tabFolderLogDetail.setSimple(false);
    tabFolderLogDetail.setUnselectedCloseVisible(true);

    CTabItem tabItemLogList = new CTabItem(tabFolderLogDetail, SWT.NONE | SWT.MULTI
                                                               | SWT.V_SCROLL);
    tabFolderLogDetail.setSelection(tabItemLogList);

    //styledTextLog = new List(tabFolderLogDetail, SWT.BORDER);
    styledTextLog = new StyledText(tabFolderLogDetail, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL
                                                       | SWT.V_SCROLL | SWT.READ_ONLY);
    styledTextLog.addLineStyleListener(new LogLineStyleListener(shell));
    tabItemLogList.setControl(styledTextLog);
    //sTextLog.setFont(new Font(display,"Courier New",10,SWT.NONE));

}
 
Example 2
Source File: GamaPreferencesView.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
private void buildContents() {
	tabFolder = new CTabFolder(shell, SWT.TOP | SWT.NO_TRIM);
	tabFolder.setBorderVisible(true);
	tabFolder.setBackgroundMode(SWT.INHERIT_DEFAULT);
	tabFolder.setMRUVisible(true);
	tabFolder.setSimple(false); // rounded tabs
	tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
	final Map<String, Map<String, List<Pref>>> prefs = GamaPreferences.organizePrefs();
	for (final String tabName : prefs.keySet()) {
		final CTabItem item = new CTabItem(tabFolder, SWT.NONE);
		item.setFont(GamaFonts.getNavigHeaderFont());
		item.setText(tabName);
		item.setImage(prefs_images.get(tabName));
		item.setShowClose(false);
		buildContentsFor(item, prefs.get(tabName));
	}
	buildButtons();
	shell.layout();
}
 
Example 3
Source File: SWTUtil.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates the tab folder for displaying the composite fragments
 * 
 * @param parent
 */
public static CTabFolder createTabFolder(Composite parent)
{
	Display display = getStandardDisplay();
	Color c1 = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), c2 = display
			.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
	CTabFolder tabs = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT);
	GridData gd = new GridData(GridData.FILL_BOTH);
	gd.horizontalSpan = 2;
	tabs.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true);
	tabs.setSelectionForeground(getStandardDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND));
	tabs.setSimple(PlatformUI.getPreferenceStore().getBoolean(
			IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
	tabs.setLayoutData(gd);
	tabs.setBorderVisible(true);
	tabs.setFont(parent.getFont());
	return tabs;
}
 
Example 4
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 5
Source File: CodeSelectorFactory.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * add all available tabs as they occur (independent from any user settings)
 * 
 * @param list
 *            list of tabs to add
 * @param ctab
 *            parent
 */
private static void addAllTabs(java.util.List<IConfigurationElement> list, CTabFolder ctab,
	String point){
	ITEMS_TO_SHOW_IN_MFU_LIST = CoreHub.userCfg.get(Preferences.USR_MFU_LIST_SIZE, 15);
	ctab.setSimple(false);
	
	//add favorites tab first
	if (point.equals(ExtensionPointConstantsUi.VERRECHNUNGSCODE)) {
		new FavoritenCTabItem(ctab, SWT.None);
	}
	
	if (list != null) {
		for (IConfigurationElement ic : list) {
			Optional<CodeSystemDescription> systemDescription = CodeSystemDescription.of(ic);
			if (systemDescription.isPresent()) {
				CTabItem tabItem = new CTabItem(ctab, SWT.NONE);
				tabItem.setText(systemDescription.get().getCodeSystemName());
				tabItem.setData(systemDescription.get());
			}
		}
	}
}
 
Example 6
Source File: DiagnosenView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent){
	parent.setLayout(new FillLayout());
	ctab = new CTabFolder(parent, SWT.BOTTOM);
	ctab.setSimple(false);
	ctab.addSelectionListener(new SelectionAdapter() {
		
		@Override
		public void widgetSelected(SelectionEvent e){
			selected = ctab.getSelection();
			if (selected != null) {
				cPage page = (cPage) selected.getControl();
				if (page == null) {
					
					page =
						new cPage(ctab, (CodeSystemDescription) selected.getData());
					selected.setControl(page);
					// parent.redraw();
				}
				page.cv.getConfigurer().getControlFieldProvider().clearValues();
			}
			((cPage) selected.getControl()).refresh();
			setFocus();
		}
		
	});
	
	CodeSelectorFactory.makeTabs(ctab, getViewSite(), ExtensionPointConstantsUi.DIAGNOSECODE);
	
	GlobalEventDispatcher.addActivationListener(this, this);
}
 
Example 7
Source File: CommonTransformDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
protected CTabFolder buildTabFolder() {
  m_wTabFolder = new CTabFolder( shell, SWT.BORDER );
  props.setLook( m_wTabFolder, Props.WIDGET_STYLE_TAB );
  m_wTabFolder.setSimple( false );
  return m_wTabFolder;
}
 
Example 8
Source File: PropsUi.java    From hop with Apache License 2.0 4 votes vote down vote up
public void setLook( final Control control, int style ) {
  if ( this.isOSLookShown() && style != WIDGET_STYLE_FIXED ) {
    return;
  }

  final GuiResource gui = GuiResource.getInstance();
  Font font = null;
  Color background = null;

  switch ( style ) {
    case WIDGET_STYLE_DEFAULT:
      background = gui.getColorBackground();
      if ( control instanceof Group && OS.indexOf( "mac" ) > -1 ) {
        control.addPaintListener( paintEvent -> {
          paintEvent.gc.setBackground( gui.getColorBackground() );
          paintEvent.gc.fillRectangle( 2, 0, control.getBounds().width - 8, control.getBounds().height - 20 );
        } );
      }
      font = null; // GuiResource.getInstance().getFontDefault();
      break;
    case WIDGET_STYLE_FIXED:
      if ( !this.isOSLookShown() ) {
        background = gui.getColorBackground();
      }
      font = gui.getFontFixed();
      break;
    case WIDGET_STYLE_TABLE:
      background = gui.getColorBackground();
      font = null; // gui.getFontGrid();
      break;
    case WIDGET_STYLE_NOTEPAD:
      background = gui.getColorBackground();
      font = gui.getFontNote();
      break;
    case WIDGET_STYLE_GRAPH:
      background = gui.getColorBackground();
      font = gui.getFontGraph();
      break;
    case WIDGET_STYLE_TOOLBAR:
      background = GuiResource.getInstance().getColorDemoGray();
      break;
    case WIDGET_STYLE_TAB:
      background = GuiResource.getInstance().getColorWhite();
      CTabFolder tabFolder = (CTabFolder) control;
      tabFolder.setSimple( false );
      tabFolder.setBorderVisible( true );
      // need to make a copy of the tab selection background color to get around PDI-13940
      Color c = GuiResource.getInstance().getColorTab();
      Color tabColor = new Color( c.getDevice(), c.getRed(), c.getGreen(), c.getBlue() );
      tabFolder.setSelectionBackground( tabColor );
      break;
    default:
      background = gui.getColorBackground();
      font = null; // gui.getFontDefault();
      break;
  }

  if ( font != null && !font.isDisposed() ) {
    control.setFont( font );
  }

  if ( background != null && !background.isDisposed() ) {
    if ( control instanceof Button ) {
      Button b = (Button) control;
      if ( ( b.getStyle() & SWT.PUSH ) != 0 ) {
        return;
      }
    }
    control.setBackground( background );
  }
}
 
Example 9
Source File: BeamJobConfigDialog.java    From kettle-beam with Apache License 2.0 4 votes vote down vote up
private void addFormWidgets() {

    int middle = Const.MIDDLE_PCT;

    // The name of the Beam Job Configuration
    //
    Label wlName = new Label( shell, SWT.RIGHT );
    props.setLook( wlName );
    wlName.setText( BaseMessages.getString( PKG, "BeamJobConfigDialog.Name.Label" ) );
    FormData fdlName = new FormData();
    fdlName.top = new FormAttachment( 0, margin );
    fdlName.left = new FormAttachment( 0, -margin ); // First one in the left top corner
    fdlName.right = new FormAttachment( middle, -margin );
    wlName.setLayoutData( fdlName );
    wName = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wName );
    FormData fdName = new FormData();
    fdName.top = new FormAttachment( wlName, 0, SWT.CENTER );
    fdName.left = new FormAttachment( middle, 0 ); // To the right of the label
    fdName.right = new FormAttachment( 95, 0 );
    wName.setLayoutData( fdName );
    Control lastControl = wName;

    // The description
    //
    Label wlDescription = new Label( shell, SWT.RIGHT );
    props.setLook( wlDescription );
    wlDescription.setText( BaseMessages.getString( PKG, "BeamJobConfigDialog.Description.Label" ) );
    FormData fdlDescription = new FormData();
    fdlDescription.top = new FormAttachment( lastControl, margin );
    fdlDescription.left = new FormAttachment( 0, -margin ); // First one in the left top corner
    fdlDescription.right = new FormAttachment( middle, -margin );
    wlDescription.setLayoutData( fdlDescription );
    wDescription = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wDescription );
    FormData fdDescription = new FormData();
    fdDescription.top = new FormAttachment( wlDescription, 0, SWT.CENTER );
    fdDescription.left = new FormAttachment( middle, 0 ); // To the right of the label
    fdDescription.right = new FormAttachment( 95, 0 );
    wDescription.setLayoutData( fdDescription );
    lastControl = wDescription;

    // Runner
    //
    Label wlRunner = new Label( shell, SWT.RIGHT );
    props.setLook( wlRunner );
    wlRunner.setText( BaseMessages.getString( PKG, "BeamJobConfigDialog.Runner.Label" ) );
    FormData fdlRunner = new FormData();
    fdlRunner.top = new FormAttachment( lastControl, margin );
    fdlRunner.left = new FormAttachment( 0, -margin ); // First one in the left top corner
    fdlRunner.right = new FormAttachment( middle, -margin );
    wlRunner.setLayoutData( fdlRunner );
    wRunner = new ComboVar( space, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    wRunner.setItems( RunnerType.getNames() );
    props.setLook( wRunner );
    FormData fdRunner = new FormData();
    fdRunner.top = new FormAttachment( wlRunner, 0, SWT.CENTER );
    fdRunner.left = new FormAttachment( middle, 0 ); // To the right of the label
    fdRunner.right = new FormAttachment( 95, 0 );
    wRunner.setLayoutData( fdRunner );
    lastControl = wRunner;


    wTabFolder = new CTabFolder( shell, SWT.BORDER );
    props.setLook( wTabFolder, Props.WIDGET_STYLE_TAB );
    wTabFolder.setSimple( false );
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment( 0, 0 );
    fdTabFolder.right = new FormAttachment( 100, 0 );
    fdTabFolder.top = new FormAttachment( lastControl, margin * 2 );
    fdTabFolder.bottom = new FormAttachment( wOK, -margin * 2 );
    wTabFolder.setLayoutData( fdTabFolder );

    addGeneralTab();
    addParametersTab();
    addDataflowTab();
    addSparkTab();
    addFlinkTab();

    wTabFolder.setSelection( 0 );

  }
 
Example 10
Source File: LamiReportView.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createPartControl(@Nullable Composite parent) {
    LamiAnalysisReport report = fReport;
    if (report == null || parent == null) {
        return;
    }

    setPartName(report.getName());

    fTabFolder = new CTabFolder(parent, SWT.NONE);
    fTabFolder.setSimple(false);

    for (LamiResultTable table : report.getTables()) {
        String name = table.getTableClass().getTableTitle();

        CTabItem tabItem = new CTabItem(fTabFolder, SWT.NULL);
        tabItem.setText(name);

        SashForm sf = new SashForm(fTabFolder, SWT.NONE);
        fTabPages.add(new LamiReportViewTabPage(sf, table));
        tabItem.setControl(sf);
    }

    /* Add toolbar buttons */
    Action toggleTableAction = new ToggleTableAction();
    toggleTableAction.setText(Messages.LamiReportView_ActivateTableAction_ButtonName);
    toggleTableAction.setToolTipText(Messages.LamiReportView_ActivateTableAction_ButtonTooltip);
    toggleTableAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath("icons/table.gif")); //$NON-NLS-1$

    IActionBars actionBars = getViewSite().getActionBars();
    IToolBarManager toolbarMgr = actionBars.getToolBarManager();
    toolbarMgr.add(toggleTableAction);

    fNewChartAction.setText(Messages.LamiReportView_NewCustomChart);

    fClearCustomViewsAction.setText(Messages.LamiReportView_ClearAllCustomViews);
    IMenuManager menuMgr = actionBars.getMenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener((@Nullable IMenuManager manager) -> {
        if (manager != null) {
            populateMenu(manager);
        }
    });
    populateMenu(menuMgr);

    /* Select the first tab initially */
    CTabFolder tf = checkNotNull(fTabFolder);
    if (tf.getItemCount() > 0) {
        tf.setSelection(0);
    }

}
 
Example 11
Source File: LogAnalysis.java    From AndroidRobot with Apache License 2.0 4 votes vote down vote up
public void createLogList() {
    tabFolderLogList = new CTabFolder(sashFormLog, SWT.NONE | SWT.BORDER);
    tabFolderLogList.setTabHeight(0);
    tabFolderLogList.marginHeight = 0;
    tabFolderLogList.marginWidth = 0;
    tabFolderLogList.setLayout(new FillLayout());
    tabFolderLogList.setBounds(5, 5, 200, 465);
    tabFolderLogList.setSimple(false);
    tabFolderLogList.setUnselectedCloseVisible(true);

    CTabItem tabItemLogList = new CTabItem(tabFolderLogList, SWT.NONE | SWT.MULTI
                                                             | SWT.V_SCROLL);
    tabFolderLogList.setSelection(tabItemLogList);
    tabItemLogList.setText("日志浏览");

    Composite composite = new Composite(tabFolderLogList, SWT.NONE);
    composite.setLayout(new GridLayout());
    treeLog = new Tree(composite, SWT.BORDER);
    colorBlack = display.getSystemColor(SWT.COLOR_BLACK);

    tabItemLogList.setControl(composite);
    treeLog.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    treeLog.addListener(SWT.MouseDoubleClick, new Listener() {
        public void handleEvent(Event event) {
            Point point = new Point(event.x, event.y);
            TreeItem item = treeLog.getItem(point);
            if (item != null) {
                String taskName = (String) item.getData("task");
                String loop = String.valueOf(item.getData("loop"));
                String caseName = (String) item.getData("case");
                int index = (Integer) item.getData("index");
                //System.out.println("task:"+taskName+" loop:"+loop+" caseName:"+caseName+" index:"+index);
                if (index != 0)
                    Log.loadLogs(styledTextLog, display, logFile, taskName, loop, caseName,
                        index);
            }
        }
    });

}
 
Example 12
Source File: DialogAbout.java    From arx with Apache License 2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
    parent.setLayout(new GridLayout());

    // Text
    final Label label = new Label(parent, SWT.CENTER | SWT.NONE);
    label.setText(ABOUT);
    label.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    
    // Folder
    CTabFolder folder = new CTabFolder(parent, SWT.BORDER);
    folder.setSimple(false);
    folder.setLayoutData(SWTUtil.createFillGridData());
    
    // License
    CTabItem item1 = new CTabItem(folder, SWT.NULL);
    item1.setText("License"); //$NON-NLS-1$
    final Text license = new Text(folder, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    license.setText(LICENSE);
    license.setEditable(false);
    license.setLayoutData(SWTUtil.createFillGridData());
    item1.setControl(license);
    
    // Contributors
    CTabItem item2 = new CTabItem(folder, SWT.NULL);
    item2.setText("Contributors"); //$NON-NLS-1$
    final Text contributors = new Text(folder, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    contributors.setText(CONTRIBUTORS);
    contributors.setEditable(false);
    contributors.setLayoutData(SWTUtil.createFillGridData());
    item2.setControl(contributors);
    
    // Information
    CTabItem item3 = new CTabItem(folder, SWT.NULL);
    item3.setText("Links"); //$NON-NLS-1$
    Composite composite3 = new Composite(folder, SWT.BORDER);
    composite3.setBackground(license.getBackground());
    item3.setControl(composite3);
    composite3.setLayout(SWTUtil.createGridLayout(1, false));
    createLink(composite3, "Website: <a>arx.deidentifier.org</a>", "Website", "http://arx.deidentifier.org"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Manual: <a>arx.deidentifier.org/anonymization-tool</a>", "Manual", "http://arx.deidentifier.org/anonymization-tool/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "API: <a>arx.deidentifier.org/api</a>", "API", "http://arx.deidentifier.org/api"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Downloads: <a>arx.deidentifier.org/downloads</a>", "Downloads", "http://arx.deidentifier.org/downloads"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Github: <a>github.com/arx-deidentifier</a>", "Github", "https://github.com/arx-deidentifier"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    return parent;
}
 
Example 13
Source File: CommonStepDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
protected CTabFolder buildTabFolder() {
  m_wTabFolder = new CTabFolder( shell, SWT.BORDER );
  props.setLook( m_wTabFolder, Props.WIDGET_STYLE_TAB );
  m_wTabFolder.setSimple( false );
  return m_wTabFolder;
}
 
Example 14
Source File: PropsUI.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void setLook( final Control control, int style ) {
  if ( this.isOSLookShown() && style != WIDGET_STYLE_FIXED ) {
    return;
  }

  final GUIResource gui = GUIResource.getInstance();
  Font font = null;
  Color background = null;

  switch ( style ) {
    case WIDGET_STYLE_DEFAULT:
      background = gui.getColorBackground();
      if ( control instanceof Group && OS.indexOf( "mac" ) > -1 ) {
        control.addPaintListener( new PaintListener() {
          @Override
          public void paintControl( PaintEvent paintEvent ) {
            paintEvent.gc.setBackground( gui.getColorBackground() );
            paintEvent.gc.fillRectangle( 2, 0, control.getBounds().width - 8, control.getBounds().height - 20 );
          }
        } );
      }
      font = null; // GUIResource.getInstance().getFontDefault();
      break;
    case WIDGET_STYLE_FIXED:
      if ( !this.isOSLookShown() ) {
        background = gui.getColorBackground();
      }
      font = gui.getFontFixed();
      break;
    case WIDGET_STYLE_TABLE:
      background = gui.getColorBackground();
      font = null; // gui.getFontGrid();
      break;
    case WIDGET_STYLE_NOTEPAD:
      background = gui.getColorBackground();
      font = gui.getFontNote();
      break;
    case WIDGET_STYLE_GRAPH:
      background = gui.getColorBackground();
      font = gui.getFontGraph();
      break;
    case WIDGET_STYLE_TOOLBAR:
      background = GUIResource.getInstance().getColorDemoGray();
      break;
    case WIDGET_STYLE_TAB:
      background = GUIResource.getInstance().getColorWhite();
      CTabFolder tabFolder = (CTabFolder) control;
      tabFolder.setSimple( false );
      tabFolder.setBorderVisible( true );
      // need to make a copy of the tab selection background color to get around PDI-13940
      Color c = GUIResource.getInstance().getColorTab();
      Color tabColor = new Color( c.getDevice(), c.getRed(), c.getGreen(), c.getBlue() );
      tabFolder.setSelectionBackground( tabColor );
      break;
    default:
      background = gui.getColorBackground();
      font = null; // gui.getFontDefault();
      break;
  }

  if ( font != null && !font.isDisposed() ) {
    control.setFont( font );
  }

  if ( background != null && !background.isDisposed() ) {
    if ( control instanceof Button ) {
      Button b = (Button) control;
      if ( ( b.getStyle() & SWT.PUSH ) != 0 ) {
        return;
      }
    }
    control.setBackground( background );
  }
}