从Eclipse插件重命名项目

时间:2012-08-02 15:06:44

标签: eclipse-plugin refactoring

我需要从eclipse插件重命名项目。我看过这个article。我是插件开发的新手。如果有人有以前的经验,你可以分享我要遵循的步骤。

2 个答案:

答案 0 :(得分:0)

有org.eclipse.ltk,它可以让你进行重构。在this Thread中,您可以看到如何以编程方式执行重构,包括重命名。

答案 1 :(得分:0)

我最近不得不这样做,而这正是我们根据上述文章所做的。

<!DOCTYPE html>
<html>
<body>
    <script>

            var board = [
            [5,3,0,0,7,0,0,0,0],
            [6,0,0,1,9,5,0,0,0],
            [0,9,8,0,0,0,0,6,0],
            [8,0,0,0,6,0,0,0,3],
            [4,0,0,8,0,3,0,0,1],
            [7,0,0,0,2,0,0,0,6],
            [0,6,0,0,0,0,2,8,0],
            [0,0,0,4,1,9,0,0,5],
            [0,0,0,0,8,0,0,7,9],
            ];

        function solve(a){
            var zeros = [];
            for(i=0;i<Math.pow(a.length,2);i++){
                var x = i%a.length;
                var y = (i-x)/a.length;
                if(board[y][x]===0){
                    zeros.push([x,y,1]);
                }
            }
            var count = 0;
            var total = [];
            for(i=0;i<zeros.length;i++){
                console.log("s");
                count+=1;
                var x = zeros[i][0];
                if(zeros[i][2]<board.length+1){
                    for(j=zeros[i][2];j<board.length+1;j++){
                        if(check(x,y,j)==true){
                            a[y][x] = j;
                            zeros[i][2] = j + 1;
                            j=board.length+1;
                        }else if(check(x,y,j)==false && j===board.length){
                            j=board.length+1;
                            zeros[i][2] = 1;
                            i-=2;
                            a[y][x] = 0;
                        }
                    }
                }else{
                    zeros[i][2] = 1;
                    a[y][x] = 0;
                    i-=2;
                }
                for(j=0;j<board.length;j++){
                    console.log(board[j][0],board[j][1],board[j][2],board[j][3],board[j][4],board[j][5],board[j][6],board[j][7],board[j][8]);
                }
                console.log(count);
            }
        }

        function check(a,b,c){
            var right = true;
            for(k=0;k<board.length;k++){
                if(board[b][k]===c || board[k][a]===c){
                    right = false;
                }
            }
            for(k=0;k<Math.sqrt(board.length);k++){
                for(l=0;l<Math.sqrt(board.length);l++){
                    if(board[Math.sqrt(board.length)*Math.floor(b/Math.sqrt(board.length))+k][Math.sqrt(board.length)*Math.floor(a/Math.sqrt(board.length))+l]==c){
                        right = false;
                    }
                }
            }
            if(right === true){
                return true;
            }else{
                return false;
            }
        }

        solve(board);
    </script>
</body>
</html>