mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ui designer MorphAction: avoid invokeLater
This commit is contained in:
@@ -45,7 +45,6 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,20 +63,14 @@ public class MorphAction extends AbstractGuiEditorAction {
|
||||
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
|
||||
Processor<ComponentItem> processor = new Processor<ComponentItem>() {
|
||||
public boolean process(final ComponentItem selectedValue) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
for(RadComponent c: selection) {
|
||||
if (!morphComponent(editor, c, selectedValue)) break;
|
||||
}
|
||||
editor.refreshAndSave(true);
|
||||
}
|
||||
};
|
||||
CommandProcessor.getInstance().executeCommand(editor.getProject(), runnable, UIDesignerBundle.message("morph.component.command"), null);
|
||||
editor.getGlassLayer().requestFocus();
|
||||
Runnable runnable = () -> {
|
||||
for(RadComponent c: selection) {
|
||||
if (!morphComponent(editor, c, selectedValue)) break;
|
||||
}
|
||||
});
|
||||
editor.refreshAndSave(true);
|
||||
};
|
||||
CommandProcessor.getInstance().executeCommand(editor.getProject(), runnable, UIDesignerBundle.message("morph.component.command"), null);
|
||||
editor.getGlassLayer().requestFocus();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,6 +41,7 @@ class PaletteListPopupStep implements ListPopupStep<ComponentItem>, SpeedSearchF
|
||||
private final Processor<ComponentItem> myRunnable;
|
||||
private final String myTitle;
|
||||
private final Project myProject;
|
||||
private Runnable myFinalRunnable;
|
||||
|
||||
PaletteListPopupStep(GuiEditor editor, ComponentItem initialSelection, final Processor<ComponentItem> runnable, final String title) {
|
||||
myInitialSelection = initialSelection;
|
||||
@@ -93,12 +94,12 @@ class PaletteListPopupStep implements ListPopupStep<ComponentItem>, SpeedSearchF
|
||||
}
|
||||
|
||||
public PopupStep onChosen(final ComponentItem selectedValue, final boolean finalChoice) {
|
||||
myRunnable.process(selectedValue);
|
||||
myFinalRunnable = () -> myRunnable.process(selectedValue);
|
||||
return PopupStep.FINAL_CHOICE;
|
||||
}
|
||||
|
||||
public Runnable getFinalRunnable() {
|
||||
return null;
|
||||
return myFinalRunnable;
|
||||
}
|
||||
|
||||
public boolean hasSubstep(final ComponentItem selectedValue) {
|
||||
|
||||
Reference in New Issue
Block a user