Package org.eclipse.jface.text.source

Examples of org.eclipse.jface.text.source.SourceViewer


            getFontPropertyPreferenceKey());
       
        tabFolder = new TabFolder(parent, SWT.BORDER);
        // Inititalize SourceViewers
        for(int i = 0; i < sourceViewers.length; i++) {
            sourceViewers[i] = new SourceViewer(tabFolder, null, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
            sourceViewers[i].setEditable(false);
            sourceViewers[i].getTextWidget().setFont(textFont);
        }
   
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
View Full Code Here


    label.setText(TemplateMessages.getString("TemplatePreferencePage.preview")); //$NON-NLS-1$
    GridData data = new GridData();
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    SourceViewer viewer =
      new SourceViewer(parent, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    //JavaTextTools tools = PerlEditorPlugin.getDefault().getJavaTextTools();
    IDocument document = new Document();
    new PerlPartitioner(PerlEditorPlugin.getDefault().getLog(), document);

    // TODO changed check
  PerlSourceViewerConfiguration sourceViewerConfiguration = new PerlSourceViewerConfiguration(PerlEditorPlugin.getDefault().getPreferenceStore(), null);
  viewer.configure(sourceViewerConfiguration);
    //viewer.configure(new PerlSourceViewerConfiguration(tools, null));
    // (tools, null));
    viewer.setEditable(false);
    viewer.setDocument(document);
    viewer.getTextWidget().setBackground(
      getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
    viewer.getTextWidget().setFont(font);

    Control control = viewer.getControl();
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.heightHint = convertHeightInCharsToPixels(5);
    control.setLayoutData(data);
View Full Code Here

   
    return text;
  }

  private SourceViewer createEditor(Composite parent) {
    SourceViewer viewer= new SourceViewer(parent, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    IDocument document= new Document(fTemplate.getPattern());
        new PerlPartitioner(PerlEditorPlugin.getDefault().getLog(), document);

    viewer.configure(new SimpleJavaSourceViewerConfiguration(fProcessor));
        viewer.setEditable(true);
    viewer.setDocument(document);
   
    Font font= JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
    viewer.getTextWidget().setFont(font);
   
    Control control= viewer.getControl();
    GridData data= new GridData(GridData.FILL_BOTH);
    data.widthHint= convertWidthInCharsToPixels(60);
    data.heightHint= convertHeightInCharsToPixels(5);
    control.setLayoutData(data);
   
    viewer.addTextListener(new ITextListener() {
      public void textChanged(TextEvent event) {
          try {
          fTranslator.translate(event.getDocumentEvent().getDocument().get());
          } catch (CoreException e) {
            e.printStackTrace();
             //PHPeclipsePlugin.log(e);
          }
       
        updateUndoAction();
        updateButtons();
      }
    });

    viewer.addSelectionChangedListener(new ISelectionChangedListener() {     
      public void selectionChanged(SelectionChangedEvent event) {
        updateSelectionDependentActions();
      }
    });

    if (viewer instanceof ITextViewerExtension) {
       ((ITextViewerExtension) viewer).prependVerifyKeyListener(new VerifyKeyListener() {
        public void verifyKey(VerifyEvent event) {
          handleVerifyKeyPressed(event);
        }
      });
    } else {     
      viewer.getTextWidget().addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent e) {
          handleKeyPressed(e);
        }
 
        public void keyReleased(KeyEvent e) {}
View Full Code Here

      composite.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
      composite.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    }

    // Source viewer
    fViewer= new SourceViewer(composite, null, style);
    fViewer.configure(new TextSourceViewerConfiguration(EditorsPlugin.getDefault().getPreferenceStore()));
    fViewer.setEditable(false);

    fText= fViewer.getTextWidget();
    gd= new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
View Full Code Here

    label.setText(TextEditorTemplateMessages.TemplatePreferencePage_preview);
    GridData data= new GridData();
    data.horizontalSpan= 2;
    label.setLayoutData(data);

    SourceViewer viewer= createViewer(parent);
    viewer.setEditable(false);

    Control control= viewer.getControl();
    data= new GridData(GridData.FILL_BOTH);
    data.horizontalSpan= 2;
    data.heightHint= convertHeightInCharsToPixels(5);
    control.setLayoutData(data);
View Full Code Here

   *
   * @param parent the parent control
   * @return a configured source viewer
   */
  protected SourceViewer createViewer(Composite parent) {
    SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    SourceViewerConfiguration configuration= new SourceViewerConfiguration();
    viewer.configure(configuration);
    IDocument document= new Document();
    viewer.setDocument(document);
    return viewer;
  }
View Full Code Here

     
      return button;
    }
   
    private SourceViewer createEditor(Composite parent, String pattern) {
      SourceViewer viewer= createViewer(parent);
      viewer.setEditable(true);
     
      IDocument document= viewer.getDocument();
      if (document != null)
        document.set(pattern);
      else {
        document= new Document(pattern);
        viewer.setDocument(document);
      }

      int nLines= document.getNumberOfLines();
      if (nLines < 5) {
        nLines= 5;
      } else if (nLines > 12) {
        nLines= 12;
      }

      Control control= viewer.getControl();
      GridData data= new GridData(GridData.FILL_BOTH);
      data.widthHint= convertWidthInCharsToPixels(80);
      data.heightHint= convertHeightInCharsToPixels(nLines);
      control.setLayoutData(data);

      viewer.addTextListener(new ITextListener() {
        public void textChanged(TextEvent event) {
          if (event .getDocumentEvent() != null)
            doSourceChanged(event.getDocumentEvent().getDocument());
        }
      });

      viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
          updateSelectionDependentActions();
        }
      });

       viewer.prependVerifyKeyListener(new VerifyKeyListener() {
        public void verifyKey(VerifyEvent event) {
          handleVerifyKeyPressed(event);
        }
      });
View Full Code Here

     *
     * @param parent the parent composite of the viewer
     * @return a configured <code>SourceViewer</code>
     */
    protected SourceViewer createViewer(Composite parent) {
      SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
      SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
        public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

          ContentAssistant assistant= new ContentAssistant();
          assistant.enableAutoActivation(true);
          assistant.enableAutoInsert(true);
          assistant.setContentAssistProcessor(fTemplateProcessor, IDocument.DEFAULT_CONTENT_TYPE);
          return assistant;
        }
      };
      viewer.configure(configuration);
      return viewer;
    }
View Full Code Here

   * @param ruler the vertical ruler
   * @param styles style bits, <code>SWT.WRAP</code> is currently not supported
   * @return the source viewer
   */
  protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    return new SourceViewer(parent, ruler, styles);
  }
View Full Code Here

  protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {

    fAnnotationAccess= getAnnotationAccess();
    fOverviewRuler= createOverviewRuler(getSharedColors());

    ISourceViewer viewer= new SourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
    // ensure decoration support has been created and configured.
    getSourceViewerDecorationSupport(viewer);

    return viewer;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.source.SourceViewer

Copyright © 2018 www.massapicom. 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.