子非鱼

BlogJava 首页 新随笔 联系 聚合 管理
  21 Posts :: 0 Stories :: 1 Comments :: 0 Trackbacks

2008年4月12日 #


eclipse瘦身后发现jboss server view找不到

原因: org.jboss.ide.eclipse.as.feature中定义:

 <requires>
          ...
          <import plugin="org.eclipse.wst.server.ui.doc.user"/>
          ...
</requires>

该doc插件包在瘦身时被干掉了,导致jbossideplugin未正常加载,恢复该包即可
posted @ 2011-09-15 18:40 子非鱼 阅读(249) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2009-03-29 13:27 子非鱼| 编辑 收藏

     摘要:   阅读全文
posted @ 2009-03-28 11:54 子非鱼 阅读(867) | 评论 (1)编辑 收藏

     摘要: 内存溢出与JVM参数设置  阅读全文
posted @ 2009-03-28 10:09 子非鱼| 编辑 收藏

     摘要: 转自 http://topic.csdn.net/u/20080929/02/4e0ef626-98ee-4d6d-96ed-fe40afe8290b.html  阅读全文
posted @ 2009-03-28 09:18 子非鱼| 编辑 收藏

转自:http://lemon.javaeye.com/blog/51480
        http://www.blogjava.net/fhawk/archive/2007/01/16/28993.html
利用IKeyBindingService接口为Action绑定快捷键:

1、
设置commands extension

   <extension
           
point = "org.eclipse.ui.commands">
           
<!-- activeKeyConfiguration项用来说明所绑定快捷键的初始设置 -->
           
<activeKeyConfiguration value="org.eclipse.ui.defaultAcceleratorConfiguration"/>
           
<!-- 如果快捷键设置有多套,可以添加多个类别 -->
           
<category
               
name="intelliPlatform.Category1"
               description
="Test description"
               id
="intelliPlatform.Category1"/>
           
<!-- 其中id为这个command的ID,相关的action通过这个ID标志找到这个command -->
           
<command
             
name="intelliPlatform.command.DataSource"
             category
="intelliPlatform.Category1"
             description
="数据源配置"
             id
="com.longtop.intelliplatform.ide.project.commands.DataSource"/>
        
<!-- 具体的快捷键设置,其中command指定实际的coomand的ID -->
        
<keyBinding
             
command="com.longtop.intelliplatform.ide.project.commands.DataSource"
             configuration
="org.eclipse.ui.defaultAcceleratorConfiguration"
             keySequence
="Ctrl+Shift+D"/>
   
</extension>
 以上是设置了plugin.xml中command extension,并指定了keybinding,在keybinding中
 的keysequence中的字符串是设置的快捷键。 

------------

在具体的Action配置中,只要在其属性definitionId设置成command的ID即可,示例如下:
<action
 
label="Sample Action"
 icon
="icons/sample.gif"
 class
="cli.bacchus.portal.ui.actions.BacchusAction"
 tooltip
="Hello, Eclipse world"
 menubarPath
="sampleMenu/sampleGroup"
 toolbarPath
="sampleGroup"
 id
="bacchus.portal.ui.actions.BacchusAction"
 definitionId
="com.longtop.intelliplatform.ide.project.commands.datesource">
</action>

注意:当给相关的action设置完definitionID后,必须保证其中设置的command是有的,而且是正确的,否则有可能导致该action显示不出来。
更具体的信息请参考eclipse开发参考中关于扩展点org.eclipse.ui.commands的详细描述。

------------

2、
 建立Acion,在此建立的action可以是实现IAction接口的任何类。比较方便的是继承
 org.eclipse.jface.Action,然后在新类中覆盖父类的run() 方法.

 public class CopyAction extends Action{
   
public CopyAction(){
    setId(
"org.example.copyaction");
    setActionDefinitionId(
"com.longtop.intelliplatform.ide.project.commands.DataSource");
   }

 }

3、
在创建CopyAction的instance之后,将copyActionInstance用IKeyBindingService绑定到
指定的command。
获得IKeyBinddingservice的一种简单方式为:
IKeyBindingService keyBindingService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getKeyBindingService();
keyBindingService.registerAction(copyActionInstance);


注意:
1、action的definitionid和command定义的id必须一致。
2、当指定的keySequence与系统默认的冲突时,如:在窗体的菜单栏中
指定了Edit->Copy(默认的快捷键为Ctrl+C),若将上面的keySequence改为
M1+C(Ctrl+C)则系统默认的快捷键(Ctrl+C)将更改为Ctrl+Insert。即RCP默认
的为用户指定的优先,系统动态更新。
3、IKeyBindingService指定的快捷键是有作用范围的。




为主菜单绑定快捷键

主菜单的快捷键即为 Alt + 菜单名称中带下划线的字母
定义主菜单快捷键只要在主菜单lable中确定的字母前面加上&字符即可
如:
plugin.properties  menulabel = &Intelliplatform
plugin_zh.properties menulabel = 平台(&I)
(注意:在该label引用的properties国际化文件中加,直接在plugin.xml中加好像无效,此处存疑)
posted @ 2008-10-06 15:18 子非鱼| 编辑 收藏

JAVA中HashMap的成员遍历  
方法一:  
        Set   entries;  
        entries=map.keySet(); 
        Iterator   iter=entries.iterator();  
        while(iter.hasNext()){  
              Object   obj=iter.next();  
              System.out.println(obj+":"+map.get(obj));      
        }            

   
    方法二:      
        Set   entries;  
        entries=map.entrySet();
        Iterator   iter=entries.iterator();  
        while(iter.hasNext())  
        {  
              System.out.println(iter.next()+"   ");      
        }  

另外,JAVA中 interface和class都可以作为对变量的声明。


    public static void copyDirtoDest(String srcDir, String toDir) {
        Copy copyDir 
= new Copy();
        copyDir.setOverwrite(
true);
        copyDir.setProject(
new Project());
        FileSet fileSet 
= new FileSet();
        fileSet.setDir(
new File(srcDir));
        copyDir.addFileset(fileSet);
        File dest 
= new File(toDir);

        copyDir.setTodir(dest);
        copyDir.execute();
    }


    
public static void copyFiletoDestDir(String srcFile, String destDir) {
        Copy copy 
= new Copy();
        copy.setProject(
new Project());
        copy.setFile(
new File(srcFile));
        copy.setTodir(
new File(destDir));
        copy.execute();
    }


    
public static void makeDir(String dir) {
        Mkdir mkdir 
= new Mkdir();
        mkdir.setProject(
new Project());
        mkdir.setDir(
new File(dir));
        mkdir.execute();
    }


    
public static void copyFiletoDestandRename(String srcFile, String destFile) {
        Copy copyTask 
= new Copy();
        copyTask.setProject(
new Project());
        copyTask.setFile(
new File(srcFile));
        copyTask.setTofile(
new File(destFile));
        copyTask.execute();
    }


    
public static void moveFiletoDest(String srcFile, String destDir) {
        Move move 
= new Move();
        move.setProject(
new Project());
        move.setFile(
new File(srcFile));
        move.setTodir(
new File(destDir));
        move.execute();
    }


验证文件夹名称是否符合java包名规范
//弱验证(只要能被java支持的名称,如中文名称)
IStatus val = JavaConventions.validatePackageName(folder);                 
if (val.getSeverity() == IStatus.ERROR) {
     
return false;
}
 
/**
     * 强验证:是否是严格符合命名规范的包名,标识:以字母开头,字母与数字的组合,字母必须都是小写。
     * 
@param str1
     * 
@return
     
*/

    
public static boolean isPackageName(String str1){
        String regex 
= "^[a-z][a-z[\\d]]*";  
        Pattern p 
= Pattern.compile(regex);
        Matcher m 
= p.matcher(str1);        
        
return  m.matches();
    }


hibernate3 hql 参数乱码问题
Hql中有中文参数(如from test as c where c.name='张三')的话被翻译成sql的时候会出现乱码,解决方法:
在Spring的配制文件applicationContext.xml文件中添加以下代码:
    <property name="hibernateProperties">
        
<props>
                 
            
<prop key="hibernate.query.factory_class">
                org.hibernate.hql.classic.ClassicQueryTranslatorFactory
            
</prop>
        
</props>
    
</property>

list转Array
(IAction[]) list.toArray(new IAction[0]);
(IAction[]) list.toArray(new IAction[list.size()]);
posted @ 2008-04-12 23:07 子非鱼| 编辑 收藏