List of usage examples for com.google.common.base Enums getField
@GwtIncompatible("reflection") public static Field getField(Enum<?> enumValue)
From source file:org.eclipse.scada.ae.ui.views.views.EventViewTable.java
/** * Create column informations if none where provided * * @param columnInformations/*from ww w . j a va 2 s . com*/ * provided informations * @return the created or provided informations, must never return * <code>null</code>. */ private static List<ColumnLabelProviderInformation> makeColumnInformations( final List<ColumnLabelProviderInformation> columnInformations) { if (columnInformations != null) { return columnInformations; } final List<ColumnLabelProviderInformation> result = new LinkedList<ColumnLabelProviderInformation>(); result.add( new ColumnLabelProviderInformation("ID", ColumnLabelProviderInformation.TYPE_ID, false, 100, null)); result.add(new ColumnLabelProviderInformation("Source Timestamp", ColumnLabelProviderInformation.TYPE_SOURCE_TIMESTAMP, true, 100, null)); for (final Fields field : Fields.values()) { if (Enums.getField(field).getAnnotation(Deprecated.class) != null) { continue; } final Map<String, String> parameters = new HashMap<String, String>(1); parameters.put("key", field.getName()); //$NON-NLS-1$ result.add(new ColumnLabelProviderInformation(field.getName(), ColumnLabelProviderInformation.TYPE_VARIANT, false, 100, parameters)); } for (int i = 0; i < 6; i++) { final Map<String, String> parameters = new HashMap<String, String>(1); parameters.put("key", String.format("level.%s", i)); //$NON-NLS-1$ final String label = String.format("Level %s", i); result.add(new ColumnLabelProviderInformation(label, ColumnLabelProviderInformation.TYPE_VARIANT, false, 100, parameters)); } result.add(new ColumnLabelProviderInformation("Entry Timestamp", ColumnLabelProviderInformation.TYPE_ENTRY_TIMESTAMP, true, 100, null)); return result; }
From source file:org.eclipse.scada.ae.ui.views.config.ConfigurationHelper.java
private static void fillWithDefault(final List<ColumnLabelProviderInformation> columnInformation) { columnInformation.add(new ColumnLabelProviderInformation("sourceTimestamp", "sourceTimestamp", true, DEFAULT_INITIAL_SIZE, Collections.<String, String>emptyMap())); for (final Fields field : Fields.values()) { if (Enums.getField(field).getAnnotation(Deprecated.class) != null) { // ignore deprecated fields continue; }/*from w w w.j a va 2s .c o m*/ final Map<String, String> properties = new HashMap<String, String>(); properties.put("key", field.getName()); switch (field) { case ACTOR_NAME: properties.put("decoration", Decoration.ACTOR.toString()); break; case EVENT_TYPE: properties.put("decoration", Decoration.MONITOR.toString()); break; default: break; } columnInformation.add(new ColumnLabelProviderInformation(field.getName(), "variant", false, DEFAULT_INITIAL_SIZE, properties)); } columnInformation.add(new ColumnLabelProviderInformation("entryTimestamp", "entryTimestamp", true, DEFAULT_INITIAL_SIZE, Collections.<String, String>emptyMap())); }