Search in sources :

Example 41 with StyledText

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;
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TabFolder(org.eclipse.swt.widgets.TabFolder)

Example 42 with StyledText

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);
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) FillLayout(org.eclipse.swt.layout.FillLayout) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 43 with StyledText

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);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) StyledText(org.eclipse.swt.custom.StyledText) IAction(org.eclipse.jface.action.IAction) TextViewer(org.eclipse.jface.text.TextViewer)

Example 44 with StyledText

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();
    }
}
Also used : StyledText(org.eclipse.swt.custom.StyledText)

Example 45 with StyledText

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);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) StyledText(org.eclipse.swt.custom.StyledText) IAction(org.eclipse.jface.action.IAction) TextViewer(org.eclipse.jface.text.TextViewer)

Aggregations

StyledText (org.eclipse.swt.custom.StyledText)329 Point (org.eclipse.swt.graphics.Point)102 GridData (org.eclipse.swt.layout.GridData)68 Composite (org.eclipse.swt.widgets.Composite)63 GridLayout (org.eclipse.swt.layout.GridLayout)62 Control (org.eclipse.swt.widgets.Control)46 SelectionEvent (org.eclipse.swt.events.SelectionEvent)32 Label (org.eclipse.swt.widgets.Label)32 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)30 Display (org.eclipse.swt.widgets.Display)30 Shell (org.eclipse.swt.widgets.Shell)30 Rectangle (org.eclipse.swt.graphics.Rectangle)27 Color (org.eclipse.swt.graphics.Color)25 FillLayout (org.eclipse.swt.layout.FillLayout)25 Button (org.eclipse.swt.widgets.Button)23 Text (org.eclipse.swt.widgets.Text)21 StyleRange (org.eclipse.swt.custom.StyleRange)20 Font (org.eclipse.swt.graphics.Font)20 Event (org.eclipse.swt.widgets.Event)20 Test (org.junit.Test)20