2015-10-21 131 views
2

有什麼辦法可以使用Intellij Idea來選擇枚舉名稱?只選擇Idea中的枚舉名稱?

... 

public enum OrganizationActivityLogItemType implements IActivityLogItemType<OrganizationActivityLog>, DisplaysAs 
{ 

    @Deprecated GENE_VARIANT_PUBLIC("Gene Variant/Mutation/Allele", null), 

    VARIANTS_MUTATIONS("Variants/Mutations/ Alleles/Loci/Probes", ALFactory.PUBLIC_PRIVATE), 
    CATEGORIES("Categories", null), 
    PUBLIC_VISIBLITY_COVERED_WHEN_MEETS_NECESSITY_CRITERIA("Covered - When Meets Medical Necessity Criteria", 
                  ALFactory.PUBLIC_PRIVATE), 
    PUBLIC_VISIBLITY_NOT_COVERED_INVESTIGATIONAL(
     "Not Covered - Investigational", 
     ALFactory.PUBLIC_PRIVATE), 
    PUBLIC_VISIBLITY_NOT_COVERED_NOT_MEDICALLY_NECESSARY(
     "Not Covered - Not Medically Necessary", 
     ALFactory.PUBLIC_PRIVATE), 
... 
+5

只選擇枚舉名稱的意思? –

+0

'PUBLIC_VISIBLITY_NOT_COVERED_NOT_MEDICALLY_NECESSARY'是一個枚舉名....我想選擇所有這些進行復制,但不是構造函數中的垃圾 – xenoterracide

回答

0

這應該讓你關閉

  1. 打開查找對話框
  2. 點擊 '區分大小寫' 複選框和 '正則表達式'
  3. 使用下面的正則表達式:[A-Z _] + (?= \()
  4. 使用鍵盤命令選擇所有出現:Shift + Ctrl + Alt + J(Ctrl + Cmd + G for Mac OS X)
  5. 複製並粘貼
1

枚舉在Java中是擴展抽象類java.lang.Enum一類特殊的,因而繼承的方法定義there.You可以使用name()方法,讓您的枚舉常量的名稱

name() method in Enum

OrganizationActivityLogItemType [] enumArray = OrganizationActivityLogItemType.values(); 
     for(OrganizationActivityLogItemType enumObject: enumArray){ 
     System.out.println(enumObject.name()); 
     } 
0

雙擊每個枚舉名稱Alt按住。