remove intellij.shortcutPromoter plugin

This commit is contained in:
Konstantin Bulenkov
2018-11-23 14:52:30 +01:00
parent 6e7214f5bb
commit beb17dc9b2
7 changed files with 0 additions and 178 deletions

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="intellij.platform.editor" />
<orderEntry type="module" module-name="intellij.platform.ide" />
<orderEntry type="library" name="JDOM" level="project" />
</component>
</module>

View File

@@ -1,20 +0,0 @@
<idea-plugin>
<name>Shortcut Promoter</name>
<id>com.intellij.promoter</id>
<version>1.0</version>
<vendor>JetBrains</vendor>
<description>The plugin advertises to use shortcuts instead of mouse clicks</description>
<depends>com.intellij.modules.platform</depends>
<application-components>
<component>
<implementation-class>com.intellij.promoter.ShortcutPromoterManager</implementation-class>
</component>
</application-components>
<extensionPoints>
<extensionPoint qualifiedName="com.intellij.shortcutPromoter" beanClass="com.intellij.promoter.ShortcutPromoterEP"/>
</extensionPoints>
<extensions defaultExtensionNs="com.intellij">
<shortcutPromoter actionId="Debug" skip="3" repeat="2"/>
</extensions>
</idea-plugin>

View File

@@ -1,20 +0,0 @@
package com.intellij.promoter;
/**
* @author Konstantin Bulenkov
*/
public class PromoterState {
private int myClicks;
public int getClicks() {
return myClicks;
}
public void setClicks(int clicks) {
myClicks = clicks;
}
public void incClicks() {
myClicks++;
}
}

View File

@@ -1,32 +0,0 @@
package com.intellij.promoter;
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.util.xmlb.annotations.Attribute;
import org.jetbrains.annotations.Nullable;
/**
* @author Konstantin Bulenkov
*/
public class ShortcutPromoterEP extends AbstractExtensionPointBean {
public static final ExtensionPointName<ShortcutPromoterEP> EP_NAME = new ExtensionPointName<>("com.intellij.shortcutPromoter");
@Attribute("actionId")
public String actionId;
@Attribute("skip")
public int skip;
@Attribute("repeat")
public int repeat;
@Nullable
public static ShortcutPromoterEP find(@Nullable String actionId) {
for (ShortcutPromoterEP ep : EP_NAME.getExtensions()) {
if (ep.actionId.equals(actionId)) {
return ep;
}
}
return null;
}
}

View File

@@ -1,88 +0,0 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.promoter;
import com.intellij.application.Topics;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.ex.AnActionListener;
import com.intellij.openapi.components.*;
import com.intellij.openapi.util.text.StringUtil;
import gnu.trove.THashMap;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author Konstantin Bulenkov
*/
@State(
name = "ShortcutPromoterManager",
storages = @Storage(value = "promoter.xml", roamingType = RoamingType.PER_OS)
)
public class ShortcutPromoterManager implements AnActionListener, PersistentStateComponent<Element>, BaseComponent {
private final Map<String, PromoterState> myState = new LinkedHashMap<>();
private final Map<String, ShortcutPromoterEP> myExtensions = new THashMap<>();
@Override
public void initComponent() {
myExtensions.clear();
myState.clear();
for (ShortcutPromoterEP ep : ShortcutPromoterEP.EP_NAME.getExtensionList()) {
myExtensions.put(ep.actionId, ep);
}
Topics.subscribe(AnActionListener.TOPIC, null, this);
}
@Override
public void beforeActionPerformed(@NotNull AnAction action, @NotNull DataContext dataContext, AnActionEvent event) {
final InputEvent input = event.getInputEvent();
if (input instanceof MouseEvent) {
final String id = ActionManager.getInstance().getId(action);
final ShortcutPromoterEP ep = myExtensions.get(id);
if (ep != null) {
PromoterState state = myState.get(id);
if (state == null) {
state = new PromoterState();
myState.put(id, state);
}
state.incClicks();
}
}
}
@Nullable
@Override
public Element getState() {
final Element actions = new Element("actions");
for (String id : myState.keySet()) {
final Element action = new Element("action");
action.setAttribute("actionId", id);
action.setAttribute("clicks", String.valueOf(myState.get(id).getClicks()));
actions.addContent(action);
}
return actions;
}
@Override
public void loadState(@NotNull Element state) {
myState.clear();
for (Element action : state.getChildren("action")) {
try {
PromoterState info = new PromoterState();
info.setClicks(StringUtil.parseInt(action.getAttributeValue("clicks"), 0));
myState.put(action.getAttributeValue("actionId"), info);
}
catch (Exception ignore) {
}
}
}
}

View File

@@ -13,7 +13,6 @@
<orderEntry type="module" module-name="intellij.python.helpers" />
<orderEntry type="module" module-name="intellij.pycharm.community" />
<orderEntry type="module" module-name="intellij.platform.main" />
<orderEntry type="module" module-name="intellij.shortcutPromoter" />
<orderEntry type="module" module-name="intellij.pycharm.edu" />
<orderEntry type="module" module-name="intellij.vcs.hg" />
<orderEntry type="module" module-name="intellij.python.ipnb" />

View File

@@ -19,7 +19,6 @@
<orderEntry type="module" module-name="intellij.pycharm.community" />
<orderEntry type="module" module-name="intellij.platform.main" />
<orderEntry type="module" module-name="intellij.tasks.jira" />
<orderEntry type="module" module-name="intellij.shortcutPromoter" />
<orderEntry type="module" module-name="intellij.python.ipnb" />
<orderEntry type="module" module-name="intellij.settingsRepository" />
<orderEntry type="module" module-name="intellij.python.terminal" />