Examples of IDocumentProvider


Examples of org.eclipse.ui.texteditor.IDocumentProvider

    try {
      Object _xblockexpression = null;
      {
        if ((element instanceof ISourceReference)) {
          final ISourceRange range = ((ISourceReference)element).getSourceRange();
          IDocumentProvider _documentProvider = editor.getDocumentProvider();
          IEditorInput _editorInput = editor.getEditorInput();
          IDocument _document = _documentProvider.getDocument(_editorInput);
          int _offset = range.getOffset();
          int _length = range.getLength();
          final String elementText = _document.get(_offset, _length);
          String _name = openResult.getName();
          return this.modelFindService.findVariable(range, _name, elementText);
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

    public boolean isDirty() {
        return false;
    }

    public void markCall() {
        final IDocumentProvider documentProvider = getDocumentProvider();
        final IAnnotationModel annotationModel = documentProvider
                .getAnnotationModel(getEditorInput());

        final ITextSelection pos = (ITextSelection) getSelectionProvider().getSelection();
        final MarkCallLocation location = new MarkCallLocation(getSourceViewer()
                .getDocument(), pos.getStartLine());
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

    static public IDocument getDocument() {
        final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                .getActivePage();
        final IEditorPart part = page.getActiveEditor();
        final ITextEditor editor = (ITextEditor) part;
        final IDocumentProvider dp = editor.getDocumentProvider();
        final IDocument doc = dp.getDocument(editor.getEditorInput());
        return doc;
    }
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

      IDocument document = textViewer.getDocument();
      if (document == null)
        return Status.CANCEL_STATUS;

      IDocumentProvider documentProvider = editor.getDocumentProvider();
      if (documentProvider == null)
        return Status.CANCEL_STATUS;

      IAnnotationModel annotationModel = documentProvider
          .getAnnotationModel(editor.getEditorInput());
      if (annotationModel == null)
        return Status.CANCEL_STATUS;

      // Add occurrence annotations
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

  private void removeOccurrenceAnnotations(JavaEditor editor) {
    fMarkOccurrenceModificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
    fMarkOccurrenceTargetRegion = null;

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

    IAnnotationModel annotationModel = documentProvider
        .getAnnotationModel(editor.getEditorInput());
    if (annotationModel == null || fOccurrenceAnnotations == null)
      return;

    synchronized (getLockObject(annotationModel)) {
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

    /**
     * @see org.apache.directory.studio.ldifeditor.editor.ILdifEditor#getLdifModel()
     */
    public LdifFile getLdifModel()
    {
        IDocumentProvider provider = getDocumentProvider();
        if ( provider instanceof LdifDocumentProvider )
        {
            return ( ( LdifDocumentProvider ) provider ).getLdifModel();
        }
        else
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

        {
            // Open FileDialog
            Shell shell = getSite().getShell();
            final IEditorInput input = getEditorInput();

            IDocumentProvider provider = getDocumentProvider();
            final IEditorInput newInput;

            FileDialog dialog = new FileDialog( shell, SWT.SAVE );

            String path = dialog.open();
            if ( path == null )
            {
                if ( progressMonitor != null )
                {
                    progressMonitor.setCanceled( true );
                }
                return;
            }

            // Check whether file exists and if so, confirm overwrite
            final File externalFile = new File( path );
            if ( externalFile.exists() )
            {
                MessageDialog overwriteDialog = new MessageDialog( shell,
                    Messages.getString( "LdifEditor.Overwrite" ), null, Messages.getString( "OverwriteQuestion" ), //$NON-NLS-1$ //$NON-NLS-2$
                    MessageDialog.WARNING, new String[]
                        { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1 ); // 'No' is the default
                if ( overwriteDialog.open() != Window.OK )
                {
                    if ( progressMonitor != null )
                    {
                        progressMonitor.setCanceled( true );
                        return;
                    }
                }
            }

            IPath iPath = new Path( path );
            newInput = new PathEditorInput( iPath );

            boolean success = false;
            try
            {
                provider.aboutToChange( newInput );
                provider.saveDocument( progressMonitor, newInput, provider.getDocument( input ), true );
                success = true;
            }
            catch ( CoreException x )
            {
                final IStatus status = x.getStatus();
                if ( status == null || status.getSeverity() != IStatus.CANCEL )
                {
                    String title = Messages.getString( "LdifEditor.ErrorInSaveAs" ); //$NON-NLS-1$
                    String msg = Messages.getString( "LdifEditor.ErrorInSaveAs" ) + x.getMessage(); //$NON-NLS-1$
                    MessageDialog.openError( shell, title, msg );
                }
            }
            finally
            {
                provider.changed( newInput );
                if ( success )
                {
                    setInput( newInput );
                }
            }
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

                  public void propertyChanged(Object source,
                      int propId) {
                    if (IEditorPart.PROP_DIRTY == propId) {
                      if (editor instanceof AbstractDecoratedTextEditor && (!editor.isDirty())) {
                        System.out.println("Save");
                        IDocumentProvider documentProvider = ((AbstractDecoratedTextEditor)editor).getDocumentProvider();
                        String content = documentProvider.getDocument(editorInput).get();
                        try {
                          editorInput.setContents(new StringInputStream(content));
                          editorInput.getNode().getSession().save();
                        } catch (Exception e) {
                          e.printStackTrace();
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

    };

    private void pasteDropContent( File file ) {
        String path = file.getAbsolutePath();
        try {
            IDocumentProvider dp = getDocumentProvider();
            IDocument doc = dp.getDocument(getEditorInput());
            // int numberOfLines = doc.getNumberOfLines() - 1;
            // int offset = doc.getLineOffset(numberOfLines);

            ISelectionProvider selectionProvider = getSelectionProvider();
            ISelection selection = selectionProvider.getSelection();
View Full Code Here

Examples of org.eclipse.ui.texteditor.IDocumentProvider

    public void reconcile()
    {
        IEditorInput input = (IEditorInput) editor.getEditorInput();
        if (!(input instanceof IFileEditorInput)) return;
       
        IDocumentProvider docProvider = editor.getDocumentProvider();
        if (docProvider == null) return;
       
        IDocument doc = docProvider.getDocument(input);
        if (doc == null) return;
       
        PerlPartitioner partitioner = (PerlPartitioner) PartitionTypes.getPerlPartitioner(doc);
        if (partitioner == null) return;
       
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.