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

The following examples show how to use org.eclipse.swt.custom.CTabFolder#addSelectionListener() . 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: DiskInfoTab.java    From AppleCommander with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the DISK INFO tab.
 */
public DiskInfoTab(CTabFolder tabFolder, FormattedDisk[] disks) {
	this.formattedDisks = disks;
	
	CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL);
	ctabitem.setText(textBundle.get("DiskInfoTab.Title")); //$NON-NLS-1$
	
	tabFolder.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent event) {
			getInfoTable().removeAll();
			buildDiskInfoTable(getFormattedDisk(0));	// FIXME!
		}
	});
	
	ScrolledComposite scrolledComposite = new ScrolledComposite(
		tabFolder, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	ctabitem.setControl(scrolledComposite);
	
	composite = new Composite(scrolledComposite, SWT.NONE);
	createDiskInfoTable();
	if (disks.length > 1) {
		RowLayout layout = new RowLayout(SWT.VERTICAL);
		layout.wrap = false;
		composite.setLayout(layout);
		for (int i=0; i<disks.length; i++) {
			Label label = new Label(composite, SWT.NULL);
			label.setText(disks[i].getDiskName());
			buildDiskInfoTable(disks[i]);
		}
	} else {
		composite.setLayout(new FillLayout());
		buildDiskInfoTable(disks[0]);
	}
	composite.pack();
	scrolledComposite.setContent(composite);
	scrolledComposite.setMinSize(
		composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
 
Example 2
Source File: SymbolProviderConfigDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.SymbolProviderConfigDialog_title);
    setTitle(Messages.SymbolProviderConfigDialog_title);
    setMessage(Messages.SymbolProviderConfigDialog_message);

    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new GridLayout());

    // if we have one single provider that we don't need a tab
    if (fPreferencePages.length == 1) {
        attachPreference(composite, fPreferencePages[0]);
        updateMessage(0);
    } else {
        fTabFolder = new CTabFolder(composite, SWT.NONE);
        fTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
        fPageTabs = new CTabItem[fPreferencePages.length];
        for (int i = 0; i < fPreferencePages.length; i++) {
            ISymbolProviderPreferencePage page = fPreferencePages[i];
            fPageTabs[i] = new CTabItem(fTabFolder, SWT.NONE);
            fPageTabs[i].setText(page.getTitle());
            Composite child = new Composite(fTabFolder, SWT.NONE);
            child.setLayout(new GridLayout());
            child.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
            fPageTabs[i].setControl(child);
            attachPreference(child, page);
            updateMessage(i);
        }
        fTabFolder.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                updateMessage(fTabFolder.indexOf((CTabItem) e.item));
            }
        });
    }
    return composite;
}
 
Example 3
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 4
Source File: ArtikelView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(Composite parent){
	parent.setLayout(new FillLayout());
	ctab = new CTabFolder(parent, SWT.NONE);
	importers = new Hashtable<String, ImporterPage>();
	
	new FavoritenCTabItem(ctab, SWT.None);
	addPagesFor(ExtensionPointConstantsUi.VERRECHNUNGSCODE);
	
	if (ctab.getItemCount() > 0) {
		ctab.setSelection(0);
	}
	ctab.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			CTabItem selected = ctab.getSelection();
			
			if (selected instanceof FavoritenCTabItem)
				return;
			
			if (selected != null) {
				String t = selected.getText();
				
				MasterDetailsPage page = (MasterDetailsPage) selected.getControl();
				if (page == null) {
					try {
						IDetailDisplay det = (IDetailDisplay) selected.getData(KEY_DETAIL);
						IConfigurationElement ce =
							(IConfigurationElement) selected.getData(KEY_CE);
						CodeSelectorFactory cs =
							(CodeSelectorFactory) ce
								.createExecutableExtension(ExtensionPointConstantsUi.VERRECHNUNGSCODE_CSF);
						String a = ce.getAttribute(ExtensionPointConstantsUi.VERRECHNUNGSCODE_IMPC);
						ImporterPage ip = null;
						if (a != null) {
							ip = (ImporterPage) ce.createExecutableExtension(ExtensionPointConstantsUi.VERRECHNUNGSCODE_IMPC);
							if (ip != null) {
								importers.put(det.getTitle(), ip);
							}
						}
						
						page = new MasterDetailsPage(ctab, cs, det);
						selected.setControl(page);
						selected.setData(det);
					} catch (Exception ex) {
						LoggerFactory.getLogger(getClass()).error("Error creating pages", ex);
						return;
					}
				}
				importAction.setEnabled(importers.get(t) != null);
				ViewerConfigurer vc = page.cv.getConfigurer();
				vc.getControlFieldProvider().setFocus();
			}
		}
		
	});
	makeActions();
	viewmenus = new ViewMenus(getViewSite());
	viewmenus.createMenu(importAction /* ,deleteAction */);
	GlobalEventDispatcher.addActivationListener(this, this);
	
}
 
Example 5
Source File: LaborView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(final Composite parent){
	setTitleImage(Images.IMG_VIEW_LABORATORY.getImage());
	
	tabFolder = new CTabFolder(parent, SWT.TOP);
	tabFolder.setLayout(new FillLayout());
	
	final CTabItem resultsTabItem = new CTabItem(tabFolder, SWT.NULL);
	resultsTabItem.setText("Resultate");
	resultsComposite = new LaborResultsComposite(tabFolder, SWT.NONE);
	resultsTabItem.setControl(resultsComposite);
	
	final CTabItem ordersTabItem = new CTabItem(tabFolder, SWT.NULL);
	ordersTabItem.setText("Verordnungen");
	ordersComposite = new LaborOrdersComposite(tabFolder, SWT.NONE);
	ordersTabItem.setControl(ordersComposite);
	
	tabFolder.setSelection(0);
	tabFolder.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			resultsComposite.reload();
			ordersComposite.reload();
		}
	});
	makeActions();
	menu = new ViewMenus(getViewSite());
	menu.createMenu(newAction, backAction, fwdAction, printAction, importAction, xmlAction);
	// Orders
	final LaborOrderPulldownMenuCreator menuCreator =
		new LaborOrderPulldownMenuCreator(parent.getShell());
	if (menuCreator.getSelected() != null) {
		IAction dropDownAction = menuCreator.getAction();
		
		IActionBars actionBars = getViewSite().getActionBars();
		IToolBarManager toolbar = actionBars.getToolBarManager();
		
		toolbar.add(dropDownAction);
		
		// Set data
		dropDownAction.setText(menuCreator.getSelected().getText());
		dropDownAction.setToolTipText(menuCreator.getSelected().getToolTipText());
		dropDownAction.setImageDescriptor(menuCreator.getSelected().getImageDescriptor());
	}
	// Importers
	IToolBarManager tm = getViewSite().getActionBars().getToolBarManager();
	List<IAction> importers =
		Extensions.getClasses(
			Extensions.getExtensions(ExtensionPointConstantsUi.LABORDATENIMPORT),
			"ToolbarAction", //$NON-NLS-1$ //$NON-NLS-2$
			false);
	for (IAction ac : importers) {
		tm.add(ac);
	}
	if (importers.size() > 0) {
		tm.add(new Separator());
	}
	tm.add(refreshAction);
	tm.add(newColumnAction);
	tm.add(newAction);
	tm.add(backAction);
	tm.add(fwdAction);
	tm.add(expandAllAction);
	tm.add(collapseAllAction);
	tm.add(printAction);
	
	// register event listeners
	ElexisEventDispatcher.getInstance().addListeners(eeli_labitem, eeli_laborder,
		eeli_labresult, eeli_pat);
	Patient act = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
	if ((act != null && act != resultsComposite.getPatient())) {
		resultsComposite.selectPatient(act);
	}
	getSite().getPage().addPartListener(udpateOnVisible);
}