Java Code Examples for org.eclipse.swt.custom.StyledText#addVerifyKeyListener()

The following examples show how to use org.eclipse.swt.custom.StyledText#addVerifyKeyListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentAssistSubjectControlAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @see org.eclipse.jface.contentassist.IContentAssistSubjectControl#prependVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
 */
public boolean prependVerifyKeyListener(VerifyKeyListener verifyKeyListener)
{
	if (fContentAssistSubjectControl != null)
	{
		return fContentAssistSubjectControl.prependVerifyKeyListener(verifyKeyListener);
	}
	else if (fViewer instanceof ITextViewerExtension)
	{
		ITextViewerExtension e = (ITextViewerExtension) fViewer;
		e.prependVerifyKeyListener(verifyKeyListener);
		return true;
	}
	else
	{

		StyledText textWidget = fViewer.getTextWidget();
		if (Helper.okToUse(textWidget))
		{
			textWidget.addVerifyKeyListener(verifyKeyListener);
			return true;
		}
	}
	return false;
}
 
Example 2
Source File: ContentAssistSubjectControlAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @see org.eclipse.jface.contentassist.IContentAssistSubjectControl#appendVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
 */
public boolean appendVerifyKeyListener(VerifyKeyListener verifyKeyListener)
{
	if (fContentAssistSubjectControl != null)
	{
		return fContentAssistSubjectControl.appendVerifyKeyListener(verifyKeyListener);
	}
	else if (fViewer instanceof ITextViewerExtension)
	{
		ITextViewerExtension extension = (ITextViewerExtension) fViewer;
		extension.appendVerifyKeyListener(verifyKeyListener);
		return true;
	}
	else
	{
		StyledText textWidget = fViewer.getTextWidget();
		if (Helper.okToUse(textWidget))
		{
			textWidget.addVerifyKeyListener(verifyKeyListener);
			return true;
		}
	}
	return false;
}
 
Example 3
Source File: StyledTextCellEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setupReadOnlyMode() {
	checkWidget();

	StyledText text = viewer.getTextWidget();
	if (!close) {
		if (!editable) {
			return;
		}
		text.removeVerifyKeyListener(edit_VerifyKey);
		text.removeTraverseListener(edit_Traverse);
	}
	editable = false;
	text.setEditable(false);
	text.addVerifyKeyListener(readOnly_VerifyKey);
}
 
Example 4
Source File: StyledTextCellEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setupEditMode() {
	checkWidget();

	StyledText text = viewer.getTextWidget();
	if (!close) {
		if (editable) {
			return;
		}
		text.removeVerifyKeyListener(readOnly_VerifyKey);
	}
	editable = true;
	text.setEditable(true);
	text.addVerifyKeyListener(edit_VerifyKey);
	text.addTraverseListener(edit_Traverse);
}
 
Example 5
Source File: StyledTextCellEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setupReadOnlyMode() {
	checkWidget();

	StyledText text = viewer.getTextWidget();
	if (!close) {
		if (!editable) {
			return;
		}
		text.removeVerifyKeyListener(edit_VerifyKey);
		text.removeTraverseListener(edit_Traverse);
	}
	editable = false;
	text.setEditable(false);
	text.addVerifyKeyListener(readOnly_VerifyKey);
}
 
Example 6
Source File: StyledTextCellEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setupEditMode() {
	checkWidget();

	StyledText text = viewer.getTextWidget();
	if (!close) {
		if (editable) {
			return;
		}
		text.removeVerifyKeyListener(readOnly_VerifyKey);
	}
	editable = true;
	text.setEditable(true);
	text.addVerifyKeyListener(edit_VerifyKey);
	text.addTraverseListener(edit_Traverse);
}
 
Example 7
Source File: OfflineActionTarget.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Installs this target. I.e. adds all required listeners.
 */
private void install() {
    if (fInstalled)
        return;

    StyledText text = fTextViewer.getTextWidget();
    if (text == null)
        return;

    text.addMouseListener(this);
    text.addFocusListener(this);
    fTextViewer.addTextListener(this);

    ISelectionProvider selectionProvider = fTextViewer.getSelectionProvider();
    if (selectionProvider != null)
        selectionProvider.addSelectionChangedListener(this);

    if (fTextViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) fTextViewer).prependVerifyKeyListener(this);
    else
        text.addVerifyKeyListener(this);

    keyAssistDialog = new KeyAssistDialog(this.fEdit);
    fInstalled = true;

    //Wait a bit until showing the key assist dialog
    new UIJob("") {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
            synchronized (lock) {
                if (fInstalled && keyAssistDialog != null) {
                    keyAssistDialog.open(OfflineActionTarget.this.fEdit.getOfflineActionDescriptions(),
                            OfflineActionTarget.this);
                }
            }
            return Status.OK_STATUS;
        }
    }.schedule(700);
}
 
Example 8
Source File: AbstractDialogKeyVerify.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * New single line styled text.
 *
 * @param parent the parent
 * @param tip the tip
 * @return the styled text
 */
protected StyledText newSingleLineStyledText(Composite parent, String tip) {
  StyledText w = new StyledText(parent, SWT.SINGLE | SWT.BORDER);
  w.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  w.setToolTipText(tip);
  w.addListener(SWT.KeyUp, this);
  w.addVerifyKeyListener(this);
  w.addListener(SWT.MouseUp, this); // for paste operation
  return w;
}