use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class RecentlyUsedSQLComposite method initialize.
/**
* Create the SQL history composite
*/
public void initialize() {
Composite toolBarComposite = new Composite(this, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.verticalSpacing = 0;
gridLayout.horizontalSpacing = 10;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.numColumns = 2;
toolBarComposite.setLayout(gridLayout);
toolBarComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ToolBar delHistoryToolBar = new ToolBar(toolBarComposite, SWT.FLAT | SWT.RIGHT);
delHistoryToolBar.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
ToolItem delHistory = new ToolItem(delHistoryToolBar, SWT.PUSH);
delHistory.setImage(CommonUIPlugin.getImage("icons/action/table_record_delete.png"));
delHistory.setDisabledImage(CommonUIPlugin.getImage("icons/action/table_record_delete_disabled.png"));
delHistory.setToolTipText(Messages.tooltip_qedit_sql_history_delete);
delHistory.setText(Messages.btn_qedit_sql_history_delete);
delHistory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (sqlHistoryTable.getTable().getSelectionIndices().length == 0) {
MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.error, Messages.sql_history_delete_error);
return;
}
MessageBox messageBox = new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setText(Messages.tooltip_qedit_sql_history_delete);
messageBox.setMessage(Messages.sql_history_delete_message);
// remove data ,both view and model
int buttonID = messageBox.open();
if (buttonID == SWT.YES) {
deleteHistory();
}
}
});
// help messages
Label helpMsg = new Label(toolBarComposite, SWT.None);
helpMsg.setText(Messages.recentlyUsedSQLHelp);
helpMsg.setLayoutData(new GridData(SWT.TRAIL, SWT.CENTER, true, false));
// create the query result tab folder
recentlyUsedSQLTabFolder = new CTabFolder(this, SWT.BOTTOM);
recentlyUsedSQLTabFolder.setSimple(false);
recentlyUsedSQLTabFolder.setUnselectedImageVisible(true);
recentlyUsedSQLTabFolder.setUnselectedCloseVisible(true);
recentlyUsedSQLTabFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
recentlyUsedSQLTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
recentlyUsedSQLTabFolder.setLayout(new GridLayout(1, true));
recentlyUsedSQLTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
//TabContextMenuManager tabContextMenuManager = new TabContextMenuManager(recentlyUsedSQLTabFolder);
//tabContextMenuManager.createContextMenu();
recentlyUsedSQLTabItem = new CTabItem(resultTabFolder, SWT.NONE);
recentlyUsedSQLTabItem.setText(Messages.qedit_sql_history_folder);
recentlyUsedSQLTabItem.setControl(this);
recentlyUsedSQLTabItem.setShowClose(false);
final SashForm bottomSash = new SashForm(recentlyUsedSQLTabFolder, SWT.VERTICAL);
bottomSash.SASH_WIDTH = SASH_WIDTH;
bottomSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
createHistoryTable(bottomSash);
SashForm tailSash = new SashForm(bottomSash, SWT.HORIZONTAL);
tailSash.SASH_WIDTH = SASH_WIDTH;
tailSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
logMessageArea = new StyledText(tailSash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
CommonUITool.registerCopyPasteContextMenu(logMessageArea, false);
bottomSash.setWeights(new int[] { 80, 20 });
logMessageArea.setToolTipText(Messages.tooltipHowToExpandLogPane);
logMessageArea.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
bottomSash.setWeights(new int[] { 80, 20 });
}
public void focusGained(FocusEvent e) {
bottomSash.setWeights(new int[] { 20, 80 });
}
});
CTabItem tabItem = new CTabItem(recentlyUsedSQLTabFolder, SWT.NONE);
tabItem.setText(Messages.qedit_sql_history);
tabItem.setControl(bottomSash);
tabItem.setShowClose(false);
recentlyUsedSQLTabFolder.setSelection(tabItem);
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class InformationWindow method createContents.
protected Control createContents(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
infoText = new StyledText(composite, SWT.None);
infoText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
infoText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
infoText.setEditable(false);
infoText.setEnabled(false);
infoText.addMouseTrackListener(new MouseTrackListener() {
public void mouseHover(MouseEvent e) {
increaseAlpha();
}
public void mouseExit(MouseEvent e) {
reduceAlpha();
}
public void mouseEnter(MouseEvent e) {
increaseAlpha();
}
});
parentShell.addControlListener(new ControlListener() {
public void controlResized(ControlEvent e) {
updateLocation();
}
public void controlMoved(ControlEvent e) {
updateLocation();
}
});
if (Platform.getOS().equals(Platform.OS_WIN32)) {
parentShell.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
updateLocation();
}
});
}
this.getShell().setAlpha(minAlpha);
updateLocation();
return parent;
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class RowDetailDialog method createColumnValueGroup.
/**
* Create column value group
*
* @param parent Composite
*/
private void createColumnValueGroup(Composite parent) {
Group group = new Group(parent, SWT.NONE);
{
group.setText(Messages.grpColumnValue);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 2;
group.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
group.setLayout(layout);
}
final Label descLabel = new Label(group, SWT.NONE);
{
descLabel.setText(Messages.lblColumnValue);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
descLabel.setLayoutData(gd);
}
{
if (isCanUpdate()) {
columnValueText = new StyledText(group, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
CommonUITool.registerContextMenu(columnValueText, true);
} else {
columnValueText = new StyledText(group, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
CommonUITool.registerContextMenu(columnValueText, false);
}
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
gd.heightHint = 300;
columnValueText.setLayoutData(gd);
columnValueText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
setUpdateButtonEnable();
}
});
}
setNullBtn = new Button(group, SWT.CHECK);
{
setNullBtn.setText(com.cubrid.common.ui.cubrid.table.Messages.btnSetNull);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
setNullBtn.setLayoutData(gd);
setNullBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (setNullBtn.getSelection()) {
columnValueText.setText(DataType.NULL_EXPORT_FORMAT);
} else {
columnValueText.setText(dataItem.getText(selComboIndex + 1));
}
}
});
}
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class QueryResultComposite method makeEmptyResult.
/**
* Make empty result contents.
*
*/
public void makeEmptyResult() {
resultTabFolder.setSelection(queryResultTabItem);
SashForm bottomSash = new SashForm(queryResultTabFolder, SWT.VERTICAL);
bottomSash.SASH_WIDTH = SASH_WIDTH;
bottomSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
Table table = new Table(bottomSash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
setDropTraget(table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn tableColumn = new TableColumn(table, SWT.NONE);
tableColumn.setWidth(60);
SashForm tailSash = new SashForm(bottomSash, SWT.HORIZONTAL);
tailSash.SASH_WIDTH = SASH_WIDTH;
tailSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
new StyledText(tailSash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
bottomSash.setWeights(new int[] { 70, 30 });
CTabItem tabItem = new CTabItem(queryResultTabFolder, SWT.NONE);
tabItem.setText(Messages.qedit_result);
tabItem.setControl(bottomSash);
queryResultTabFolder.setSelection(tabItem);
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method createQueryTunerTab.
private void createQueryTunerTab(CTabFolder tabFolder) {
CTabItem item = new CTabItem(tabFolder, SWT.None | SWT.MULTI | SWT.V_SCROLL);
item.setText(Messages.tabItemQueryTuner);
tabFolder.setSelection(item);
SashForm form = new SashForm(tabFolder, SWT.HORIZONTAL);
item.setControl(form);
form.setLayout(new FillLayout());
/*Left composite*/
Composite leftComposite = new Composite(form, SWT.BORDER);
leftComposite.setLayout(new GridLayout());
/*Right composite*/
queryPlanContainer = new Composite(form, SWT.BORDER);
queryPlanContainer.setLayout(new FillLayout());
form.setWeights(new int[] { 40, 60 });
ToolBar toolBar = new ToolBar(leftComposite, SWT.None);
runItem = new ToolItem(toolBar, SWT.None);
runItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_run.png"));
runItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/query_run_disabled.png"));
runItem.setToolTipText(Messages.run);
runItem.setEnabled(false);
runItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
runQuery();
}
});
runPlanItem = new ToolItem(toolBar, SWT.None);
runPlanItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_execution_plan.png"));
runPlanItem.setToolTipText(Messages.queryPlanTip);
runPlanItem.setEnabled(false);
runPlanItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
runQueryPlan();
}
});
saveQueryItem = new ToolItem(toolBar, SWT.None);
saveQueryItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_save.png"));
saveQueryItem.setToolTipText(Messages.ttSaveQueryTuning);
saveQueryItem.setEnabled(false);
saveQueryItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
saveQueryRecord();
}
});
SashForm sashForm = new SashForm(leftComposite, SWT.VERTICAL);
sashForm.setBackground(SASH_COLOR);
sashForm.setLayout(new FillLayout());
sashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
CompositeRuler ruler = new CompositeRuler();
LineNumberRulerColumn lineCol = new LineNumberRulerColumn();
lineCol.setBackground(ResourceManager.getColor(new RGB(236, 233, 216)));
ruler.addDecorator(0, lineCol);
sqlTextViewer = new SQLTextViewer(sashForm, ruler, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, this);
viewerConfig = new SQLViewerConfiguration(this);
sqlTextViewer.configure(viewerConfig);
SQLDocument document = new SQLDocument();
IDocumentPartitioner partitioner = new FastPartitioner(new SQLPartitionScanner(), SQLPartitionScanner.getAllTypes());
document.setDocumentPartitioner(ISQLPartitions.SQL_PARTITIONING, partitioner);
partitioner.connect(document);
sqlTextViewer.setDocument(document);
undoManager = new TextViewerUndoManager(50);
undoManager.connect(sqlTextViewer);
contentAssistant = viewerConfig.getContentAssistant(sqlTextViewer);
contentAssistant.install(sqlTextViewer);
recentlyUsedSQLcontentAssistant = viewerConfig.getRecentlyUsedContentAssistant(sqlTextViewer);
recentlyUsedSQLcontentAssistant.install(sqlTextViewer);
formatHandler = new TextViewerOperationHandler(sqlTextViewer, ISourceViewer.FORMAT);
contentAssistHandler = new TextViewerOperationHandler(sqlTextViewer, ISourceViewer.CONTENTASSIST_PROPOSALS);
StyledText text = (StyledText) sqlTextViewer.getTextWidget();
text.setIndent(1);
text.setData(SQL_EDITOR_FLAG, sqlTextViewer);
addTextViewerListener(text);
queryResultContainer = new Composite(sashForm, SWT.None);
queryResultContainer.setLayout(new FillLayout());
displayQuery(null);
displayQueryPlan(null);
}
Aggregations