org.eclipse.jface.text.IDocumentListener Java Examples

The following examples show how to use org.eclipse.jface.text.IDocumentListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DocumentAutoFormatter.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public void endAutoFormat() {
	final Collection<RegionFormattingRequest> requests;
	synchronized (this) {
		requests = this.formattingRequests;
		this.formattingRequests = Collections.synchronizedList(new ArrayList<>(1));
		if (this.autoFormatListener != null) {
			final IDocumentListener listener = this.autoFormatListener;
			this.autoFormatListener = null;
			if (this.document != null) {
				this.document.removeDocumentListener(listener);
			}
		}
	}
	if (this.contentFormatter != null) {
		for (final RegionFormattingRequest request : requests) {
			formatRegion(request.document, request.offset, request.length);
		}
	}
}
 
Example #2
Source File: BaseDocumentCommand.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Adds an additional replace command. The added replace command must not overlap
 * with existing ones. If the document command owner is not <code>null</code>, it will not
 * get document change notifications for the particular command.
 *
 * @param commandOffset the offset of the region to replace
 * @param commandLength the length of the region to replace
 * @param commandText the text to replace with, may be <code>null</code>
 * @param commandOwner the command owner, may be <code>null</code>
 * @throws BadLocationException if the added command intersects with an existing one
 * @since 2.1
 */
public void addCommand(int commandOffset, int commandLength, String commandText, IDocumentListener commandOwner)
        throws BadLocationException {
    final Command command = new Command(commandOffset, commandLength, commandText, commandOwner);

    if (intersects(command)) {
        throw new BadLocationException();
    }

    final int index = Collections.binarySearch(fCommands, command);

    // a command with exactly the same ranges exists already
    if (index >= 0) {
        throw new BadLocationException();
    }

    // binary search result is defined as (-(insertionIndex) - 1)
    final int insertionIndex = -(index + 1);

    // overlaps to the right?
    if (insertionIndex != fCommands.size() && intersects(fCommands.get(insertionIndex), command)) {
        throw new BadLocationException();
    }

    // overlaps to the left?
    if (insertionIndex != 0 && intersects(fCommands.get(insertionIndex - 1), command)) {
        throw new BadLocationException();
    }

    fCommands.add(insertionIndex, command);
}
 
Example #3
Source File: BaseDocumentCommand.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new command with the given specification.
 *
 * @param offset the offset of the replace command
 * @param length the length of the replace command
 * @param text the text to replace with, may be <code>null</code>
 * @param owner the document command owner, may be <code>null</code>
 * @since 3.0
 */
public Command(int offset, int length, String text, IDocumentListener owner) {
    if (offset < 0 || length < 0) {
        throw new IllegalArgumentException();
    }
    fOffset = offset;
    fLength = length;
    fText = text;
    fOwner = owner;
}
 
Example #4
Source File: MockDocument.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void removeDocumentListener(IDocumentListener listener) {
  throw new UnsupportedMockOperationException();
}
 
Example #5
Source File: PyEdit.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Important: keep for scripting
 */
public Class<IDocumentListener> getIDocumentListenerClass() {
    return IDocumentListener.class;
}
 
Example #6
Source File: DocCopy.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
    throw new RuntimeException("not implemented");
}
 
Example #7
Source File: DocCopy.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
    throw new RuntimeException("not implemented");
}
 
Example #8
Source File: DocCopy.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void removeDocumentListener(IDocumentListener listener) {
    throw new RuntimeException("not implemented");
}
 
Example #9
Source File: DocCopy.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void addDocumentListener(IDocumentListener listener) {
    throw new RuntimeException("not implemented");
}
 
Example #10
Source File: SimpleDocument.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	// defining interface method
}
 
Example #11
Source File: SimpleDocument.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	// defining interface method
}
 
Example #12
Source File: SimpleDocument.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void removeDocumentListener(IDocumentListener listener) {
	// defining interface method
}
 
Example #13
Source File: SimpleDocument.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void addDocumentListener(IDocumentListener listener) {
	// defining interface method
}
 
Example #14
Source File: MockDocument.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void removePrenotifiedDocumentListener(
    IDocumentListener documentAdapter) {
  throw new UnsupportedMockOperationException();
}
 
Example #15
Source File: AbstractDocumentSimulatingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addDocumentListener(IDocumentListener listener) {
	fail("Unexpected call");
}
 
Example #16
Source File: MockDocument.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
  throw new UnsupportedMockOperationException();
}
 
Example #17
Source File: MockDocument.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void addDocumentListener(IDocumentListener listener) {
  throw new UnsupportedMockOperationException();
}
 
Example #18
Source File: DummyDocument.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	throw new UnsupportedOperationException();
}
 
Example #19
Source File: DummyDocument.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	throw new UnsupportedOperationException();
}
 
Example #20
Source File: DummyDocument.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void removeDocumentListener(IDocumentListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #21
Source File: DummyDocument.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void addDocumentListener(IDocumentListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #22
Source File: DummyDocument.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	throw new UnsupportedOperationException();
}
 
Example #23
Source File: DummyDocument.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	throw new UnsupportedOperationException();
}
 
Example #24
Source File: DummyDocument.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removeDocumentListener(IDocumentListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #25
Source File: DummyDocument.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addDocumentListener(IDocumentListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #26
Source File: AbstractDocumentSimulatingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	fail("Unexpected call");
}
 
Example #27
Source File: AbstractDocumentSimulatingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removeDocumentListener(IDocumentListener listener) {
	fail("Unexpected call");
}
 
Example #28
Source File: AbstractDocumentSimulatingTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
	fail("Unexpected call");
}