Examples of ITextSelection


Examples of org.eclipse.jface.text.ITextSelection

        }
    }

    protected ITextSelection getLineSelection(final ITextSelection selection0,
            final boolean beginningOfNextLine) {
        ITextSelection selection = selection0;
        final IDocument document = editor.getDocumentProvider().getDocument(
                editor.getEditorInput());
        if (selection.getLength() == 0) { // don't use isEmpty()!
            selection = ErlangAbstractHandler.extendSelectionToWholeLines(document,
                    selection);
        }
        if (beginningOfNextLine) {
            final int endLine = selection.getEndLine();
            int offset;
            try {
                offset = document.getLineOffset(endLine)
                        + document.getLineLength(endLine);
                selection = new TextSelection(offset, 0);
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

     *              clients.
     */
    public OpenEdocInExternalBrowserAction(final ErlangEditor editor) {
        this(editor.getEditorSite(), null);
        this.editor = editor;
        final ITextSelection selection = (ITextSelection) editor.getSelection();
        final IErlElement element = editor.getElementAt(selection.getOffset(), false);
        setEnabled(element != null);
    }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    /**
     * @return the Selected text
     */
    public String getSelectedText() {
        final ITextSelection txtSel = getTextSelection();
        final int start = txtSel.getOffset();
        final int len = txtSel.getLength();
        try {
            return doc.get(start, len);
        } catch (final BadLocationException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    @Override
    protected void doAction(final ISelection sel, final ITextEditor textEditor) {
        final IDocument document = textEditor.getDocumentProvider().getDocument(
                textEditor.getEditorInput());
        final ITextSelection selection = extendSelectionToWholeLines(document,
                (ITextSelection) sel);
        final ITextSelection getSelection = getTextSelection(document, selection,
                textEditor);
        String text;
        OtpErlangObject r1 = null;
        try {
            text = document.get(getSelection.getOffset(), getSelection.getLength());
            // call erlang, with selection within text
            r1 = callErlang(selection.getOffset() - getSelection.getOffset(),
                    selection.getLength(), text);
        } catch (final Exception e) {
            ErlLogger.error(e);
        }
        final String newText = Util.stringValue(r1);
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

                .getIsGoToNextNavigationTargetKey();
        return key != null && preferences.getBoolean(key);
    }

    public Annotation gotoAnnotation(final boolean forward) {
        final ITextSelection selection = (ITextSelection) editor.getSelectionProvider()
                .getSelection();
        final Position position = new Position(0, 0);
        final Annotation annotation = getNextAnnotation(selection.getOffset(),
                selection.getLength(), forward, position);
        editor.setStatusLineErrorMessage(null);
        editor.setStatusLineMessage(null);
        if (annotation != null) {
            updateAnnotationViews(annotation);
            editor.selectAndReveal(position.getOffset(), position.getLength());
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    @Override
    protected void doAction(final ISelection sel, final ITextEditor textEditor) {
        final IDocument document = textEditor.getDocumentProvider().getDocument(
                textEditor.getEditorInput());
        final ITextSelection selection = extendSelectionToWholeLines(document,
                (ITextSelection) sel);
        final ITextSelection getSelection = getTextSelection(document, selection,
                textEditor);
        String text;
        OtpErlangObject r1 = null;
        try {
            text = document.get(getSelection.getOffset(), getSelection.getLength());
            // call erlang, with selection within text
            r1 = callErlang(selection.getOffset() - getSelection.getOffset(),
                    selection.getLength(), text);
        } catch (final Exception e) {
            ErlLogger.error(e);
        }
        final String newText = Util.stringValue(r1);
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    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());

        final Position position = new Position(location.getOffset(), location.getLength());
        final String description = location.getDescription();

        final Annotation oldAnnotation = callMatchingLine;
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

            final ISelection selection) throws CoreException {
        final ITextEditor textEditor = getEditor(part);
        if (textEditor != null) {
            final IResource resource = (IResource) textEditor.getEditorInput()
                    .getAdapter(IResource.class);
            final ITextSelection textSelection = (ITextSelection) selection;
            final int lineNumber = textSelection.getStartLine();
            final IBreakpoint[] breakpoints = DebugPlugin.getDefault()
                    .getBreakpointManager()
                    .getBreakpoints(ErlDebugConstants.ID_ERLANG_DEBUG_MODEL);
            for (final IBreakpoint breakpoint : breakpoints) {
                if (resource.equals(breakpoint.getMarker().getResource())) {
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

     *
     * @param editor
     *            the erlang editor which is used to get the current selection
     */
    public AbstractErlMemberSelection(final ITextEditor editor) {
        final ITextSelection selection = (ITextSelection) editor.getSelectionProvider()
                .getSelection();
        final IFileEditorInput input = (IFileEditorInput) editor.getEditorInput();
        document = editor.getDocumentProvider().getDocument(input);
        final IFile afile = input.getFile();
        store(selection, afile, document);
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

        IStructuredModel model = null;
        try {
          model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
          if (model != null) {
            // begin recording
            ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
            model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength());

            // tell the model that we are about to make a big
            // model change
            model.aboutToChangeModel();

            // run
            BusyIndicator.showWhile(fEditor.getEditorSite().getWorkbenchWindow().getShell().getDisplay(), runnable);
          }
        }
        finally {
          if (model != null) {
            // tell the model that we are done with the big
            // model
            // change
            model.changedModel();

            // end recording
            ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
            model.endRecording(this, selection.getOffset(), selection.getLength());
            model.releaseFromEdit();
          }
        }
      }
    }
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.