/*
 * Copyright 2000-2013 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.platform;

import com.intellij.ide.SearchTopHitProvider;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;

/**
 * @author Konstantin Bulenkov
 */
public class DefaultPlatformTopHitProvider implements SearchTopHitProvider {

  @Override
  public void consumeTopHits(String pattern, Consumer<Object> collector) {
    //todo[kb] move to constant. Now it's better for hotswap
    String[][] ACTION_MATRIX = {
       {"op", "open ", "OpenFile"},
       {"reo", "reopen ", "$LRU"},
       {"new", "new ", "NewGroup"},
       {"new c", "new class ", "NewClass"},
       {"new i", "new interface ", "NewClass"},
       {"new e", "new enum ", "NewClass"},
     };
    final ActionManager actionManager = ActionManager.getInstance();
    for (String[] strings : ACTION_MATRIX) {
      if (StringUtil.isBetween(pattern, strings[0], strings[1])) {
        for (int i = 2; i < strings.length; i++) {
          collector.consume(actionManager.getAction(strings[i]));
        }
      }
    }
  }
}

@@ -650,22 +650,23 @@
 lij.ide.
-Search
+Actions
 TopHitPr
@@ -676,149 +676,8 @@
 der;
-%0Aimport com.intellij.openapi.actionSystem.ActionManager;%0Aimport com.intellij.openapi.util.text.StringUtil;%0Aimport com.intellij.util.Consumer;
 %0A%0A/*
@@ -760,25 +760,23 @@
 der 
-implements Search
+extends Actions
 TopH
@@ -792,160 +792,30 @@
 r %7B%0A
-%0A  @Override%0A  public void consumeTopHits(String pattern, Consumer%3CObject%3E collector) %7B%0A    //todo%5Bkb%5D move to constant. Now it's better for hotswap%0A   
+  private static final
  Str
@@ -845,18 +845,16 @@
  %7B%0A     
-  
 %7B%22op%22, %22
@@ -879,18 +879,16 @@
 %7D,%0A     
-  
 %7B%22reo%22, 
@@ -908,26 +908,24 @@
 LRU%22%7D,%0A     
-  
 %7B%22new%22, %22new
@@ -937,26 +937,24 @@
 NewGroup%22%7D,%0A
-  
      %7B%22new c
@@ -975,34 +975,32 @@
 %22, %22NewClass%22%7D,%0A
-  
      %7B%22new i%22, %22
@@ -1034,18 +1034,16 @@
 %7D,%0A     
-  
 %7B%22new e%22
@@ -1077,334 +1077,93 @@
 %0A   
-  
 %7D;%0A
-    final ActionManager actionManager = ActionManager.getInstance();%0A    for (String%5B%5D strings : ACTION_MATRIX) %7B%0A      if (StringUtil.isBetween(pattern, strings%5B0%5D, strings%5B1%5D)) %7B%0A        for (int i = 2; i %3C strings.length; i++) %7B%0A          collector.consume(actionManager.getAction(strings%5Bi%5D));%0A        %7D%0A      %7D%0A    %7D
+%0A  @Override%0A  protected String%5B%5D%5B%5D getActionsMatrix() %7B%0A    return ACTION_MATRIX;
 %0A  %7D

simplify by extending ActionsTopHitProvider