diff --git a/README.md b/README.md index 0310aa7..0e92059 100644 --- a/README.md +++ b/README.md @@ -1 +1,37 @@ -# git-conflict \ No newline at end of file +# git-conflict + +[![GitHub release](https://img.shields.io/github/release/liying2008/git-conflict.svg)](https://github.com/liying2008/git-conflict/releases) +[![license](https://img.shields.io/github/license/liying2008/git-conflict.svg)](https://github.com/liying2008/git-conflict/blob/master/LICENSE) + +一款 JetBrains IDEA / Android Studio 等 IDE 的 `Git` 冲突 **高亮显示** 的插件。 + +## How to Install + +- 在 [GitHub Releases](https://github.com/liying2008/git-conflict/releases) 页面下载最新的 `jar` 包,然后通过 `Settings -> Plugins -> Install plugin from disk..` 选择下载的 `jar` 包安装。 + + +## How to Use + +**高亮显示冲突:** 打开包含冲突的文件,然后在编辑区域右键选择 `Highlight Git Conflict` (快捷键 `shift ctrl G`),就可以看到冲突部分被高亮显示了: + +![highlight-git-conflict](example/highlight-git-conflict.png) + +**取消高亮显示冲突:** 在编辑区域再次右键,选择 `Cancel Highlight Git Conflict` (快捷键 `shift ctrl alt G`)即可。 + +**快速解决冲突:** 在高亮状态下,在编辑区域右键,可看到 `Fix Git Conflict` 菜单组里提供了三种解决冲突的预置方案: +- *Accept Current Change:* 采用当前更改 +- *Accept Incoming Change:* 采用传入的更改 +- *Accept Both Changes:* 保留双方更改 + +**Screenshot:** + +![fix-git-conflict](example/fix-git-conflict.gif) + +**设置面板:** 通过 `Settings -> Tools -> Git Conflict` 进入设置面板,可以根据 IDE 的颜色方案选择冲突高亮的颜色方案: + +![settings-panel](example/settings-panel.png) + +## Contact Me + +CSDN:[http://blog.csdn.net/u012939909](http://blog.csdn.net/u012939909) +Email:[liruoer2008@yeah.net](mailto:liruoer2008@yeah.net) \ No newline at end of file diff --git a/changeNotes.html b/changeNotes.html index b38f22e..ff91e06 100644 --- a/changeNotes.html +++ b/changeNotes.html @@ -1,2 +1,5 @@ -

v0.0.1-rc

+

v0.0.1-rc

+A plugin for Jetbrains IDE aim to highlight git conflict content.
+please see liying2008/git-conflict for more information. +
  • The first release.
  • \ No newline at end of file diff --git a/description.html b/description.html index a5f1069..06cf5d5 100644 --- a/description.html +++ b/description.html @@ -1,2 +1,6 @@ +

    Introduce

    Highlight git conflict content and fix conflicts more -conveniently. \ No newline at end of file +conveniently. +
    +

    Screenshot

    + diff --git a/example/fix-git-conflict.gif b/example/fix-git-conflict.gif new file mode 100644 index 0000000..847786e Binary files /dev/null and b/example/fix-git-conflict.gif differ diff --git a/example/highlight-git-conflict.png b/example/highlight-git-conflict.png new file mode 100644 index 0000000..ee568cb Binary files /dev/null and b/example/highlight-git-conflict.png differ diff --git a/example/settings-panel.png b/example/settings-panel.png new file mode 100644 index 0000000..5b66c32 Binary files /dev/null and b/example/settings-panel.png differ diff --git a/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.form b/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.form index c030d1a..ba974ca 100644 --- a/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.form +++ b/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.form @@ -1,6 +1,6 @@
    - + @@ -8,35 +8,30 @@ - + - + - + - + - + - - - + - + - + - + - + - - - - + diff --git a/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.java b/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.java index f3da3f9..2502f4f 100644 --- a/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.java +++ b/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanel.java @@ -1,6 +1,7 @@ package cc.duduhuo.git.conflict.setting; import com.intellij.openapi.options.SearchableConfigurable; +import com.intellij.openapi.ui.ComboBox; import javax.swing.*; @@ -13,7 +14,13 @@ * ======================================================= */ public abstract class ColorSettingsPanel implements SearchableConfigurable { - protected JRadioButton radioDefault; - protected JRadioButton radioDarcula; + protected static final String DEFAULT = "Default"; + protected static final String DARCULA = "Darcula"; protected JPanel mainPanel; + protected ComboBox cbColorScheme; + + private void createUIComponents() { + String[] schemes = new String[]{DEFAULT, DARCULA}; + cbColorScheme = new ComboBox<>(schemes); + } } diff --git a/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanelImpl.java b/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanelImpl.java index 5dac37a..236cbb2 100644 --- a/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanelImpl.java +++ b/src/main/java/cc/duduhuo/git/conflict/setting/ColorSettingsPanelImpl.java @@ -2,7 +2,6 @@ import cc.duduhuo.git.conflict.*; import cc.duduhuo.git.conflict.action.HighlightConflictAction; -import com.intellij.openapi.options.SearchableConfigurable; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,19 +17,16 @@ * ======================================================= */ public class ColorSettingsPanelImpl extends ColorSettingsPanel { + public ColorSettingsPanelImpl() { initUI(); } private void initUI() { - radioDefault.setSelected(false); - radioDarcula.setSelected(false); if (GlobalSettings.getMarkColor().equals(SettingsService.ColorSettings.DEFAULT)) { - System.out.println("default=="); - radioDefault.setSelected(true); + cbColorScheme.setSelectedItem(DEFAULT); } else if (GlobalSettings.getMarkColor().equals(SettingsService.ColorSettings.DARCULA)) { - System.out.println("darcula=="); - radioDarcula.setSelected(true); + cbColorScheme.setSelectedItem(DARCULA); } } @@ -54,9 +50,9 @@ public JComponent createComponent() { @Override public boolean isModified() { - if (radioDefault.isSelected()) { + if (cbColorScheme.getSelectedItem() == DEFAULT) { return !GlobalSettings.getMarkColor().equals(SettingsService.ColorSettings.DEFAULT); - } else if (radioDarcula.isSelected()) { + } else if (cbColorScheme.getSelectedItem() == DARCULA) { return !GlobalSettings.getMarkColor().equals(SettingsService.ColorSettings.DARCULA); } return false; @@ -64,18 +60,15 @@ public boolean isModified() { @Override public void reset() { - radioDefault.setSelected(true); - radioDarcula.setSelected(false); -// GlobalSettings.getMarkColor().setMarkColor(SettingsService.ColorSettings.DEFAULT); } @Override public void apply() { boolean isModified = isModified(); - if (radioDefault.isSelected()) { + if (cbColorScheme.getSelectedItem() == DEFAULT) { GlobalSettings.getMarkColor().setMarkColor(SettingsService.ColorSettings.DEFAULT); Global.sCurrentColor = SettingsService.ColorSettings.DEFAULT; - } else if (radioDarcula.isSelected()) { + } else if (cbColorScheme.getSelectedItem() == DARCULA) { GlobalSettings.getMarkColor().setMarkColor(SettingsService.ColorSettings.DARCULA); Global.sCurrentColor = SettingsService.ColorSettings.DARCULA; } diff --git a/src/main/java/cc/duduhuo/git/conflict/setting/SettingsServiceImpl.java b/src/main/java/cc/duduhuo/git/conflict/setting/SettingsServiceImpl.java index 89f3b1f..44d6f7a 100644 --- a/src/main/java/cc/duduhuo/git/conflict/setting/SettingsServiceImpl.java +++ b/src/main/java/cc/duduhuo/git/conflict/setting/SettingsServiceImpl.java @@ -22,13 +22,13 @@ public class SettingsServiceImpl implements SettingsService, PersistentStateComp @Nullable @Override public MarkColor getState() { - System.out.println("getState()"); + //System.out.println("getState()"); return XmlSerializerUtil.createCopy(markColor); } @Override public void loadState(@NotNull MarkColor markColor) { - System.out.println("loadState()"); + //System.out.println("loadState()"); XmlSerializerUtil.copyBean(markColor, this.markColor); } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index cb40ff2..1e128de 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -7,13 +7,13 @@ - com.intellij.modules.lang - --> + - + - +