Search in sources :

Example 1 with AntEditor

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);
        }
    }
}
Also used : AntEditor(org.eclipse.ant.internal.ui.editor.AntEditor) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer)

Example 2 with AntEditor

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);
}
Also used : AntEditor(org.eclipse.ant.internal.ui.editor.AntEditor) ITextEditor(org.eclipse.ui.texteditor.ITextEditor)

Example 3 with AntEditor

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();
    }
}
Also used : AntEditor(org.eclipse.ant.internal.ui.editor.AntEditor) IFile(org.eclipse.core.resources.IFile) TestTextCompletionProcessor(org.eclipse.ant.tests.ui.editor.support.TestTextCompletionProcessor) TextSelection(org.eclipse.jface.text.TextSelection) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal)

Example 4 with AntEditor

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();
    }
}
Also used : AntEditor(org.eclipse.ant.internal.ui.editor.AntEditor) IFile(org.eclipse.core.resources.IFile)

Example 5 with AntEditor

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();
    }
}
Also used : AntEditor(org.eclipse.ant.internal.ui.editor.AntEditor) IFile(org.eclipse.core.resources.IFile) Position(org.eclipse.jface.text.Position) OccurrencesFinder(org.eclipse.ant.internal.ui.editor.OccurrencesFinder)

Aggregations

AntEditor (org.eclipse.ant.internal.ui.editor.AntEditor)45 IFile (org.eclipse.core.resources.IFile)40 ITextSelection (org.eclipse.jface.text.ITextSelection)12 OccurrencesFinder (org.eclipse.ant.internal.ui.editor.OccurrencesFinder)7 XMLTextHover (org.eclipse.ant.internal.ui.editor.text.XMLTextHover)7 IRegion (org.eclipse.jface.text.IRegion)7 Position (org.eclipse.jface.text.Position)7 IEditorPart (org.eclipse.ui.IEditorPart)6 AntModel (org.eclipse.ant.internal.ui.model.AntModel)4 TestTextCompletionProcessor (org.eclipse.ant.tests.ui.editor.support.TestTextCompletionProcessor)4 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)4 IDocument (org.eclipse.jface.text.IDocument)3 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)3 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 AntElementNode (org.eclipse.ant.internal.ui.model.AntElementNode)1 AntProjectNode (org.eclipse.ant.internal.ui.model.AntProjectNode)1 IAntModel (org.eclipse.ant.internal.ui.model.IAntModel)1 TextSelection (org.eclipse.jface.text.TextSelection)1 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1