Examples of PHPStructuredEditor


Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

  private ProjectionAnnotationModel getModel() {
    return this.viewer.getProjectionAnnotationModel();
  }

  private IDocument getDocument() {
    PHPStructuredEditor editor = fEditor;
    if (editor == null)
      return null;

    IDocumentProvider provider = editor.getDocumentProvider();
    if (provider == null)
      return null;

    return provider.getDocument(editor.getEditorInput());
  }
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

        .getEditorReferences();
    for (int i = 0; i < editors.length; i++) {
      IEditorReference editorReference = editors[i];
      IEditorPart editor = editorReference.getEditor(false);
      if (editor instanceof PHPStructuredEditor) {
        PHPStructuredEditor phpEditor = (PHPStructuredEditor) editor;
        boolean isDirty = phpEditor.isDirty();
        if (phpEditor.getTextViewer() instanceof PHPStructuredTextViewer) {
          PHPStructuredTextViewer textViewer = (PHPStructuredTextViewer) phpEditor
              .getTextViewer();
          IDocumentAdapter documentAdapter = textViewer
              .getDocumentAdapter();
          IDocument document = phpEditor.getDocument();
          String content = document.get();
          if (documentAdapter != null) {
            documentAdapter.replaceTextRange(0, content.length(),
                ""); //$NON-NLS-1$
            documentAdapter.replaceTextRange(0, 0, content);
          }

        }
        if (!isDirty) {
          phpEditor.doSave(null);
        }
      }
    }
  }
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

       * @return the selected project
       * @throws CoreException
       */
      private final IScriptProject getCurrentScriptProject()
          throws CoreException {
        final PHPStructuredEditor phpEditor = EditorUtility
            .getPHPStructuredEditor(editorPart);
        if (phpEditor != null) {
          return phpEditor.getProject();
        }

        final IProject[] projects = ResourcesPlugin.getWorkspace()
            .getRoot().getProjects();
        for (IProject project : projects) {
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

      public void run() {
        IWorkbenchPage page = PHPUiPlugin.getActivePage();
        if (page != null) {
          IEditorPart editor = page.getActiveEditor();
          if (editor instanceof PHPStructuredEditor) {
            PHPStructuredEditor phpStructuredEditor = (PHPStructuredEditor) editor;
            if (phpStructuredEditor.getTextViewer() != null
                && phpStructuredEditor != null) {
              ISourceModule sourceModule = (ISourceModule) phpStructuredEditor
                  .getModelElement();
              projects[0] = sourceModule.getScriptProject()
                  .getProject();
            }
          }
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

      throws ModelException {
    while (element != null) {
      if (element instanceof ISourceModule) {
        final ISourceModule unit = (ISourceModule) element;
        if (unit.getScriptProject() instanceof ExternalScriptProject) {
          PHPStructuredEditor editorPart = (PHPStructuredEditor) findOpenEditor(new IEditorLookupCondition() {
            public boolean find(IEditorPart editorPart) {
              return editorPart instanceof PHPStructuredEditor
                  && ((PHPStructuredEditor) editorPart)
                      .getModelElement().equals(unit);
            }
          });
          if (editorPart != null) {
            return editorPart.getEditorInput();
          }
        }
        break;
      }
      element = element.getParent();
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

        IWorkbenchPage page = window.getActivePage();       
        IEditorPart part = page.getActiveEditor();
       
        if (part instanceof PHPStructuredEditor) {
         
          PHPStructuredEditor editor = (PHPStructuredEditor) part;
          ISourceModule source = org.eclipse.dltk.internal.ui.editor.EditorUtility.getEditorInputModelElement(editor, false);   
          project = source.getScriptProject();
          ISelectionProvider provider = editor.getSelectionProvider();         
          ISelection selection = provider.getSelection();
         
          if (selection instanceof ITextSelection) {
           
            ITextSelection textSelection = (ITextSelection) selection;           
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

        this.viewer = viewer1;

        if (editor instanceof PHPStructuredEditor) {

            PHPStructuredEditor phpEditor = (PHPStructuredEditor) editor;

            if (phpEditor.getSourceViwerConfiguration().getClass() == PHPStructuredTextViewerConfiguration.class) {
                phpFoldingProvider = new StructuredTextFoldingProviderPHP();
                phpFoldingProvider.install(viewer);
            } else {

                fProjectionListener = new ProjectionListener(viewer);
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

        return new FoldingStructureComputationContext(doc, model, allowCollapse);
    }

    private IDocument getDocument()
    {
        PHPStructuredEditor editor = fEditor;
        if (editor == null)
            return null;

        IDocumentProvider provider = editor.getDocumentProvider();
        if (provider == null)
            return null;

        return provider.getDocument(editor.getEditorInput());
    }
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

            IDocument document = getDocument();
            if (document == null)
                return false; // can't compute

            PHPStructuredEditor editor = fEditor;
            if (editor == null || editor.getCachedSelectedRange() == null)
                return false; // can't compute

            int caretLine = 0;
            try {
                caretLine = document.getLineOfOffset(editor
                        .getCachedSelectedRange().x) + 1;
            } catch (BadLocationException x) {
                return false; // can't compute
            }
View Full Code Here

Examples of org.eclipse.php.internal.ui.editor.PHPStructuredEditor

    @Override
    public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
            IRegion region, boolean canShowMultipleHyperlinks)
    {

        final PHPStructuredEditor editor = org.eclipse.php.internal.ui.util.EditorUtility
                .getPHPEditor(textViewer);
        if (editor == null) {
            return null;
        }
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.