Package org.eclipse.wst.sse.ui.internal

Examples of org.eclipse.wst.sse.ui.internal.StructuredTextViewer


      public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
        return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
      }
    };
    SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSPTAG);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(sourceViewerConfiguration);
    viewer.setDocument(document);
    return viewer;
  }
View Full Code Here


  }

  SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) {
    SourceViewer viewer = null;
    String contentTypeID = ContentTypeIdForXML.ContentTypeID_XML;
    viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(viewerConfiguration);
    viewer.setDocument(document);
View Full Code Here

      public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
        return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
      }
    };
    SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForXML.ContentTypeID_XML);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(sourceViewerConfiguration);
    viewer.setDocument(document);
    return viewer;
  }
View Full Code Here

    IStructuredModel model =
      StructuredModelManager.getModelManager().getModelForRead(ifile);

    if (model != null){
      StructuredTextViewer viewer = new StructuredTextViewer(
          EclimPlugin.getShell(), null, null, false, 0){
        private Point point;
        public Point getSelectedRange()
        {
          return point;
        }
        public void setSelectedRange(int x, int y)
        {
          point = new Point(x, y);
        }
      };
      viewer.setDocument(model.getStructuredDocument());
      // note: non-zero length can break html completion.
      viewer.setSelectedRange(offset, 0);

      ICompletionProposal[] proposals =
        processor.computeCompletionProposals(viewer, offset);
      model.releaseFromRead();
      return proposals;
View Full Code Here

    IStructuredModel model =
      StructuredModelManager.getModelManager().getModelForRead(ifile);

    if (viewer == null) {
      viewer = new StructuredTextViewer(
          EclimPlugin.getShell(), null, null, false, 0){
        protected void createControl(Composite parent, int styles)
        {
          // no-op to prevent possible deadlock in native method on windows.
        }
View Full Code Here

          changed = true;

          // get the display for the editor if we can
          Display display = null;
          if (textEditor instanceof StructuredTextEditor) {
            StructuredTextViewer viewer = ((StructuredTextEditor) textEditor)
                .getTextViewer();
            if (viewer != null) {
              display = viewer.getControl().getDisplay();
            }
          }

          // create the toggling operation
          IRunnableWithProgress toggleCommentsRunnable = new ToggleLinesRunnable(
View Full Code Here

  protected PHPPairMatcher fPairMatcher = new PHPPairMatcher(BRACKETS);

  @Override
  public void doubleClicked(ITextViewer textViewer) {
    if (textViewer instanceof StructuredTextViewer) {
      StructuredTextViewer structuredTextViewer = (StructuredTextViewer) textViewer;
      IStructuredModel structuredModel = null;
      try {
        structuredModel = StructuredModelManager.getModelManager()
            .getExistingModelForRead(
                structuredTextViewer.getDocument());
        if (structuredModel != null) {
          int caretPosition = textViewer.getSelectedRange().x;
          if (caretPosition > 0) {
            Node node = (Node) structuredModel
                .getIndexedRegion(caretPosition);
            if (node != null) {
              IStructuredDocumentRegion sdRegion = structuredModel
                  .getStructuredDocument()
                  .getRegionAtCharacterOffset(caretPosition);
              if (sdRegion != null) {
                ITextRegion tRegion = sdRegion
                    .getRegionAtCharacterOffset(caretPosition);

                ITextRegionCollection container = sdRegion;
                if (tRegion instanceof ITextRegionContainer) {
                  container = (ITextRegionContainer) tRegion;
                  tRegion = container
                      .getRegionAtCharacterOffset(caretPosition);
                }

                // We should always hit the PhpScriptRegion:
                if (tRegion != null
                    && tRegion.getType() == PHPRegionContext.PHP_CONTENT) {
                  IPhpScriptRegion phpScriptRegion = (IPhpScriptRegion) tRegion;
                  tRegion = phpScriptRegion
                      .getPhpToken(caretPosition
                          - container
                              .getStartOffset()
                          - phpScriptRegion
                              .getStart());

                  // Handle double-click on PHPDoc tags:
                  if (tRegion.getType() == PHPRegionTypes.PHP_VARIABLE
                      || tRegion.getType() == PHPRegionTypes.PHP_THIS
                      || PHPPartitionTypes
                          .isPHPDocTagState(tRegion
                              .getType())) {
                    structuredTextViewer.setSelectedRange(
                        container.getStartOffset()
                            + phpScriptRegion
                                .getStart()
                            + tRegion.getStart(),
                        tRegion.getTextLength());
View Full Code Here

          ISourceViewer sourceViewer, String partitionType) {
        return baseConfiguration.getLineStyleProviders(sourceViewer,
            partitionType);
      }
    };
    SourceViewer viewer = new StructuredTextViewer(parent, null, null,
        false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    ((StructuredTextViewer) viewer).getTextWidget().setFont(
        JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    IStructuredModel scratchModel = StructuredModelManager
        .getModelManager().createUnManagedStructuredModelFor(
            ContentTypeIdForPHP.ContentTypeID_PHP);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(sourceViewerConfiguration);
    viewer.setDocument(document);
    return viewer;
  }
View Full Code Here

  private AutoActivationTrigger(StructuredTextViewer textViewer) {
    this.textViewer = textViewer;
  }

  public static void register(IDocument document) {
    StructuredTextViewer textViewer = null;
    IWorkbenchPage page = PHPUiPlugin.getActivePage();
    if (page != null) {
      IEditorPart editor = page.getActiveEditor();
      if (editor instanceof PHPStructuredEditor) {
        textViewer = ((PHPStructuredEditor) editor).getTextViewer();
      }
    }
    if (textViewer != null && textViewer.getDocument() == document) {
      textViewer.addSelectionChangedListener(new AutoActivationTrigger(
          textViewer));
    }
  }
View Full Code Here

    // GridData.FILL_VERTICAL);
    // data.horizontalSpan= nColumns;
    // data.heightHint= fPixelConverter.convertHeightInCharsToPixels(5);
    // control.setLayoutData(data);

    StructuredTextViewer viewer = new StructuredTextViewer(parent, null,
        null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL
            | SWT.READ_ONLY);

    IStructuredDocument document = StructuredModelManager.getModelManager()
        .createStructuredDocumentFor(
            ContentTypeIdForPHP.ContentTypeID_PHP);
    StyledText text = viewer.getTextWidget();
    text.setLayoutData(data);
    text.setEditable(false);
    text.setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$

    // PHPStructuredTextViewerConfiguration configuration = new
    // PHPStructuredTextViewerConfiguration();
    SourceViewerConfiguration configuration = new StructuredTextViewerConfiguration() {
      StructuredTextViewerConfiguration baseConfiguration = new PHPStructuredTextViewerConfiguration();

      @Override
      public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
        return baseConfiguration
            .getConfiguredContentTypes(sourceViewer);
      }

      @Override
      public LineStyleProvider[] getLineStyleProviders(
          ISourceViewer sourceViewer, String partitionType) {
        return baseConfiguration.getLineStyleProviders(sourceViewer,
            partitionType);
      }
    };
    viewer.configure(configuration);
    viewer.setEditable(false);
    viewer.setDocument(document);

    Control control = viewer.getControl();
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
        | GridData.FILL_VERTICAL);
    data.horizontalSpan = nColumns;
    data.heightHint = fPixelConverter.convertHeightInCharsToPixels(5);
    control.setLayoutData(data);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.ui.internal.StructuredTextViewer

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.