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"));
}
}
}
}
}
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 SQLBuilderDialog method okPressed.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
public void okPressed() {
// gain the contextmode from sqlbuilder,and set it in connParameters,add by hyWang
MultiPageSqlBuilderEditor editor = null;
CTabFolder folder = getEditorComposite().getTabFolder();
CTabItem[] a = folder.getItems();
for (CTabItem itm : a) {
//$NON-NLS-1$
Object obj = itm.getData("KEY");
if (obj instanceof MultiPageSqlBuilderEditor) {
editor = (MultiPageSqlBuilderEditor) obj;
}
if (editor != null) {
if (itm.getData() instanceof Query) {
Query q = (Query) itm.getData();
connParameters.setIfContextButtonCheckedFromBuiltIn(q.isContextMode());
}
}
}
if (EParameterFieldType.DBTABLE.equals(connParameters.getFieldType())) {
final IStructuredSelection selection = (IStructuredSelection) structureComposite.getTreeViewer().getSelection();
final Object firstElement = selection.getFirstElement();
if (firstElement instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) firstElement;
boolean is = node.getProperties(EProperties.CONTENT_TYPE).equals(RepositoryNodeType.TABLE);
if (is) {
MetadataTableRepositoryObject object = (MetadataTableRepositoryObject) node.getObject();
connParameters.setSelectDBTable(object.getSourceName());
}
}
} else {
//$NON-NLS-1$
String sql = "";
// sql = editorComposite.getDefaultTabSql();
sql = editorComposite.getCurrentTabSql();
// if (ConnectionParameters.isJavaProject()) {
// sql = sql.replace("\"", "\\" + "\"");
// } else {
// sql = sql.replace("'", "\\'");
// }
// sql = QueryUtil.checkAndAddQuotes(sql);
connParameters.setQuery(sql);
if (connParameters.isFromRepository() && !connParameters.isNodeReadOnly()) {
List<Query> qs = new ArrayList<Query>();
boolean isInfo = false;
final CTabFolder tabFolder = getEditorComposite().getTabFolder();
final CTabItem[] items = tabFolder.getItems();
for (CTabItem item : items) {
final String text = item.getText();
//$NON-NLS-1$
boolean isInfo2 = text.length() > 1 && text.substring(0, 1).equals("*");
if (isInfo2) {
isInfo = true;
}
}
if (isInfo) {
//$NON-NLS-1$
String title = Messages.getString("SQLBuilderDialog.SaveAllQueries.Title");
//$NON-NLS-1$
String info = Messages.getString("SQLBuilderDialog.SaveAllQueries.Info");
boolean openQuestion = MessageDialog.openQuestion(getShell(), title, info);
if (openQuestion) {
for (CTabItem item : items) {
final String text = item.getText();
//$NON-NLS-1$
boolean isInfo2 = text.length() > 1 && text.substring(0, 1).equals("*");
if (isInfo2) {
MultiPageSqlBuilderEditor meditor = null;
//$NON-NLS-1$
Object control = item.getData("KEY");
if (control instanceof MultiPageSqlBuilderEditor) {
meditor = (MultiPageSqlBuilderEditor) control;
}
if (meditor != null) {
RepositoryNode node = null;
node = meditor.getActivePageRepositoryNode();
if (text.substring(1).startsWith(AbstractSQLEditorComposite.QUERY_PREFIX)) {
if (item.getData() instanceof Query) {
Query q = (Query) item.getData();
q.setValue(meditor.getActivePageSqlString());
// add by hyWang
q.setContextMode(meditor.getActiveEditors().getContextmode().getContextmodeaction().isChecked());
qs.add(q);
if (node != null && q != null) {
manager.saveQuery(node, q, null);
}
}
} else {
meditor.getActivePageSaveAsSQLAction().run();
}
}
}
}
}
}
if (connParameters.getQueryObject() != null) {
RepositoryUpdateManager.updateQuery(connParameters.getQueryObject(), node);
}
}
}
deleteNoUseTable();
super.okPressed();
}
use of org.eclipse.swt.custom.CTabFolder in project tdi-studio-se by Talend.
the class CpuSection method createControls.
/*
* @see AbstractPropertySection#createControls(Composite, TabbedPropertySheetPage)
*/
@Override
public void createControls(Composite parent) {
contributeToActionBars();
// hide the highlight margin with SWT.FLAT
final CTabFolder tabFolder = getWidgetFactory().createTabFolder(parent, SWT.BOTTOM | SWT.FLAT);
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tabSelectionChanged(tabFolder.getSelection());
}
});
callTree = new CallTreeTabPage(this, tabFolder);
hotSpots = new HotSpotsTabPage(this, tabFolder);
callerCallee = new CallerCalleeTabPage(this, tabFolder);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.CPU_PAGE);
}
Aggregations