Welcome to loveyfore's blog!

不管别人怎么看,用自己的眼光去看世界,相信自己,做最好的自己!

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  0 随笔 :: 1 文章 :: 0 评论 :: 0 Trackbacks

尝试一下,看看第一次发表的Java文章是否另人满意!!:)

 1 package org.eclipse.qt;
 2 
 3 import java.io.*;
 4 import java.util.ArrayList;
 5 import org.eclipse.core.runtime.*;
 6 import org.eclipse.jface.resource.ImageDescriptor;
 7 import org.eclipse.ui.plugin.AbstractUIPlugin;
 8 import org.osgi.framework.BundleContext;
 9 
10 public class QtPlugin extends AbstractUIPlugin {
11 
12     public static String[] readStringsFrom(String file) {
13         try {
14             org.eclipse.core.runtime.IPath template = new Path(file);
15             java.io.InputStream stream = FileLocator.openStream(getDefault()
16                     .getBundle(), template, false);
17             BufferedReader in = new BufferedReader(
18                     new InputStreamReader(stream));
19             ArrayList lines = new ArrayList();
20             for (String s = in.readLine(); s != null; s = in.readLine())
21                 lines.add(s);
22 
23             return (String[]) lines.toArray(new String[lines.size()]);
24         } catch (IOException e) {
25             log(makeStatus(2"Error searching qmake templates", e));
26         }
27         return new String[0];
28     }
29 
30     public static void log(IStatus status) {
31         getDefault().getLog().log(status);
32     }
33 
34     public QtPlugin() {
35         plugin = this;
36     }
37 
38     public void start(BundleContext context) throws Exception {
39         super.start(context);
40     }
41 
42     public void stop(BundleContext context) throws Exception {
43         super.stop(context);
44         plugin = null;
45     }
46 
47     public static QtPlugin getDefault() {
48         return plugin;
49     }
50 
51     public static ImageDescriptor getImageDescriptor(String path) {
52         return AbstractUIPlugin.imageDescriptorFromPlugin("qt", path);
53     }
54 
55     public static IStatus makeStatus(int severity, String msg, Throwable exc) {
56         if (exc != null)
57             exc.printStackTrace();
58         return new Status(severity, "org.eclipse.qt"0, msg, exc);
59     }
60 
61     public static final String ID = "org.eclipse.qt";
62 
63     private static QtPlugin plugin;
64 }
65 

posted on 2006-12-08 00:43 金永华 阅读(76) 评论(0)  编辑  收藏 所属分类: Java

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


网站导航: