1 20 21 package org.apache.directory.ldapstudio.browser.common.actions; 22 23 24 import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator; 25 import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants; 26 import org.apache.directory.ldapstudio.browser.core.model.IAttribute; 27 import org.apache.directory.ldapstudio.browser.core.model.IValue; 28 import org.apache.directory.ldapstudio.browser.core.model.schema.SchemaUtils; 29 import org.eclipse.jface.resource.ImageDescriptor; 30 31 32 38 public class DeleteAllValuesAction extends DeleteAction 39 { 40 43 public DeleteAllValuesAction() 44 { 45 } 46 47 48 51 public void run() 52 { 53 super.run(); 54 } 55 56 57 60 public String getText() 61 { 62 if ( getSelectedValues().length == 1 ) 63 { 64 return "Delete Attribute '" + getSelectedValues()[0].getAttribute().getDescription() + "'"; 65 } 66 else 67 { 68 return "Delete Attribute"; 69 } 70 } 71 72 73 76 public ImageDescriptor getImageDescriptor() 77 { 78 return BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_DELETE_ALL ); 79 } 80 81 82 85 public String getCommandId() 86 { 87 return null; 88 } 89 90 91 94 public boolean isEnabled() 95 { 96 return super.isEnabled(); 97 } 104 105 106 109 protected IAttribute[] getAttributes() throws Exception 110 { 111 if ( getSelectedAttributes().length == 0 && getSelectedValues().length == 1 112 && getSelectedValues()[0].getAttribute().getValueSize() > 1 113 && !getSelectedValues()[0].getAttribute().isMustAttribute() 114 && !getSelectedValues()[0].getAttribute().isObjectClassAttribute() 115 && SchemaUtils.isModifyable( getSelectedValues()[0].getAttribute().getAttributeTypeDescription() ) ) 116 { 117 118 return new IAttribute[] 119 { getSelectedValues()[0].getAttribute() }; 120 121 } 122 else 123 { 124 return new IAttribute[0]; 125 } 126 } 127 128 129 132 protected IValue[] getValues() throws Exception 133 { 134 return new IValue[0]; 135 } 136 } 137 | Popular Tags |