protected void setOriginalSql(ILanguageObject theLangObj) { IQueryService queryService = ModelerCore.getTeiidQueryService(); ISQLStringVisitor visitor = queryService.getSQLStringVisitor(); originalSql.setText(visitor.getSQLString(theLangObj)); }
/* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite theParent) { originalLanguageObjLabel = WidgetFactory.createLabel(theParent, CoreStringUtil.Constants.EMPTY_STRING); Composite pnlContents = (Composite) super.createDialogArea(theParent); // // main panel contents // CTabFolder tabFolder = WidgetFactory.createTabFolder(pnlContents); // // tabFolder contents - 2 tabs (Tree, SQL Text), each with a splitter // CTabItem treeTab = WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "treeTab")); // $NON-NLS-1$ treeTab.setToolTipText(Util.getString(PREFIX + "treeTab.tip")); // $NON-NLS-1$ SashForm treeTabSash = new SashForm(tabFolder, SWT.VERTICAL); treeTabSash.setLayoutData(new GridData(GridData.FILL_BOTH)); treeTab.setControl(treeTabSash); CTabItem sqlTab = WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "sqlTab")); // $NON-NLS-1$ sqlTab.setToolTipText(Util.getString(PREFIX + "sqlTab.tip")); // $NON-NLS-1$ SashForm sqlTabSash = new SashForm(tabFolder, SWT.VERTICAL); sqlTabSash.setLayoutData(new GridData(GridData.FILL_BOTH)); sqlTab.setControl(sqlTabSash); // // treeTab contents // ViewForm formTree = new ViewForm(treeTabSash, SWT.BORDER); Composite pnlTree = new Composite(formTree, SWT.NO_TRIM); formTree.setContent(pnlTree); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; pnlTree.setLayout(layout); pnlTree.setLayoutData(new GridData(GridData.FILL_BOTH)); ViewForm formEditor = new ViewForm(treeTabSash, SWT.BORDER); pnlEditor = new Composite(formEditor, SWT.NO_TRIM); formEditor.setContent(pnlEditor); pnlEditor.setLayoutData(new GridData(GridData.FILL_BOTH)); lblTitle = new Label(formEditor, SWT.CENTER); lblTitle.setBackground(BuilderUtils.COLOR_HIGHLIGHT); formEditor.setTopLeft(lblTitle); treeTabSash.setWeights(new int[] {30, 70}); // // sqlTab contents // ViewForm formCurrentSql = new ViewForm(sqlTabSash, SWT.BORDER); ViewForm formOriginalSql = new ViewForm(sqlTabSash, SWT.BORDER); // // formCurrentSql contents // Composite pnlCurrentSql = new Composite(formCurrentSql, SWT.NONE); formCurrentSql.setContent(pnlCurrentSql); pnlCurrentSql.setLayout(new GridLayout()); pnlCurrentSql.setLayoutData(new GridData(GridData.FILL_BOTH)); currentSql = new SqlDisplayPanel(pnlCurrentSql); currentSql.setLayoutData(new GridData(GridData.FILL_BOTH)); CLabel lblCurrent = new CLabel(formCurrentSql, SWT.NONE); lblCurrent.setBackground(BuilderUtils.COLOR_HIGHLIGHT); lblCurrent.setText(Util.getString(PREFIX + "lblCurrent")); // $NON-NLS-1$ lblCurrent.setToolTipText(Util.getString(PREFIX + "lblCurrent.tip")); // $NON-NLS-1$ formCurrentSql.setTopLeft(lblCurrent); // // formOriginalSql contents // Composite pnlOriginalSql = new Composite(formOriginalSql, SWT.NONE); formOriginalSql.setContent(pnlOriginalSql); pnlOriginalSql.setLayout(new GridLayout()); pnlOriginalSql.setLayoutData(new GridData(GridData.FILL_BOTH)); originalSql = new SqlDisplayPanel(pnlOriginalSql); originalSql.setLayoutData(new GridData(GridData.FILL_BOTH)); CLabel lblOriginal = new CLabel(formOriginalSql, SWT.NONE); lblOriginal.setBackground(BuilderUtils.COLOR_HIGHLIGHT); lblOriginal.setText(Util.getString(PREFIX + "lblOriginal")); // $NON-NLS-1$ lblOriginal.setToolTipText(Util.getString(PREFIX + "lblOriginal.tip")); // $NON-NLS-1$ formOriginalSql.setTopLeft(lblOriginal); // // pnlTree contents - 2 columns (tree viewer, button panel) // layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; pnlTree.setLayout(layout); treeViewer = new LanguageObjectBuilderTreeViewer(pnlTree); treeViewer.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent theEvent) { handleTreeSelection(); } }); MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener( new IMenuListener() { @Override public void menuAboutToShow(IMenuManager theMenuMgr) { fillContextMenu(theMenuMgr); } }); treeViewer.getTree().setMenu(menuMgr.createContextMenu(treeViewer.getTree())); Composite pnlButtons = new Composite(pnlTree, SWT.NONE); pnlButtons.setLayout(new GridLayout()); createTreeButtons(pnlButtons); // // pnlEditor contents // layout = new GridLayout(); layout.numColumns = 2; pnlEditor.setLayout(layout); pnlEditorDetail = new Composite(pnlEditor, SWT.NONE); pnlEditorDetail.setLayoutData(new GridData(GridData.FILL_BOTH)); pnlEditorDetail.setLayout(new GridLayout()); return pnlContents; }