mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
MnemonicHelper refactoring
This commit is contained in:
@@ -242,7 +242,7 @@ public class FileStructurePopup implements Disposable {
|
||||
public void show() {
|
||||
//final long time = System.currentTimeMillis();
|
||||
JComponent panel = createCenterPanel();
|
||||
new MnemonicHelper().register(panel);
|
||||
MnemonicHelper.init(panel);
|
||||
boolean shouldSetWidth = DimensionService.getInstance().getSize(getDimensionServiceKey(), myProject) == null;
|
||||
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, null)
|
||||
.setTitle(myTitle)
|
||||
|
||||
@@ -897,7 +897,7 @@ public abstract class ChooseByNameBase {
|
||||
myTextPopup.setSize(bounds.getSize());
|
||||
myTextPopup.setLocation(bounds.getLocation());
|
||||
|
||||
new MnemonicHelper().register(myTextFieldPanel);
|
||||
MnemonicHelper.init(myTextFieldPanel);
|
||||
if (myProject != null && !myProject.isDefault()) {
|
||||
DaemonCodeAnalyzer.getInstance(myProject).disableUpdateByTimer(myTextPopup);
|
||||
}
|
||||
|
||||
@@ -143,4 +143,13 @@ public class MnemonicHelper extends ComponentTreeWatcher {
|
||||
"alt pressed " + mnemonic;
|
||||
return CustomShortcutSet.fromString(shortcut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes mnemonics support for the specified component and for its children if needed.
|
||||
*
|
||||
* @param component the root component of the hierarchy
|
||||
*/
|
||||
public static void init(Component component) {
|
||||
new MnemonicHelper().register(component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1242,7 +1242,7 @@ public abstract class DialogWrapper {
|
||||
southSection.add(south, BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
new MnemonicHelper().register(root);
|
||||
MnemonicHelper.init(root);
|
||||
if (!postponeValidation()) {
|
||||
startTrackingValidation();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class AuthenticationDialog extends DialogWrapper {
|
||||
super(component, true);
|
||||
setTitle(title);
|
||||
|
||||
new MnemonicHelper().register(getContentPane());
|
||||
MnemonicHelper.init(getContentPane());
|
||||
panel = new AuthenticationPanel(description, login, password, rememberPassword);
|
||||
|
||||
final Window window = getWindow();
|
||||
@@ -45,7 +45,7 @@ public class AuthenticationDialog extends DialogWrapper {
|
||||
super(JOptionPane.getRootFrame(), true);
|
||||
setTitle(title);
|
||||
|
||||
new MnemonicHelper().register(getContentPane());
|
||||
MnemonicHelper.init(getContentPane());
|
||||
panel = new AuthenticationPanel(description, login, password, rememberPassword);
|
||||
|
||||
final Window window = getWindow();
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class ImportOldConfigsPanel extends JDialog {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
new MnemonicHelper().register(getContentPane());
|
||||
MnemonicHelper.init(getContentPane());
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(myRbDoNotImport);
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class FloatingDecorator extends JDialog {
|
||||
|
||||
FloatingDecorator(final IdeFrameImpl owner,final WindowInfoImpl info,final InternalDecorator internalDecorator){
|
||||
super(owner,internalDecorator.getToolWindow().getId());
|
||||
new MnemonicHelper().register(getContentPane());
|
||||
MnemonicHelper.init(getContentPane());
|
||||
myInternalDecorator=internalDecorator;
|
||||
|
||||
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
||||
|
||||
@@ -109,7 +109,7 @@ public class IdeFrameImpl extends JFrame implements IdeFrameEx, DataProvider {
|
||||
setFocusTraversalPolicy(layoutFocusTraversalPolicy);
|
||||
|
||||
setupCloseAction();
|
||||
new MnemonicHelper().register(this);
|
||||
MnemonicHelper.init(this);
|
||||
|
||||
myBalloonLayout = new BalloonLayoutImpl(myRootPane, new Insets(8, 8, 8, 8));
|
||||
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame {
|
||||
myBalloonLayout = new BalloonLayoutImpl(rootPane, new JBInsets(8, 8, 8, 8));
|
||||
|
||||
WelcomeFrame.setupCloseAction(this);
|
||||
new MnemonicHelper().register(this);
|
||||
MnemonicHelper.init(this);
|
||||
Disposer.register(ApplicationManager.getApplication(), new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class WelcomeFrame extends JFrame implements IdeFrame {
|
||||
|
||||
myScreen = screen;
|
||||
setupCloseAction(this);
|
||||
new MnemonicHelper().register(this);
|
||||
MnemonicHelper.init(this);
|
||||
myScreen.setupFrame(this);
|
||||
Disposer.register(ApplicationManager.getApplication(), new Disposable() {
|
||||
@Override
|
||||
|
||||
@@ -102,7 +102,7 @@ public class DomFileEditor<T extends BasicDomElementComponent> extends Perspecti
|
||||
@Override
|
||||
@NotNull
|
||||
protected JComponent createCustomComponent() {
|
||||
new MnemonicHelper().register(getComponent());
|
||||
MnemonicHelper.init(getComponent());
|
||||
myComponent = myComponentFactory.create();
|
||||
DomUIFactory.getDomUIFactory().setupErrorOutdatingUserActivityWatcher(this, getDomElement());
|
||||
DomManager.getDomManager(getProject()).addDomEventListener(new DomEventListener() {
|
||||
|
||||
Reference in New Issue
Block a user