@@ -98,20 +98,21 @@ private static int getBaudRate(IProject iProject) {
98
98
}
99
99
100
100
IIndexName [] names = index .findNames (setupFunc , org .eclipse .cdt .core .index .IIndex .FIND_DEFINITIONS );
101
- if (names .length != 1 ) {
102
- return -3 ;
103
- }
104
-
105
- String SetupFileName = names [0 ].getFileLocation ().getFileName ();
106
- String SetupFileContent = FileUtils .readFileToString (new File (SetupFileName ));
107
- int serialBeginStart = SetupFileContent .indexOf (serialVariable );
108
- if (serialBeginStart != -1 ) {
109
- int serialBeginStartbraket = SetupFileContent .indexOf ("(" , serialBeginStart ); //$NON-NLS-1$
110
- if (serialBeginStartbraket != -1 ) {
111
- int serialBeginCloseBraket = SetupFileContent .indexOf (")" , serialBeginStartbraket ); //$NON-NLS-1$
112
- if (serialBeginCloseBraket != -1 ) {
113
- String baudrate = SetupFileContent .substring (serialBeginStartbraket + 1 , serialBeginCloseBraket ).trim ();
114
- return Integer .parseInt (baudrate );
101
+ // if (names.length != 1) {
102
+ // return -3;
103
+ // }
104
+ for (IIndexName name : names ) {
105
+ String SetupFileName = name .getFileLocation ().getFileName ();
106
+ String SetupFileContent = FileUtils .readFileToString (new File (SetupFileName ));
107
+ int serialBeginStart = SetupFileContent .indexOf (serialVariable );
108
+ if (serialBeginStart != -1 ) {
109
+ int serialBeginStartbraket = SetupFileContent .indexOf ("(" , serialBeginStart ); //$NON-NLS-1$
110
+ if (serialBeginStartbraket != -1 ) {
111
+ int serialBeginCloseBraket = SetupFileContent .indexOf (")" , serialBeginStartbraket ); //$NON-NLS-1$
112
+ if (serialBeginCloseBraket != -1 ) {
113
+ String baudrate = SetupFileContent .substring (serialBeginStartbraket + 1 , serialBeginCloseBraket ).trim ();
114
+ return Integer .parseInt (baudrate );
115
+ }
115
116
}
116
117
}
117
118
}
0 commit comments