use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class CreateTriggerDialog method createDialogArea.
/**
* Create dialog area content
*
* @param parent the parent composite
*
* @return the composite
*/
protected Control createDialogArea(Composite parent) {
isCommentSupport = CompatibleUtil.isCommentSupports(database.getDatabaseInfo());
Composite parentComp = (Composite) super.createDialogArea(parent);
parentComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Composite tabComposite = new Composite(parentComp, SWT.NONE);
{
final GridData gdComposite = new GridData(SWT.FILL, SWT.FILL, true, true);
tabComposite.setLayoutData(gdComposite);
GridLayout tabCompositeLayout = new GridLayout();
tabCompositeLayout.numColumns = 1;
tabCompositeLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
tabCompositeLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
tabCompositeLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
tabCompositeLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
tabCompositeLayout.numColumns = 1;
tabComposite.setLayout(tabCompositeLayout);
}
tabFolder = new TabFolder(tabComposite, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
//create trigger tab
final TabItem triggerTabItem = new TabItem(tabFolder, SWT.NONE);
triggerTabItem.setText(Messages.infoTriggerTab);
triggerTabItem.setControl(createTriggerComposite(tabFolder));
//create the SQL tab
final Composite sqlScriptComposite = new Composite(tabFolder, SWT.NONE);
sqlScriptComposite.setLayout(new GridLayout());
final TabItem sqlScriptTabItem = new TabItem(tabFolder, SWT.NONE);
sqlScriptTabItem.setText(Messages.infoSQLScriptTab);
sqlScriptTabItem.setControl(sqlScriptComposite);
sqlText = new StyledText(sqlScriptComposite, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY | SWT.H_SCROLL | SWT.BORDER);
CommonUITool.registerContextMenu(sqlText, false);
sqlText.setBackground(white);
sqlText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
setTitle(Messages.newTriggerMSGTitle);
setMessage(Messages.newTriggerMsg);
createInit();
alterInit();
addListener();
return parentComp;
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class ObjectInfoComposite method initDDLTabItem.
/**
* Initial ddl tab item
*
*/
private void initDDLTabItem() {
CTabItem ddlTabItem = new CTabItem(objInfoFolder, SWT.NONE);
ddlTabItem.setText(Messages.titleDDL);
ddlTabItem.setShowClose(false);
Composite composite = new Composite(objInfoFolder, SWT.NONE);
ddlTabItem.setControl(composite);
composite.setLayout(new FillLayout());
sqlText = new StyledText(composite, SWT.V_SCROLL | SWT.READ_ONLY | SWT.H_SCROLL | SWT.BORDER | SWT.WRAP | SWT.MULTI);
/*For bug TOOLS-996*/
CommonUITool.registerCopyPasteContextMenu(sqlText, false);
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class UndoAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Control control = getFocusProvider();
if (!(control instanceof StyledText)) {
return;
}
StyledText stext = (StyledText) control;
Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
if (obj instanceof TextViewer) {
TextViewer viewer = (TextViewer) obj;
if (viewer.getUndoManager() != null) {
viewer.getUndoManager().undo();
}
IAction redoAction = ActionManager.getInstance().getAction(RedoAction.ID);
FocusAction.changeActionStatus(redoAction, stext);
FocusAction.changeActionStatus(this, stext);
}
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class QuickBuilderDialog method pasteIntoQueryEditor.
private void pasteIntoQueryEditor(String query, int cursor) {
StyledText text = sqlComp.getText();
int cursorOffset = text.getCaretOffset();
int pos = cursorOffset + cursor - 1;
if (pos < 0) {
pos = 0;
}
text.getContent().replaceTextRange(cursorOffset, 0, query);
try {
text.setSelectionRange(pos, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class RedoAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Control control = getFocusProvider();
if (!(control instanceof StyledText)) {
return;
}
StyledText stext = (StyledText) control;
Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
if (obj instanceof TextViewer) {
TextViewer viewer = (TextViewer) obj;
if (viewer.getUndoManager() != null) {
viewer.getUndoManager().redo();
}
IAction undoAction = ActionManager.getInstance().getAction(UndoAction.ID);
FocusAction.changeActionStatus(undoAction, stext);
IAction copyAction = ActionManager.getInstance().getAction(CopyAction.ID);
FocusAction.changeActionStatus(copyAction, stext);
FocusAction.changeActionStatus(this, stext);
}
}
Aggregations