protected void replaceName ( final EObject object, final EStructuralFeature feature ) { final String hostname = (String)object.eGet ( feature ); if ( hostname == null ) { return; } final Mappings mappings = getMappings (); for ( final MappingEntry entry : mappings.getEntries () ) { final String newName = entry.map ( hostname ); if ( newName != null ) { object.eSet ( feature, newName ); return; } } switch ( mappings.getFallbackMode () ) { case IGNORE: return; case FAIL: throw new IllegalStateException ( String.format ( "No node mapping for: %s", hostname ) ); } }
protected void replaceName ( final EObject object, final EStructuralFeature feature ) { final String hostname = (String)object.eGet ( feature ); if ( hostname == null ) { return; } final Mappings mappings = getMappings (); for ( final MappingEntry entry : mappings.getEntries () ) { final String newName = entry.map ( hostname ); if ( newName != null ) { object.eSet ( feature, newName ); return; } } switch ( mappings.getFallbackMode () ) { case IGNORE: return; case FAIL: throw new IllegalStateException ( String.format ( "No node mapping for: %s", hostname ) ); } }
/** * This returns the label styled text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getStyledText ( Object object ) { FallbackMappingMode labelValue = ( (Mappings)object ).getFallbackMode (); String label = labelValue == null ? null : labelValue.toString (); StyledString styledLabel = new StyledString (); if ( label == null || label.length () == 0 ) { styledLabel.append ( getString ( "_UI_Mappings_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$ } else { styledLabel.append ( getString ( "_UI_Mappings_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$ } return styledLabel; }