随笔-26  评论-111  文章-19  trackbacks-0
    Myeclipse 7 的插件安装方式与原先的方式完全不一样了,下面以JBossTools-2.1.2.GA插件安装为例进行说明。

    假设
            Myeclipse 7的安装路径为:C:\Genuitec
            JBossTools-2.1.2.GA插件的路径为:  C:\eclipse-plugins\plugins\JBossTools-2.1.2.GA-ALL-win32

    将下面这段代码编译后执行:

    
 1package test;
 2
 3import java.io.File;
 4import java.util.ArrayList;
 5import java.util.List;
 6
 7
 8/**
 9 * Descript: 
10 *
11 *
12 */

13
14public class CreatePluginsConfig {
15    private String path;
16    
17    public CreatePluginsConfig(String path){
18        this.path=path;
19    }

20    
21    public void print(){
22        List list=getFileList(path);
23        if(list==null){
24            return;
25        }

26        
27        int length=list.size();
28        for(int i=0;i<length;i++){
29            String result="";
30            String thePath=getFormatPath(getString(list.get(i)));
31            File file=new File(thePath);
32            if(file.isDirectory()){
33                String fileName=file.getName();
34                if(fileName.indexOf("_")<0){
35                    continue;
36                }

37                String[] filenames=fileName.split("_");
38                String filename1=filenames[0];
39                String filename2=filenames[1];
40                result=filename1+","+filename2+",file:/"+path+"\\"+fileName+"\\,4,false";
41                System.out.println(result);
42            }
else if(file.isFile()){
43                String fileName=file.getName();
44                if(fileName.indexOf("_")<0){
45                    continue;
46                }

47                String[] filenames=fileName.split("_");
48                String filename1=filenames[0];
49                String filename2=filenames[1].substring(0, filenames[1].lastIndexOf("."));
50                result=filename1+","+filename2+",file:/"+path+"\\"+fileName+",4,false";
51                System.out.println(result);
52            }

53            
54        }

55    }

56    
57    public List getFileList(String path){
58        path=getFormatPath(path);
59        path=path+"/";
60        File filePath=new File(path);
61        if(!filePath.isDirectory()){
62            return null;
63        }

64        String[] filelist=filePath.list();
65        List filelistFilter=new ArrayList();
66
67        for(int i=0;i<filelist.length;i++){
68            String tempfilename=getFormatPath(path+filelist[i]);
69            filelistFilter.add(tempfilename);
70        }

71        return filelistFilter;
72    }

73    
74    public String getString(Object object){
75        if(object==null){
76            return "";
77        }

78        return String.valueOf(object);
79    }

80    
81    public String getFormatPath(String path) {
82        path = path.replaceAll("\\\\""/");
83        path = path.replaceAll("//""/");
84        return path;
85    }

86    
87    public static void main(String[] args){
88        new CreatePluginsConfig("C:\\eclipse-plugins\\plugins\\JBossTools-2.1.2.GA-ALL-win32\\eclipse\\plugins").print();
89    }

90}
    
    执行完之后,将控制台中打印出的执行结果,直接复制到下面这个文件中:

    C:\Genuitec\MyEclipse 7.0\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info

    然后用 -clean 命令重新启动Myeclipse即了完成插件的安装。
    
posted on 2008-12-15 13:41 snoics 阅读(8437) 评论(13)  编辑  收藏

评论:
# re: Myeclipse 7 插件安装[未登录] 2008-12-16 16:51 | dragon
其他的插件怎么安装??  回复  更多评论
  
# re: Myeclipse 7 插件安装 2008-12-16 17:22 | a_faint_hope
非常感谢你的帮助.
但程序出现两个问题:
1.C:\\eclipse-plugins\\plugins\JBossTools-2.1.2.GA-ALL-win32
这里(\JBossTools-2.1.2.GA-ALL-win32)应该是 \\ ;
2.文件名有两个下划线时,会报下标越界问题.
修改后的程序如下:
import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class CreatePluginsConfig {
private String path;

public CreatePluginsConfig(String path) {
this.path = path;
}

public void print() {
List list = getFileList(path);
if (list == null) {
return;
}

int length = list.size();
for (int i = 0; i < length; i++) {
String result = "";
String thePath = getFormatPath(getString(list.get(i)));
File file = new File(thePath);
if (file.isDirectory()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
continue;
}
String[] filenames = fileName.split("_");
String filename1 = filenames[0];
String filename2 = filenames[1];
result = filename1 + "," + filename2 + ",file:/" + path + "\\"
+ fileName + "\\,4,false";
System.out.println(result);
} else if (file.isFile()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
continue;
}
int last = fileName.lastIndexOf("_");// 最后一个下划线的位置
String filename1 = fileName.substring(0, last);
String filename2 = fileName.substring(last + 1, fileName
.length() - 4);
result = filename1 + "," + filename2 + ",file:/" + path + "\\"
+ fileName + ",4,false";
System.out.println(result);
}
}
}

public List getFileList(String path) {
path = getFormatPath(path);
path = path + "/";
File filePath = new File(path);
if (!filePath.isDirectory()) {
return null;
}
String[] filelist = filePath.list();
List filelistFilter = new ArrayList();

for (int i = 0; i < filelist.length; i++) {
String tempfilename = getFormatPath(path + filelist[i]);
filelistFilter.add(tempfilename);
}
return filelistFilter;
}

public String getString(Object object) {
if (object == null) {
return "";
}
return String.valueOf(object);
}

public String getFormatPath(String path) {
path = path.replaceAll("\\\\", "/");
path = path.replaceAll("//", "/");
return path;
}

public static void main(String[] args) {
new CreatePluginsConfig(
"C:\\eclipse-plugins\\plugins\\JBossTools-2.1.2.GA-ALL-win32")
.print();
}
}


  回复  更多评论
  
# re: Myeclipse 7 插件安装 2008-12-16 22:09 | Ivan阿文
7.0出是出来了,只是不怎么好用。
至少已经发现几个问题了,
1、插件跟原地的安装方式不一样,好多插件目前我还不会装,希望有高人指点
2、用默认的hibernate编辑器去编辑hibernate 绑定的那xml文件的时候,ctrl+d ctrl+alt+下这两个(目前为止发现的)快捷键都无法使用。设置那里,设置为in dialog and window就有效果,不过回到普通代码编辑就无效果。如果设置为editing text,效果就刚好相反,反正就没一种设法可以两边都能用上这两个快捷键。
3、同样的一段JSP普通位码,在6.6下可以用ctrl+shift+f格式化,在7下就有问题了 - -
给我感觉是7的html标签配对做得很好,有vs和netbeans等ide的风格。后台的设置也强了很多,但,以上我说的3个小问题。其实对于开发来说,很重要啦,竟然,,,,,,7在这些方面都退步了 - -  回复  更多评论
  
# re: Myeclipse 7 插件安装[未登录] 2008-12-17 01:23 | kevin
我试了一下阿,弄了半天都没用,什么都不显示  回复  更多评论
  
# re: Myeclipse 7 插件安装 2008-12-17 08:58 | a_faint_hope
插件按楼主说的那样做可以啊!
我昨天都安装了svn插件.

路径修改为:
C:\\eclipse-plugins\\plugins\\JBossTools-2.1.2.GA-ALL-win32\\eclipse\\plugins
  回复  更多评论
  
# re: Myeclipse 7 插件安装 2008-12-17 10:33 | snoics
^_^ 谢谢,Bug 已修复,最后一行的路径写错了,应该是

C:\\eclipse-plugins\\plugins\\JBossTools-2.1.2.GA-ALL-win32\\eclipse\\plugins

已改正,其他插件的安装也都是可以按照这种方式来处理,只要将路径指向插件目录即可一般都是插件包内的 plugins 这个目录  回复  更多评论
  
# re: Myeclipse 7 插件安装 2008-12-17 16:27 | Q
我碰到这么个问题,适用check for update的执行update的时候会自动关闭,并且会死机  回复  更多评论
  
# re: Myeclipse 7 插件安装[未登录] 2008-12-17 22:49 | kevin
@snoics
请问features目录为什么不要呢?  回复  更多评论
  
# re: Myeclipse 7 插件安装[未登录] 2008-12-25 21:28 | z
我把你的代码考下来执行完了后生成了两行记录,考进去没法用。然后我就根据那个文档里的东西手工写了一个就可以了  回复  更多评论
  
# re: Myeclipse 7 插件安装 2009-01-02 15:09 | 小东东
怎么用你这种方式我装了不成功呢,
我的插件位置在E:\java\plugin\PropEditor
用你的这个方法改变main方法中 对应的path为
E:\java\plugin\PropEditor\eclipse\plugins
能够生成两行代码
jp.gr.java,conf.ussiy.app.propedit,file:/E:\java\plugin\PropEditor\eclipse\plugins\jp.gr.java_conf.ussiy.app.propedit_4.8.2\,4,false
viPluginPropertiesEditorVersion,0.2.11,file:/E:\java\plugin\PropEditor\eclipse\plugins\viPluginPropertiesEditorVersion_0.2.11\,4,false

但是复制到我Myeclipse中对应的文件中,重新启动却不能看到插件。。

请帮看一下 我控制台打印出来的 东西有错吗?

怎么修改? 十分感谢!!!  回复  更多评论
  
# re: Myeclipse 7 插件安装 2009-05-19 08:35 | shyhao
我就奇怪了 按个插件 搞这么复杂干什么




  回复  更多评论
  
# re: Myeclipse 7 插件安装 2009-05-19 08:38 | shyhao
我就用以前的方式安装,改怎么用,就怎么用  回复  更多评论
  
# re: Myeclipse 7 插件安装 2009-06-12 12:54 | xiaobenniao
@shyhao
你把你做法发上来 大家分享   回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: