use of org.eclipse.jface.text.source.LineNumberRulerColumn in project cubrid-manager by CUBRID.
the class SQLEditorComposite method createSQLEditor.
/**
* Create the SQL editor
*/
private void createSQLEditor() {
final Composite composite = new Composite(this, SWT.NONE);
composite.setLayout(new FillLayout());
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
CompositeRuler ruler = new CompositeRuler();
LineNumberRulerColumn lineCol = new LineNumberRulerColumn();
lineCol.setBackground(ResourceManager.getColor(new RGB(236, 233, 216)));
ruler.addDecorator(0, lineCol);
sqlTextViewer = new SQLTextViewer(composite, ruler, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, queryEditor);
viewerConfig = new SQLViewerConfiguration(queryEditor);
sqlTextViewer.configure(viewerConfig);
document = new SQLDocument();
IDocumentPartitioner partitioner = new FastPartitioner(new SQLPartitionScanner(), SQLPartitionScanner.getAllTypes());
document.setDocumentPartitioner(ISQLPartitions.SQL_PARTITIONING, partitioner);
partitioner.connect(document);
sqlTextViewer.setDocument(document);
findReplaceDocAdapter = new FindReplaceDocumentAdapter(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);
text = (StyledText) sqlTextViewer.getTextWidget();
text.setIndent(1);
text.setData(SQL_EDITOR_FLAG, sqlTextViewer);
createContextMenu();
addListener();
}
use of org.eclipse.jface.text.source.LineNumberRulerColumn 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);
}
use of org.eclipse.jface.text.source.LineNumberRulerColumn in project cubrid-manager by CUBRID.
the class CUBRIDTextEditor method getRuler.
/**
* @return CompositeRuler of SourceViewer.
*/
protected CompositeRuler getRuler() {
CompositeRuler ruler = new CompositeRuler();
LineNumberRulerColumn lineCol = new LineNumberRulerColumn();
lineCol.setBackground(colorManager.getColor(new RGB(236, 233, 216)));
ruler.addDecorator(0, lineCol);
return ruler;
}
use of org.eclipse.jface.text.source.LineNumberRulerColumn in project eclipse.platform.text by eclipse.
the class LineNumberColumn method updateForegroundColor.
private void updateForegroundColor(IPreferenceStore store, IVerticalRulerColumn column) {
RGB rgb = getColorFromStore(store, FG_COLOR_KEY);
if (rgb == null)
rgb = new RGB(0, 0, 0);
ISharedTextColors sharedColors = getSharedColors();
if (column instanceof LineNumberRulerColumn)
((LineNumberRulerColumn) column).setForeground(sharedColors.getColor(rgb));
}
use of org.eclipse.jface.text.source.LineNumberRulerColumn in project eclipse.platform.text by eclipse.
the class LineNumberRulerColumnTest method testRedrawAfterDispose.
@Test
public void testRedrawAfterDispose() {
LineNumberRulerColumn lineNumberRulerColumn = new LineNumberRulerColumn();
CompositeRuler ruler = new CompositeRuler();
ruler.addDecorator(0, lineNumberRulerColumn);
SourceViewer sourceViewer = new SourceViewer(fParent, ruler, SWT.NONE);
lineNumberRulerColumn.getControl().setSize(10, 10);
sourceViewer.getTextWidget().dispose();
lineNumberRulerColumn.redraw();
}
Aggregations