use of org.eclipse.ant.internal.ui.editor.AntEditor in project eclipse.platform by eclipse-platform.
the class FoldingToggleRulerAction method update.
private void update() {
if (fTextEditor instanceof AntEditor) {
ISourceViewer viewer = ((AntEditor) fTextEditor).getViewer();
if (viewer instanceof ProjectionViewer) {
boolean enabled = ((ProjectionViewer) viewer).getProjectionAnnotationModel() != null;
fUIAction.setChecked(enabled);
}
}
}
use of org.eclipse.ant.internal.ui.editor.AntEditor in project eclipse.platform by eclipse-platform.
the class ToggleMarkOccurrencesAction method update.
@Override
public void update() {
ITextEditor editor = getTextEditor();
boolean checked = false;
boolean enabled = false;
if (editor instanceof AntEditor) {
checked = ((AntEditor) editor).isMarkingOccurrences();
enabled = ((AntEditor) editor).getAntModel() != null;
}
setChecked(checked);
setEnabled(enabled);
}
use of org.eclipse.ant.internal.ui.editor.AntEditor in project eclipse.platform by eclipse-platform.
the class CodeCompletionTest method testNestedElementTemplateProposals.
/**
* Tests the code completion for nested elements that no templates are presented Bug 76414
*/
public void testNestedElementTemplateProposals() throws BadLocationException, PartInitException {
try {
// $NON-NLS-1$
IFile file = getIFile("nestedElementAttributes.xml");
AntEditor editor = (AntEditor) EditorTestHelper.openInEditor(file, ANT_EDITOR_ID, true);
TestTextCompletionProcessor processor = new TestTextCompletionProcessor(editor);
int lineNumber = 4;
int lineOffset = editor.getDocumentProvider().getDocument(editor.getEditorInput()).getLineOffset(lineNumber);
editor.getSelectionProvider().setSelection(new TextSelection(lineOffset, 0));
ICompletionProposal[] proposals = processor.computeCompletionProposals(lineOffset);
// $NON-NLS-1$
assertTrue("No templates are relevant at the current position. Found: " + proposals.length, proposals.length == 1);
} finally {
EditorTestHelper.closeAllEditors();
}
}
use of org.eclipse.ant.internal.ui.editor.AntEditor in project eclipse.platform by eclipse-platform.
the class OccurrencesFinderTests method testFromMacrodefAttributeDecl.
public void testFromMacrodefAttributeDecl() throws PartInitException, BadLocationException {
try {
// $NON-NLS-1$
IFile file = getIFile("occurrencesTest.xml");
// $NON-NLS-1$
AntEditor editor = (AntEditor) EditorTestHelper.openInEditor(file, "org.eclipse.ant.ui.internal.editor.AntEditor", true);
int offset = getOffsetWithinLine(editor, 13, 25);
editor.selectAndReveal(offset, 0);
macrodefAttributeOccurences(editor, offset);
} finally {
EditorTestHelper.closeAllEditors();
}
}
use of org.eclipse.ant.internal.ui.editor.AntEditor in project eclipse.platform by eclipse-platform.
the class OccurrencesFinderTests method testTargetFromProjectDefault.
/**
* bug 89115
*/
public void testTargetFromProjectDefault() throws PartInitException, BadLocationException {
try {
// $NON-NLS-1$
IFile file = getIFile("89115.xml");
// $NON-NLS-1$
AntEditor editor = (AntEditor) EditorTestHelper.openInEditor(file, "org.eclipse.ant.ui.internal.editor.AntEditor", true);
int offset = getOffsetWithinLine(editor, 0, 40);
editor.selectAndReveal(offset, 0);
OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
// $NON-NLS-1$
assertTrue("2 positions should have been found; found: " + positions.size(), positions.size() == 2);
assertContainsPosition(positions, offset, 7);
offset = getOffsetWithinLine(editor, 1, 45);
assertContainsPosition(positions, offset, 7);
} finally {
EditorTestHelper.closeAllEditors();
}
}
Aggregations