Browse Source

插件搜索问题

master
XiaXiang 7 years ago
parent
commit
43d6792db4
  1. 8
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 10
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java

8
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -440,6 +440,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildDocumentList(final String searchText) { private void buildDocumentList(final String searchText) {
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText); SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : documentModelList) { for (AlphaCellModel object : documentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
@ -447,6 +448,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildFileList(final String searchText) { private void buildFileList(final String searchText) {
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText); SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : fileModelList) { for (AlphaCellModel object : fileModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
@ -454,6 +456,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildActionList(final String searchText) { private void buildActionList(final String searchText) {
SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText); SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : actionModelList) { for (AlphaCellModel object : actionModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
@ -461,6 +464,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildPluginList(final String searchText) { private void buildPluginList(final String searchText) {
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText); SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : pluginModelList) { for (AlphaCellModel object : pluginModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
@ -468,6 +472,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildRecommendList(final String searchText) { private void buildRecommendList(final String searchText) {
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText); SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : recommendModelList) { for (AlphaCellModel object : recommendModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
@ -475,6 +480,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildRecentList(final String searchText) { private void buildRecentList(final String searchText) {
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText); SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText);
for (AlphaCellModel object : recentModelList) { for (AlphaCellModel object : recentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
@ -1001,7 +1007,7 @@ public class AlphaFineDialog extends UIDialog {
} }
@Override @Override
public synchronized void add(int index, AlphaCellModel element) { public void add(int index, AlphaCellModel element) {
myDelegate.add(index, element); myDelegate.add(index, element);
fireIntervalAdded(this, index, index); fireIntervalAdded(this, index, index);
} }

10
designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java

@ -90,10 +90,9 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
String result; String result;
try { try {
String url = AlphaFineConstants.PLUGIN_SEARCH_URL; String encodedKey = URLEncoder.encode(searchText, "UTF-8");
final HashMap<String, String> para = new HashMap<>(); String url = AlphaFineConstants.PLUGIN_SEARCH_URL + "?keyword=" + encodedKey;
para.put("keyword", searchText); HttpClient httpClient = new HttpClient(url);
HttpClient httpClient = new HttpClient(url, para, true);
httpClient.asGet(); httpClient.asGet();
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
return getNoConnectList(); return getNoConnectList();
@ -124,6 +123,9 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error("plugin search json error :" + e.getMessage()); FRLogger.getLogger().error("plugin search json error :" + e.getMessage());
return this.lessModelList; return this.lessModelList;
} catch (UnsupportedEncodingException e) {
FRLogger.getLogger().error("plugin search encode error :" + e.getMessage());
return this.lessModelList;
} }
} }
return this.lessModelList; return this.lessModelList;

Loading…
Cancel
Save