Examples of IModification


Examples of org.eclipse.xtext.ui.editor.model.edit.IModification

*/
@SuppressWarnings("all")
public class TargetPlatformQuickfixProvider extends DefaultQuickfixProvider {
  @Fix(TargetPlatformValidator.DEPRECATE__STRINGS_ON_IU_VERSION)
  public void removeQuotes(final Issue issue, final IssueResolutionAcceptor acceptor) {
    final IModification _function = new IModification() {
      public void apply(final IModificationContext context) throws Exception {
        final IXtextDocument xtextDocument = context.getXtextDocument();
        Integer _offset = issue.getOffset();
        Integer _length = issue.getLength();
        int _plus = ((_offset).intValue() + (_length).intValue());
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.model.edit.IModification

      "Set the IDs of all locations with the same URI to the same value as included location.", null, _function);
  }
 
  @Fix(TargetPlatformValidator.CHECK__VERSION_KEYWORDS)
  public void removeVersionKeywords(final Issue issue, final IssueResolutionAcceptor acceptor) {
    final IModification _function = new IModification() {
      public void apply(final IModificationContext context) throws Exception {
        final IXtextDocument xtextDocument = context.getXtextDocument();
        Integer _offset = issue.getOffset();
        Integer _length = issue.getLength();
        xtextDocument.replace((_offset).intValue(), (_length).intValue(), "");
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.model.edit.IModification

    acceptor.accept(issue, "Remove deprecated keywords.", "Remove deprecated keywords.", null, _function);
  }
 
  @Fix(TargetPlatformValidator.CHECK__ESCAPE_CHAR_IU_ID)
  public void removeEscapeCharInIUID(final Issue issue, final IssueResolutionAcceptor acceptor) {
    final IModification _function = new IModification() {
      public void apply(final IModificationContext context) throws Exception {
        final IXtextDocument xtextDocument = context.getXtextDocument();
        Integer _offset = issue.getOffset();
        Integer _length = issue.getLength();
        final String fullId = xtextDocument.get((_offset).intValue(), (_length).intValue());
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.model.edit.IModification

    _builder.append("Rename property to ");
    String[] _data_1 = issue.getData();
    String _head_1 = IterableExtensions.<String>head(((Iterable<String>)Conversions.doWrapArray(_data_1)));
    _builder.append(_head_1, "");
    _builder.append(".");
    final IModification _function = new IModification() {
      public void apply(final IModificationContext it) throws Exception {
        IXtextDocument _xtextDocument = it.getXtextDocument();
        Integer _offset = issue.getOffset();
        Integer _length = issue.getLength();
        String[] _data = issue.getData();
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.model.edit.IModification

      issue, "Surround with double quotes", "Places the unquoted interpolation in a string", null,
      new SurroundWithTextModification(issue.getOffset(), issue.getLength(), "\"", "\""));

    // $x
    acceptor.accept(
      issue, "Change to regular variable reference", "Removes the '{' and '}'", null, new IModification() {

        @Override
        public void apply(IModificationContext context) throws Exception {
          IXtextDocument doc = context.getXtextDocument();
          doc.replace(
            issue.getOffset(), issue.getLength(),
            "$" + doc.get(issue.getOffset() + 2, issue.getLength() - 3));
        }
      });

    // $x ? { undef => '', default => $x }
    acceptor.accept(
      issue, "Change to selector that makes undef empty string", "$x ? {undef => '', default => $x }", null,
      new IModification() {

        @Override
        public void apply(IModificationContext context) throws Exception {
          IXtextDocument doc = context.getXtextDocument();
          String varName = "$" + doc.get(issue.getOffset() + 2, issue.getLength() - 3);
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.model.edit.IModification

//    });
//  }

  @Fix(FXGraphJavaValidator.UNKNOWN_CONTROLLER_FIELD)
  public void fixAddControllerField(final Issue issue, IssueResolutionAcceptor acceptor) {
    acceptor.accept(issue, "Add controller field", "Add a field of '"+issue.getData()[0]+"' to the controller '"+issue.getData()[1]+"'", null, new IModification() {
     
      @Override
      public void apply(IModificationContext context) throws Exception {
        IJavaProject p = context.getXtextDocument().readOnly(new IUnitOfWork<IJavaProject, XtextResource>() {

          @Override
          public IJavaProject exec(XtextResource state) throws Exception {
            return provider.getJavaProject(state.getResourceSet());
          }
         
        });
       
        IType type = p.findType(issue.getData()[1]);
       
        String[][] resolvedType = type.resolveType("FXML");
       
        if( resolvedType == null ) {
          type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor())
        }
       
        resolvedType = type.resolveType(Signature.getSimpleName(issue.getData()[2]));
       
        if( resolvedType == null ) {
          type.getCompilationUnit().createImport(issue.getData()[2], null, new NullProgressMonitor());
        }
       
        type.createField("@FXML " + Signature.getSimpleName(issue.getData()[2]) + " " + issue.getData()[0] + ";", null, true, new NullProgressMonitor());
      }
    });
    acceptor.accept(issue, "Remove id field", "Remove the id field from the element", null, new IModification() {
     
      @Override
      public void apply(IModificationContext context) throws Exception {
        IXtextDocument xtextDocument = context.getXtextDocument();
        StringBuilder b = new StringBuilder();
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.model.edit.IModification

  public void fixAddControllerMethod(final Issue issue, IssueResolutionAcceptor acceptor) {
    final String methodName = issue.getData()[0];
    final String controllerClass = issue.getData()[1];
    final String argType = issue.getData()[2];
    final String simpleArgType = Signature.getSimpleName(argType);
    acceptor.accept(issue, "Add controller method "+methodName+"("+simpleArgType+")", "Add a controller method '"+methodName+"("+simpleArgType+")' to controller '"+controllerClass+"'", null, new IModification() {
     
      @Override
      public void apply(IModificationContext context) throws Exception {
        IJavaProject p = context.getXtextDocument().readOnly(new IUnitOfWork<IJavaProject, XtextResource>() {

          @Override
          public IJavaProject exec(XtextResource state) throws Exception {
            return provider.getJavaProject(state.getResourceSet());
          }
         
        });
       
        IType type = p.findType(controllerClass);
       
        String[][] resolvedType = type.resolveType("FXML");
       
        if( resolvedType == null ) {
          type.getCompilationUnit().createImport("javafx.fxml.FXML", null, new NullProgressMonitor())
        }
       
        resolvedType = type.resolveType(simpleArgType);
       
        if( resolvedType == null ) {
          type.getCompilationUnit().createImport(argType, null, new NullProgressMonitor())
        }
       
        type.createMethod("@FXML public void " + methodName + "("+simpleArgType+" event) {}", null, true, new NullProgressMonitor());
      }
    });
    acceptor.accept(issue, "Add controller method "+methodName+"()", "Add a controller method '"+methodName+"()' to controller '"+controllerClass+"'", null, new IModification() {
     
      @Override
      public void apply(IModificationContext context) throws Exception {
        IJavaProject p = context.getXtextDocument().readOnly(new IUnitOfWork<IJavaProject, XtextResource>() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.