use of org.eclipse.swt.custom.CTabFolder in project tdi-studio-se by Talend.
the class AddTablesComposite method createTabFolder.
private void createTabFolder() {
if (tabFolder == null || tabFolder.isDisposed()) {
clearParent();
// create tab folder for different sessions
tabFolder = new CTabFolder(this, SWT.NULL | SWT.BORDER);
tabFolder.setLayout(new GridLayout());
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
tabFolder.setSimple(false);
this.layout();
this.redraw();
}
}
use of org.eclipse.swt.custom.CTabFolder in project tdi-studio-se by Talend.
the class DetailTabManager method createTabs.
/**
* Creates all the tabs in the detail pane to display the information for a
* given node.
*
* @param composite
* @param node
*/
public static void createTabs(Composite composite, INode node) {
List tabs = getTabs(node);
if (tabs == null || tabs.size() == 0) {
// no detail found..
Label label = new Label(composite, SWT.FILL | SWT.WRAP);
//$NON-NLS-1$ //$NON-NLS-2$
label.setText(Messages.getString("DatabaseDetailView.Tab.Unavailable") + " " + node.getLabelText());
return;
}
// create tabs
CTabFolder tabFolder = new CTabFolder(composite, SWT.NULL);
tabFolder.setSimple(false);
// only init tabs when the tab becomes active
tabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
CTabItem tabItem = (CTabItem) e.item;
IDetailTab tab = (IDetailTab) tabItem.getData();
if (tab != null) {
// create composite on tab and fill it..
Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL);
tabItem.setControl(detailComposite);
detailComposite.setLayout(new FillLayout());
tab.fillComposite(detailComposite);
detailComposite.layout();
// store tab name, so we can reselect when other node is
// chosen
DetailTabManager.setActiveTabName(tabItem.getText());
}
}
});
// add tabs to folder
Iterator it = tabs.iterator();
int tabIndex = 0;
while (it.hasNext()) {
IDetailTab detailTab = (IDetailTab) it.next();
// create tab
CTabItem tabItem = new CTabItem(tabFolder, SWT.NULL);
tabItem.setText(detailTab.getLabelText());
tabItem.setToolTipText(detailTab.getLabelToolTipText());
// store tab so we can fill later
tabItem.setData(detailTab);
// reselect same tab as was previous selected
if (tabItem.getText() != null && pActiveTabName != null) {
if (tabItem.getText().equals(pActiveTabName)) {
tabFolder.setSelection(tabIndex);
}
}
tabIndex++;
}
// load data for active tab, default to first one if none is selected
tabIndex = tabFolder.getSelectionIndex();
if (tabIndex == -1) {
tabIndex = 0;
}
CTabItem tabItem = tabFolder.getItem(tabIndex);
if (tabItem != null) {
Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL);
tabItem.setControl(detailComposite);
detailComposite.setLayout(new FillLayout());
IDetailTab tab = (IDetailTab) tabItem.getData();
tab.fillComposite(detailComposite);
detailComposite.layout();
}
if (tabFolder.getChildren().length > 0 && tabFolder.getSelection() == null) {
tabFolder.setSelection(0);
}
tabFolder.layout();
}
use of org.eclipse.swt.custom.CTabFolder in project tdi-studio-se by Talend.
the class JSONFileStep2Form method addGroupFileViewer.
/**
* add Field to Group File Viewer.
*
* @param parent
* @param form
* @param width
* @param height
*/
private void addGroupFileViewer(final Composite parent, final int width, int height) {
// composite JSON File Preview
// Group previewGroup = Form.createGroup(parent, 1, Messages.getString("FileStep2.groupPreview"), height);
// //$NON-NLS-1$
// Composite compositeJSONFilePreviewButton = Form.startNewDimensionnedGridLayout(previewGroup, 4, width,
// HEIGHT_BUTTON_PIXEL);
// height = height - HEIGHT_BUTTON_PIXEL - 15;
tabFolder = new CTabFolder(parent, SWT.BORDER);
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
previewTabItem = new CTabItem(tabFolder, SWT.BORDER);
//$NON-NLS-1$
previewTabItem.setText("Preview");
outputTabItem = new CTabItem(tabFolder, SWT.BORDER);
outputTabItem.setText("Output");
fileTabItem = new CTabItem(tabFolder, SWT.BORDER);
fileTabItem.setText("File Viewer");
Composite previewComposite = Form.startNewGridLayout(tabFolder, 1);
outputComposite = Form.startNewGridLayout(tabFolder, 1);
Composite compositeFileViewer = Form.startNewGridLayout(tabFolder, 1);
// previewGroup.setLayout(new GridLayout());
Composite preivewButtonPart = new Composite(previewComposite, SWT.NONE);
preivewButtonPart.setLayout(new GridLayout(3, false));
preivewButtonPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Preview Button
previewButton = new Button(preivewButtonPart, SWT.NONE);
//$NON-NLS-1$
previewButton.setText("Refresh Preview");
previewButton.setSize(WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL);
XmlArray.setLimitToDefault();
previewInformationLabel = new Label(previewComposite, SWT.NONE);
previewInformationLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
// JSON File Preview
jsonFilePreview = new JSONShadowProcessPreview(previewComposite, null, width, height - 10);
jsonFilePreview.newTablePreview();
// File View
fileJSONText = new Text(compositeFileViewer, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.minimumWidth = width;
gridData.minimumHeight = HEIGHT_BUTTON_PIXEL;
fileJSONText.setLayoutData(gridData);
fileJSONText.setToolTipText("When Filepath is specified, you can read here the" + " " + TreePopulator.getMaximumRowsToPreview() + " " + "first rows of the file.");
fileJSONText.setEditable(false);
fileJSONText.setText("Filepath must be specified to show the Data file");
previewTabItem.setControl(previewComposite);
outputTabItem.setControl(outputComposite);
fileTabItem.setControl(compositeFileViewer);
tabFolder.setSelection(previewTabItem);
tabFolder.pack();
}
use of org.eclipse.swt.custom.CTabFolder in project tdi-studio-se by Talend.
the class MetadataColumnComparator method synchronizeAllSqlEditors.
public void synchronizeAllSqlEditors(SQLBuilderDialog builderDialog) {
if (builderDialog.getStructureComposite() == null) {
return;
}
List<Query> displayQueries = builderDialog.getStructureComposite().getTreeLabelProvider().getDisplayQueries();
for (Query activeQuery : displayQueries) {
CTabFolder tabFolder = builderDialog.getEditorComposite().getTabFolder();
if (tabFolder != null) {
CTabItem[] items = tabFolder.getItems();
for (CTabItem item : items) {
final boolean b = (item.getData() instanceof Query) && item.getData(TextUtil.KEY) instanceof MultiPageSqlBuilderEditor && activeQuery != null;
Query data2 = (Query) item.getData();
if (b && data2.getLabel().equals(activeQuery.getLabel())) {
data2.setValue(activeQuery.getValue());
data2.setComment(activeQuery.getComment());
data2.setLabel(activeQuery.getLabel());
//$NON-NLS-1$
updateEditor(activeQuery, (MultiPageSqlBuilderEditor) item.getData("KEY"));
}
}
}
}
}
Aggregations