Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加每日一题的入口 #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.shuzijun.leetcode.plugin.actions.toolbar;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.shuzijun.leetcode.plugin.actions.AbstractAction;
import com.shuzijun.leetcode.plugin.manager.CodeManager;
import com.shuzijun.leetcode.plugin.manager.QuestionManager;
import com.shuzijun.leetcode.plugin.model.Config;
import com.shuzijun.leetcode.plugin.model.Question;
import org.apache.commons.collections.CollectionUtils;

import java.util.List;

/**
* @author gn.binarybei
* @date 2021/9/18
* @note
*/
public class DailyAction extends AbstractAction {

@Override
public void actionPerformed(AnActionEvent anActionEvent, Config config) {
Project project = anActionEvent.getProject();
List<Question> questionCache = QuestionManager.getQuestionCache();
if(CollectionUtils.isNotEmpty(questionCache)){
CodeManager.openCode(questionCache.get(0), project);
}
}
}
3 changes: 2 additions & 1 deletion src/main/java/icons/LeetCodeEditorIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author shuzijun
*/
public interface LeetCodeEditorIcons {

Icon LEETCODE_TOOL_WINDOW = IconLoader.getIcon("/icons/LeetCode.svg");
Icon EMPEROR_NEW_CLOTHES = IconLoader.getIcon("/icons/emperor_new_clothes.svg");

Expand All @@ -30,6 +30,7 @@ public interface LeetCodeEditorIcons {
Icon PROGRESS = IconLoader.getIcon("/icons/progress.svg");
Icon QUESTION = IconLoader.getIcon("/icons/question.svg");
Icon RANDOM = IconLoader.getIcon("/icons/random.svg");
Icon DAILY = IconLoader.getIcon("/icons/daily.svg");
Icon REFRESH = IconLoader.getIcon("/icons/refresh.svg");
Icon RUN = IconLoader.getIcon("/icons/run.svg");
Icon SOLUTION = IconLoader.getIcon("/icons/solution.svg");
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@
<action id="leetcode.PickAction" class="com.shuzijun.leetcode.plugin.actions.toolbar.PickAction"
text="Pick one" description="Pick one" icon="LeetCodeEditorIcons.RANDOM">
</action>
<action id="leetcode.DaliyAction" class="com.shuzijun.leetcode.plugin.actions.toolbar.DailyAction"
text="Daily one" description="Daily one" icon="LeetCodeEditorIcons.DAILY">
</action>
<action id="leetcode.positionAction" class="com.shuzijun.leetcode.plugin.actions.editor.PositionAction"
text="position" description="position" icon="LeetCodeEditorIcons.POSITION"/>

Expand All @@ -248,6 +251,7 @@
<separator/>
<reference id="leetcode.RefreshAction"/>
<reference id="leetcode.PickAction"/>
<reference id="leetcode.DaliyAction"/>
<reference id="leetcode.FindAction"/>
<reference id="leetcode.positionAction"/>
<reference id="leetcode.CollapseAction"/>
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/icons/daily.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/main/resources/icons/daily_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.