@Test public void generateGrammarURI() { String actual = NoGrammarConstraintsCodeAction.getGrammarURI("file: assertEquals("file: }
static String getGrammarURI(String documentURI, String fileExtension) { int index = documentURI.lastIndexOf('.'); if (index > 1 && documentURI.charAt(index - 1) == '/') { index = -1; } String grammarWithoutExtension = index != -1 ? documentURI.substring(0, index) : documentURI; String grammarURI = grammarWithoutExtension + "." + fileExtension; int i = 1; try { while (Files.exists(Paths.get(new URI(grammarURI)))) { grammarURI = grammarWithoutExtension + (i++) + "." + fileExtension; } } catch (Exception e) { } return grammarURI; }
NoGrammarConstraintsCodeAction implements ICodeActionParticipant { static String getGrammarURI(String documentURI, String fileExtension) { int index = documentURI.lastIndexOf('.'); if (index > 1 && documentURI.charAt(index - 1) == '/') { index = -1; } String grammarWithoutExtension = index != -1 ? documentURI.substring(0, index) : documentURI; String grammarURI = grammarWithoutExtension + "." + fileExtension; int i = 1; try { while (Files.exists(Paths.get(new URI(grammarURI)))) { grammarURI = grammarWithoutExtension + (i++) + "." + fileExtension; } } catch (Exception e) { } return grammarURI; } }
NoGrammarConstraintsCodeAction implements ICodeActionParticipant { static String getGrammarURI(String documentURI, String fileExtension) { int index = documentURI.lastIndexOf('.'); if (index > 1 && documentURI.charAt(index - 1) == '/') { index = -1; } String grammarWithoutExtension = index != -1 ? documentURI.substring(0, index) : documentURI; String grammarURI = grammarWithoutExtension + "." + fileExtension; int i = 1; try { while (Files.exists(Paths.get(new URI(grammarURI)))) { grammarURI = grammarWithoutExtension + (i++) + "." + fileExtension; } } catch (Exception e) { } return grammarURI; }  }
NoGrammarConstraintsCodeAction implements ICodeActionParticipant { static String getGrammarURI(String documentURI, String fileExtension) { int index = documentURI.lastIndexOf('.'); if (index > 1 && documentURI.charAt(index - 1) == '/') { index = -1; } String grammarWithoutExtension = index != -1 ? documentURI.substring(0, index) : documentURI; String grammarURI = grammarWithoutExtension + "." + fileExtension; int i = 1; try { while (Files.exists(Paths.get(new URI(grammarURI)))) { grammarURI = grammarWithoutExtension + (i++) + "." + fileExtension; } } catch (Exception e) { } return grammarURI; }  @Override void doCodeAction(Diagnostic diagnostic, Range range, DOMDocument document, List<CodeAction> codeActions,
			SharedSettings sharedSettings, IComponentProvider componentProvider); }
NoGrammarConstraintsCodeAction implements ICodeActionParticipant { static String getGrammarURI(String documentURI, String fileExtension) { int index = documentURI.lastIndexOf('.'); if (index > 1 && documentURI.charAt(index - 1) == '/') { index = -1; } String grammarWithoutExtension = index != -1 ? documentURI.substring(0, index) : documentURI; String grammarURI = grammarWithoutExtension + "." + fileExtension; int i = 1; try { while (Files.exists(Paths.get(new URI(grammarURI)))) { grammarURI = grammarWithoutExtension + (i++) + "." + fileExtension; } } catch (Exception e) { } return grammarURI; }  @Override void doCodeAction(Diagnostic diagnostic, Range range, DOMDocument document, List<CodeAction> codeActions,
			SharedSettings sharedSettings, IComponentProvider componentProvider);  }