1

is there a possibility to activate autocomplete for constants with underscores _?

I have a class with many constants, where many of them begin same. Example:

// Component details
public static final String PROPERTY_NAME_COMPONENT_MATERIAL_NUMBER = "name";
public static final String PROPERTY_NAME_COMPONENT_OVERALL_WORK_STATUS = "componentOverallWorkStatus";
public static final String PROPERTY_NAME_COMPONENT_RELEASE_STATUS = "freigabestatus";
public static final String PROPERTY_NAME_COMPONENT_DESCRIPTION = "label";
public static final String PROPERTY_NAME_COMPONENT_AMOUNT = "newAmount";
public static final String PROPERTY_NAME_COMPONENT_BASE_QUANTITY_UNIT = "basismengeneinheit";
public static final String PROPERTY_NAME_COMPONENT_PRODUCER = "hersteller";
public static final String PROPERTY_NAME_COMPONENT_PRODUCER_FRAGMENT_NUMBER = "herstellerteilenummer";
public static final String PROPERTY_NAME_COMPONENT_EXCLUDE_ALTERNATIVE_ARTICLE = "componentExcludeAlternativeArticle";
public static final String PROPERTY_NAME_COMPONENT_GENERAL_INFO = "componentGeneralInfo";

They all start with PROPERTY_NAME_COMPONENT and if I now begin to type this

System.out.println(ClassWithThoseConstants.P

and press Ctrl + Space. Now I got all constansts starting with P, which is fine. But now I'd like to go further with camelcase style, i.e. PNCP which shall lead to the options:

PROPERTY_NAME_COMPONENT_PRODUCER and PROPERTY_NAME_COMPONENT_PRODUCER_FRAGMENT_NUMBER.

Typing P_N_C_P doesn't help either. Is there a possibility? I couldn't find any.

Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
BAERUS
  • 4,009
  • 3
  • 24
  • 39
  • Good question. I would have tried the `PNC..` route too. Worst case, you could define a template that inserts `public static final String PROPERTY_NAME_COMPONENT_{$cursor}`. Side note: in a programming context, camel-case more traditional refers to lower-case first letter. "Title case" might be a less ambiguous choice. – Duncan Jones Sep 24 '14 at 12:13
  • `enum PropertyNameComponent { MATERIAL_NUMBER("name"), OVERALL_WORKSTATUS("componentOverallWorkStatus"), ...; }` – Joop Eggen Sep 24 '14 at 12:24
  • @Joop Some might wanna try refactoring this by using enums for kind of grouping, but I asked this question in a more general intention. I simply want to search through my constants like I do when searching for a class using `Ctrl+Shift+T` or similar, with camelcase. – BAERUS Sep 24 '14 at 13:12
  • Try setting this in your shortcuts in the Preferences Menu – user3241019 Sep 24 '14 at 14:34
  • Could you be a little more precise please and give me an example of what you mean? How can I create something like this as a generic shortcut..? – BAERUS Sep 24 '14 at 19:59

0 Answers0