Search in sources :

Example 56 with StyledText

use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.

the class CheckQueryEditorTask method doSave.

public void doSave() {
    ApplicationPersistUtil.getInstance().clearAllEditorStatus();
    Display.getDefault().syncExec(new Runnable() {

        public void run() {
            Date createTime = new Date();
            List<QueryEditorPart> editorPartList = QueryEditorUtil.getAllQueryEditorPart();
            for (QueryEditorPart editor : editorPartList) {
                ArrayList<RestorableQueryEditorInfo> sqlTabItemList = new ArrayList<RestorableQueryEditorInfo>();
                for (CombinedQueryEditorComposite combinedQueryEditorComposite : editor.getAllCombinedQueryEditorComposite()) {
                    StyledText text = combinedQueryEditorComposite.getSqlEditorComp().getText();
                    if (text == null) {
                        LOGGER.warn("The editor.getSqlTextEditor() is a null.");
                        continue;
                    }
                    if (StringUtil.isEmpty(text.getText())) {
                        LOGGER.warn("The text.getText() is a null.");
                        continue;
                    }
                    CubridDatabase cubridDatabase = editor.getSelectedDatabase();
                    RestorableQueryEditorInfo editorStatus = new RestorableQueryEditorInfo();
                    if (cubridDatabase != null) {
                        DatabaseInfo dbInfo = cubridDatabase.getDatabaseInfo();
                        if (dbInfo != null) {
                            editorStatus.setDatabaseName(dbInfo.getDbName());
                        }
                        CubridServer cubridServer = cubridDatabase.getServer();
                        if (cubridServer != null) {
                            editorStatus.setServerName(cubridServer.getId());
                        }
                    }
                    editorStatus.setQueryContents(text.getText());
                    editorStatus.setCreatedTime(createTime);
                    sqlTabItemList.add(editorStatus);
                }
                ApplicationPersistUtil.getInstance().addEditorStatus(sqlTabItemList);
            }
        }
    });
    ApplicationPersistUtil.getInstance().save();
}
Also used : QueryEditorPart(com.cubrid.common.ui.query.editor.QueryEditorPart) StyledText(org.eclipse.swt.custom.StyledText) CombinedQueryEditorComposite(com.cubrid.common.ui.query.control.CombinedQueryEditorComposite) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) RestorableQueryEditorInfo(com.cubrid.common.ui.spi.model.RestorableQueryEditorInfo) Date(java.util.Date)

Example 57 with StyledText

use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.

the class CubridBrokerConfEditAnnotationDialog method createDialogArea.

/**
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 * @param parent the parent composite to contain the dialog area
	 * @return the dialog area control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    {
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
        GridLayout layout = new GridLayout(1, true);
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
        layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        composite.setLayout(layout);
    }
    annotationText = new StyledText(composite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
    annotationText.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 2, 1, -1, 200));
    annotationText.setText(annotation);
    setTitle(Messages.cubridBrokerConfEditorTableMenuEditAnnotation);
    setMessage(Messages.cubridBrokerConfEditorTableMenuEditAnnotation + parentString);
    return parentComp;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData)

Example 58 with StyledText

use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.

the class DBSpaceLabelProvider method createServerInfoItem.

private void createServerInfoItem(ExpandBar bar, int index) {
    /* Database server information */
    ExpandItem dbServerInfoItem = new ExpandItem(bar, SWT.NONE, index);
    dbServerInfoItem.setText(Messages.titleServerInfo);
    Composite dbServerComposite = new Composite(bar, SWT.None);
    dbServerComposite.setLayout(new FillLayout());
    dbServerInfoText = new StyledText(dbServerComposite, SWT.MULTI);
    dbServerInfoText.setEditable(false);
    dbServerInfoItem.setControl(dbServerComposite);
    dbServerInfoItem.setHeight(110);
    dbServerInfoItem.setExpanded(true);
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 59 with StyledText

use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.

the class LoadDatabaseResultDialog method createDialogArea.

/**
	 * Create dialog area content
	 * 
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    Label userNameLabel = new Label(composite, SWT.LEFT);
    userNameLabel.setText(Messages.msgLoadDbResultDialog);
    userNameLabel.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    StyledText resultInfoText = new StyledText(composite, SWT.LEFT | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
    CommonUITool.registerContextMenu(resultInfoText, false);
    resultInfoText.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, 100, 300));
    resultInfoText.setText(resultInfoStr);
    resultInfoText.setEditable(false);
    setTitle(Messages.titleLoadDbResultDialog);
    setMessage(Messages.msgLoadDbResultDialog);
    return parentComp;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 60 with StyledText

use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.

the class ShowErrorTraceInfoDialog method createDialogArea.

/**
	 * Create dialog area content
	 * 
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    Label infoLabel = new Label(composite, SWT.LEFT);
    infoLabel.setText(Messages.lblErrorTraceResultInfo);
    infoLabel.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    StyledText resultInfoText = new StyledText(composite, SWT.LEFT | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
    CommonUITool.registerContextMenu(resultInfoText, false);
    resultInfoText.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, 100, 300));
    resultInfoText.setText(resultInfoStr);
    resultInfoText.setEditable(false);
    setTitle(Messages.titleErrorTraceDialog);
    if (resultInfoStr.trim().length() == 0) {
        setErrorMessage(Messages.errCannotFindTraceLog);
    } else {
        setMessage(Messages.msgErrorTraceDialog);
    }
    return parentComp;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

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