-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddbeaaa
commit 172bbd9
Showing
16 changed files
with
334 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,43 @@ | ||
<idea-plugin> | ||
<id>com.shenhua.idea.plugin.quoit</id> | ||
<name>Quoit</name> | ||
<version>1.0.0</version> | ||
<vendor email="shenhuanet@126.com" url="http://www.shenhuanet.com">ShenhuaTech</vendor> | ||
<id>com.shenhua.idea.plugin.quoit</id> | ||
<name>Quoit</name> | ||
<version>1.0.1</version> | ||
<vendor email="shenhuanet@126.com" url="http://www.shenhuanet.com">ShenhuaTech</vendor> | ||
|
||
<description><![CDATA[ | ||
<description><![CDATA[ | ||
A plug-in that generates a two-dimensional code of a specific text.<br> | ||
]]></description> | ||
|
||
<change-notes><![CDATA[ | ||
<change-notes><![CDATA[ | ||
First release.<br> | ||
]]> | ||
</change-notes> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description --> | ||
<idea-version since-build="145.0"/> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html | ||
on how to target different products --> | ||
<!-- uncomment to enable plugin in all products--> | ||
<depends>com.intellij.modules.lang</depends> | ||
|
||
<extensions defaultExtensionNs="com.intellij"> | ||
<!-- Add your extensions here --> | ||
<toolWindow id="Quoit" icon="/icon/logo_13.png" anchor="bottom" | ||
canCloseContents="true" | ||
factoryClass="com.shenhua.idea.plugin.quoit.ui.QuoitView"/> | ||
</extensions> | ||
|
||
<project-components> | ||
<component> | ||
<implementation-class>com.shenhua.idea.plugin.quoit.MainComponent</implementation-class> | ||
</component> | ||
</project-components> | ||
|
||
<actions> | ||
<!-- Add your actions here --> | ||
</actions> | ||
</change-notes> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description --> | ||
<idea-version since-build="145.0"/> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html | ||
on how to target different products --> | ||
<!-- uncomment to enable plugin in all products--> | ||
<depends>com.intellij.modules.lang</depends> | ||
|
||
<extensions defaultExtensionNs="com.intellij"> | ||
<!-- Add your extensions here --> | ||
<toolWindow id="Quoit" icon="/icon/logo_13.png" anchor="bottom" | ||
canCloseContents="true" | ||
factoryClass="com.shenhua.idea.plugin.quoit.ui.QuoitView"/> | ||
<projectService serviceInterface="com.shenhua.idea.plugin.quoit.core.HistoryConfig" | ||
serviceImplementation="com.shenhua.idea.plugin.quoit.core.HistoryConfig"/> | ||
</extensions> | ||
|
||
<project-components> | ||
<component> | ||
<implementation-class>com.shenhua.idea.plugin.quoit.MainComponent</implementation-class> | ||
</component> | ||
</project-components> | ||
|
||
<actions> | ||
<!-- Add your actions here --> | ||
</actions> | ||
|
||
</idea-plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.shenhua.idea.plugin.quoit.core; | ||
|
||
import com.intellij.openapi.components.*; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.util.xmlb.XmlSerializerUtil; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by shenhua on 2018-02-01-0001. | ||
* | ||
* @author shenhua | ||
* Email shenhuanet@126.com | ||
*/ | ||
@State( | ||
name = "Quoit.History", | ||
storages = {@Storage(id = "Quoit", file = StoragePathMacros.WORKSPACE_FILE)} | ||
) | ||
public class HistoryConfig implements PersistentStateComponent<HistoryConfig> { | ||
|
||
private HistoryConfig() { | ||
} | ||
|
||
private List<String> histories; | ||
|
||
static HistoryConfig getInstance(Project project) { | ||
return ServiceManager.getService(project, HistoryConfig.class); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public HistoryConfig getState() { | ||
System.out.println("--- getState"); | ||
return this; | ||
} | ||
|
||
@Override | ||
public void loadState(HistoryConfig historyConfig) { | ||
System.out.println("--- loadState"); | ||
XmlSerializerUtil.copyBean(historyConfig, this); | ||
} | ||
|
||
List<String> getHistories() { | ||
return histories; | ||
} | ||
|
||
void setHistories(List<String> histories) { | ||
this.histories = histories; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/com/shenhua/idea/plugin/quoit/core/HistoryConfigImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.shenhua.idea.plugin.quoit.core; | ||
|
||
import b.c.H; | ||
import com.intellij.openapi.options.Configurable; | ||
import com.intellij.openapi.options.ConfigurationException; | ||
import com.intellij.openapi.project.Project; | ||
import org.jetbrains.annotations.Nls; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import javax.swing.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by shenhua on 2018-02-01-0001. | ||
* | ||
* @author shenhua | ||
* Email shenhuanet@126.com | ||
*/ | ||
public class HistoryConfigImpl implements Configurable { | ||
|
||
private final HistoryConfig historyConfig; | ||
private List<String> histories = new ArrayList<>(); | ||
|
||
public HistoryConfigImpl(Project project) { | ||
historyConfig = HistoryConfig.getInstance(project); | ||
} | ||
|
||
@Nls | ||
@Override | ||
public String getDisplayName() { | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public JComponent createComponent() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isModified() { | ||
return false; | ||
} | ||
|
||
/** | ||
* 1.set the histories object want to save; | ||
* | ||
* @param histories histories | ||
*/ | ||
public void setHistories(List<String> histories) { | ||
this.histories = histories; | ||
} | ||
|
||
/** | ||
* 2.apply; | ||
* | ||
* @throws ConfigurationException e | ||
*/ | ||
@Override | ||
public void apply() throws ConfigurationException { | ||
historyConfig.setHistories(histories); | ||
System.out.println("添加成功!" + histories.size()); | ||
} | ||
|
||
/** | ||
* get histories that it saved. | ||
* | ||
* @return ArrayList<History> | ||
*/ | ||
public List<String> getHistories() { | ||
return historyConfig.getHistories(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/com/shenhua/idea/plugin/quoit/core/HistoryListModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.shenhua.idea.plugin.quoit.core; | ||
|
||
import javax.swing.*; | ||
import javax.swing.event.ListDataListener; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by shenhua on 2018-02-01-0001. | ||
* | ||
* @author shenhua | ||
* Email shenhuanet@126.com | ||
*/ | ||
public class HistoryListModel implements ListModel<String> { | ||
|
||
private List<String> histories; | ||
|
||
public HistoryListModel(List<String> histories) { | ||
this.histories = histories; | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return histories == null ? 0 : histories.size(); | ||
} | ||
|
||
@Override | ||
public String getElementAt(int index) { | ||
return histories.get(index); | ||
} | ||
|
||
@Override | ||
public void addListDataListener(ListDataListener l) { | ||
|
||
} | ||
|
||
@Override | ||
public void removeListDataListener(ListDataListener l) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.