use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class SchemaInfoEditorPart method createTextViewSpec.
/**
* Create Text View Spec
*
*/
private void createTextViewSpec() {
Label specLabel = new Label(topComposite, SWT.LEFT | SWT.WRAP);
specLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
specLabel.setText(Messages.lblQuerySpec);
txtViewSpec = new StyledText(topComposite, SWT.WRAP | SWT.BORDER);
txtViewSpec.setLayoutData(new GridData(GridData.FILL_BOTH));
txtViewSpec.setEditable(false);
txtViewSpec.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
com.cubrid.common.ui.spi.util.CommonUITool.registerContextMenu(txtViewSpec, false);
fillTextViewSpec();
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class CopyAllAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
TextTransfer textTransfer = TextTransfer.getInstance();
Clipboard clipboard = CommonUITool.getClipboard();
Control control = getFocusProvider();
if (control instanceof StyledText) {
StyledText stext = (StyledText) control;
String data = stext.getText();
if (data != null && !data.equals("")) {
clipboard.setContents(new Object[] { data }, new Transfer[] { textTransfer });
IAction pasteAction = ActionManager.getInstance().getAction(PasteAction.ID);
FocusAction.changeActionStatus(pasteAction, stext);
}
} else {
/*Copy from the active editor*/
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IEditorPart editor = window.getActivePage().getActiveEditor();
if (editor != null && editor instanceof ICopiableFromTable) {
ICopiableFromTable copyAbleEditor = (ICopiableFromTable) editor;
copyAbleEditor.copyAllItems();
}
}
}
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class CutAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
TextTransfer textTransfer = TextTransfer.getInstance();
Clipboard clipboard = CommonUITool.getClipboard();
Control control = getFocusProvider();
if (control instanceof StyledText) {
StyledText stext = (StyledText) control;
String data = stext.getSelectionText();
if (data != null && !data.equals("")) {
clipboard.setContents(new Object[] { data }, new Transfer[] { textTransfer });
Point range = stext.getSelectionRange();
stext.replaceTextRange(range.x, range.y, "");
stext.setSelection(range.x);
IAction pasteAction = ActionManager.getInstance().getAction(PasteAction.ID);
FocusAction.changeActionStatus(pasteAction, stext);
}
}
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class CutAction method focusGained.
/**
* Notifies that the focus gained event
*
* @param event an event containing information about the focus change
*/
public void focusGained(FocusEvent event) {
setEnabled(false);
if (event.getSource() instanceof StyledText) {
StyledText stext = (StyledText) event.getSource();
boolean isEnabled = stext != null && stext.getSelectionText() != null && stext.getSelectionText().length() > 0 && stext.isEnabled() && stext.getEditable();
setEnabled(isEnabled);
}
}
use of org.eclipse.swt.custom.StyledText in project cubrid-manager by CUBRID.
the class FindReplaceAction method focusGained.
/**
* Notifies that the focus gained event
*
* @param event an event containing information about the focus change
*/
public void focusGained(FocusEvent event) {
setEnabled(false);
if (event.getSource() instanceof StyledText) {
StyledText stext = (StyledText) event.getSource();
Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
setEnabled(obj instanceof TextViewer);
}
}
Aggregations