1 20 package org.apache.directory.ldapstudio.schemas.view.editors.attributeType; 21 22 23 import java.util.Collections ; 24 import java.util.List ; 25 26 import org.apache.directory.ldapstudio.schemas.model.MatchingRule; 27 import org.apache.directory.ldapstudio.schemas.model.MatchingRules; 28 import org.eclipse.jface.viewers.IStructuredContentProvider; 29 import org.eclipse.jface.viewers.Viewer; 30 31 32 38 public class ATESubstringComboContentProvider implements IStructuredContentProvider 39 { 40 43 public Object [] getElements( Object inputElement ) 44 { 45 if ( inputElement instanceof ATEMatchingRulesComboInput ) 46 { 47 ATEMatchingRulesComboInput input = ( ATEMatchingRulesComboInput ) inputElement; 48 49 if ( input.getChildren().isEmpty() ) 50 { 51 input.addChild( new NonExistingMatchingRule( NonExistingMatchingRule.NONE ) ); 53 54 List <MatchingRule> substringMatchingRules = MatchingRules.getSubstringMatchingRules(); 56 for ( MatchingRule substringMatchingRule : substringMatchingRules ) 57 { 58 input.addChild( substringMatchingRule ); 59 } 60 } 61 62 List <Object > children = input.getChildren(); 64 65 Collections.sort( children, new ATEMatchingRulesComboComparator() ); 67 68 return children.toArray(); 69 } 70 71 return new Object [0]; 73 } 74 75 76 79 public void dispose() 80 { 81 } 82 83 84 87 public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) 88 { 89 } 90 } 91 | Popular Tags |