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) {
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : documentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
@ -447,6 +448,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildFileList(final String searchText) {
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : fileModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
@ -454,6 +456,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildActionList(final String searchText) {
SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : actionModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
@ -461,6 +464,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildPluginList(final String searchText) {
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : pluginModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
@ -468,6 +472,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildRecommendList(final String searchText) {
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : recommendModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
@ -475,6 +480,7 @@ public class AlphaFineDialog extends UIDialog {
private void buildRecentList(final String searchText) {
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText);
for (AlphaCellModel object : recentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
@ -1001,7 +1007,7 @@ public class AlphaFineDialog extends UIDialog {
}
@Override
public synchronized void add(int index, AlphaCellModel element) {
public void add(int index, AlphaCellModel element) {
myDelegate.add(index, element);
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()) {
String result;
try {
String url = AlphaFineConstants.PLUGIN_SEARCH_URL;
final HashMap<String, String> para = new HashMap<>();
para.put("keyword", searchText);
HttpClient httpClient = new HttpClient(url, para, true);
String encodedKey = URLEncoder.encode(searchText, "UTF-8");
String url = AlphaFineConstants.PLUGIN_SEARCH_URL + "?keyword=" + encodedKey;
HttpClient httpClient = new HttpClient(url);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return getNoConnectList();
@ -124,6 +123,9 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
} catch (JSONException e) {
FRLogger.getLogger().error("plugin search json error :" + e.getMessage());
return this.lessModelList;
} catch (UnsupportedEncodingException e) {
FRLogger.getLogger().error("plugin search encode error :" + e.getMessage());
return this.lessModelList;
}
}
return this.lessModelList;

Loading…
Cancel
Save