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;
}
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());
}
}
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;
}
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();
}
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();
}));
}
Aggregations