public void setSourceCode(File source, Charset charset) { this.astNode = configurationModel.getParser().parse(source); try { this.sourceCode = new String(Files.readAllBytes(Paths.get(source.getPath())), charset); } catch (IOException e) { throw new RuntimeException(e); } }
private ConfigurationProperty getConfigurationPropertyByName(String name) { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { if (name.equals(configurationProperty.getName())) { return configurationProperty; } } return null; }
public String getHighlightedSourceCode() { return htmlRenderer.render(new StringReader(sourceCode), configurationModel.getTokenizers()); }
public void onConfigurationPropertyFocusLost(String name) { ConfigurationProperty configurationProperty = getConfigurationPropertyByName(name); Preconditions.checkArgument(configurationProperty != null, "No such configuration property: " + name); String newValueCandidate = view.getConfigurationPropertyValue(name); String errorMessage = configurationProperty.validate(newValueCandidate); view.setConfigurationPropertyErrorMessage(configurationProperty.getName(), errorMessage); if ("".equals(errorMessage)) { configurationProperty.setValue(newValueCandidate); configurationModel.setUpdatedFlag(); } else { view.setFocusOnConfigurationPropertyField(name); view.setFocusOnConfigurationView(); } }
public void onSourceCodeOpenButtonClick() { File fileToParse = view.pickFileToParse(); if (fileToParse != null) { view.clearConsole(); try { view.displayHighlightedSourceCode(new String(Files.readAllBytes(Paths.get(fileToParse.getPath())), configurationModel.getCharset())); } catch (IOException e) { throw new RuntimeException(e); } model.setSourceCode(fileToParse, configurationModel.getCharset()); view.displayHighlightedSourceCode(model.getHighlightedSourceCode()); view.displayAst(model.getAstNode()); view.displayXml(model.getXml()); view.scrollSourceCodeTo(new Point(0, 0)); view.setFocusOnAbstractSyntaxTreeView(); view.enableXPathEvaluateButton(); } }
public void onConfigurationPropertyFocusLost(String name) { ConfigurationProperty configurationProperty = getConfigurationPropertyByName(name); if (configurationProperty == null) { throw new IllegalArgumentException("No such configuration property: " + name); } String newValueCandidate = view.getConfigurationPropertyValue(name); String errorMessage = configurationProperty.validate(newValueCandidate); view.setConfigurationPropertyErrorMessage(configurationProperty.getName(), errorMessage); if ("".equals(errorMessage)) { configurationProperty.setValue(newValueCandidate); configurationModel.setUpdatedFlag(); } else { view.setFocusOnConfigurationPropertyField(name); view.setFocusOnConfigurationView(); } }
public void onSourceCodeOpenButtonClick() { File fileToParse = view.pickFileToParse(); if (fileToParse != null) { view.clearConsole(); try { view.displayHighlightedSourceCode(new String(Files.readAllBytes(Paths.get(fileToParse.getPath())), configurationModel.getCharset())); } catch (IOException e) { throw new RuntimeException(e); } model.setSourceCode(fileToParse, configurationModel.getCharset()); view.displayHighlightedSourceCode(model.getHighlightedSourceCode()); view.displayAst(model.getAstNode()); view.displayXml(model.getXml()); view.scrollSourceCodeTo(new Point(0, 0)); view.setFocusOnAbstractSyntaxTreeView(); view.enableXPathEvaluateButton(); } }
public void setSourceCode(File source, Charset charset) { this.astNode = configurationModel.getParser().parse(source); try { this.sourceCode = Files.toString(source, charset); } catch (IOException e) { Throwables.propagate(e); } }
private ConfigurationProperty getConfigurationPropertyByName(String name) { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { if (name.equals(configurationProperty.getName())) { return configurationProperty; } } return null; }
public String getHighlightedSourceCode() { return htmlRenderer.render(new StringReader(sourceCode), configurationModel.getTokenizers()); }
public void onConfigurationPropertyFocusLost(String name) { ConfigurationProperty configurationProperty = getConfigurationPropertyByName(name); if (configurationProperty == null) { throw new IllegalArgumentException("No such configuration property: " + name); } String newValueCandidate = view.getConfigurationPropertyValue(name); String errorMessage = configurationProperty.validate(newValueCandidate); view.setConfigurationPropertyErrorMessage(configurationProperty.getName(), errorMessage); if ("".equals(errorMessage)) { configurationProperty.setValue(newValueCandidate); configurationModel.setUpdatedFlag(); } else { view.setFocusOnConfigurationPropertyField(name); view.setFocusOnConfigurationView(); } }
public void onSourceCodeOpenButtonClick() { File fileToParse = view.pickFileToParse(); if (fileToParse != null) { view.clearConsole(); try { view.displayHighlightedSourceCode(Files.toString(fileToParse, configurationModel.getCharset())); } catch (IOException e) { Throwables.propagate(e); } model.setSourceCode(fileToParse, configurationModel.getCharset()); view.displayHighlightedSourceCode(model.getHighlightedSourceCode()); view.displayAst(model.getAstNode()); view.displayXml(model.getXml()); view.scrollSourceCodeTo(new Point(0, 0)); view.setFocusOnAbstractSyntaxTreeView(); view.enableXPathEvaluateButton(); } }
public void setSourceCode(File source, Charset charset) { this.astNode = configurationModel.getParser().parse(source); try { this.sourceCode = new String(Files.readAllBytes(Paths.get(source.getPath())), charset); } catch (IOException e) { throw new RuntimeException(e); } }
private ConfigurationProperty getConfigurationPropertyByName(String name) { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { if (name.equals(configurationProperty.getName())) { return configurationProperty; } } return null; }
public String getHighlightedSourceCode() { return htmlRenderer.render(new StringReader(sourceCode), configurationModel.getTokenizers()); }
public void setSourceCode(String sourceCode) { this.astNode = configurationModel.getParser().parse(sourceCode); this.sourceCode = sourceCode; }
@VisibleForTesting void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } }
public void setSourceCode(String sourceCode) { this.astNode = configurationModel.getParser().parse(sourceCode); this.sourceCode = sourceCode; }
void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } }
public void setSourceCode(String sourceCode) { this.astNode = configurationModel.getParser().parse(sourceCode); this.sourceCode = sourceCode; }