2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.openapi
.actionSystem
.ex
;
20 import com
.intellij
.openapi
.Disposable
;
21 import com
.intellij
.openapi
.actionSystem
.*;
22 import com
.intellij
.openapi
.extensions
.PluginId
;
23 import org
.jetbrains
.annotations
.NotNull
;
24 import org
.jetbrains
.annotations
.Nullable
;
27 import java
.util
.Comparator
;
31 public abstract class ActionManagerEx
extends ActionManager
{
33 private boolean myActionPopupStackEmpty
;
37 public static ActionManagerEx
getInstanceEx(){
39 return (ActionManagerEx
)getInstance();
44 public abstract void addAnActionListener(AnActionListener listener
);
45 public abstract void addAnActionListener(AnActionListener listener
, Disposable parentDisposable
);
47 public abstract void removeAnActionListener(AnActionListener listener
);
51 public abstract void fireBeforeActionPerformed(AnAction action
, DataContext dataContext
, AnActionEvent event
);
53 public abstract void fireAfterActionPerformed(AnAction action
, DataContext dataContext
, AnActionEvent event
);
56 public abstract KeyboardShortcut
getKeyboardShortcut(@NotNull String actionId
);
59 public abstract void fireBeforeEditorTyping(char c
, DataContext dataContext
);
63 * For logging purposes
67 public abstract String
getLastPreformedActionId();
69 public abstract String
getPrevPreformedActionId();
75 * Comparator compares action ids (String) on order of action registration.
77 * @return a negative integer if action that corresponds to the first id was registered earler than the action that corresponds
79 * to the second id; zero if both ids are equal; a positive number otherwise.
83 public abstract Comparator
<String
> getRegistrationOrderComparator();
91 * Similar to {@link KeyStroke#getKeyStroke(String)} but allows keys in lower case.
93 * I.e. "control x" is accepted and interpreted as "control X".
95 * @return null if string cannot be parsed.
101 public static KeyStroke
getKeyStroke(String s
) {
103 KeyStroke result
= null;
107 result
= KeyStroke
.getKeyStroke(s
);
109 } catch (Exception ex
) {
117 if (result
== null && s
!= null && s
.length() >= 2 && s
.charAt(s
.length() - 2) == ' ') {
121 String s1
= s
.substring(0, s
.length() - 1) + Character
.toUpperCase(s
.charAt(s
.length() - 1));
123 result
= KeyStroke
.getKeyStroke(s1
);
125 } catch (Exception ex
) {
141 public abstract String
[] getPluginActions(PluginId pluginId
);
145 public abstract void queueActionPerformedEvent(final AnAction action
, DataContext context
, AnActionEvent event
);
149 public abstract boolean isActionPopupStackEmpty();