Search in sources :

Example 26 with CTabFolder

use of org.eclipse.swt.custom.CTabFolder in project cubrid-manager by CUBRID.

the class ChartSettingDlg method createDialogArea.

/**
	 * Creates and returns the contents of the upper part of this dialog (above
	 * the button bar).
	 * 
	 * @param parent The parent composite to contain the dialog area
	 * @return the dialog area control
	 */
protected Control createDialogArea(Composite parent) {
    Composite comp = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    setTitle(Messages.chartSettingDlgTtl);
    setMessage(Messages.chartSettingDlgMsg);
    folder = new CTabFolder(comp, SWT.BORDER);
    folder.setLayout(new GridLayout());
    GridData gdTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
    folder.setLayoutData(gdTabFolder);
    folder.setSimple(false);
    if (hasTitlSetting) {
        createTtlTab();
    }
    if (hasPlotItemSetting) {
        createPlotItem();
    }
    if (hasSeriesItemSetting) {
        createSeriesItemByDefault();
    }
    if (hasHistoryPath) {
        createHistoryPathItem();
    }
    if (hasChartSelection) {
        createChartSelectionItem();
    }
    return parent;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData)

Example 27 with CTabFolder

use of org.eclipse.swt.custom.CTabFolder in project eclipse.platform.text by eclipse.

the class StatusEditorTest method doNotThrowOnActivationInStale.

/*
	 * https://bugs.eclipse.org/bugs/attachment.cgi?bugid=320672
	 *
	 * No exceptions are thrown when a status editor displaying an erroneous status is activated with a mouse click.
	 * @throws Exception
	 */
@Test
public void doNotThrowOnActivationInStale() throws Exception {
    IEditorPart editor1 = openNonExistentFile(page, new URI("file:/1.txt"));
    openNonExistentFile(page, new URI("file:/2.txt"));
    ILog log = Platform.getLog(Platform.getBundle("org.eclipse.e4.ui.workbench"));
    List<String> logEvents = new ArrayList<>();
    ILogListener listener = (status, plugin) -> logEvents.add(status.toString());
    log.addLogListener(listener);
    // Clicks are not equivalent to activation from API, so we need this
    // hack to imitate tab clicks.
    CTabFolder folder = (CTabFolder) (((PartSite) editor1.getSite()).getModel().getParent().getWidget());
    try {
        folder.setSelection(0);
        processEvents();
        folder.setSelection(1);
        processEvents();
    } finally {
        log.removeLogListener(listener);
    }
    if (!logEvents.isEmpty()) {
        Assert.assertEquals("Unexpected errors logged", "", logEvents.toString());
    }
}
Also used : WorkbenchException(org.eclipse.ui.WorkbenchException) ForwardingDocumentProvider(org.eclipse.ui.editors.text.ForwardingDocumentProvider) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) PartSite(org.eclipse.ui.internal.PartSite) ArrayList(java.util.ArrayList) IStatus(org.eclipse.core.runtime.IStatus) After(org.junit.After) URI(java.net.URI) TextEditor(org.eclipse.ui.editors.text.TextEditor) Method(java.lang.reflect.Method) EFS(org.eclipse.core.filesystem.EFS) IEditorPart(org.eclipse.ui.IEditorPart) Before(org.junit.Before) IDocumentProvider(org.eclipse.ui.texteditor.IDocumentProvider) CTabFolder(org.eclipse.swt.custom.CTabFolder) ILog(org.eclipse.core.runtime.ILog) PlatformUI(org.eclipse.ui.PlatformUI) Status(org.eclipse.core.runtime.Status) Test(org.junit.Test) Display(org.eclipse.swt.widgets.Display) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) EditorsUI(org.eclipse.ui.editors.text.EditorsUI) FileStoreEditorInput(org.eclipse.ui.ide.FileStoreEditorInput) List(java.util.List) AbstractTextEditor(org.eclipse.ui.texteditor.AbstractTextEditor) Platform(org.eclipse.core.runtime.Platform) Assert(org.junit.Assert) ILogListener(org.eclipse.core.runtime.ILogListener) CTabFolder(org.eclipse.swt.custom.CTabFolder) PartSite(org.eclipse.ui.internal.PartSite) ArrayList(java.util.ArrayList) ILog(org.eclipse.core.runtime.ILog) ILogListener(org.eclipse.core.runtime.ILogListener) IEditorPart(org.eclipse.ui.IEditorPart) URI(java.net.URI) Test(org.junit.Test)

Example 28 with CTabFolder

use of org.eclipse.swt.custom.CTabFolder in project eclipse.platform.text by eclipse.

the class SearchDialog method createPageArea.

@Override
protected Control createPageArea(Composite parent) {
    int numPages = fDescriptors.size();
    fScopeParts = new ScopePart[numPages];
    if (numPages == 0) {
        Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
        label.setText(SearchMessages.SearchDialog_noSearchExtension);
        return label;
    }
    fCurrentIndex = getPreferredPageIndex();
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    CTabFolder folder = new CTabFolder(composite, SWT.BORDER);
    folder.setLayout(new TabFolderLayout());
    folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    folder.setFont(composite.getFont());
    for (int i = 0; i < numPages; i++) {
        SearchPageDescriptor descriptor = getDescriptorAt(i);
        if (WorkbenchActivityHelper.filterItem(descriptor))
            continue;
        final CTabItem item = new CTabItem(folder, SWT.NONE);
        // $NON-NLS-1$
        item.setData("descriptor", descriptor);
        item.setText(descriptor.getLabel());
        item.addDisposeListener(e -> {
            // $NON-NLS-1$
            item.setData("descriptor", null);
            if (item.getImage() != null)
                item.getImage().dispose();
        });
        ImageDescriptor imageDesc = descriptor.getImage();
        if (imageDesc != null)
            item.setImage(imageDesc.createImage());
        if (i == fCurrentIndex) {
            Control pageControl = createPageControl(folder, descriptor);
            pageControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            item.setControl(pageControl);
            fCurrentPage = descriptor.getPage();
            fDialogSettings.put(STORE_PREVIOUS_PAGE, descriptor.getId());
        }
    }
    folder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            turnToPage(event);
        }
    });
    folder.setSelection(fCurrentIndex);
    return composite;
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) CTabItem(org.eclipse.swt.custom.CTabItem) Point(org.eclipse.swt.graphics.Point) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Example 29 with CTabFolder

use of org.eclipse.swt.custom.CTabFolder in project eclipse.platform.text by eclipse.

the class SearchDialog method turnToPage.

private void turnToPage(SelectionEvent event) {
    final CTabItem item = (CTabItem) event.item;
    CTabFolder folder = item.getParent();
    // $NON-NLS-1$
    SearchPageDescriptor descriptor = (SearchPageDescriptor) item.getData("descriptor");
    if (item.getControl() == null) {
        item.setControl(createPageControl(folder, descriptor));
    }
    Control oldControl = folder.getItem(fCurrentIndex).getControl();
    Point oldSize = oldControl.getSize();
    Control newControl = item.getControl();
    Point newSize = newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    resizeDialogIfNeeded(oldSize, newSize);
    ISearchPage oldPage = fCurrentPage;
    if (oldPage != null) {
        oldPage.setVisible(false);
    }
    fCurrentPage = descriptor.getPage();
    fDialogSettings.put(STORE_PREVIOUS_PAGE, descriptor.getId());
    fCurrentIndex = folder.getSelectionIndex();
    setPerformActionEnabled(fCurrentPage != null);
    if (fCurrentPage != null) {
        fCurrentPage.setVisible(true);
        Control pageControl = fCurrentPage.getControl();
        if (pageControl instanceof Composite)
            ((Composite) pageControl).layout(false, true);
    }
    fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
    notifyPageChanged();
}
Also used : Control(org.eclipse.swt.widgets.Control) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) IReplacePage(org.eclipse.search.ui.IReplacePage) Point(org.eclipse.swt.graphics.Point) CTabItem(org.eclipse.swt.custom.CTabItem) ISearchPage(org.eclipse.search.ui.ISearchPage)

Example 30 with CTabFolder

use of org.eclipse.swt.custom.CTabFolder in project linuxtools by eclipse.

the class AbstractProfilingOptionsTab method createControl.

@Override
public void createControl(Composite parent) {
    top = new Composite(parent, SWT.NONE);
    setControl(top);
    top.setLayout(new GridLayout(1, true));
    comboItems = getProviders();
    Set<String> providerNames = comboItems.keySet();
    providerCombo = new Combo(top, SWT.READ_ONLY);
    providerCombo.setItems(providerNames.toArray(new String[0]));
    if (providerNames.size() == 0) {
        providerCombo.setVisible(false);
        providerCombo.setEnabled(false);
        Label label = new Label(top, SWT.NULL);
        label.setText(Messages.ProfilingTab_no_category_profilers_installed);
    }
    tabgroup = new CTabFolder(top, SWT.NONE);
    tabgroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    providerCombo.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        String curProviderId = comboItems.get(providerCombo.getText());
        loadTabGroupItems(tabgroup, curProviderId);
        initializeFrom(initial);
        // Since we are calling initializeFrom manually, we have to
        // update the launch configuration dialog manually to ensure
        // initial validation on the configuration.
        updateLaunchConfigurationDialog();
        top.layout();
    }));
}
Also used : ProviderProfileConstants(org.eclipse.linuxtools.internal.profiling.launch.provider.ProviderProfileConstants) Image(org.eclipse.swt.graphics.Image) HashMap(java.util.HashMap) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ProviderLaunchShortcut(org.eclipse.linuxtools.internal.profiling.launch.provider.launch.ProviderLaunchShortcut) ILaunchConfigurationTab(org.eclipse.debug.ui.ILaunchConfigurationTab) AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) ProviderFramework(org.eclipse.linuxtools.internal.profiling.launch.provider.launch.ProviderFramework) GridData(org.eclipse.swt.layout.GridData) Combo(org.eclipse.swt.widgets.Combo) NLS(org.eclipse.osgi.util.NLS) CTabFolder(org.eclipse.swt.custom.CTabFolder) Set(java.util.Set) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) CTabItem(org.eclipse.swt.custom.CTabItem) ICDTLaunchConfigurationConstants(org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants) SWT(org.eclipse.swt.SWT) Entry(java.util.Map.Entry) ProfileLaunchConfigurationTabGroup(org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup) Label(org.eclipse.swt.widgets.Label) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Combo(org.eclipse.swt.widgets.Combo)

Aggregations

CTabFolder (org.eclipse.swt.custom.CTabFolder)66 CTabItem (org.eclipse.swt.custom.CTabItem)36 GridData (org.eclipse.swt.layout.GridData)35 GridLayout (org.eclipse.swt.layout.GridLayout)27 Composite (org.eclipse.swt.widgets.Composite)26 SelectionEvent (org.eclipse.swt.events.SelectionEvent)18 FillLayout (org.eclipse.swt.layout.FillLayout)18 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)13 Label (org.eclipse.swt.widgets.Label)13 Point (org.eclipse.swt.graphics.Point)9 Shell (org.eclipse.swt.widgets.Shell)8 StyledText (org.eclipse.swt.custom.StyledText)7 SelectionListener (org.eclipse.swt.events.SelectionListener)7 Button (org.eclipse.swt.widgets.Button)7 SashForm (org.eclipse.swt.custom.SashForm)6 FormAttachment (org.eclipse.swt.layout.FormAttachment)6 FormData (org.eclipse.swt.layout.FormData)6 Text (org.eclipse.swt.widgets.Text)6 ToolBar (org.eclipse.swt.widgets.ToolBar)6 ToolItem (org.eclipse.swt.widgets.ToolItem)6