Time of Update: 2018-12-03
1.前者為UI提供支援,後者不是2.前者在外掛程式卸載關閉時會自動儲存首選面值,後者不會,Plugin中的stop方法什麼都沒做,所以,如果要儲存喜好設定持久化內容,就需要在stop方法裡面自己去做儲存工作。這是兩者最重要的區別AbstractUIPlugin中的stop源碼為: public void stop(BundleContext context) throws Exception { try { if (bundleListener !=
Time of Update: 2018-12-03
eg:private NumberFormat formatter =
Time of Update: 2018-12-03
在osgi控制台,直接鍵入getprop,可查看所有ogsi啟動時參數實際上,這些參數都在Eclipse平台啟動類org.eclipse.core.runtime.adaptor.EclipseStarter中有定義(位於org.eclipse.osgi外掛程式中),查看源碼即一目瞭然。該類不允許在外部執行個體化,它自身有一個main方法用於啟動平台。也可通過Startup方法將其啟動。eg:String[] equinoxArgs = {"-console","1234","-noExit"}
Time of Update: 2018-12-03
1) 原則 / 法則: a) 誰構造誰釋放;b) 釋放父資源時子資源同時被釋放; 2) 需要手工釋放的情形: a) Display對象;b) 自建立的圖形資來源物件(如Color、Image、Font等對象); 3) 不需要手工釋放的情形: a) Shell對象(Display對象釋放時會自動釋放);b) 控制項(其父資源視窗關閉時會自動釋放);c) 系統內建的圖形資來源物件(通過 getSystemXXX 方法得到的圖形資來源物件)。
Time of Update: 2018-12-03
1.plugin.xmlMANIFEST.MF描述了bundle的基本資料,與osgi有關。plugin.xml描述了bundle中擴充與擴充點資訊。在eclipse3.1後,外掛程式若沒有任何擴充點資訊,不一定會有plugin.xml檔案。即某個外掛程式中可能是沒有plugin.xml檔案的。 2.MANIFEST.MF在eclipse3.1以前,ogsi清單資訊可以寫在plugin.xml中,所以,大家在一些比較老版本的外掛程式中,會看到,並沒有MANIFEST.MF檔案,其實真正的原因是它
Time of Update: 2018-12-03
BufferedWriter類的newLine方法源碼: /** * Writes a line separator. The line separator string is defined by the * system property <tt>line.separator</tt>, and is not necessarily a single * newline ('/n') character. * *
Time of Update: 2018-12-03
類別 命令 含義控制架構 launch 啟動架構shutdown 停止架構close 關閉、退出架構exit 立即退出,相當於 System.exitinit 卸載所有 bundle(前提是已經 shutdown)setprop 設定屬性,在運行時進行Install 安裝uninstall 卸載start 啟動stop 停止refresh 重新整理update 更新ss 展示所有 bundle
Time of Update: 2018-12-03
可通過修改啟動的osgi.ParentClassLoader來改變這個parent classloaer,預設採用是boot。可選的其他值有app、ext、fwk。app對應的SystemClassLoader。即系統類別載入器ext對應的是SystemClassLoader的parent,即擴充類載入器fwk對應的為啟動equinox的classloader。可在org.eclipse.osgi.baseadaptor.BaseAdaptor看到如下代碼// System property
Time of Update: 2018-12-03
1.資源檔的擷取ResourceBundle.getBundle(參數)參數:包名+基名eg:private static final ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.jface.messages"); 其中org.eclipse.jface為包名,基名為messages(這個是由資源檔首碼決定的) 2.資源檔基名一般以.properties結尾eg:messages.properties
Time of Update: 2018-12-03
前段時間研究Socket編程,看了幾個有關Ftp協議服務端和用戶端的開源實現。瞭解了下port模式和passive模式。 FTP的串連一般是有兩個串連的,一個是客戶程和伺服器傳輸命令的,另一個是資料傳送的串連。FTP服務程式一般會支援兩種不同的模式,一種是Port模式,一種是Passive模式(Pasv
Time of Update: 2018-12-03
繼承自org.eclipse.jface.Dialog的對話方塊,覆蓋父類Windows的handleShellCloseEvent方法,可使其關閉按鈕失效@Override protected void handleShellCloseEvent() { //do nothig //當然在handleShellCloseEvent中做其它事情也是可以的,具體看代碼怎麼寫了。
Time of Update: 2018-12-03
最早的保護敏感資訊的技術是把包含敏感性資料的成員聲明為私人的(private)和暫時的(transietn) . 使用transietn修飾的變數不會被序列化,也不可能通過任何序列化機制儲存.
Time of Update: 2018-12-03
SWT中對一些類被子類化進行了限制,但也許是為了以後的相容性,這些類並沒有生硬的使用final來強制終態。而是使用了一個叫做checkSubclass的方法,來確保不被子類化。 但有的時候,我們確實想要繼承這個類,此時,可以在子類中覆蓋 checkSubclass方法,來解除SWT不允許被繼承的限制。 eg: 重寫checkSubclass()方法 @Override protected void checkSubclass() { // do nothing }
Time of Update: 2018-12-03
前者只是一普通的字元號串替換,後者是一個支援Regex的替換eg:String str = "2008.1.12";現有需要將字串中的"."替換為"_"。 一種方法是老老實實使用str.replace(".","_"); 若是使用str.replaceAll(".","_") 那str中所有字元均會被替換為"_"。 因為在Regex中,"."代表任一字元。 正確做法是在replaceAll的第一個參數中使用轉義構造正確的Regex。 如: str.replaceAll("//.","_");
Time of Update: 2018-12-03
實際上就是new Socket。因為Socket在的同時會去嘗試串連遠程伺服器 eg:public String[] connect(String host, int port) throws IllegalStateException, IOException, FTPIllegalReplyException, FTPException { synchronized (lock) { // Is this client already connected to any
Time of Update: 2018-12-03
SWT:儲存映像主要涉及一個org.eclipse.swt.graphics.ImageLoader類eg:ImageLoader loader = new ImageLoader();loader.data = new ImageData[] {image.getImageData()};loader.save("swt.png", SWT.IMAGE_PNG); 完整程式public class ImaeSave { public static void main(String[]
Time of Update: 2018-12-03
由於無法找到該文章的原創作者,在此無法註明出處,請作者見諒.如有問題或侵害到您的利益,請與我聯絡. 這裡以Spring 2.0.2來說明。 Spring2.0架構要求J2SE 1.3和J2EE 1.3 (Servlet 2.3, JSP 1.2, JTA 1.0, EJB 2.0)。編譯時間要求使用 JDK 1.5; 需要AspectJ來編譯包括全部aspects(方面)的完全版本。 當不使用Spring的JSP標籤庫或者EJB的支援時,J2EE 1.2 (Servlet 2.2, JSP
Time of Update: 2018-12-03
資料庫連接池供應商實際上將jdbc的常用類進行了再次封裝,比如Connecton,Statement等等。主要是使用的適配器模式,比如從資料庫連接池中擷取的Connnection可能是一個實現了java.sql.Connection介面的類,所以當我們使用完Connection後所進行的close()操作,實際上只是對這個實作類別進行了close。在實作類別內部實現的close並沒有關閉資料庫物理串連,只是將其歸還到串連池中。
Time of Update: 2018-12-03
eclipse啟動失敗,彈出對話方塊內容如下:-startupplugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar--launcher.libraryplugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519-productorg.eclipse.epp.package.rcp.product--launcher.XXMaxPermSize512M-s
Time of Update: 2018-12-03
《調優JVM記憶體解決OutOfMemoryError 》從VM規範中我們可以得到,一下幾種異常。 java.lang.StackOverflowError:(很少) java.lang.OutOfMemoryError:heap space(比較常見) java.lang.OutOfMemoryError: PermGen space (經常出現) 以下分別解釋一下,從最常見的開始:java.lang.OutOfMemoryErrorPermGen space