999久久精品,精品视频免费在线,国内精品久久久久久久影视简单http://www.aygfsteel.com/sdyjmc/category/16405.html單飛zh-cnThu, 27 Jun 2013 08:35:41 GMTThu, 27 Jun 2013 08:35:41 GMT60eclipse寫正則式的插件Regex Utilhttp://www.aygfsteel.com/sdyjmc/archive/2013/06/27/400986.html單飛單飛Thu, 27 Jun 2013 02:49:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2013/06/27/400986.htmlhttp://www.aygfsteel.com/sdyjmc/comments/400986.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2013/06/27/400986.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/400986.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/400986.html寫正則式挺好用的一個elcipse插件:
http://myregexp.com/eclipsePlugin.html
內容拷貝如下:

Screenshot:
Screenshot of eclipse plugin

Features

  • Full highlighting of regular expression syntax for an easy visual clue
    (including bracket matching , ; error detecting , , , )
  • Tooltips will be shown when the mouse is over a part of the regex. , , ,
  • Evaluates your regular expression while you are typing;
  • 4 distinct match modes:
    • Find a sequence of characters ;
    • Match a complete text , ;
    • Split text (see java.lang.String.split(String regex)) ;
    • Replace ;
  • Support for pattern flags (e.g. Pattern.CASE_INSENSITIVE, Pattern.DOTALL, ...);
  • Generation of java source string literals based on the regexp, (escape slash, e.g. "\(x\)" becomes "\\(x\\)")
  • Synchronized selection of regular expression and text: Just select part of the regexp to see which part of the text is matched by this part. .
Functionality of this plugin is available as java-applet

Demo of Regular Expression Hilighting

Move mouse to regex to see example of tooltips and brackets matching
(19|20)\d\d([- /.])(0[1-9]|1[012])\2(0[1-9]|[12][0-9]|3[01])

Opening in eclipse

In Eclipse choose Window -> Show View -> Other -> Regex Util

License

This programm is free and is distributed under the GPL. All funds for developement come from advertisement on this page.

Download the plugin

Last version: Download


單飛 2013-06-27 10:49 發表評論
]]>
swt 顯示滾動字幕http://www.aygfsteel.com/sdyjmc/archive/2010/08/06/328146.html單飛單飛Fri, 06 Aug 2010 08:47:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2010/08/06/328146.htmlhttp://www.aygfsteel.com/sdyjmc/comments/328146.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2010/08/06/328146.html#Feedback1http://www.aygfsteel.com/sdyjmc/comments/commentRss/328146.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/328146.html private Timer timer;

    public class ATask extends TimerTask {
        @Override
        public void run() {
            showScrollText(doneLabel);
           

        }
    }

    /**
     * 滾動顯示字幕
     *
     * @param toDoLabel
     */
    private void showScrollText(final Label toDoLabel) {
        if (toDoLabel != null) {
            if (toDoLabel.isDisposed()) {
                timer.cancel();
                return;
            }
            shell.getDisplay().asyncExec(new Runnable() {
                // @Override
                public void run() {
                    String txt = toDoLabel.getText();
                    if (txt != null && txt.length() > 50) {
                        txt = txt.substring(1, txt.length())
                                + txt.substring(0, 1);
                        toDoLabel.setText(txt);
                    }
                }

            });

        }
    }
構造的時候
// 滾動顯示字幕
        timer = new Timer();
        timer.schedule(new ATask(), 0, 500);

        //
    }

    // @Override
    public void dispose() {
        timer.cancel();
        super.dispose();
    }
private Timer timer;

    public class ATask extends TimerTask {
        @Override
        public void run() {
            showScrollText(doneLabel);
           

        }
    }


    /**
     * 滾動顯示字幕
     *
     * @param toDoLabel
     */
    private void showScrollText(final Label toDoLabel) {
        if (toDoLabel != null) {
            if (toDoLabel.isDisposed()) {
                timer.cancel();
                return;
            }
            shell.getDisplay().asyncExec(new Runnable() {
                // @Override
                public void run() {
                    String txt = toDoLabel.getText();
                    if (txt != null && txt.length() > 50) {
                        txt = txt.substring(1, txt.length())
                                + txt.substring(0, 1);
                        toDoLabel.setText(txt);
                    }
                }

            });

        }
    }


構造的時候
// 滾動顯示字幕
        timer = new Timer();
        timer.schedule(new ATask(), 0, 500);

// @Override
    public void dispose() {
        timer.cancel();
        super.dispose();
    }





單飛 2010-08-06 16:47 發表評論
]]>
插件中使用Dll,導致vista系統下面不能啟動問題http://www.aygfsteel.com/sdyjmc/archive/2009/09/22/295953.html單飛單飛Tue, 22 Sep 2009 02:05:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/09/22/295953.htmlhttp://www.aygfsteel.com/sdyjmc/comments/295953.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/09/22/295953.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/295953.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/295953.html
Bundle-NativeCode manifest allows you to use native libraries (DLLs) without having to set the java.library.path system property

#Processor Aliases                      Description

68k                                     # Motorola 68000 and up
ARM                                     # Intel Strong ARM
Alpha                                   # Compaq (ex DEC)
Ignite psc1k                            # PTSC
Mips                                    # SGI
PArisc                                  # Hewlett Packard PA Risc
PowerPC power ppc                       # Motorola/IBM Power PC
Sparc                                   # SUN
x86 pentium i386 i486 i586 i686         # Intel
s390                                    # IBM System 390
s390x                                  # IBM System 390 (64-bit)
v850e                                   # NEC V850E
x86-64 amd64 em64t x86_64               # 64 bit x86 architecture

#OS Aliases                             Description

AIX                                      # IBM
DigitalUnix                              # Compaq
embos                                    # Segger Embedded Software Solutions
Epoc32 SymbianOS                         # Symbian OS
FreeBSD                                  # Free BSD
HPUX                                     # Hewlett Packard
IRIX                                     # Sillicon Graphics
Linux                                    # Open source
MacOS "Mac OS"                   # Apple
MacOSX "Mac OS X"              # Apple
NetBSD                                   # Open source
Netware                                  # Novell
OpenBSD                                  # Open source
OS2 OS/2                                 # IBM
QNX procnto                              # QNX Neutrino 2.1
Solaris                                  # Sun
SunOS                                    # Sun
VxWorks                                  # WindRiver Systems
Windows95 "Windows 95" Win95 Win32       # Microsoft
Windows98 "Windows 98" Win98 Win32       # Microsoft
WindowsNT "Windows NT" WinNT Win32       # Microsoft
WindowsCE "Windows CE" WinCE             # Microsoft
Windows2000 "Windows 2000" Win2000 Win32 # Microsoft
WindowsXP "Windows XP" WinXP Win32       # Microsoft
Windows2003 "Windows 2003" "Windows Server 2003" Win2003 Win32 # Microsoft
WindowsVista WinVista "Windows Vista" Win32 # Microsoft




單飛 2009-09-22 10:05 發表評論
]]>
swt TableItem增加菜單http://www.aygfsteel.com/sdyjmc/archive/2009/09/21/295853.html單飛單飛Mon, 21 Sep 2009 05:48:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/09/21/295853.htmlhttp://www.aygfsteel.com/sdyjmc/comments/295853.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/09/21/295853.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/295853.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/295853.html
 
MenuManager menuMgr = new MenuManager();
        menuMgr.setRemoveAllWhenShown(
true);
        menuMgr.addMenuListener(
new IMenuListener() {
            
public void menuAboutToShow(IMenuManager manager) {
                manager.add(
new Action("刪除"){
                    
public void run(){
                        
boolean flag = MessageDialog.openConfirm(parentComposite.getShell(), "確認刪除嗎?""你確認要刪除嗎?");
                        
if(flag){
                            removeSelectPage();    
                        }

                        
                    }

                }
);
            }

        }
);
        
final Menu menu = menuMgr.createContextMenu(this);
        
this.setMenu(menu);
        
        tabFolder.addMenuDetectListener(
new MenuDetectListener(){

            
public void menuDetected(MenuDetectEvent arg0) {
                menu.setVisible(
true);
            }

            
        }
);
        tabFolder.addMouseListener(
new MouseAdapter(){
            
public void mouseDown(MouseEvent mouseevent)
            
{
                TabItem selectItem 
= tabFolder.getItem(new Point(mouseevent.x,mouseevent.y));
                tabFolder.setSelection(selectItem);
            }

        }
);
Unfortunately, there is no way to get the bounds of a TabItem on every
platform (specifically, the Mac does not support it).  Therefore, at the
lowest level, we can't get what you want.
"Stéphane Fournier" <stephane.fournier@xxxxxxxxxxxxxxx> wrote in message
news:dgdg2j$5p4$1@xxxxxxxxxxxxxxxxxxx
> Hi,
>
> Does anyone know how to set a Popup Menu on a TabItem.
> I found how to set a Menu on the TabFolder but in my case I need a popup
> menu with a content related to the TabItem when right mouse click is
> triggered (the TabItem could not be the selected tabItem for the
TabFolder).
>
> Another way is to get a dynamic content for the Menu  set on the
> TabFolder, but I need to listen to an event when mouse is moving over
> the TabItems without selecting them....
> My need is something close to the behavior of the CTabItem when the
> mouse is over a not selected CTabItem ,a cross is displayed to close the
> CTabItem without activating it...
>
> Which event can I listen to ?
>
> Thanks in advance,
> Stephane.


單飛 2009-09-21 13:48 發表評論
]]>
轉貼 Swt/Jface tableViewer入門教程三(加入在表格上直接編輯數據)http://www.aygfsteel.com/sdyjmc/archive/2009/08/27/292819.html單飛單飛Thu, 27 Aug 2009 06:54:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/08/27/292819.htmlhttp://www.aygfsteel.com/sdyjmc/comments/292819.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/08/27/292819.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/292819.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/292819.html閱讀全文

單飛 2009-08-27 14:54 發表評論
]]>
[RCP] 隱藏屬性視圖http://www.aygfsteel.com/sdyjmc/archive/2009/08/03/289555.html單飛單飛Mon, 03 Aug 2009 03:29:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/08/03/289555.htmlhttp://www.aygfsteel.com/sdyjmc/comments/289555.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/08/03/289555.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/289555.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/289555.html         hideView("org.eclipse.ui.views.PropertySheet");
    }

    public static void hideView(final String theViewId) {
        invokeOnDisplayThread(new Runnable() {
            public void run() {
                try {
                    IWorkbenchPage activePage = getActivePage();
                    IViewPart iviewpart = activePage.findView(theViewId);
                    activePage.hideView(iviewpart);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        });
    }

    public static void invokeOnDisplayThread(Runnable runnable) {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchWindow windows[] = workbench.getWorkbenchWindows();
        if (windows != null && windows.length > 0) {
            Display display = windows[0].getShell().getDisplay();
            display.syncExec(runnable);
        } else {
            runnable.run();
        }
    }




單飛 2009-08-03 11:29 發表評論
]]>
[原創]RCP JFace Dialog 的Cancel Ok 按鈕國際化http://www.aygfsteel.com/sdyjmc/archive/2009/07/28/288677.html單飛單飛Tue, 28 Jul 2009 01:34:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/07/28/288677.htmlhttp://www.aygfsteel.com/sdyjmc/comments/288677.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/07/28/288677.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/288677.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/288677.html 重寫創建按鈕的方法createButtonFromButtonBar

方法2:
等待窗口open()后調用:

getButton(0).setText("確定");
getButton(1).setText("取消");

方法3:
國際化操作:
new Fragment Project;

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Fragement Fragment
Bundle-SymbolicName: org.eclipse.jface.fragement
Bundle-Version: 1.0.0
Fragment-Host: org.eclipse.jface;bundle-version="3.2.2"
Bundle-Localization: plugin


new org.eclipse.jface.fragment/src/org/eclipse/jface/messages_zh_CN.properties Files.

cancel = \u53D6\u6D88
ok = \u786E\u5B9A


單飛 2009-07-28 09:34 發表評論
]]>
MANIFEST.MF dll pluginhttp://www.aygfsteel.com/sdyjmc/archive/2009/07/08/285906.html單飛單飛Wed, 08 Jul 2009 02:07:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/07/08/285906.htmlhttp://www.aygfsteel.com/sdyjmc/comments/285906.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/07/08/285906.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/285906.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/285906.html



單飛 2009-07-08 10:07 發表評論
]]>
swt table 另一種表頭排序的實現http://www.aygfsteel.com/sdyjmc/archive/2009/07/07/285812.html單飛單飛Tue, 07 Jul 2009 06:45:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/07/07/285812.htmlhttp://www.aygfsteel.com/sdyjmc/comments/285812.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/07/07/285812.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/285812.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/285812.htmlfor (int i = 0; i < COLUMNS.length; i++) {
                TableColumn idColumn 
= new TableColumn(table, SWT.LEFT);
                cName 
= StringUtils.getNotEmpty(COLUMNS[i]);
                ColumnPixelData columnpixeldata 
= new ColumnPixelData(COLUMNS_WIDTH[i]);
                tableLayout.addColumnData(columnpixeldata);
                idColumn.setText(cName);
                idColumn.setResizable(
true);
                
final String columnName = cName;
                
final Collator collator = Collator.getInstance();
                idColumn.addSelectionListener(
new SelectionListener() {
                    
private boolean sortType = true;

                    
public void widgetDefaultSelected(SelectionEvent e) {

                    }

                    
public void widgetSelected(SelectionEvent e) {
                        sortType 
= !sortType;
                        java.util.Collections.sort(input, 
new Comparator<FElement>() {

                            
public int compare(FElement entry1, FElement entry2) {
                                
int rt = -1;
                                
if (COLUMNS[1].equals(columnName)) {
                                    rt 
= collator.compare(entry1.getName(), entry2.getName());
                                } 
else if (COLUMNS[2].equals(columnName)) {
                                    rt 
= collator.compare(StringUtils.getNotEmpty(entry1.getValueTxt()), StringUtils.getNotEmpty(entry2.getValueTxt()));
                                } 
else if (COLUMNS[3].equals(columnName)) {
                                    rt 
= collator.compare(StringUtils.getNotEmpty(entry1.getDescription()), StringUtils.getNotEmpty(entry2.getDescription()));
                                }
                                
if (sortType) {
                                    
return (-1* rt;
                                }

                                
return rt;
                            }

                        });
                        options.setInput(input);
                        options.refresh();

                    }

                });
            }

這種方法的好處是短小精悍
如果做架構設計就不如使用Annotation封裝一下,如果是剛入門就不妨每列增加一個Sorter而且還要增加正反兩個.


單飛 2009-07-07 14:45 發表評論
]]>
[原創] WST 的Outline增加菜單http://www.aygfsteel.com/sdyjmc/archive/2009/06/03/279751.html單飛單飛Wed, 03 Jun 2009 02:04:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/06/03/279751.htmlhttp://www.aygfsteel.com/sdyjmc/comments/279751.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/06/03/279751.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/279751.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/279751.html
   <extension
         
point="org.eclipse.wst.sse.ui.editorConfiguration">
  
<!-- associating an outline configuration to an input's content type -->
      
<contentOutlineConfiguration
          
class="com.test.outline.OutlineConfiguration"
          target
="org.eclipse.core.runtime.xml,org.eclipse.wst.html.core.htmlsource"/>        
   
</extension>
OutlineConfiguration.java

import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.ui.internal.IReleasable;
import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager;
import org.eclipse.wst.xml.ui.views.contentoutline.XMLContentOutlineConfiguration;

public class OutlineConfiguration extends XMLContentOutlineConfiguration {
    
    
private class ActionManagerMenuListener implements IMenuListener, IReleasable {

        
public void menuAboutToShow(IMenuManager imenumanager) {
            TestAction action 
= new TestAction();
            imenumanager.add(action);
        }

        
public void release() {
            fTreeViewer 
= null;
            
if (fActionManager != null)
                fActionManager.setModel(
null);
        }

        
private XMLNodeActionManager fActionManager;

        
private TreeViewer fTreeViewer;

        
public ActionManagerMenuListener(TreeViewer treeviewer) {
            
super();
            fTreeViewer 
= treeviewer;
        }
    }

    
private ActionManagerMenuListener fContextMenuFiller;

    
public OutlineConfiguration() {
        
super();
    }
    @Override
    
public IMenuListener getMenuListener(TreeViewer treeviewer) {
        
if (fContextMenuFiller == null)
            fContextMenuFiller 
= new ActionManagerMenuListener(treeviewer);
        
return fContextMenuFiller;
    }
}


import org.eclipse.jface.action.Action;

public class TestAction extends Action {
    
public TestAction(){
        
super("Test");
    }
}

這樣Outline的Menu就是你自己定義的了.


參考資料:
http://www.eclipse.org/webtools/wst/components/sse/designs/EditorConfiguration.html





單飛 2009-06-03 10:04 發表評論
]]>
設計原則: 關上一扇窗戶的時候,留下一把錘子http://www.aygfsteel.com/sdyjmc/archive/2009/05/27/278160.html單飛單飛Wed, 27 May 2009 02:31:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/05/27/278160.htmlhttp://www.aygfsteel.com/sdyjmc/comments/278160.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/05/27/278160.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/278160.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/278160.html
public int addPage(Control control)
    {
        
int i = getPageCount();
        addPage(i, control);
        
return i;
    }

    
public void addPage(int i, IEditorPart ieditorpart, IEditorInput ieditorinput)
        
throws PartInitException
    {
        IEditorSite ieditorsite 
= createSite(ieditorpart);
        ieditorpart.init(ieditorsite, ieditorinput);
        Composite composite 
= new Composite(getContainer(), getOrientation(ieditorpart));
        composite.setLayout(
new FillLayout());
        ieditorpart.createPartControl(composite);
        ieditorpart.addPropertyListener(
new IPropertyListener() {

            
public void propertyChanged(Object obj, int j)
            {
                handlePropertyChange(j);
            }

        }
);
        CTabItem ctabitem 
= createItem(i, composite);
        ctabitem.setData(ieditorpart);
        nestedEditors.add(ieditorpart);
    }

那么有辦法把一個EditorPart 加入Composite再放到Page里面呢?
public void addHtmlPage(IEditorPart ieditorpart, IEditorInput ieditorinput) throws PartInitException {
        
final SashForm sashForm = new SashForm(getContainer(), SWT.NONE);
        
        
final Composite pageContainer = new Composite(sashForm, SWT.NONE);
        sashForm.setSashWidth(
1);
        
        
final Composite resultContainer = new Composite(sashForm, SWT.NONE);
        resultContainer.setLayout(
new FillLayout());
        
        sashForm.setWeights(
new int[] {11 });        
        createAnalyzePage(resultContainer);
        
        IEditorSite ieditorsite 
= createSite(ieditorpart);
        ieditorpart.init(ieditorsite, ieditorinput);

        pageContainer.setLayout(
new FillLayout());
        ieditorpart.createPartControl(pageContainer);
        ieditorpart.addPropertyListener(
new IPropertyListener() {

            
public void propertyChanged(Object obj, int j) {
                handlePropertyChange(j);
            }

        });
        
        
        
int index = addPage(sashForm);
        setPageText(index, 
"html");
    }
視乎這樣就可以了,但是問題出現了.缺少了父類nestedEditors.add(ieditorpart);對editor生命周期的管理.導致屬性編輯器出問題.怎么解決呢?
    private CTabFolder container;
    
private ArrayList nestedEditors;

MultiPageEditorPart 聲明的都是私有的屬性,按照面向對象的設計是不能被繼承者訪問的.
那怎么辦呢?這時候就該使用錘子了."Reflect"

CTabFolder container = (CTabFolder) getParentFileValue(MultiPageEditorPart.class,(MultiPageEditorPart)this"container");
        CTabItem ctabitem 
= new CTabItem(container, 0, i);
        ctabitem.setControl(composite);
        ctabitem.setData(ieditorpart);
        ArrayList nestedEditors 
= (ArrayList) getParentFileValue(MultiPageEditorPart.class,(MultiPageEditorPart)this"nestedEditors");
        nestedEditors.add(ieditorpart);

public static Object getParentFileValue(Class parentClassType,Object object, String filedName) {
        Field fild = null;
        Object fildValue = null;
        try {
            fild = parentClassType.getDeclaredField(filedName);
            fild.setAccessible(true);// 設置安全檢查,訪問私有成員變量必須
            fildValue = fild.get(object);

        } catch (NoSuchFieldException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return fildValue;
    }

呵呵,問題解決了.



單飛 2009-05-27 10:31 發表評論
]]>
IFile getFullPath注意http://www.aygfsteel.com/sdyjmc/archive/2009/04/21/266778.html單飛單飛Tue, 21 Apr 2009 08:27:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/04/21/266778.htmlhttp://www.aygfsteel.com/sdyjmc/comments/266778.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/04/21/266778.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/266778.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/266778.html
這樣才能獲取到磁盤路徑


單飛 2009-04-21 16:27 發表評論
]]>
國際化編輯器http://www.aygfsteel.com/sdyjmc/archive/2009/04/15/265775.html單飛單飛Wed, 15 Apr 2009 07:51:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/04/15/265775.htmlhttp://www.aygfsteel.com/sdyjmc/comments/265775.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/04/15/265775.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/265775.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/265775.htmlEclipse Plugin]ResourceBundle Editor(國際化資源文件編輯器 http://sourceforge.net/projects/eclipse-rbe




單飛 2009-04-15 15:51 發表評論
]]>
實現當IFile內容改變的時候更新Editorhttp://www.aygfsteel.com/sdyjmc/archive/2009/03/20/260973.html單飛單飛Fri, 20 Mar 2009 02:07:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/03/20/260973.htmlhttp://www.aygfsteel.com/sdyjmc/comments/260973.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/03/20/260973.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/260973.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/260973.htmlpublic class HtmlEditor extends MultiPageEditorPart
public
 void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {

   initResourceChangeListener();
}
    
    
private IWorkspace getWorkspace() {
        
return ((IFileEditorInput) getEditorInput()).getFile().getWorkspace();
    }
    
    
private void initResourceChangeListener() {
        IResourceChangeListener resourceChangeListener 
= new IResourceChangeListener() {
            
public void resourceChanged(IResourceChangeEvent event) {
                handleResourceChange(event);
            }
        };
        getWorkspace().addResourceChangeListener(resourceChangeListener);
    }

    
private void handleResourceChange(IResourceChangeEvent event) {
        
if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
            IFile file 
= ((IFileEditorInput) getEditorInput()).getFile();
            
// update editor
            
        }
    }
/**
 *當更新或者刪除文件的時候
**/
public void resourceChanged(final IResourceChangeEvent event) {
        if (event.getType() == IResourceChangeEvent.POST_CHANGE)
            Display.getDefault().asyncExec(new Runnable() {

                public void run() {
                    IResourceDelta rootDelta = event.getDelta();
                    if(rootDelta ==null){
                        return;
                    }
                    IResourceDelta htmlDelta = rootDelta.findMember(new Path("DefaultProject/t.html"));
                    if(htmlDelta == null){
                        return;
                    }
                }
            });
        if (event.getType() == IResourceChangeEvent.PRE_CLOSE) {
            Display.getDefault().asyncExec(new Runnable() {
                public void run() {
                    IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
                    for (int i = 0; i < pages.length; i++) {
                        if (((FileEditorInput) getSourceEditor().getEditorInput()).getFile().getProject().equals(event.getResource())) {
                            IEditorPart editorPart = pages[i].findEditor(getSourceEditor().getEditorInput());
                            pages[i].closeEditor(editorPart, true);
                        }
                    }
                }
            });
        }
    }



單飛 2009-03-20 10:07 發表評論
]]>
插件依賴的單向性Plugin dependence http://www.aygfsteel.com/sdyjmc/archive/2009/01/25/252546.html單飛單飛Sun, 25 Jan 2009 02:27:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/01/25/252546.htmlhttp://www.aygfsteel.com/sdyjmc/comments/252546.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2009/01/25/252546.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/252546.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/252546.html


單飛 2009-01-25 10:27 發表評論
]]>
Rcp plugin 國際化bughttp://www.aygfsteel.com/sdyjmc/archive/2009/01/23/252439.html單飛單飛Fri, 23 Jan 2009 03:42:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2009/01/23/252439.html Plugin.properties放在plugin.xml的相同目錄下, Eclipse里面看國際化也是非常正確, 但是運行以后就是只顯示"%XXXX"這樣的字符串原來是因為

Localization in RCP plugins is usually done by including translations in a property file and using their id in plugin.xml.

I spend some time lately trying to understand why some translations were not used in my application although they were correctly displayed in PDE.

Answer : when using plugin.properties, you MUST include the following line in the plugin manifest :

Bundle-Localization: plugin

Otherwise, PDE will show the translated text, but your app won’t.

Strangely, I had to edit the manifest manually because I couldn’t find a way to enable plugin localization in PDE. Some other plugins of my application already had this line, but I don’t remember adding it. Maybe Eclipse templates have changed since I created my first plugins (using Eclipse 3.1).


記得以前插件開發也有這個問題,不過忘記了。
真是記性越來越差了。
這個問題竟然困擾了我兩個星期。還好可以google到別人的解決辦法,今天在這里留個腳印。


單飛 2009-01-23 11:42 發表評論
]]>
[原創] 修正com.ibm.rcp.activex不能打開中文路徑bughttp://www.aygfsteel.com/sdyjmc/archive/2008/08/09/221078.html單飛單飛Sat, 09 Aug 2008 14:52:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2008/08/09/221078.htmlhttp://www.aygfsteel.com/sdyjmc/comments/221078.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2008/08/09/221078.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/221078.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/221078.html

IBM Container for ActiveX Documents - Eclipse Version

但是我發現如果使用它打開含有中文名稱的文檔,就會拋異常,看了它的代碼,發現

JNIEXPORT jint JNICALL Java_com_ibm_rcp_activex_ActivexDocumentWidget_createControl
    (JNIEnv 
* env, jclass that, jint hwndParent, jstring filename, jstring progid, jint hwndShell,
    jintArray fileMenu, jintArray containerMenu, jintArray windowMenu,
    jint indexHelpMenu, jstring helpMenuItemPrefix)
{
    ADD_TO_TRACE();
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    
if (NULL == progid)
    {
        
return 0;
    }

    
const char * lpszProgid = env->GetStringUTFChars(progid, 0);

    
const char * lpszFileName = NULL;

    
if (NULL != filename)
    {
        lpszFileName 
= env->GetStringUTFChars(filename, 0);
    }

這樣會引發jni的字符亂碼問題,在參考了《〈Java與C之間通過JNI傳遞中文字符串〉》的解決方案后
做了如下的改寫:
char* jstringToWindows( JNIEnv *env, jstring jstr );


if (NULL != filename)
    {
        lpszFileName 
= jstringToWindows( env, filename );
        
//lpszFileName = env->GetStringUTFChars(filename, 0);
    }


char* jstringToWindows(JNIEnv* env,jstring jstr)
{
    
int length=(env)->GetStringLength(jstr);
    
const jchar* jcstr=(env)->GetStringChars(jstr,0);
    
char* rtn=(char*)malloc(length*2+1);
    
int size=0;
    size
=WideCharToMultiByte(CP_ACP,0,(LPCWSTR)jcstr,length,rtn,(length*2+1),NULL,NULL);
    
if(size<=0)
    
return NULL;
    (env)
->ReleaseStringChars(jstr,jcstr);
    rtn[size]
=0;
    
return rtn;
}

成功編譯后,可以正常使用了。




單飛 2008-08-09 22:52 發表評論
]]>
Composite To Image filehttp://www.aygfsteel.com/sdyjmc/archive/2008/04/22/194838.html單飛單飛Tue, 22 Apr 2008 09:49:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2008/04/22/194838.htmlhttp://www.aygfsteel.com/sdyjmc/comments/194838.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2008/04/22/194838.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/194838.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/194838.htmlpublic void toImage(Control composiste ,File file)throws Excepton{
Display display 
= PlatformUI.getWorkbench().getDisplay();
Point size 
= composite.getSize();
final Image image = new Image(display,size.x,size.y);
GC gc 
= new GC(Composite);
gc.copyArea(image,
0,0);
gc.dispose();
// save image to file;
ImageData imageData = image.getImageData();
ImageLoader imageLoader 
= new ImageLoader();
imageLoader.data 
= new  ImageData[1];
FileOutputStream fos 
= new FileOutputStream(file);
iamgeLoader.save(fos,SWT.IMAGE_JPEG);
image.dispose();
fos.close();
}




單飛 2008-04-22 17:49 發表評論
]]>
org.eclipse.ui.viewActions 使用心得http://www.aygfsteel.com/sdyjmc/archive/2008/04/20/194272.html單飛單飛Sun, 20 Apr 2008 02:24:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2008/04/20/194272.htmlhttp://www.aygfsteel.com/sdyjmc/comments/194272.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2008/04/20/194272.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/194272.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/194272.html Java代碼
 1 private void createContextMenu(Composite parent) {
 2         MenuManager mgr = new MenuManager();
 3         mgr.setRemoveAllWhenShown(true);
 4         final EntityTreeView tree = this;
 5         mgr.addMenuListener(new IMenuListener() {
 6             public void menuAboutToShow(IMenuManager manager) {
 7                 // TODO Auto-generated method stub
 8                 ISelection selection = tree.getSelection();
 9                 if(selection instanceof IStructuredSelection){
10                     IStructuredSelection incoming = (IStructuredSelection)selection;
11                     if(incoming.size() >0 && incoming.getFirstElement() instanceof AbstractEntity){    
12                         selectedEntity = (AbstractEntity)incoming.getFirstElement();
13                         fillContextMenu(manager,selectedEntity);        
14                     }
15                 }
16                 
17             }
18 
19         });
20 
21         org.eclipse.swt.widgets.Menu menu = mgr.createContextMenu(this.getControl());
22         this.getControl().setMenu(menu);
23         getViewSite().registerContextMenu(mgr, this);
24     }
25 
26     private void fillContextMenu(IMenuManager manager,AbstractEntity selectedEntity) {
27         org.eclipse.jface.action.IContributionItem items[] = getViewSite().getActionBars().getMenuManager().getItems();
28         for (IContributionItem item : items) {
29             if(item instanceof PluginActionContributionItem){
30                 PluginActionContributionItem pitem = (PluginActionContributionItem)item;
31                 if(selectedEntity instanceof CategoryModel){
32                     if ("com.test.actions.RefreshViewActionDelegate".equals(pitem.getAction().getId())){
33                         manager.add(item);
34                         continue;
35                     }
36                 }                
37     
38             }
39             
40             
41         }
42     }

plugin.xml

<extension
         
point="org.eclipse.ui.viewActions">
      
<viewContribution
            
id="com.test.EntityContribution"
            targetID
="com.test.View">
         
<action
               
class="com.etest.actions.AddActionDelegate"
               icon
="icons/action.gif"
               id
="com.etest.actions.AddActionDelegate"
               label
="Add"
               menubarPath
="category"
               style
="push">
         
</action>
targetID指定那個View會獲取到這些action
如果指定一個toolbarPath
就會在NavigatorBar顯示這些action


單飛 2008-04-20 10:24 發表評論
]]>
重新定制StructuredTextEditor的PropertySheethttp://www.aygfsteel.com/sdyjmc/archive/2007/04/24/113190.html單飛單飛Tue, 24 Apr 2007 07:17:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2007/04/24/113190.htmlhttp://www.aygfsteel.com/sdyjmc/comments/113190.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2007/04/24/113190.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/113190.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/113190.htmlpublic Object getAdapter(Class required) {
        if (org.eclipse.ui.views.properties.IPropertySheetPage.class
                .equals(required){
          org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration cfg = createPropertySheetConfiguration();
                if (cfg != null) {
                    PropertySheet propertySheetPage = new PropertySheet(
                            this);
                    propertySheetPage.setConfiguration(cfg);
                }
           
        }

public class PropertySheet extends Page implements
        IPropertySheetPage {
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    //change form part
}



單飛 2007-04-24 15:17 發表評論
]]>
IDaptablehttp://www.aygfsteel.com/sdyjmc/archive/2007/03/16/104131.html單飛單飛Fri, 16 Mar 2007 00:14:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2007/03/16/104131.htmlhttp://www.aygfsteel.com/sdyjmc/comments/104131.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2007/03/16/104131.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/104131.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/104131.htmlhttp://www.eclipsezone.com/articles/what-is-iadaptable/

?http://bjzhanghao.cnblogs.com/archive/2005/09/24/243312.html

文章寫的好,翻譯的也好.感謝一下.




單飛 2007-03-16 08:14 發表評論
]]>
how the Nature id is!http://www.aygfsteel.com/sdyjmc/archive/2006/12/01/84206.html單飛單飛Thu, 30 Nov 2006 18:19:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2006/12/01/84206.htmlhttp://www.aygfsteel.com/sdyjmc/comments/84206.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2006/12/01/84206.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/84206.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/84206.html nature_id = pluginid+extension-id

i dont like this idea.


單飛 2006-12-01 02:19 發表評論
]]>
Dissect Eclipse Plugin Frameworkhttp://www.aygfsteel.com/sdyjmc/archive/2006/11/11/80638.html單飛單飛Sat, 11 Nov 2006 14:37:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2006/11/11/80638.htmlhttp://www.aygfsteel.com/sdyjmc/comments/80638.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2006/11/11/80638.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/80638.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/80638.html
http://eclipsezone.com/articles/eclipse-vms/




單飛 2006-11-11 22:37 發表評論
]]>
Project Builders and Natureshttp://www.aygfsteel.com/sdyjmc/archive/2006/11/11/80525.html單飛單飛Fri, 10 Nov 2006 16:00:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2006/11/11/80525.htmlhttp://www.aygfsteel.com/sdyjmc/comments/80525.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2006/11/11/80525.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/80525.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/80525.html

單飛 2006-11-11 00:00 發表評論
]]>
how to access eclipse Workspacehttp://www.aygfsteel.com/sdyjmc/archive/2006/11/10/80477.html單飛單飛Fri, 10 Nov 2006 11:31:00 GMThttp://www.aygfsteel.com/sdyjmc/archive/2006/11/10/80477.htmlhttp://www.aygfsteel.com/sdyjmc/comments/80477.htmlhttp://www.aygfsteel.com/sdyjmc/archive/2006/11/10/80477.html#Feedback0http://www.aygfsteel.com/sdyjmc/comments/commentRss/80477.htmlhttp://www.aygfsteel.com/sdyjmc/services/trackbacks/80477.html IPath IFile IProject IWorkspace


String filePath = "\testP\src\context\test.html";
IPath path = new Path(filePath);

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

IProject ps[] = root.getProjects();
org.eclipse.core.resources.IFile file = root.getFileForLocation(path
);
IProject = file.getProject();

root 是整個Workspace的根容器,它可以獲取到子目錄的文件。
和java.io.File不同的是IFile通常是get出來的,不是new出來的。


The Official Eclipse FAQs

http://wiki.eclipse.org/index.php/The_Official_Eclipse_FAQs





單飛 2006-11-10 19:31 發表評論
]]>
主站蜘蛛池模板: 凤台县| 阿坝县| 永春县| 济阳县| 鸡西市| 巢湖市| 仙桃市| 修水县| 张掖市| 金沙县| 昌宁县| 盐源县| 台江县| 镇江市| 泽州县| 林芝县| 河池市| 行唐县| 临澧县| 鹤岗市| 甘德县| 新干县| 石柱| 宁海县| 海南省| 静乐县| 邵东县| 仲巴县| 海城市| 海伦市| 江口县| 玉门市| 甘德县| 禄丰县| 理塘县| 云南省| 弥渡县| 周口市| 通化县| 沛县| 大埔区|