|
|
|
@ -7,7 +7,6 @@ import com.fr.design.notification.Notification;
|
|
|
|
|
import com.fr.design.notification.NotificationCenter; |
|
|
|
|
import com.fr.plugin.error.PluginErrorRemindHandler; |
|
|
|
|
import com.fr.plugin.error.PluginErrorReminder; |
|
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.collections.CollectionUtils; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
@ -23,9 +22,10 @@ import java.util.List;
|
|
|
|
|
public class PluginErrorDesignReminder implements PluginErrorReminder { |
|
|
|
|
|
|
|
|
|
private static final String MESSAGE_ID = "plugin-invalidate-remind"; |
|
|
|
|
private static final String COMMA = "、"; |
|
|
|
|
private static final String COLON = ":"; |
|
|
|
|
private static final String NEW_LINE_TAG = "<br/>"; |
|
|
|
|
public static final String COMMA = "、"; |
|
|
|
|
public static final String COLON = ":"; |
|
|
|
|
public static final String NEW_LINE_TAG = "<br/>"; |
|
|
|
|
private static final int MAX_PLUGIN_NAME_PER_LINE = 3; |
|
|
|
|
|
|
|
|
|
private static class Holder { |
|
|
|
|
private static final PluginErrorDesignReminder INSTANCE = new PluginErrorDesignReminder(); |
|
|
|
@ -84,13 +84,33 @@ public class PluginErrorDesignReminder implements PluginErrorReminder {
|
|
|
|
|
.append(Toolkit.i18nText("Fine-Design_Plugin_Embed_Notice")) |
|
|
|
|
.append(COLON) |
|
|
|
|
.append(NEW_LINE_TAG) |
|
|
|
|
.append(StableUtils.join(invalidatePluginNames, COMMA)) |
|
|
|
|
.append(NEW_LINE_TAG) |
|
|
|
|
.append(dealWithPluginNames(invalidatePluginNames)) |
|
|
|
|
.append(NEW_LINE_TAG) |
|
|
|
|
.append(NEW_LINE_TAG) |
|
|
|
|
.append(Toolkit.i18nText("Fine-Design_Plugin_Embed_Description")) |
|
|
|
|
.append(NEW_LINE_TAG) |
|
|
|
|
.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理消息中的插件名称展示 |
|
|
|
|
* 由于Notification那边展示的弹窗是随消息宽度变化的,所以插件名称很多时会变得很长。这里做个分行 |
|
|
|
|
* @return |
|
|
|
|
* @param invalidatePluginNames |
|
|
|
|
*/ |
|
|
|
|
public String dealWithPluginNames(List<String> invalidatePluginNames) { |
|
|
|
|
StringBuilder builder = new StringBuilder(); |
|
|
|
|
for (int i = 0; i < invalidatePluginNames.size(); i++) { |
|
|
|
|
String pluginName = invalidatePluginNames.get(i); |
|
|
|
|
builder.append(pluginName); |
|
|
|
|
if (i != invalidatePluginNames.size() - 1) { |
|
|
|
|
builder.append(i % MAX_PLUGIN_NAME_PER_LINE == (MAX_PLUGIN_NAME_PER_LINE - 1) ? NEW_LINE_TAG : COMMA); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return builder.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建通知对象 |
|
|
|
|
* @param message |
|
|
|
|