Skip to content

Commit 54dc3c5

Browse files
HeikoKlareakurtakov
authored andcommitted
Move ShellStateListener to only test class that uses it
ShellStateListener is only used in a single test class, so move it there from the to-be-removed UITestCase.
1 parent f254d43 commit 54dc3c5

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/UITestCase.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.ArrayList;
2323
import java.util.List;
2424
import java.util.Set;
25-
import java.util.concurrent.atomic.AtomicBoolean;
2625

2726
import org.eclipse.core.resources.ResourcesPlugin;
2827
import org.eclipse.core.runtime.CoreException;
@@ -31,8 +30,6 @@
3130
import org.eclipse.core.runtime.jobs.Job;
3231
import org.eclipse.jface.preference.IPreferenceStore;
3332
import org.eclipse.jface.preference.PreferenceMemento;
34-
import org.eclipse.swt.events.ShellEvent;
35-
import org.eclipse.swt.events.ShellListener;
3633
import org.eclipse.swt.widgets.Display;
3734
import org.eclipse.swt.widgets.Shell;
3835
import org.eclipse.ui.IWorkbench;
@@ -330,39 +327,6 @@ public static boolean forceActive(Shell shell) {
330327
return display.getActiveShell() == shell;
331328
}
332329

333-
public static class ShellStateListener implements ShellListener {
334-
private final AtomicBoolean shellIsActive;
335-
336-
public ShellStateListener(AtomicBoolean shellIsActive) {
337-
this.shellIsActive = shellIsActive;
338-
}
339-
340-
@Override
341-
public void shellIconified(ShellEvent e) {
342-
shellIsActive.set(false);
343-
}
344-
345-
@Override
346-
public void shellDeiconified(ShellEvent e) {
347-
shellIsActive.set(true);
348-
}
349-
350-
@Override
351-
public void shellDeactivated(ShellEvent e) {
352-
shellIsActive.set(false);
353-
}
354-
355-
@Override
356-
public void shellClosed(ShellEvent e) {
357-
shellIsActive.set(false);
358-
}
359-
360-
@Override
361-
public void shellActivated(ShellEvent e) {
362-
shellIsActive.set(true);
363-
}
364-
}
365-
366330
public static interface Condition {
367331
public boolean compute();
368332
}

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
3838
import org.eclipse.jface.text.IDocument;
3939
import org.eclipse.jface.util.IPropertyChangeListener;
40+
import org.eclipse.swt.events.ShellEvent;
4041
import org.eclipse.swt.events.ShellListener;
4142
import org.eclipse.ui.IEditorInput;
4243
import org.eclipse.ui.IEditorPart;
@@ -3332,4 +3333,38 @@ public void testGetViewStackWithSecondaryId() throws PartInitException {
33323333

33333334
assertEquals(part, stack[0]);
33343335
}
3336+
3337+
private static class ShellStateListener implements ShellListener {
3338+
private final AtomicBoolean shellIsActive;
3339+
3340+
public ShellStateListener(AtomicBoolean shellIsActive) {
3341+
this.shellIsActive = shellIsActive;
3342+
}
3343+
3344+
@Override
3345+
public void shellIconified(ShellEvent e) {
3346+
shellIsActive.set(false);
3347+
}
3348+
3349+
@Override
3350+
public void shellDeiconified(ShellEvent e) {
3351+
shellIsActive.set(true);
3352+
}
3353+
3354+
@Override
3355+
public void shellDeactivated(ShellEvent e) {
3356+
shellIsActive.set(false);
3357+
}
3358+
3359+
@Override
3360+
public void shellClosed(ShellEvent e) {
3361+
shellIsActive.set(false);
3362+
}
3363+
3364+
@Override
3365+
public void shellActivated(ShellEvent e) {
3366+
shellIsActive.set(true);
3367+
}
3368+
}
3369+
33353370
}

0 commit comments

Comments
 (0)