diff --git a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/performance/EditorTestHelper.java b/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/performance/EditorTestHelper.java index f29e224d3fe..b50a8fb6a34 100644 --- a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/performance/EditorTestHelper.java +++ b/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/performance/EditorTestHelper.java @@ -14,12 +14,7 @@ package org.eclipse.ant.tests.ui.editor.performance; import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.text.IDocument; -import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; @@ -27,8 +22,6 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.texteditor.IDocumentProvider; -import org.eclipse.ui.texteditor.ITextEditor; /** * @since 3.1 @@ -51,19 +44,6 @@ public static IEditorPart openInEditor(IFile file, String editorId, boolean runE return part; } - public static IDocument getDocument(ITextEditor editor) { - IDocumentProvider provider = editor.getDocumentProvider(); - IEditorInput input = editor.getEditorInput(); - return provider.getDocument(input); - } - - public static void revertEditor(ITextEditor editor, boolean runEventQueue) { - editor.doRevertToSaved(); - if (runEventQueue) { - runEventQueue(editor); - } - } - public static void closeAllEditors() { IWorkbenchPage page = getActivePage(); if (page != null) { @@ -105,28 +85,6 @@ public static IWorkbenchPage getActivePage() { return window != null ? window.getActivePage() : null; } - public static Display getActiveDisplay() { - IWorkbenchWindow window = getActiveWorkbenchWindow(); - return window != null ? window.getShell().getDisplay() : null; - } - - public static boolean calmDown(long minTime, long maxTime, long intervalTime) { - long startTime = System.currentTimeMillis() + minTime; - runEventQueue(); - while (System.currentTimeMillis() < startTime) { - runEventQueue(intervalTime); - } - - long endTime = maxTime > 0 ? System.currentTimeMillis() + maxTime : Long.MAX_VALUE; - boolean calm = isCalm(); - while (!calm && System.currentTimeMillis() < endTime) { - runEventQueue(intervalTime); - calm = isCalm(); - } - // System.out.println("--------------------------------------------------"); - return calm; - } - public static void sleep(int intervalTime) { try { Thread.sleep(intervalTime); @@ -136,21 +94,4 @@ public static void sleep(int intervalTime) { } } - public static boolean isCalm() { - IJobManager jobManager = Job.getJobManager(); - for (Job job : jobManager.find(null)) { - int state = job.getState(); - // System.out.println(job.getName() + ": " + getStateName(state)); - if (state == Job.RUNNING || state == Job.WAITING) { - // System.out.println(); - return false; - } - } - // System.out.println(); - return true; - } - - public static void bringToTop() { - getActiveWorkbenchWindow().getShell().forceActive(); - } } diff --git a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/performance/NonInitialTypingTest.java b/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/performance/NonInitialTypingTest.java deleted file mode 100644 index 3630e584292..00000000000 --- a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/performance/NonInitialTypingTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ant.tests.ui.editor.performance; - -import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest; - -/** - * Measures the time to type in one single target into a large buildfile - * - * @since 3.1 - */ -public class NonInitialTypingTest extends AbstractAntUITest { - - // private ITextEditor fEditor; - // - // private static final char[] TARGET= ("\r" + - // "\"New Target\"\r" + - // "\r").toCharArray(); - // - // private PerformanceMeter fMeter; - // - // private KeyboardProbe fKeyboardProbe; - // - // protected void setUp() throws PartInitException, BadLocationException { - // EditorTestHelper.runEventQueue(); - // IFile file= getProject().getFolder("buildfiles").getFolder("performance").getFile("build.xml"); - // fEditor= (ITextEditor) EditorTestHelper.openInEditor(file, true); - // // dirty editor to avoid initial dirtying / validate edit costs - // dirtyEditor(); - // Performance performance= Performance.getDefault(); - // fMeter= performance.createPerformanceMeter(performance.getDefaultScenarioId(this)); - // fKeyboardProbe= new KeyboardProbe(); - // - // int offset= getInsertPosition(); - // fEditor.getSelectionProvider().setSelection(new TextSelection(offset, 0)); - // EditorTestHelper.runEventQueue(); - // sleep(1000); - // } - // - // private void dirtyEditor() { - // fEditor.getSelectionProvider().setSelection(new TextSelection(0, 0)); - // EditorTestHelper.runEventQueue(); - // sleep(1000); - // - // Display display= EditorTestHelper.getActiveDisplay(); - // fKeyboardProbe.pressChar('{', display); - // SWTEventHelper.pressKeyCode(display, SWT.BS); - // sleep(1000); - // } - // - // protected void tearDown() throws Exception { - // sleep(1000); - // EditorTestHelper.revertEditor(fEditor, true); - // EditorTestHelper.closeAllEditors(); - // - // fMeter.commit(); - // } - // - // public void testTypeAMethod() { - // Display display= EditorTestHelper.getActiveDisplay(); - // - // fMeter.start(); - // for (int i= 0; i < TARGET.length; i++) { - // fKeyboardProbe.pressChar(TARGET[i], display); - // } - // fMeter.stop(); - // } - // - // private synchronized void sleep(int time) { - // try { - // wait(time); - // } catch (InterruptedException e) { - // } - // } - // - // private int getInsertPosition() throws BadLocationException { - // IDocument document= EditorTestHelper.getDocument(fEditor); - // int lines= document.getNumberOfLines(); - // int offset= document.getLineOffset(lines - 2); - // return offset; - // } -}