Package org.eclipse.php.internal.ui.corext.fix

Examples of org.eclipse.php.internal.ui.corext.fix.LinkedProposalModel


  }
 
 
  @Override
  protected ASTRewrite getRewrite() throws CoreException {
    LinkedProposalModel linkedModel = getLinkedProposalModel();
    TextEditGroup editGroup = new TextEditGroup(ASSIGN_TO_LOCAL_ID);
 
    ExpressionStatement statement = getStatement(context);
    Expression expression = statement.getExpression();
   
    AST ast = statement.getAST();
    ASTRewrite astRewrite = ASTRewrite.create(ast);
    String[] names = possibleNames(expression);
    for (int i = 0; i < names.length; i++) {
      linkedModel.getPositionGroup(KEY_NAME, true).addProposal(names[0], null, 10);
    }
    Variable variable = ast.newVariable(names[0]);
   
    Assignment assign = ast.newAssignment(variable, Assignment.OP_EQUAL, (Expression) astRewrite.createCopyTarget(expression));
    astRewrite.replace(expression, assign, editGroup);

    linkedModel.getPositionGroup(KEY_NAME, true).addPosition(astRewrite.track(variable.getName()), true);
    linkedModel.setEndPosition(astRewrite.track(statement));
   
    return astRewrite;
  }
View Full Code Here


      throws CoreException {
  }

  protected LinkedProposalModel getLinkedProposalModel() {
    if (fLinkedProposalModel == null) {
      fLinkedProposalModel = new LinkedProposalModel();
    }
    return fLinkedProposalModel;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.ui.corext.fix.LinkedProposalModel

Copyright © 2018 www.massapicom. 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.