@@ -17,8 +17,10 @@ public class Eminus : IContextMenuEntry, ILogExpertPluginConfigurator
1717 #region Fields
1818
1919 private const string CFG_FILE_NAME = "eminus.json" ;
20- private const string dot = "." ;
21- private const string doubleDot = ":" ;
20+ private const string DOT = "." ;
21+ private const string DOUBLE_DOT = ":" ;
22+ private const string DISABLED = "_" ;
23+
2224 private EminusConfig _config = new ( ) ;
2325 private EminusConfigDlg dlg ;
2426 private EminusConfig tmpConfig = new ( ) ;
@@ -27,48 +29,50 @@ public class Eminus : IContextMenuEntry, ILogExpertPluginConfigurator
2729
2830 #region Properties
2931
30- public string Text => "eminus" ;
32+ public static string Text => "eminus" ;
3133
3234 #endregion
3335
3436 #region Private Methods
3537
3638 private XmlDocument BuildParam ( ILogLine line )
3739 {
38- string temp = line . FullLine ;
40+ string fullLogLine = line . FullLine ;
3941 // no Java stacktrace but some special logging of our applications at work:
40- if ( temp . Contains ( "Exception of type" , StringComparison . CurrentCulture ) || temp . Contains ( "Nested:" , StringComparison . CurrentCulture ) )
42+ if ( fullLogLine . Contains ( "Exception of type" , StringComparison . CurrentCulture ) ||
43+ fullLogLine . Contains ( "Nested:" , StringComparison . CurrentCulture ) )
4144 {
42- int pos = temp . IndexOf ( "created in " ) ;
45+ int pos = fullLogLine . IndexOf ( "created in " ) ;
46+
4347 if ( pos == - 1 )
4448 {
4549 return null ;
4650 }
4751
4852 pos += "created in " . Length ;
49- int endPos = temp . IndexOf ( dot , pos ) ;
53+ int endPos = fullLogLine . IndexOf ( DOT , pos ) ;
5054
5155 if ( endPos == - 1 )
5256 {
5357 return null ;
5458 }
5559
56- string className = temp [ pos ..endPos ] ;
57- pos = temp . IndexOf ( doubleDot , pos ) ;
60+ string className = fullLogLine [ pos ..endPos ] ;
61+ pos = fullLogLine . IndexOf ( DOUBLE_DOT , pos ) ;
5862
5963 if ( pos == - 1 )
6064 {
6165 return null ;
6266 }
6367
64- string lineNum = temp [ ( pos + 1 ) ..] ;
68+ string lineNum = fullLogLine [ ( pos + 1 ) ..] ;
6569 XmlDocument doc = BuildXmlDocument ( className , lineNum ) ;
6670 return doc ;
6771 }
6872
69- if ( temp . Contains ( "at " , StringComparison . CurrentCulture ) )
73+ if ( fullLogLine . Contains ( "at " , StringComparison . CurrentCulture ) )
7074 {
71- string str = temp . Trim ( ) ;
75+ string str = fullLogLine . Trim ( ) ;
7276 string className = null ;
7377 string lineNum = null ;
7478 int pos = str . IndexOf ( "at " ) + 3 ;
@@ -83,15 +87,15 @@ private XmlDocument BuildParam(ILogLine line)
8387 }
8488 else
8589 {
86- pos = str . LastIndexOf ( '.' , idx ) ;
90+ pos = str . LastIndexOf ( DOT , idx ) ;
8791 if ( pos == - 1 )
8892 {
8993 return null ;
9094 }
9195 className = str [ ..pos ] ;
9296 }
9397
94- idx = str . LastIndexOf ( ':' ) ;
98+ idx = str . LastIndexOf ( DOUBLE_DOT ) ;
9599
96100 if ( idx == - 1 )
97101 {
@@ -150,24 +154,36 @@ private XmlDocument BuildXmlDocument(string className, string lineNum)
150154
151155 public string GetMenuText ( IList < int > logLines , ILogLineColumnizer columnizer , ILogExpertCallback callback )
152156 {
153- if ( logLines . Count == 1 && BuildParam ( callback . GetLogLine ( logLines [ 0 ] ) ) != null )
157+ //not used
158+ return string . Empty ;
159+ }
160+
161+ public string GetMenuText ( int logLinesCount , ILogLineColumnizer columnizer , ILogLine logline )
162+ {
163+ if ( logLinesCount == 1 && BuildParam ( logline ) != null )
154164 {
155165 return "Load class in Eclipse" ;
156166 }
157167 else
158168 {
159- return "_Load class in Eclipse";
169+ return $ " { DISABLED } Load class in Eclipse";
160170 }
161171 }
162172
163173 public void MenuSelected ( IList < int > logLines , ILogLineColumnizer columnizer , ILogExpertCallback callback )
164174 {
165- if ( logLines . Count != 1 )
175+ //Not used
176+ }
177+
178+ public void MenuSelected ( int logLinesCount , ILogLineColumnizer columnizer , ILogLine logline )
179+ {
180+ if ( logLinesCount != 1 )
166181 {
167182 return ;
168183 }
169184
170- XmlDocument doc = BuildParam ( callback . GetLogLine ( logLines [ 0 ] ) ) ;
185+ XmlDocument doc = BuildParam ( logline ) ;
186+
171187 if ( doc == null )
172188 {
173189 MessageBox . Show ( "Cannot parse Java stack trace line" , "LogExpert" ) ;
0 commit comments