public AnnotationEditorPopup( List<AnnotationMetaModel> annotations ) { this( new AnnotationMetaModel(), annotations ); }
private static StringBuilder buildAnnotationDRL( AnnotationMetaModel a ) { final StringBuilder sb = new StringBuilder(); sb.append( "@" ); sb.append( a.name ); sb.append( "(" ); for ( final Map.Entry<String, String> e : a.getValues().entrySet() ) { if ( e.getKey() != null && e.getKey().length() > 0 ) { sb.append( e.getKey() ); sb.append( " = " ); } if ( e.getValue() != null && e.getValue().length() > 0 ) { sb.append( e.getValue() ); } sb.append( ", " ); } sb.delete( sb.length() - 2, sb.length() ); sb.append( ")" ); return sb; }
private void setControlValues( AnnotationMetaModel annotation ) { String name = annotation.name; String key = getFirstEntry( annotation.getValues().keySet() ); String value = getFirstEntry( annotation.getValues().values() ); annotationName.setText( "@" + name ); annotationKey.setText( key ); annotationValue.setText( value ); }
final AnnotationDescr descr = en.getValue(); final Map<String, String> values = descr.getValues(); final AnnotationMetaModel am = new AnnotationMetaModel( annotationName, values );
private void setControlValues( AnnotationMetaModel annotation ) { String name = ( annotation.name == null ? "" : annotation.name ); String key = getFirstEntry( annotation.getValues().keySet() ); String value = getFirstEntry( annotation.getValues().values() ); txtName.setText( name ); txtKey.setText( key ); txtValue.setText( value ); }
private void setNameAndClose() { String name = txtName.getText(); String key = txtKey.getText(); if ( key == null || key.length() == 0 ) { //This is the default annotation key constructed by AnnotationDescr when none is provided //e.g. @smurf( Pupa ) -> @smurf( value = Pupa ). We explicitly set it to keep the user //experience consistent between what they enter and what is parsed. key = "value"; } String value = txtValue.getText(); annotation.name = name; annotation.getValues().clear(); annotation.getValues().put( key, value ); okCommand.execute(); pop.hide(); }