|
44 | 44 | })
|
45 | 45 | public abstract class SourceHandle {
|
46 | 46 |
|
| 47 | + public static final SourceHandle EMPTY = new Empty(); |
| 48 | + |
| 49 | + |
47 | 50 | public static enum Feature {
|
48 | 51 |
|
49 |
| - LANGUAGE("{lang}", Bundle.SourceHandle_Language()), // NOI18N |
| 52 | + LANGUAGE("{lang}", Bundle.SourceHandle_Language()) {}, // NOI18N |
50 | 53 |
|
51 |
| - CLASS("{class}", Bundle.SourceHandle_ClassName()), // NOI18N |
52 |
| - METHOD("{method}", Bundle.SourceHandle_MethodName()), // NOI18N |
53 |
| - SIGNATURE("{sig}", Bundle.SourceHandle_MethodSignature()), // NOI18N |
| 54 | + CLASS("{class}", Bundle.SourceHandle_ClassName()) {}, // NOI18N |
| 55 | + METHOD("{method}", Bundle.SourceHandle_MethodName()) {}, // NOI18N |
| 56 | + SIGNATURE("{sig}", Bundle.SourceHandle_MethodSignature()) {}, // NOI18N |
54 | 57 |
|
55 |
| - LINE("{line}", Bundle.SourceHandle_SourceLine()), // NOI18N |
56 |
| - COLUMN("{column}", Bundle.SourceHandle_SourceColumn()), // NOI18N |
57 |
| - OFFSET("{offset}", Bundle.SourceHandle_SourceOffset()), // NOI18N |
| 58 | + LINE("{line}", Bundle.SourceHandle_SourceLine()) {}, // NOI18N |
| 59 | + COLUMN("{column}", Bundle.SourceHandle_SourceColumn()) {}, // NOI18N |
| 60 | + OFFSET("{offset}", Bundle.SourceHandle_SourceOffset()) {}, // NOI18N |
58 | 61 |
|
59 |
| - TEXT("{text}", Bundle.SourceHandle_SourceText()), // NOI18N |
| 62 | + TEXT("{text}", Bundle.SourceHandle_SourceText()) {}, // NOI18N |
60 | 63 |
|
61 |
| - URI("{uri}", Bundle.SourceHandle_SourceUri()), // NOI18N |
62 |
| - FILE("{file}", Bundle.SourceHandle_SourceFile()); // NOI18N |
| 64 | + URI("{uri}", Bundle.SourceHandle_SourceUri()) {}, // NOI18N |
| 65 | + FILE("{file}", Bundle.SourceHandle_SourceFile()) {}; // NOI18N |
63 | 66 |
|
64 | 67 |
|
65 | 68 | private final String code;
|
@@ -164,4 +167,21 @@ public static String simpleUri(String uri) {
|
164 | 167 | return fileIndex == -1 ? uri : uri.substring(fileIndex + FILE_PREFIX.length());
|
165 | 168 | }
|
166 | 169 |
|
| 170 | + |
| 171 | + private static final class Empty extends SourceHandle { |
| 172 | + |
| 173 | + @Override public String getLanguage() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 174 | + @Override public String getClassName() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 175 | + @Override public String getMethodName() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 176 | + @Override public String getMethodSignature() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 177 | + @Override public int getLine() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 178 | + @Override public int getColumn() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 179 | + @Override public int getOffset() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 180 | + @Override public String getText() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 181 | + @Override public String getSourceUri() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 182 | + @Override public String getSourceFile() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 183 | + @Override protected void close() { throw new UnsupportedOperationException("Not supported."); } // NOI18N |
| 184 | + |
| 185 | + } |
| 186 | + |
167 | 187 | }
|
0 commit comments