mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+12
-41
@@ -16,8 +16,6 @@
|
||||
package com.intellij.openapi.actionSystem.ex;
|
||||
|
||||
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.extensions.PluginId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -27,23 +25,11 @@ import javax.swing.*;
|
||||
import java.util.Comparator;
|
||||
|
||||
|
||||
|
||||
public abstract class ActionManagerEx extends ActionManager{
|
||||
|
||||
private boolean myActionPopupStackEmpty;
|
||||
|
||||
|
||||
|
||||
public static ActionManagerEx getInstanceEx(){
|
||||
|
||||
public abstract class ActionManagerEx extends ActionManager {
|
||||
public static ActionManagerEx getInstanceEx() {
|
||||
return (ActionManagerEx)getInstance();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public abstract void fireBeforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event);
|
||||
|
||||
public abstract void fireAfterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event);
|
||||
@@ -55,9 +41,7 @@ public abstract class ActionManagerEx extends ActionManager{
|
||||
public abstract void fireBeforeEditorTyping(char c, DataContext dataContext);
|
||||
|
||||
/**
|
||||
|
||||
* For logging purposes
|
||||
|
||||
*/
|
||||
|
||||
public abstract String getLastPreformedActionId();
|
||||
@@ -65,31 +49,23 @@ public abstract class ActionManagerEx extends ActionManager{
|
||||
public abstract String getPrevPreformedActionId();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* Comparator compares action ids (String) on order of action registration.
|
||||
|
||||
*
|
||||
* @return a negative integer if action that corresponds to the first id was registered earler than the action that corresponds
|
||||
|
||||
* to the second id; zero if both ids are equal; a positive number otherwise.
|
||||
|
||||
* <p/>
|
||||
* to the second id; zero if both ids are equal; a positive number otherwise.
|
||||
*/
|
||||
|
||||
public abstract Comparator<String> getRegistrationOrderComparator();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* Similar to {@link KeyStroke#getKeyStroke(String)} but allows keys in lower case.
|
||||
|
||||
* <p/>
|
||||
* I.e. "control x" is accepted and interpreted as "control X".
|
||||
|
||||
*
|
||||
* @return null if string cannot be parsed.
|
||||
|
||||
*/
|
||||
|
||||
@Nullable
|
||||
@@ -102,14 +78,14 @@ public abstract class ActionManagerEx extends ActionManager{
|
||||
|
||||
result = KeyStroke.getKeyStroke(s);
|
||||
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
//ok
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (result == null && s != null && s.length() >= 2 && s.charAt(s.length() - 2) == ' ') {
|
||||
|
||||
try {
|
||||
@@ -118,7 +94,8 @@ public abstract class ActionManagerEx extends ActionManager{
|
||||
|
||||
result = KeyStroke.getKeyStroke(s1);
|
||||
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
// ok
|
||||
|
||||
@@ -127,21 +104,15 @@ public abstract class ActionManagerEx extends ActionManager{
|
||||
}
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public abstract String [] getPluginActions(PluginId pluginId);
|
||||
|
||||
|
||||
public abstract String[] getPluginActions(PluginId pluginId);
|
||||
|
||||
public abstract void queueActionPerformedEvent(final AnAction action, DataContext context, AnActionEvent event);
|
||||
|
||||
|
||||
|
||||
public abstract boolean isActionPopupStackEmpty();
|
||||
|
||||
public abstract boolean isTransparrentOnlyActionsUpdateNow();
|
||||
|
||||
+3
-3
@@ -22,15 +22,15 @@ import java.lang.ref.WeakReference;
|
||||
|
||||
public final class WeakKeymapManagerListener implements KeymapManagerListener{
|
||||
private final KeymapManagerEx myKeymapManager;
|
||||
private final WeakReference myRef;
|
||||
private final WeakReference<KeymapManagerListener> myRef;
|
||||
|
||||
public WeakKeymapManagerListener(KeymapManagerEx keymapManager,KeymapManagerListener delegate){
|
||||
myKeymapManager=keymapManager;
|
||||
myRef=new WeakReference(delegate);
|
||||
myRef=new WeakReference<KeymapManagerListener>(delegate);
|
||||
}
|
||||
|
||||
public void activeKeymapChanged(Keymap keymap){
|
||||
KeymapManagerListener delegate=(KeymapManagerListener)myRef.get();
|
||||
KeymapManagerListener delegate= myRef.get();
|
||||
if(delegate!=null){
|
||||
delegate.activeKeymapChanged(keymap);
|
||||
}else{
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowAnchor;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -34,11 +35,11 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
/**
|
||||
* Map between <code>id</code>s and registered <code>WindowInfo</code>s.
|
||||
*/
|
||||
private final com.intellij.util.containers.HashMap<String, WindowInfoImpl> myRegisteredId2Info;
|
||||
private final HashMap<String, WindowInfoImpl> myRegisteredId2Info;
|
||||
/**
|
||||
* Map between <code>id</code>s and unregistered <code>WindowInfo</code>s.
|
||||
*/
|
||||
private final com.intellij.util.containers.HashMap<String, WindowInfoImpl> myUnregisteredId2Info;
|
||||
private final HashMap<String, WindowInfoImpl> myUnregisteredId2Info;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -64,8 +65,8 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
@NonNls public static final String ID_ATTR = "id";
|
||||
|
||||
public DesktopLayout() {
|
||||
myRegisteredId2Info = new com.intellij.util.containers.HashMap<String, WindowInfoImpl>();
|
||||
myUnregisteredId2Info = new com.intellij.util.containers.HashMap<String, WindowInfoImpl>();
|
||||
myRegisteredId2Info = new HashMap<String, WindowInfoImpl>();
|
||||
myUnregisteredId2Info = new HashMap<String, WindowInfoImpl>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,18 +76,18 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
*/
|
||||
public final void copyFrom(final DesktopLayout layout) {
|
||||
final WindowInfoImpl[] infos = layout.getAllInfos();
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
WindowInfoImpl info = myRegisteredId2Info.get(infos[i].getId());
|
||||
for (WindowInfoImpl info1 : infos) {
|
||||
WindowInfoImpl info = myRegisteredId2Info.get(info1.getId());
|
||||
if (info != null) {
|
||||
info.copyFrom(infos[i]);
|
||||
info.copyFrom(info1);
|
||||
continue;
|
||||
}
|
||||
info = myUnregisteredId2Info.get(infos[i].getId());
|
||||
info = myUnregisteredId2Info.get(info1.getId());
|
||||
if (info != null) {
|
||||
info.copyFrom(infos[i]);
|
||||
info.copyFrom(info1);
|
||||
}
|
||||
else {
|
||||
myUnregisteredId2Info.put(infos[i].getId(), infos[i].copy());
|
||||
myUnregisteredId2Info.put(info1.getId(), info1.copy());
|
||||
}
|
||||
}
|
||||
// invalidate caches
|
||||
@@ -227,7 +228,7 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
* @return comparator which compares <code>StripeButtons</code> in the stripe with
|
||||
* specified <code>anchor</code>.
|
||||
*/
|
||||
final Comparator comparator(final ToolWindowAnchor anchor) {
|
||||
final Comparator<StripeButton> comparator(final ToolWindowAnchor anchor) {
|
||||
return new MyStripeButtonComparator(anchor);
|
||||
}
|
||||
|
||||
@@ -239,8 +240,7 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
private int getMaxOrder(final ToolWindowAnchor anchor) {
|
||||
int res = -1;
|
||||
final WindowInfoImpl[] infos = getAllInfos();
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
final WindowInfoImpl info = infos[i];
|
||||
for (final WindowInfoImpl info : infos) {
|
||||
if (anchor == info.getAnchor() && res < info.getOrder()) {
|
||||
res = info.getOrder();
|
||||
}
|
||||
@@ -284,9 +284,9 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
info.setSplit(split);
|
||||
}
|
||||
|
||||
public final void readExternal(final org.jdom.Element layoutElement) {
|
||||
for (Iterator i = layoutElement.getChildren().iterator(); i.hasNext();) {
|
||||
final Element e = (Element)i.next();
|
||||
public final void readExternal(final Element layoutElement) {
|
||||
for (Object o : layoutElement.getChildren()) {
|
||||
final Element e = (Element)o;
|
||||
if (WindowInfoImpl.TAG.equals(e.getName())) {
|
||||
final WindowInfoImpl info = new WindowInfoImpl(e.getAttributeValue(ID_ATTR));
|
||||
info.readExternal(e);
|
||||
@@ -300,9 +300,9 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
|
||||
public final void writeExternal(final Element layoutElement) {
|
||||
final WindowInfoImpl[] infos = getAllInfos();
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
for (WindowInfoImpl info : infos) {
|
||||
final Element element = new Element(WindowInfoImpl.TAG);
|
||||
infos[i].writeExternal(element);
|
||||
info.writeExternal(element);
|
||||
layoutElement.addContent(element);
|
||||
}
|
||||
}
|
||||
@@ -328,25 +328,24 @@ public final class DesktopLayout implements JDOMExternalizable {
|
||||
}
|
||||
}
|
||||
|
||||
private final class MyStripeButtonComparator implements Comparator {
|
||||
private final com.intellij.util.containers.HashMap<String, WindowInfoImpl> myId2Info;
|
||||
private final class MyStripeButtonComparator implements Comparator<StripeButton> {
|
||||
private final HashMap<String, WindowInfoImpl> myId2Info;
|
||||
|
||||
public MyStripeButtonComparator(final ToolWindowAnchor anchor) {
|
||||
myId2Info = new com.intellij.util.containers.HashMap<String, WindowInfoImpl>();
|
||||
myId2Info = new HashMap<String, WindowInfoImpl>();
|
||||
final WindowInfoImpl[] infos = getInfos();
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
final WindowInfoImpl info = infos[i];
|
||||
for (final WindowInfoImpl info : infos) {
|
||||
if (anchor == info.getAnchor()) {
|
||||
myId2Info.put(info.getId(), info.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final int compare(final Object obj1, final Object obj2) {
|
||||
final WindowInfoImpl info1 = myId2Info.get(((StripeButton)obj1).getWindowInfo().getId());
|
||||
public final int compare(final StripeButton obj1, final StripeButton obj2) {
|
||||
final WindowInfoImpl info1 = myId2Info.get(obj1.getWindowInfo().getId());
|
||||
final int order1 = info1 != null ? info1.getOrder() : 0;
|
||||
|
||||
final WindowInfoImpl info2 = myId2Info.get(((StripeButton)obj2).getWindowInfo().getId());
|
||||
final WindowInfoImpl info2 = myId2Info.get(obj2.getWindowInfo().getId());
|
||||
final int order2 = info2 != null ? info2.getOrder() : 0;
|
||||
|
||||
return order1 - order2;
|
||||
|
||||
Reference in New Issue
Block a user