From b23769e1112b97efcd75deb069ba7120e8be7501 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Thu, 25 May 2017 15:17:27 +0800 Subject: [PATCH] =?UTF-8?q?bug=20fix=20AOP=E5=AE=9E=E7=8E=B0=E6=8F=90?= =?UTF-8?q?=E9=86=92=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/TemplateProcessTracker.aj | 8 +++---- .../manager/RecommendSearchManager.java | 2 +- .../aspectj/designerbase/AlphaFineReminder.aj | 23 +++++++++++++++++++ .../designerbase/TemplateProcessTracker.aj | 11 +++++---- .../designerchart/TemplateProcessTracker.aj | 6 ++--- .../designerform/TemplateProcessTracker.aj | 6 ++--- 6 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj diff --git a/designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj b/designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj index 032cd2342..d0f310829 100644 --- a/designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj +++ b/designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj @@ -35,7 +35,7 @@ public aspect TemplateProcessTracker { // String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 before(ActionEvent e) : onActionPerformed(e) { @@ -47,7 +47,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 @@ -56,7 +56,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 @@ -66,7 +66,7 @@ public aspect TemplateProcessTracker { // String v = "test"; //String log = String.format("%s:\n%s\nset value: %s at %s\n\n", new Date(), sl, v, g.getEditingCellElement()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java index b2707e502..d1213822b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java @@ -30,9 +30,9 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { } @Override public synchronized SearchResult getLessSearchResult(String searchText) { + this.modelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainRecommend()) { String result; - this.modelList = new SearchResult(); HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); httpClient.asGet(); httpClient.setTimeout(5000); diff --git a/designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj b/designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj new file mode 100644 index 000000000..a42e339ac --- /dev/null +++ b/designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj @@ -0,0 +1,23 @@ +package com.fr.aspectj.designerbase; + +import java.awt.event.ActionEvent; + +/** + * Created by XiaXiang on 2017/5/25. + */ +public aspect AlphaFineReminder { + pointcut onActionPerformed(ActionEvent e) : + execution(* actionPerformed(ActionEvent)) && args(e); + + before(ActionEvent e) : onActionPerformed(e) { + String point = thisJoinPoint.toString(); + if (e != null && e.getSource().toString().contains("javax.swing.Timer")) { + return; + } + if (e != null && e.getSource().getClass().getName().equals("com.fr.design.gui.imenu.UIMenuItem") && point.contains("com.fr.design.actions")) { + System.out.print("在点击菜单\n" + thisJoinPoint); + } + + + } +} diff --git a/designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj b/designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj index 61a0be500..b3f05a2c6 100644 --- a/designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj +++ b/designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj @@ -32,19 +32,22 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 before(ActionEvent e) : onActionPerformed(e) { SourceLocation sl = thisJoinPoint.getSourceLocation(); // !within(LogHandlerBar) 没用, 手动过滤 - if (e.getSource().toString().contains("javax.swing.Timer")) { + if (e != null && e.getSource().toString().contains("javax.swing.Timer")) { return; } + if (e != null && e.getSource().getClass().getName().equals("com.fr.design.gui.imenu.UIMenuItem")) { + System.out.print("在点击菜单\n" + thisJoinPointStaticPart.getSourceLocation() + thisJoinPoint); + } //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 @@ -53,7 +56,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); String log = ""; - TemplateInfoCollector.appendProcess(log); + // TemplateInfoCollector.appendProcess(log); } diff --git a/designer_chart/src/com/fr/aspectj/designerchart/TemplateProcessTracker.aj b/designer_chart/src/com/fr/aspectj/designerchart/TemplateProcessTracker.aj index 51e86fd15..60038d4a3 100644 --- a/designer_chart/src/com/fr/aspectj/designerchart/TemplateProcessTracker.aj +++ b/designer_chart/src/com/fr/aspectj/designerchart/TemplateProcessTracker.aj @@ -32,7 +32,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 before(ActionEvent e) : onActionPerformed(e) { @@ -44,7 +44,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 @@ -52,7 +52,7 @@ public aspect TemplateProcessTracker { SourceLocation sl = thisJoinPoint.getSourceLocation(); //String log = String.format("%s:\n%s\n插入新图表:%s\n\n", new Date(), sl, c.getChartName()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } diff --git a/designer_form/src/com/fr/aspectj/designerform/TemplateProcessTracker.aj b/designer_form/src/com/fr/aspectj/designerform/TemplateProcessTracker.aj index 0aabeb362..187079371 100644 --- a/designer_form/src/com/fr/aspectj/designerform/TemplateProcessTracker.aj +++ b/designer_form/src/com/fr/aspectj/designerform/TemplateProcessTracker.aj @@ -30,7 +30,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 before(ActionEvent e) : onActionPerformed(e) { @@ -42,7 +42,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); } //同上 @@ -51,7 +51,7 @@ public aspect TemplateProcessTracker { //String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); String log = ""; - TemplateInfoCollector.appendProcess(log); + //TemplateInfoCollector.appendProcess(log); }