|
|
@ -20,7 +20,7 @@ import java.awt.event.KeyEvent; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Created by XiaXiang on 2017/4/6. |
|
|
|
* Created by XiaXiang on 2017/4/6. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class AlphafineConfigPane extends BasicPane { |
|
|
|
public class AlphaFineConfigPane extends BasicPane { |
|
|
|
private static final String TYPE = "pressed"; |
|
|
|
private static final String TYPE = "pressed"; |
|
|
|
private static final String DISPLAY_TYPE = "+"; |
|
|
|
private static final String DISPLAY_TYPE = "+"; |
|
|
|
private static final String BACK_SLASH = "BACK_SLASH"; |
|
|
|
private static final String BACK_SLASH = "BACK_SLASH"; |
|
|
@ -56,7 +56,7 @@ public class AlphafineConfigPane extends BasicPane { |
|
|
|
private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox; |
|
|
|
private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox; |
|
|
|
private UITextField shortcutsField; |
|
|
|
private UITextField shortcutsField; |
|
|
|
|
|
|
|
|
|
|
|
public AlphafineConfigPane() { |
|
|
|
public AlphaFineConfigPane() { |
|
|
|
this.initComponents(); |
|
|
|
this.initComponents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -71,7 +71,7 @@ public class AlphafineConfigPane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Component[][] initsearchRangeComponents() { |
|
|
|
private Component[][] initSearchRangeComponents() { |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, |
|
|
|
new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, |
|
|
|
new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox} |
|
|
|
new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox} |
|
|
@ -91,7 +91,7 @@ public class AlphafineConfigPane extends BasicPane { |
|
|
|
isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP")); |
|
|
|
isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP")); |
|
|
|
isContainTemplateCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates")); |
|
|
|
isContainTemplateCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates")); |
|
|
|
isContainFileContentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates_Content")); |
|
|
|
isContainFileContentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates_Content")); |
|
|
|
JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initsearchRangeComponents(), rowSize, columnSize); |
|
|
|
JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize); |
|
|
|
northPane.add(searchConfigPane); |
|
|
|
northPane.add(searchConfigPane); |
|
|
|
contentPane.add(northPane); |
|
|
|
contentPane.add(northPane); |
|
|
|
} |
|
|
|
} |
|
|
@ -154,34 +154,35 @@ public class AlphafineConfigPane extends BasicPane { |
|
|
|
return "AlphaFine"; |
|
|
|
return "AlphaFine"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void populate(AlphafineConfigManager alphafineConfigManager) { |
|
|
|
public void populate(AlphaFineConfigManager alphaFineConfigManager) { |
|
|
|
this.isEnabledCheckbox.setSelected(alphafineConfigManager.isEnabled()); |
|
|
|
this.isEnabledCheckbox.setSelected(alphaFineConfigManager.isEnabled()); |
|
|
|
this.isSearchOnlineCheckbox.setSelected(alphafineConfigManager.isSearchOnLine()); |
|
|
|
this.isSearchOnlineCheckbox.setSelected(alphaFineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainActionCheckbox.setSelected(alphafineConfigManager.isContainAction()); |
|
|
|
this.isContainActionCheckbox.setSelected(alphaFineConfigManager.isContainAction()); |
|
|
|
this.isContainTemplateCheckbox.setSelected(alphafineConfigManager.isContainTemplate()); |
|
|
|
this.isContainTemplateCheckbox.setSelected(alphaFineConfigManager.isContainTemplate()); |
|
|
|
this.isContainDocumentCheckbox.setSelected(alphafineConfigManager.isContainDocument() && alphafineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainFileContentCheckbox.setSelected(alphaFineConfigManager.isContainFileContent()); |
|
|
|
this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && alphaFineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainDocumentCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && alphaFineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainRecommendCheckbox.setSelected(alphafineConfigManager.isContainRecommend() && alphafineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainPluginCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainRecommendCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); |
|
|
|
this.isContainRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && alphaFineConfigManager.isSearchOnLine()); |
|
|
|
this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts())); |
|
|
|
this.isContainRecommendCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine()); |
|
|
|
shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts()); |
|
|
|
this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts())); |
|
|
|
|
|
|
|
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void update() { |
|
|
|
public void update() { |
|
|
|
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); |
|
|
|
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); |
|
|
|
AlphafineConfigManager alphafineConfigManager = designerEnvManager.getAlphafineConfigManager(); |
|
|
|
AlphaFineConfigManager alphaFineConfigManager = designerEnvManager.getAlphaFineConfigManager(); |
|
|
|
alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected()); |
|
|
|
alphaFineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected()); |
|
|
|
alphafineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText()); |
|
|
|
alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText()); |
|
|
|
designerEnvManager.setAlphafineConfigManager(alphafineConfigManager); |
|
|
|
designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager); |
|
|
|
try { |
|
|
|
try { |
|
|
|
DesignerEnvManager.loadLogSetting(); |
|
|
|
DesignerEnvManager.loadLogSetting(); |
|
|
|
DesignerEnvManager.getEnvManager().saveXMLFile(); |
|
|
|
DesignerEnvManager.getEnvManager().saveXMLFile(); |
|
|
@ -192,8 +193,8 @@ public class AlphafineConfigPane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String getDisplayShortCut(String shotrCut) { |
|
|
|
private String getDisplayShortCut(String shortCut) { |
|
|
|
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) |
|
|
|
return shortCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) |
|
|
|
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) |
|
|
|
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) |
|
|
|
.replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) |
|
|
|
.replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) |
|
|
|
.replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND); |
|
|
|
.replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND); |