Eclipse3.3m7 VS Eclipse3.2.2

Eclipse3.3m7 VS Eclipse3.2.2
没有深入研究过两者的差别,只是昨天在更换平台时发现的。差别主要存在与Application类上,两者继承或者实现的类不同,也就决定了其底层的不同。
Eclipse3.3M7
 1 None.gif import  org.eclipse.equinox.app.IApplication;
 2 None.gif import  org.eclipse.equinox.app.IApplicationContext;
 3 None.gif import  org.eclipse.jface.wizard.WizardDialog;
 4 None.gif import  org.eclipse.swt.widgets.Display;
 5 None.gif import  org.eclipse.swt.widgets.Shell;
 6 None.gif import  org.eclipse.ui.IWorkbench;
 7 None.gif import  org.eclipse.ui.PlatformUI;
 8 None.gif
 9 None.gif import  com.glnpu.glbom.ui.wizard.FirstTimeConfigWizard;
10 None.gif
11 ExpandedBlockStart.gifContractedBlock.gif /** */ /**
12InBlock.gif * This class controls all aspects of the application's execution
13ExpandedBlockEnd.gif */

14 ExpandedBlockStart.gifContractedBlock.gif public   class  Application  implements  IApplication  dot.gif {
15InBlock.gif
16ExpandedSubBlockStart.gifContractedSubBlock.gif    /**//* (non-Javadoc)
17InBlock.gif     * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
18ExpandedSubBlockEnd.gif     */

19ExpandedSubBlockStart.gifContractedSubBlock.gif    public Object start(IApplicationContext context) throws Exception dot.gif{
20InBlock.gif        Display display = PlatformUI.createDisplay();
21InBlock.gif
22ExpandedSubBlockStart.gifContractedSubBlock.gif        try dot.gif{
23InBlock.gif            int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
24InBlock.gif            if (returnCode == PlatformUI.RETURN_RESTART)
25InBlock.gif                return IApplication.EXIT_RESTART;
26InBlock.gif            else
27InBlock.gif                return IApplication.EXIT_OK;
28ExpandedSubBlockStart.gifContractedSubBlock.gif        }
 finally dot.gif{
29InBlock.gif            display.dispose();
30ExpandedSubBlockEnd.gif        }

31InBlock.gif        
32ExpandedSubBlockEnd.gif    }

33InBlock.gif
34InBlock.gif
35InBlock.gif
36ExpandedSubBlockStart.gifContractedSubBlock.gif    /**//* (non-Javadoc)
37InBlock.gif     * @see org.eclipse.equinox.app.IApplication#stop()
38ExpandedSubBlockEnd.gif     */

39ExpandedSubBlockStart.gifContractedSubBlock.gif    public void stop() dot.gif{
40InBlock.gif        final IWorkbench workbench = PlatformUI.getWorkbench();
41InBlock.gif        if (workbench == null)
42InBlock.gif            return;
43InBlock.gif        final Display display = workbench.getDisplay();
44ExpandedSubBlockStart.gifContractedSubBlock.gif        display.syncExec(new Runnable() dot.gif{
45ExpandedSubBlockStart.gifContractedSubBlock.gif            public void run() dot.gif{
46InBlock.gif                if (!display.isDisposed())
47InBlock.gif                    workbench.close();
48ExpandedSubBlockEnd.gif            }

49ExpandedSubBlockEnd.gif        }
);
50ExpandedSubBlockEnd.gif    }

51ExpandedBlockEnd.gif}

52 None.gif

实现再org.eclipse.core.runtime.IPlatformRunnable;

Eclipse3.2.2
 1 None.gif import  org.eclipse.core.runtime.IPlatformRunnable;
 2 None.gif import  org.eclipse.jface.wizard.WizardDialog;
 3 None.gif import  org.eclipse.swt.widgets.Display;
 4 None.gif import  org.eclipse.swt.widgets.Shell;
 5 None.gif import  org.eclipse.ui.PlatformUI;
 6 None.gif
 7 None.gif import  com.bom.demo.ui.wizard.FirstTimeConfigWizard;
 8 None.gif
 9 ExpandedBlockStart.gifContractedBlock.gif /** */ /**
10InBlock.gif * This class controls all aspects of the application's execution
11ExpandedBlockEnd.gif */

12 ExpandedBlockStart.gifContractedBlock.gif public   class  Application  implements  IPlatformRunnable  dot.gif {
13InBlock.gif
14ExpandedSubBlockStart.gifContractedSubBlock.gif    /**//* (non-Javadoc)
15InBlock.gif     * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
16ExpandedSubBlockEnd.gif     */

17ExpandedSubBlockStart.gifContractedSubBlock.gif    public Object run(Object args) throws Exception dot.gif{
18InBlock.gif        Display display = PlatformUI.createDisplay();
19InBlock.gif        
20ExpandedSubBlockStart.gifContractedSubBlock.gif        try dot.gif{
21InBlock.gif            int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
22ExpandedSubBlockStart.gifContractedSubBlock.gif            if (returnCode == PlatformUI.RETURN_RESTART) dot.gif{
23InBlock.gif                return IPlatformRunnable.EXIT_RESTART;
24ExpandedSubBlockEnd.gif            }

25InBlock.gif            return IPlatformRunnable.EXIT_OK;
26ExpandedSubBlockStart.gifContractedSubBlock.gif        }
 finally dot.gif{
27InBlock.gif            display.dispose();
28ExpandedSubBlockEnd.gif        }

29ExpandedSubBlockEnd.gif    }

Eclipse3.2.2则实现自org.eclipse.core.runtime.IPlatformRunnable;
看来是又做了一次小幅度的分离,而且给出了更加合理的方法命名。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值