mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-03 20:33:31 +07:00
GitOrigin-RevId: 924cc6d64e19bbd645b106d7164011c8fcf33170
39 lines
1.3 KiB
Java
39 lines
1.3 KiB
Java
package com.sample;
|
|
|
|
import com.intellij.openapi.actionSystem.*;
|
|
import static com.intellij.openapi.actionSystem.ActionUpdateThread.*;
|
|
|
|
// plain
|
|
class <warning descr="Override 'getActionUpdateThread' and choose 'EDT' or 'BGT'">ActionError</warning> extends AnAction {
|
|
public void update(AnActionEvent e) { }
|
|
}
|
|
|
|
class ActionNoError extends AnAction {
|
|
public void update(AnActionEvent e) { }
|
|
|
|
public ActionUpdateThread getActionUpdateThread() { return EDT; }
|
|
}
|
|
|
|
// inherited
|
|
class <warning descr="Override 'getActionUpdateThread' and choose 'EDT' or 'BGT'">ActionChildError</warning> extends ActionError { }
|
|
class ActionChildNoError extends ActionNoError { }
|
|
|
|
// anonymous
|
|
class Holder {
|
|
AnAction actionError = new <warning descr="Override 'getActionUpdateThread' and choose 'EDT' or 'BGT'">ActionError</warning>() {
|
|
};
|
|
|
|
AnAction actionNoError = new ActionError() {
|
|
public ActionUpdateThread getActionUpdateThread() { return EDT; }
|
|
};
|
|
}
|
|
|
|
// default method (NOT applicable)
|
|
interface WithDefaultMethod extends ActionUpdateThreadAware {
|
|
default ActionUpdateThread getActionUpdateThread() {
|
|
return BGT;
|
|
}
|
|
}
|
|
|
|
class <warning descr="Override 'getActionUpdateThread' and choose 'EDT' or 'BGT'">ActionErrorAnyway</warning> extends ActionError implements WithDefaultMethod {
|
|
} |