??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲在线视频网站,狠狠久久综合婷婷不卡,日韩国产欧美区http://www.aygfsteel.com/dayue/像疯子一样去战斗Q?/description>zh-cnWed, 18 Jun 2025 14:34:13 GMTWed, 18 Jun 2025 14:34:13 GMT60关于Eclipse首选项的几炚w?/title><link>http://www.aygfsteel.com/dayue/archive/2007/08/28/140677.html</link><dc:creator>dayue</dc:creator><author>dayue</author><pubDate>Tue, 28 Aug 2007 14:17:00 GMT</pubDate><guid>http://www.aygfsteel.com/dayue/archive/2007/08/28/140677.html</guid><wfw:comment>http://www.aygfsteel.com/dayue/comments/140677.html</wfw:comment><comments>http://www.aygfsteel.com/dayue/archive/2007/08/28/140677.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/dayue/comments/commentRss/140677.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/dayue/services/trackbacks/140677.html</trackback:ping><description><![CDATA[<p>    今天调试一个bugQ迷惑了很久。最后发现是关于首选项取值存值问题?br>   q里ps为IPreferenceStore对象.</p> <p>   ps.getString(XXX_KEY)是首选查N选项 Q如果取出的gؓI,如果有default值的话则执行ps.getDefault(XXX_KEY)?/p> <p>   ps.setValue(XXX_KEY, "XXX")旉先和default中的XXX_KEY比较Q如果不同的话才putq去Q否则就删除。这也是我今天这个bug的原因。修改办法是用putValue函数来代替setValue. <br><br>有什么说的不对的地方Ƣ迎批评指正.</p> <img src ="http://www.aygfsteel.com/dayue/aggbug/140677.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/dayue/" target="_blank">dayue</a> 2007-08-28 22:17 <a href="http://www.aygfsteel.com/dayue/archive/2007/08/28/140677.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]eclipse插g中取得\径的Ҏhttp://www.aygfsteel.com/dayue/archive/2007/05/24/119784.htmldayuedayueThu, 24 May 2007 10:07:00 GMThttp://www.aygfsteel.com/dayue/archive/2007/05/24/119784.htmlhttp://www.aygfsteel.com/dayue/comments/119784.htmlhttp://www.aygfsteel.com/dayue/archive/2007/05/24/119784.html#Feedback0http://www.aygfsteel.com/dayue/comments/commentRss/119784.htmlhttp://www.aygfsteel.com/dayue/services/trackbacks/119784.html        
TestPlugin.getDefault().getStateLocation().makeAbsolute().toFile().getAbsolutePath());

通过文g得到ProjectQ?/p>

IProject project = ((IFile)o).getProject();

通过文g得到全\径:

String path = ((IFile)o).getLocation().makeAbsolute().toFile().getAbsolutePath();

得到整个Workspace的根Q?/p>

IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();

从根来查找资源:

IResource resource = root.findMember(new Path(containerName));


从Bundle来查找资源:

Bundle bundle = Platform.getBundle(pluginId);
URL fullPathString
= BundleUtility.find(bundle, filePath);

得到Appliaction workspaceQ?/span>

Platform.asLocalURL(PRODUCT_BUNDLE.getEntry("")).getPath()).getAbsolutePath();

得到runtimeworkspaceQ?br>  
Platform.getInstanceLocation().getURL().getPath();

从编辑器来获得编辑文?br>
IEditorPart editor = ((DefaultEditDomain)(parent.getViewer().getEditDomain())).getEditorPart();
IEditorInput input
= editor.getEditorInput();
   if(input instanceof IFileEditorInput){
     IFile file
= ((IFileEditorInput)input).getFile();
   }


dayue 2007-05-24 18:07 发表评论
]]>
css基础知识http://www.aygfsteel.com/dayue/archive/2007/05/08/116009.htmldayuedayueTue, 08 May 2007 09:48:00 GMThttp://www.aygfsteel.com/dayue/archive/2007/05/08/116009.htmlhttp://www.aygfsteel.com/dayue/comments/116009.htmlhttp://www.aygfsteel.com/dayue/archive/2007/05/08/116009.html#Feedback0http://www.aygfsteel.com/dayue/comments/commentRss/116009.htmlhttp://www.aygfsteel.com/dayue/services/trackbacks/116009.htmlCascading Style Sheets Q样式定义了HTML元素怎样LC,样式一般存储在样式表中Q外部样式表存储在CSS文g中。用CSSQ你的HTML文档可以用不同的样式输出来显C?br>       HTML标签起初被设计成为定义文档的内容。通过使用?lt;h1>,<p>,<table>q样的标{他们应该表辄?q是一个标?,"q是一个段?,"q是一张表?,而布局该由览器来处理q使用格式化标{? 作ؓ两大览?- |景 ?IE - 不断地将新的HTML标签和属??lt;font>标签和颜色属?d到原来的HTML规格?q让建立清晰的HTML文档内容q从形式中分d来变的越来越困难.Z解决q个N,W3C q个非赢利的,建立标准的组l?为HTML4.0增加了样式。所有主浏览器都支持样式表?br>        样式表定义元素怎样LC?像在HTML3.2中字体标{֒颜色属性一般保存在一个外部的.css文g一?外部样式表能够让你改变所有出现在你WEB中的外观和布局,而仅仅通过~辑一个单独的CSS文档.(原理是一动多??br>         当多于一U的样式指定一HTML元素时用怎样的样式呢?
  1. 览器默?
  2. 外部样式?
  3. 内嵌样式??lt;head>标签?
  4. 行内样式(在一HTML元素? Q最高优先Q?/li>


dayue 2007-05-08 17:48 发表评论
]]>
面向对象设计QOODQ原?/title><link>http://www.aygfsteel.com/dayue/archive/2007/04/30/114789.html</link><dc:creator>dayue</dc:creator><author>dayue</author><pubDate>Mon, 30 Apr 2007 07:27:00 GMT</pubDate><guid>http://www.aygfsteel.com/dayue/archive/2007/04/30/114789.html</guid><wfw:comment>http://www.aygfsteel.com/dayue/comments/114789.html</wfw:comment><comments>http://www.aygfsteel.com/dayue/archive/2007/04/30/114789.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/dayue/comments/commentRss/114789.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/dayue/services/trackbacks/114789.html</trackback:ping><description><![CDATA[<ol> <li>单一职责原则QSRPQ:一个类应当只有一个改变的原因Q类只需要知道一件事情,它们应当有一个单独的职责Q要点就是当一个类需要改变时Q应当只有一个原因?/li> <li>开?闭原则QOCPQ:软g实体(cR模块、函数等)应当为扩展而开放,又ؓ修改而封闭。这个原则有一个相当详l的定义Q但是一个简单的意思是Q你应当能够改变一个模块的周边环境而无L变模块本w?/li> <li>Liskov替换原则(LSP)Q子cd(subtypes)必须是ؓ它们的基cd(base types)可替代的?/li> <li>依存关系倒置原则(DIP) QAQ高层模块应当不依赖低层模块Q它们应当依赖于抽象?br>                                              BQ抽象应当不依赖于细节,l节应当依赖于抽象?br>更好的描q是Q不要依赖那些容易变化的具体cR如果你要承一个类Q从一个抽象类l承吧。如果你要持有一个类的引用,从一个抽象的cd用吧。如果你要调用一个函敎ͼ从一个抽象的函数调用吧?/li> <li>接口隔离原则QISPQ:客户不应当依赖那些它们根本不用的Ҏ?/li> </ol> <p>ȝQ?br>五个单的原则是:<br>1、SRPQ-一个类应当只有一个发生变化的原因?<br>2、OCP――应当能够改变一个类的环境,而无L变类本n?br>3、LSP――避免造成zcȝҎ非法或退化,一个基cȝ用户应当不需要知道这个派生类?br>4、DIP ――用依赖于接口和抽象cL替代依赖Ҏ变化的具体类?br>5、ISP――给一个对象的每一个用户一个接口,q个接口仅有用户需要的Ҏ?br></p> <p>  </p> <img src ="http://www.aygfsteel.com/dayue/aggbug/114789.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/dayue/" target="_blank">dayue</a> 2007-04-30 15:27 <a href="http://www.aygfsteel.com/dayue/archive/2007/04/30/114789.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>设计模式之命令(CommandQ模?W记http://www.aygfsteel.com/dayue/archive/2007/04/30/114768.htmldayuedayueMon, 30 Apr 2007 06:13:00 GMThttp://www.aygfsteel.com/dayue/archive/2007/04/30/114768.htmlhttp://www.aygfsteel.com/dayue/comments/114768.htmlhttp://www.aygfsteel.com/dayue/archive/2007/04/30/114768.html#Feedback0http://www.aygfsteel.com/dayue/comments/commentRss/114768.htmlhttp://www.aygfsteel.com/dayue/services/trackbacks/114768.html        在这个模式里一个命令接口是必需的。对一个命令对象来_它必M先实现这个命令的Ҏ。下面是一个简单的命o接口Q有一个方法需要实现执行的?br>
public interface Command{
 
         
public void execute();
}
         所有被命o的类必须实现q个命o接口。下面是一个简单的命oQ当执行时控制台打印"hello world"?br>
public class HelloCommand implements Command{
         
public void execute(){

          System.out.println(
"Hello World");
}

}

           
         你可以创Z个HelloCommand的实例然后执行这个方法?

dayue 2007-04-30 14:13 发表评论
]]>
在rcp中获得父Shell的几U方?/title><link>http://www.aygfsteel.com/dayue/archive/2007/04/23/112941.html</link><dc:creator>dayue</dc:creator><author>dayue</author><pubDate>Mon, 23 Apr 2007 06:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/dayue/archive/2007/04/23/112941.html</guid><wfw:comment>http://www.aygfsteel.com/dayue/comments/112941.html</wfw:comment><comments>http://www.aygfsteel.com/dayue/archive/2007/04/23/112941.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/dayue/comments/commentRss/112941.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/dayue/services/trackbacks/112941.html</trackback:ping><description><![CDATA[在实C<font face="Times New Roman">IWorkbenchWindowActionDelegate接口的类中:<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> IWorkbenchWindow window;<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><br><img id=Codehighlighter1_76_103_Open_Image onclick="this.style.display='none'; Codehighlighter1_76_103_Open_Text.style.display='none'; Codehighlighter1_76_103_Closed_Image.style.display='inline'; Codehighlighter1_76_103_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_76_103_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_76_103_Closed_Text.style.display='none'; Codehighlighter1_76_103_Open_Image.style.display='inline'; Codehighlighter1_76_103_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> init(IWorkbenchWindow window) </span><span id=Codehighlighter1_76_103_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif"></span><span id=Codehighlighter1_76_103_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.window </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> window;<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_137_249_Open_Image onclick="this.style.display='none'; Codehighlighter1_137_249_Open_Text.style.display='none'; Codehighlighter1_137_249_Closed_Image.style.display='inline'; Codehighlighter1_137_249_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_137_249_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_137_249_Closed_Text.style.display='none'; Codehighlighter1_137_249_Open_Image.style.display='inline'; Codehighlighter1_137_249_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> run(IAction action) </span><span id=Codehighlighter1_137_249_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif"></span><span id=Codehighlighter1_137_249_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   Shell parentShell </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> window.getShell();<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   MyDialog dialog </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MyDialog(parentShell, <img src="http://www.aygfsteel.com/Images/dot.gif">);<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   <img src="http://www.aygfsteel.com/Images/dot.gif"> etc <img src="http://www.aygfsteel.com/Images/dot.gif"><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top></span></div> </font>在实C<font face="Times New Roman"><font face="Courier New">IObjectActionDelegate</font> 接口的类中:<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> IWorkbenchPart targetPart;<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> setActivePart(IAction action, IWorkbenchPart targetPart)<br><img id=Codehighlighter1_105_140_Open_Image onclick="this.style.display='none'; Codehighlighter1_105_140_Open_Text.style.display='none'; Codehighlighter1_105_140_Closed_Image.style.display='inline'; Codehighlighter1_105_140_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_105_140_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_105_140_Closed_Text.style.display='none'; Codehighlighter1_105_140_Open_Image.style.display='inline'; Codehighlighter1_105_140_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_105_140_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif"></span><span id=Codehighlighter1_105_140_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.targetPart </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> targetPart;<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><br><img id=Codehighlighter1_175_289_Open_Image onclick="this.style.display='none'; Codehighlighter1_175_289_Open_Text.style.display='none'; Codehighlighter1_175_289_Closed_Image.style.display='inline'; Codehighlighter1_175_289_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_175_289_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_175_289_Closed_Text.style.display='none'; Codehighlighter1_175_289_Open_Image.style.display='inline'; Codehighlighter1_175_289_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> run(IAction action) </span><span id=Codehighlighter1_175_289_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif"></span><span id=Codehighlighter1_175_289_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   IWorkbenchPartSite site </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> targetPart.getSite();<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   MyDialog dialog </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MyDialog(site, <img src="http://www.aygfsteel.com/Images/dot.gif">);<br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/InBlock.gif" align=top>   <img src="http://www.aygfsteel.com/Images/dot.gif"> etc <img src="http://www.aygfsteel.com/Images/dot.gif"><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top></span></div> <font face="Courier New">IViewPart</font> 或?tt>IEditorPart</tt> Q? <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">IShellProvider shellProvider </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> viewOrEditor.getSite();</span></div> <font face="Courier New">PlatformUIQ?br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">Shell parentShell </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><br><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top>   PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();</span></div> </font><br><font face="Courier New">Display</font> Q?br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.aygfsteel.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">Shell parentShell </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Display.getDefault().getActiveShell();</span></div> <br><br>以上各种Ҏ对于获取其它的一些rcp中的重要对象也都有借鉴意义?br></font> <img src ="http://www.aygfsteel.com/dayue/aggbug/112941.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/dayue/" target="_blank">dayue</a> 2007-04-23 14:00 <a href="http://www.aygfsteel.com/dayue/archive/2007/04/23/112941.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>设计模式之工厂方法(factory methodQ?W记http://www.aygfsteel.com/dayue/archive/2007/04/18/111595.htmldayuedayueWed, 18 Apr 2007 05:48:00 GMThttp://www.aygfsteel.com/dayue/archive/2007/04/18/111595.htmlhttp://www.aygfsteel.com/dayue/comments/111595.htmlhttp://www.aygfsteel.com/dayue/archive/2007/04/18/111595.html#Feedback0http://www.aygfsteel.com/dayue/comments/commentRss/111595.htmlhttp://www.aygfsteel.com/dayue/services/trackbacks/111595.html       工厂Ҏ设计模式使用l承来决定返回哪个对象。基的创造类是抽象的。而具体的创造类l承q个基类。工厂方法在基类中声明。如果工厂方法是抽象的,那么所有承这个类的类都必Lq个Ҏ。如果不是,则可以根据需要选择覆盖它与否?br>       当一个类惛_例化其中一个具体类的实例时Q这个类可以通过调用具体cȝ工厂Ҏ来生成正的对象?br>       举例来说Q假设我们有两个c,Product1和Product2。ؓ了能接收到这两个cMQ何一个的实例Q我们必让他们l承或实现相同的cL接口。我们创造一个叫做Creator的抽象类。如下:
public abstract class Creator{
    
public abstract getProduct();
}
 
      现在我们创造两个类l承Creator,叫做Product1Creator和Product2Creator。每一个都有一个getProductҎ?br>例如Product1CreatorQ?br>
public class Product1Creator extends Creator{

           
public Product getProduct(){
                 
             
return new Product1();
}

}


dayue 2007-04-18 13:48 发表评论
]]>
设计模式之单例(SingletonQ?W记http://www.aygfsteel.com/dayue/archive/2007/04/18/111514.htmldayuedayueWed, 18 Apr 2007 02:17:00 GMThttp://www.aygfsteel.com/dayue/archive/2007/04/18/111514.htmlhttp://www.aygfsteel.com/dayue/comments/111514.htmlhttp://www.aygfsteel.com/dayue/archive/2007/04/18/111514.html#Feedback0http://www.aygfsteel.com/dayue/comments/commentRss/111514.htmlhttp://www.aygfsteel.com/dayue/services/trackbacks/111514.html单例模式是最单的一U设计模式,它是创造型的。一个单例类仅允总的一个实例被初始化。它查一个实例是否已l被创徏Q如果是则返回这个实例。下面是一个单例类的基本结构:
 1package dp.singleton;
 2
 3public class Singleton {
 4    private static Singleton singleton;
 5    private Singleton(){
 6        
 7    }

 8    
 9    public static Singleton getInstance(){
10        if(singleton==null){
11            singleton=new Singleton();
12        }

13        return singleton;
14    }

15 
16}

17
在这个类中,有一个private static 的域Q构造函数被设ؓU有的,q样调用它的cd不能使用构造器来创建它的一个实例。从一个单例类中取得一个实例的唯一办法是通过public static getInstance()Ҏ。通过以下ҎQ?
Singleton instance=Singleton.getInstance();
q个 getInstance()通过试实例与是否ؓI来查这个类的唯一实例是否被创建,如果是空的,则创Z个实例,如果非空Q则q回q个已经存在的实例,一旦一个实例被创徏了,那么 getInstance()q个Ҏp回这个实例?br>
另一U稍微有些不同的实现单例cȝҎ是将域声明改?br>
private static final Singleton singleton=new Singleton();
q种ҎL创徏一个实例?

dayue 2007-04-18 10:17 发表评论
]]>
发现了一个好玩的插gPatternBoxhttp://www.aygfsteel.com/dayue/archive/2007/04/12/110042.htmldayuedayueWed, 11 Apr 2007 20:06:00 GMThttp://www.aygfsteel.com/dayue/archive/2007/04/12/110042.htmlhttp://www.aygfsteel.com/dayue/comments/110042.htmlhttp://www.aygfsteel.com/dayue/archive/2007/04/12/110042.html#Feedback0http://www.aygfsteel.com/dayue/comments/commentRss/110042.htmlhttp://www.aygfsteel.com/dayue/services/trackbacks/110042.html可以通过选择模版来生成对应模式的java代码Q倒不׃ؓ一个学习设计模式的好方法?br>


来觉得eclipse以及各方开发的插g的强大了Q好像潜意识里需要什么东西,在某一天自己就会蹦出来q样一个插件?



dayue 2007-04-12 04:06 发表评论
]]>
|上攉的设计模式资?全部转脓http://www.aygfsteel.com/dayue/archive/2007/04/12/110041.htmldayuedayueWed, 11 Apr 2007 19:53:00 GMThttp://www.aygfsteel.com/dayue/archive/2007/04/12/110041.htmlhttp://www.aygfsteel.com/dayue/comments/110041.htmlhttp://www.aygfsteel.com/dayue/archive/2007/04/12/110041.html#Feedback0http://www.aygfsteel.com/dayue/comments/commentRss/110041.htmlhttp://www.aygfsteel.com/dayue/services/trackbacks/110041.html 设计模式(Design Patterns)W记之一QAbstract Factory

定义Q提供一个创Zpd相关或相互依赖对象的接口Q而无需指定它们具体的类。提供创建对象的接?br>
工厂模式是我们最常用的模式,是用来创建对象的Q它q当于创徏对象的new?br>例如我们有一个类Example,我们要创建Example的对?

Example example=new Example();
?br>Example example
=new Example(参数);

如果创徏Example时做的事情不是如赋DL单的?可能是很长一D代?如果也写入构造函C,那明昄p背了面向对象的原?
我们需要将创徏实例的责M使用实例的责d开, 使得

Example example=new Example(参数);

是单的责Q:使用Exampleq个实例;而创建Example的Q务就交给了Factory工厂模式.

按照传统ҎQ我们如果需要承Examplec,生成MyExampleQ就需要定义Example为InterfaceQ然后,不断l承q个InterfaceQ生成许多子c,造成以后代码l护是如此的困难?br>
如果Q我们开始就采用了工厂模式,也许没有这么多的烦g?br>
我们生成一个FactoryQ它专门负责生成Example的实例?br>
public class Factory {
     
public static Example getIntance() 
   
          
if(flag == 1)
             
return new MyExample();
          
if(flag == 2)
             
return new YourExample();
     }

}


然后Q那么在你的E序?如果要实例化MyExample?׃?br>
Example example=Factory.getIntance();//q有其它标志Q不具体写了?br>

具体使用Q?br>工厂模式有以下三U:
1. 单工?Simple Factory)
2. 工厂Ҏ(Factory Method)Q?br>3. 抽象工厂(Abstract Factory)?br>
我们先看一D代?br>
public abstract class Factory{
  
public abstract MyExample creator();
  
public abstract YourExample creator(); 
}


public class FirstFactory extends Factory{
  
public MyExample creator(){
     
  }

  
public YourExample creator(){
     
  }

}


public class SecondFactory extends Factory{
  
public MyExample creator(){
     
  }

  
public YourExample creator(){
     
  }

}


q里Q我们需要创建多个对象,复杂性提高,于是需要采用Abstract Factory来封装共同属性和ҎQ而将不同的属性和Ҏ通过子类来实现?br>
而言之,工厂模式的目的就是用来实现实例分发?br>
工厂模式中几U类型的一些差别:
单工厂模式是Ҏ参数来决定生实例;
单工厂模? 核心是一个实c;
工厂Ҏ模式的核心是一个抽象工厂类Q?br>工厂Ҏ模式可以允许很多实的工厂cM抽象工厂cȝ承下? 从而可以在实际上成为多个简单工厂模式的l合Q?br>工厂Ҏ一般只创徏一个实例,而Abstract Factory创徏多个实例?br>

dayue 2007-04-12 03:53 发表评论
]]>
վ֩ģ壺 | | ӽ| ɽ| | | üɽ| ں| | ƽ| ֹ| | ֦| ɽ| Ů| ξ| | ν| | ɽ| ʯ| | | Ͽ| | | | | ƽ| | | ɽ| | ţ| Դ| ֹ| | ɽ| ɽ| ɽ| |