Examples of StyledText


Examples of org.eclipse.swt.custom.StyledText

   */
  @Override
  protected Control createContents(Composite parent) {
    Composite container = createContainer(parent);

    StyledText infoText = new StyledText(container, SWT.WRAP | SWT.READ_ONLY);
    infoText.setEnabled(false);
    infoText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    ((GridData) infoText.getLayoutData()).widthHint = 200;
    infoText.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    infoText.setText(Messages.SharingPreferencesPage_SELECT_COMMUNITY);

    Composite tableContainer = new Composite(container, SWT.NONE);
    tableContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    tableContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

        ISourceViewer sourceViewer = getSourceViewer();
        if (sourceViewer == null) {
            return null;
        }
        StyledText styledText = sourceViewer.getTextWidget();
        if (styledText == null) {
            return null;
        }

        int caret = 0;
        if (sourceViewer instanceof ITextViewerExtension5) {
            ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
            caret = extension.widgetOffset2ModelOffset(styledText
                .getCaretOffset());
        } else {
            int offset = sourceViewer.getVisibleRegion().getOffset();
            caret = offset + styledText.getCaretOffset();
        }

        IJavaElement element = getElementAt(caret);

        if (!(element instanceof ISourceReference)) {
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

            }

            if (input != null && input.equals(getEditorInput())) {
                ISourceViewer viewer = getSourceViewer();
                if (viewer != null) {
                    StyledText textWidget = viewer.getTextWidget();
                    if (textWidget != null && !textWidget.isDisposed()) {
                        synchronized (this) {
                            fPosted = true;
                            fClassFileEditorInput = input;
                        }
                        textWidget.getDisplay().asyncExec(this);
                    }
                }
            }
        }
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

        Label lblRequirement = new Label(contents, SWT.NONE);
        lblRequirement.setText("Requirement Info");
        lblRequirement.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

        StyledText txtRequirement = new StyledText(contents, SWT.WRAP | SWT.BORDER);
        txtRequirement.setEditable(false);
        txtRequirement.setCaret(null);
        //        txtRequirement.setBackground(contents.getBackground());
        txtRequirement.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));

        @SuppressWarnings("unused")
        Label lblSpacer = new Label(contents, SWT.NONE);

        Label lblCandidates = new Label(contents, SWT.NONE);
        lblCandidates.setText("Candidates");
        lblCandidates.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

        Composite lowerPanel = new Composite(contents, SWT.NONE);
        Table tbl = new Table(lowerPanel, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);

        viewer = new CheckboxTableViewer(tbl);
        viewer.setContentProvider(ArrayContentProvider.getInstance());
        viewer.setLabelProvider(new CapabilityResourceLabelProvider());

        btnUp = new Button(lowerPanel, SWT.PUSH);
        btnUp.setText("Move Up");
        btnUp.setEnabled(false);

        btnDown = new Button(lowerPanel, SWT.PUSH);
        btnDown.setText("Move Down");
        btnDown.setEnabled(false);

        Composite cmpPreferences = new Composite(contents, SWT.NONE);
        btnSavePreference = new Button(cmpPreferences, SWT.CHECK | SWT.WRAP);
        txtSavePreference = new StyledText(cmpPreferences, SWT.WRAP);
        txtSavePreference.setEditable(false);
        txtSavePreference.setCaret(null);
        txtSavePreference.setBackground(contents.getBackground());
        txtSavePreference.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));

        // Events
        txtSavePreference.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseDown(MouseEvent e) {
                btnSavePreference.setSelection(!btnSavePreference.getSelection());
            }
        });

        // Load data
        StyledString label = createRequirementText();
        txtRequirement.setText(label.getString());
        txtRequirement.setStyleRanges(label.getStyleRanges());

        viewer.setInput(candidates);

        updateSavePreferenceText();

        // Layout
        GridLayout layout;
        GridData gd;

        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        contents.setLayoutData(gd);
        layout = new GridLayout(1, false);
        contents.setLayout(layout);

        gd = new GridData(SWT.FILL, SWT.NONE, true, false);
        gd.horizontalIndent = 5;
        txtRequirement.setLayoutData(gd);
        gd = new GridData(SWT.FILL, SWT.NONE, true, false);

        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        lowerPanel.setLayoutData(gd);
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

        Label lblRequirement = new Label(contents, SWT.NONE);
        lblRequirement.setText("Requirement Info");
        lblRequirement.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

        StyledText txtRequirement = new StyledText(contents, SWT.WRAP | SWT.BORDER);
        txtRequirement.setEditable(false);
        txtRequirement.setCaret(null);
        //        txtRequirement.setBackground(contents.getBackground());
        txtRequirement.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));

        new Label(contents, SWT.NONE);

        Label lblCandidates = new Label(contents, SWT.NONE);
        lblCandidates.setText("Candidates");
        lblCandidates.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

        Composite lowerPanel = new Composite(contents, SWT.NONE);
        Table tbl = new Table(lowerPanel, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);

        viewer = new CheckboxTableViewer(tbl);
        viewer.setContentProvider(ArrayContentProvider.getInstance());
        viewer.setLabelProvider(new CapabilityResourceLabelProvider());

        btnUp = new Button(lowerPanel, SWT.PUSH);
        btnUp.setText("Move Up");
        btnUp.setEnabled(false);

        btnDown = new Button(lowerPanel, SWT.PUSH);
        btnDown.setText("Move Down");
        btnDown.setEnabled(false);

        Composite cmpPreferences = new Composite(contents, SWT.NONE);
        btnSavePreference = new Button(cmpPreferences, SWT.CHECK | SWT.WRAP);
        txtSavePreference = new StyledText(cmpPreferences, SWT.WRAP);
        txtSavePreference.setEditable(false);
        txtSavePreference.setCaret(null);
        txtSavePreference.setBackground(contents.getBackground());
        txtSavePreference.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));

        // Events
        txtSavePreference.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseDown(MouseEvent e) {
                btnSavePreference.setSelection(!btnSavePreference.getSelection());
            }
        });

        // Load data
        StyledString label = createRequirementText();
        txtRequirement.setText(label.getString());
        txtRequirement.setStyleRanges(label.getStyleRanges());

        viewer.setInput(candidates);

        updateSavePreferenceText();

        // Layout
        GridLayout layout;
        GridData gd;

        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        contents.setLayoutData(gd);
        layout = new GridLayout(1, false);
        contents.setLayout(layout);

        gd = new GridData(SWT.FILL, SWT.NONE, true, false);
        gd.horizontalIndent = 5;
        txtRequirement.setLayoutData(gd);
        gd = new GridData(SWT.FILL, SWT.NONE, true, false);

        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        lowerPanel.setLayoutData(gd);
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

    Integer id = getEditorId(editor);
    if (!installedEditors.containsKey(id)) {
      // install key listener for Tab key
      try {
        ITextViewer textViewer = EclipseEmmetHelper.getTextViewer(editor);
        StyledText widget = textViewer.getTextWidget();
        widget.addVerifyKeyListener(getKeyListener(editor));
        installedEditors.put(id, editor);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

      return;
   
    Integer id = getEditorId(editor);
    if (installedEditors.containsKey(id)) {
      try {
        StyledText widget = EclipseEmmetHelper.getTextViewer(editor).getTextWidget();
        widget.removeVerifyKeyListener(getKeyListener(editor));
        installedEditors.remove(id);
        keyListeners.remove(id);
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

     * @param store
     *            the preference store from which to read colors
     */
  private void initializeViewerColors(ISourceViewer viewer, IPreferenceStore store) {

    StyledText styledText= viewer.getTextWidget();

    // ---------- background color ----------------------
    Color color= store.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
      ? null
      : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR, styledText.getDisplay());
    styledText.setBackground(color);

    if (fBackgroundColor != null)
      fBackgroundColor.dispose();

    fBackgroundColor= color;
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

        catch (InterruptedException e) { /* normal termination */ }
    }
   
    private boolean isEditorVisible()
    {
        StyledText widget = ((SourceViewer) sourceViewer).getTextWidget();       
        return widget != null && widget.isVisible();
    }
View Full Code Here

Examples of org.eclipse.swt.custom.StyledText

        // the problem is, we might be called after the ISourceViewer
        // has been disposed; this occurs BEFORE dispose() is invoked
        // on the PerlEditor, so there seems to be no good way to
        // synchronise properly
        if (sourceViewer == null) return;
        StyledText widget = sourceViewer.getTextWidget();
        if (widget == null || widget.isDisposed()) return;
        Display display = widget.getDisplay();
        if (display == null) return;
        final IDocument doc = sourceViewer.getDocument();
        if (doc == null) return;

        // We reconcile on the main (Display) thread in order to avoid
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.