You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2010/08/20 19:07:23 UTC
svn commit: r987577 [2/10] - in
/directory/studio/branches/studio-rap/plugins:
common.ui/src/main/java/org/apache/directory/studio/common/ui/
connection.ui/src/main/java/org/apache/directory/studio/connection/ui/
connection.ui/src/main/java/org/apache/...
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java Fri Aug 20 17:07:19 2010
@@ -20,7 +20,6 @@
package org.apache.directory.studio.ldapbrowser.common.actions;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -52,530 +51,477 @@ import org.eclipse.jface.resource.ImageD
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
/**
- * This Action implements the Delete Action. It deletes Connections, Entries, Searches, Bookmarks, Attributes or Values.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * This Action implements the Delete Action. It deletes Connections, Entries,
+ * Searches, Bookmarks, Attributes or Values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory
+ * Project</a>
*/
-public class DeleteAction extends BrowserAction
-{
- /**
- * {@inheritDoc}
- */
- public String getText()
- {
- try
- {
- Collection<IEntry> entries = getEntries();
- ISearch[] searches = getSearches();
- IBookmark[] bookmarks = getBookmarks();
- Collection<IValue> values = getValues();
-
- if ( entries.size() > 0 && searches.length == 0 && bookmarks.length == 0 && values.size() == 0 )
- {
- return entries.size() > 1 ? Messages.getString( "DeleteAction.DeleteEntries" ) : Messages.getString( "DeleteAction.DeleteEntry" ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if ( searches.length > 0 && entries.size() == 0 && bookmarks.length == 0 && values.size() == 0 )
- {
- return searches.length > 1 ? Messages.getString( "DeleteAction.DeleteSearches" ) : Messages.getString( "DeleteAction.DeleteSearch" ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if ( bookmarks.length > 0 && entries.size() == 0 && searches.length == 0 && values.size() == 0 )
- {
- return bookmarks.length > 1 ? Messages.getString( "DeleteAction.DeleteBookmarks" ) : Messages.getString( "DeleteAction.DeleteBookmark" ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if ( values.size() > 0 && entries.size() == 0 && searches.length == 0 && bookmarks.length == 0 )
- {
- return values.size() > 1 ? Messages.getString( "DeleteAction.DeleteValues" ) : Messages.getString( "DeleteAction.DeleteValue" ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- catch ( Exception e )
- {
- }
-
- return Messages.getString( "DeleteAction.Delete" ); //$NON-NLS-1$
- }
-
-
- /**
- * {@inheritDoc}
- */
- public ImageDescriptor getImageDescriptor()
- {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor( ISharedImages.IMG_TOOL_DELETE );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String getCommandId()
- {
- return IWorkbenchActionDefinitionIds.DELETE;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void run()
- {
- try
- {
- Collection<IEntry> entries = getEntries();
- ISearch[] searches = getSearches();
- IBookmark[] bookmarks = getBookmarks();
- Collection<IValue> values = getValues();
-
- StringBuffer message = new StringBuffer();
- boolean askForTreeDeleteControl = false;
-
- if ( entries.size() > 0 )
- {
- appendEntriesWarnMessage( message, entries );
-
- if ( entries.iterator().next().getBrowserConnection().getRootDSE()
- .isControlSupported( StudioControl.TREEDELETE_CONTROL.getOid() ) )
- {
- askForTreeDeleteControl = true;
- }
- }
-
- if ( searches.length > 0 )
- {
- appendSearchesWarnMessage( message, searches );
- }
-
- if ( bookmarks.length > 0 )
- {
- appendBookmarsWarnMessage( message, bookmarks );
- }
-
- if ( values.size() > 0 )
- {
- boolean emptyValuesOnly = true;
- for ( IValue value : values )
- {
- if ( !value.isEmpty() )
- {
- emptyValuesOnly = false;
- }
- }
- if ( !emptyValuesOnly )
- {
- appendValuesWarnMessage( message, values );
- }
- }
-
- DeleteDialog dialog = new DeleteDialog( getShell(), getText(), message.toString(), askForTreeDeleteControl );
- if ( message.length() == 0 || dialog.open() == DeleteDialog.OK )
- {
- if ( entries.size() > 0 )
- {
- deleteEntries( entries, dialog.isUseTreeDeleteControl() );
- }
- if ( searches.length > 0 )
- {
- deleteSearches( searches );
- }
- if ( bookmarks.length > 0 )
- {
- deleteBookmarks( bookmarks );
- }
- if ( values.size() > 0 )
- {
- deleteValues( values );
- }
- }
- }
- catch ( Exception e )
- {
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isEnabled()
- {
- try
- {
- Collection<IEntry> entries = getEntries();
- ISearch[] searches = getSearches();
- IBookmark[] bookmarks = getBookmarks();
- Collection<IValue> values = getValues();
-
- return entries.size() + searches.length + bookmarks.length + values.size() > 0;
-
- }
- catch ( Exception e )
- {
- //e.printStackTrace();
- return false;
- }
- }
-
-
- /**
- * Gets the Entries.
- *
- * @return
- * the Entries
- * @throws Exception
- * when an Entry has parent Entries
- */
- protected Collection<IEntry> getEntries()
- {
- LinkedHashSet<IEntry> entriesSet = new LinkedHashSet<IEntry>();
- for ( IEntry entry : getSelectedEntries() )
- {
- entriesSet.add( entry );
- }
- for ( ISearchResult sr : getSelectedSearchResults() )
- {
- entriesSet.add( sr.getEntry() );
- }
-
- Iterator<IEntry> iterator = entriesSet.iterator();
- while ( iterator.hasNext() )
- {
- IEntry entry = iterator.next();
- if ( entriesSet.contains( entry.getParententry() ) )
- {
- iterator.remove();
- }
- }
-
- return entriesSet;
- }
-
-
- /**
- * Appends the entries warn message.
- *
- * @param message the message
- * @param entries the entries
- */
- protected void appendEntriesWarnMessage( StringBuffer message, Collection<IEntry> entries )
- {
- for ( IEntry entry : entries )
- {
- if ( entry instanceof IRootDSE )
- {
- message.append( Messages.getString( "DeleteAction.DeleteRootDSE" ) ); //$NON-NLS-1$
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
- }
-
- if ( entries.size() <= 5 )
- {
- message.append( entries.size() == 1 ? Messages.getString( "DeleteAction.DeleteEntryQuestion" ) //$NON-NLS-1$
- : Messages.getString( "DeleteAction.DeleteEntriesQuestion" ) ); //$NON-NLS-1$
- for ( IEntry entry : entries )
- {
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( " - " ); //$NON-NLS-1$
- message.append( entry.getDn().getUpName() );
- }
- }
- else
- {
- message.append( Messages.getString( "DeleteAction.DeleteSelectedEntriesQuestion" ) ); //$NON-NLS-1$
- }
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
-
-
- /**
- * Deletes Entries.
- *
- * @param entries the Entries to delete
- * @param useTreeDeleteControl true to use the tree delete control
- */
- protected void deleteEntries( Collection<IEntry> entries, boolean useTreeDeleteControl )
- {
- new StudioBrowserJob( new DeleteEntriesRunnable( entries, useTreeDeleteControl ) ).execute();
- }
-
-
- /**
- * Gets the Searches
- *
- * @return
- * the Searches
- * @throws Exception
- */
- protected ISearch[] getSearches()
- {
- return getSelectedSearches();
- }
-
-
- protected void appendSearchesWarnMessage( StringBuffer message, ISearch[] searches )
- {
- if ( searches.length <= 5 )
- {
- message.append( searches.length == 1 ? Messages.getString( "DeleteAction.DeleteSearchQuestion" ) //$NON-NLS-1$
- : Messages.getString( "DeleteAction.DeleteSearchesQuestion" ) ); //$NON-NLS-1$
- for ( int i = 0; i < searches.length; i++ )
- {
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( " - " ); //$NON-NLS-1$
- message.append( searches[i].getName() );
- }
- }
- else
- {
- message.append( Messages.getString( "DeleteAction.DeleteSelectedSearchesQuestion" ) ); //$NON-NLS-1$
- }
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
-
-
- /**
- * Delete Searches
- *
- * @param searches
- * the Searches to delete
- */
- protected void deleteSearches( ISearch[] searches )
- {
- for ( ISearch search : searches )
- {
- search.getBrowserConnection().getSearchManager().removeSearch( search );
- }
- }
-
-
- /**
- * Get the Bookmarks
- *
- * @return
- * @throws Exception
- */
- protected IBookmark[] getBookmarks()
- {
- return getSelectedBookmarks();
- }
-
-
- protected void appendBookmarsWarnMessage( StringBuffer message, IBookmark[] bookmarks )
- {
- if ( bookmarks.length <= 5 )
- {
- message.append( bookmarks.length == 1 ? Messages.getString( "DeleteAction.DeleteBookmarkQuestion" ) //$NON-NLS-1$
- : Messages.getString( "DeleteAction.DeleteBookmarksQuestion" ) ); //$NON-NLS-1$
- for ( int i = 0; i < bookmarks.length; i++ )
- {
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( " - " ); //$NON-NLS-1$
- message.append( bookmarks[i].getName() );
- }
- }
- else
- {
- message.append( Messages.getString( "DeleteAction.DeleteSelectedBookmarksQuestion" ) ); //$NON-NLS-1$
- }
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
-
-
- /**
- * Delete Bookmarks
- *
- * @param bookmarks
- * the Bookmarks to delete
- */
- protected void deleteBookmarks( IBookmark[] bookmarks )
- {
- for ( IBookmark bookmark : bookmarks )
- {
- bookmark.getBrowserConnection().getBookmarkManager().removeBookmark( bookmark );
- }
- }
-
-
- /**
- * Gets the Values
- *
- * @return
- * the Values
- * @throws Exception
- */
- protected Collection<IValue> getValues() throws Exception
- {
- Set<IValue> valueList = new LinkedHashSet<IValue>();
-
- // add selected attributes
- for ( IAttribute attribute : getSelectedAttributes() )
- {
- if ( attribute != null && attribute.getValueSize() > 0 )
- {
- valueList.addAll( Arrays.asList( attribute.getValues() ) );
- }
- }
-
- // add selected hierarchies
- for ( AttributeHierarchy ah : getSelectedAttributeHierarchies() )
- {
- for ( IAttribute attribute : ah )
- {
- if ( attribute != null && attribute.getValueSize() > 0 )
- {
- valueList.addAll( Arrays.asList( attribute.getValues() ) );
- }
- }
- }
-
- // add selected values, but not if there attributes are also selected
- for ( IValue value : getSelectedValues() )
- {
- valueList.add( value );
- }
-
- return valueList;
- }
-
-
- protected void appendValuesWarnMessage( StringBuffer message, Collection<IValue> values )
- {
- Map<AttributeTypeDescription, Integer> attributeNameToSelectedValuesCountMap = new HashMap<AttributeTypeDescription, Integer>();
- Set<ObjectClassDescription> selectedObjectClasses = new HashSet<ObjectClassDescription>();
- for ( IValue value : values )
- {
- String type = value.getAttribute().getType();
- AttributeTypeDescription atd = value.getAttribute().getAttributeTypeDescription();
- AttributeHierarchy ah = value.getAttribute().getEntry().getAttributeWithSubtypes( type );
-
- // check if (part of) RDN is selected
- if ( value.isRdnPart() )
- {
- message.append( NLS.bind( Messages.getString( "DeleteAction.DeletePartOfRDN" ), value.toString() ) ); //$NON-NLS-1$
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
-
- // check if a required objectClass is selected
- if ( value.getAttribute().isObjectClassAttribute() )
- {
- selectedObjectClasses.add( value.getAttribute().getEntry().getBrowserConnection().getSchema()
- .getObjectClassDescription( value.getStringValue() ) );
- }
-
- // check if ALL values of objectClass or a MUST attribute are selected
- if ( !attributeNameToSelectedValuesCountMap.containsKey( atd ) )
- {
- attributeNameToSelectedValuesCountMap.put( atd, new Integer( 0 ) );
- }
- int count = ( attributeNameToSelectedValuesCountMap.get( atd ) ).intValue() + 1;
- attributeNameToSelectedValuesCountMap.put( atd, new Integer( count ) );
- if ( value.getAttribute().isObjectClassAttribute() && count >= ah.getValueSize() )
- {
- message.append( Messages.getString( "DeleteAction.DeleteObjectClass" ) ); //$NON-NLS-1$
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- continue;
- }
- else if ( value.getAttribute().isMustAttribute() && count >= ah.getValueSize() )
- {
- message.append( NLS.bind( Messages.getString( "DeleteAction.DeleteMust" ), type ) ); //$NON-NLS-1$
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
-
- // check if a value of an operational attribute is selected
- if ( !SchemaUtils.isModifiable( atd ) )
- {
- message.append( NLS.bind( Messages.getString( "DeleteAction.DeleteNonModifiable" ), type ) ); //$NON-NLS-1$
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- continue;
- }
- }
-
- // check if a required objectClass is selected
- if ( values.size() > 0 && !selectedObjectClasses.isEmpty() )
- {
- IEntry entry = values.iterator().next().getAttribute().getEntry();
- Schema schema = entry.getBrowserConnection().getSchema();
- // get remaining attributes
- Collection<ObjectClassDescription> remainingObjectClasses = entry.getObjectClassDescriptions();
- remainingObjectClasses.removeAll( selectedObjectClasses );
- Set<AttributeTypeDescription> remainingAttributeSet = new HashSet<AttributeTypeDescription>();
- for ( ObjectClassDescription ocd : remainingObjectClasses )
- {
- {
- Collection<String> mustAttrs = SchemaUtils.getMustAttributeTypeDescriptionNamesTransitive( ocd,
- schema );
- for ( String mustAttr : mustAttrs )
- {
- AttributeTypeDescription atd = entry.getBrowserConnection().getSchema()
- .getAttributeTypeDescription( mustAttr );
- remainingAttributeSet.add( atd );
- }
- Collection<String> mayAttrs = SchemaUtils.getMayAttributeTypeDescriptionNamesTransitive( ocd,
- schema );
- for ( String mayAttr : mayAttrs )
- {
- AttributeTypeDescription atd = entry.getBrowserConnection().getSchema()
- .getAttributeTypeDescription( mayAttr );
- remainingAttributeSet.add( atd );
- }
- }
- }
- // check against attributes
- IAttribute[] attributes = entry.getAttributes();
- for ( IAttribute attribute : attributes )
- {
- if ( attribute.isMayAttribute() || attribute.isMustAttribute() )
- {
- if ( !remainingAttributeSet.contains( attribute.getAttributeTypeDescription() ) )
- {
- message.append( NLS.bind(
- Messages.getString( "DeleteAction.DeleteNeededObjectClass" ), attribute.getDescription() ) ); //$NON-NLS-1$
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
- }
- }
- }
-
- if ( values.size() <= 5 )
- {
- message.append( values.size() == 1 ? Messages.getString( "DeleteAction.DeleteAttributeQuestion" ) //$NON-NLS-1$
- : Messages.getString( "DeleteAction.DeleteAttributesQuestion" ) ); //$NON-NLS-1$
- for ( IValue value : values )
- {
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( " - " ); //$NON-NLS-1$
- message.append( value.toString() );
- }
- }
- else
- {
- message.append( Messages.getString( "DeleteAction.DeleteSelectedAttributesQuestion" ) ); //$NON-NLS-1$
- }
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- message.append( BrowserCoreConstants.LINE_SEPARATOR );
- }
-
-
- /**
- * Deletes Attributes and Values
- *
- * @param values
- * the Values to delete
- */
- protected void deleteValues( Collection<IValue> values )
- {
- new CompoundModification().deleteValues( values );
- }
+public class DeleteAction extends BrowserAction {
+ /**
+ * {@inheritDoc}
+ */
+ public String getText() {
+ try {
+ Collection<IEntry> entries = getEntries();
+ ISearch[] searches = getSearches();
+ IBookmark[] bookmarks = getBookmarks();
+ Collection<IValue> values = getValues();
+
+ if (entries.size() > 0 && searches.length == 0
+ && bookmarks.length == 0 && values.size() == 0) {
+ return entries.size() > 1 ? Messages
+ .getString("DeleteAction.DeleteEntries") : Messages.getString("DeleteAction.DeleteEntry"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (searches.length > 0 && entries.size() == 0
+ && bookmarks.length == 0 && values.size() == 0) {
+ return searches.length > 1 ? Messages
+ .getString("DeleteAction.DeleteSearches") : Messages.getString("DeleteAction.DeleteSearch"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (bookmarks.length > 0 && entries.size() == 0
+ && searches.length == 0 && values.size() == 0) {
+ return bookmarks.length > 1 ? Messages
+ .getString("DeleteAction.DeleteBookmarks") : Messages.getString("DeleteAction.DeleteBookmark"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (values.size() > 0 && entries.size() == 0
+ && searches.length == 0 && bookmarks.length == 0) {
+ return values.size() > 1 ? Messages
+ .getString("DeleteAction.DeleteValues") : Messages.getString("DeleteAction.DeleteValue"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } catch (Exception e) {
+ }
+
+ return Messages.getString("DeleteAction.Delete"); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ImageDescriptor getImageDescriptor() {
+ return PlatformUI.getWorkbench().getSharedImages()
+ .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getCommandId() {
+ return "delete";// IWorkbenchActionDefinitionIds.DELETE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run() {
+ try {
+ Collection<IEntry> entries = getEntries();
+ ISearch[] searches = getSearches();
+ IBookmark[] bookmarks = getBookmarks();
+ Collection<IValue> values = getValues();
+
+ StringBuffer message = new StringBuffer();
+ boolean askForTreeDeleteControl = false;
+
+ if (entries.size() > 0) {
+ appendEntriesWarnMessage(message, entries);
+
+ if (entries
+ .iterator()
+ .next()
+ .getBrowserConnection()
+ .getRootDSE()
+ .isControlSupported(
+ StudioControl.TREEDELETE_CONTROL.getOid())) {
+ askForTreeDeleteControl = true;
+ }
+ }
+
+ if (searches.length > 0) {
+ appendSearchesWarnMessage(message, searches);
+ }
+
+ if (bookmarks.length > 0) {
+ appendBookmarsWarnMessage(message, bookmarks);
+ }
+
+ if (values.size() > 0) {
+ boolean emptyValuesOnly = true;
+ for (IValue value : values) {
+ if (!value.isEmpty()) {
+ emptyValuesOnly = false;
+ }
+ }
+ if (!emptyValuesOnly) {
+ appendValuesWarnMessage(message, values);
+ }
+ }
+
+ DeleteDialog dialog = new DeleteDialog(getShell(), getText(),
+ message.toString(), askForTreeDeleteControl);
+ if (message.length() == 0 || dialog.open() == DeleteDialog.OK) {
+ if (entries.size() > 0) {
+ deleteEntries(entries, dialog.isUseTreeDeleteControl());
+ }
+ if (searches.length > 0) {
+ deleteSearches(searches);
+ }
+ if (bookmarks.length > 0) {
+ deleteBookmarks(bookmarks);
+ }
+ if (values.size() > 0) {
+ deleteValues(values);
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEnabled() {
+ try {
+ Collection<IEntry> entries = getEntries();
+ ISearch[] searches = getSearches();
+ IBookmark[] bookmarks = getBookmarks();
+ Collection<IValue> values = getValues();
+
+ return entries.size() + searches.length + bookmarks.length
+ + values.size() > 0;
+
+ } catch (Exception e) {
+ // e.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * Gets the Entries.
+ *
+ * @return the Entries
+ * @throws Exception
+ * when an Entry has parent Entries
+ */
+ protected Collection<IEntry> getEntries() {
+ LinkedHashSet<IEntry> entriesSet = new LinkedHashSet<IEntry>();
+ for (IEntry entry : getSelectedEntries()) {
+ entriesSet.add(entry);
+ }
+ for (ISearchResult sr : getSelectedSearchResults()) {
+ entriesSet.add(sr.getEntry());
+ }
+
+ Iterator<IEntry> iterator = entriesSet.iterator();
+ while (iterator.hasNext()) {
+ IEntry entry = iterator.next();
+ if (entriesSet.contains(entry.getParententry())) {
+ iterator.remove();
+ }
+ }
+
+ return entriesSet;
+ }
+
+ /**
+ * Appends the entries warn message.
+ *
+ * @param message
+ * the message
+ * @param entries
+ * the entries
+ */
+ protected void appendEntriesWarnMessage(StringBuffer message,
+ Collection<IEntry> entries) {
+ for (IEntry entry : entries) {
+ if (entry instanceof IRootDSE) {
+ message.append(Messages.getString("DeleteAction.DeleteRootDSE")); //$NON-NLS-1$
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+ }
+
+ if (entries.size() <= 5) {
+ message.append(entries.size() == 1 ? Messages
+ .getString("DeleteAction.DeleteEntryQuestion") //$NON-NLS-1$
+ : Messages.getString("DeleteAction.DeleteEntriesQuestion")); //$NON-NLS-1$
+ for (IEntry entry : entries) {
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(" - "); //$NON-NLS-1$
+ message.append(entry.getDn().getUpName());
+ }
+ } else {
+ message.append(Messages
+ .getString("DeleteAction.DeleteSelectedEntriesQuestion")); //$NON-NLS-1$
+ }
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+
+ /**
+ * Deletes Entries.
+ *
+ * @param entries
+ * the Entries to delete
+ * @param useTreeDeleteControl
+ * true to use the tree delete control
+ */
+ protected void deleteEntries(Collection<IEntry> entries,
+ boolean useTreeDeleteControl) {
+ new StudioBrowserJob(new DeleteEntriesRunnable(entries,
+ useTreeDeleteControl)).execute();
+ }
+
+ /**
+ * Gets the Searches
+ *
+ * @return the Searches
+ * @throws Exception
+ */
+ protected ISearch[] getSearches() {
+ return getSelectedSearches();
+ }
+
+ protected void appendSearchesWarnMessage(StringBuffer message,
+ ISearch[] searches) {
+ if (searches.length <= 5) {
+ message.append(searches.length == 1 ? Messages
+ .getString("DeleteAction.DeleteSearchQuestion") //$NON-NLS-1$
+ : Messages.getString("DeleteAction.DeleteSearchesQuestion")); //$NON-NLS-1$
+ for (int i = 0; i < searches.length; i++) {
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(" - "); //$NON-NLS-1$
+ message.append(searches[i].getName());
+ }
+ } else {
+ message.append(Messages
+ .getString("DeleteAction.DeleteSelectedSearchesQuestion")); //$NON-NLS-1$
+ }
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+
+ /**
+ * Delete Searches
+ *
+ * @param searches
+ * the Searches to delete
+ */
+ protected void deleteSearches(ISearch[] searches) {
+ for (ISearch search : searches) {
+ search.getBrowserConnection().getSearchManager()
+ .removeSearch(search);
+ }
+ }
+
+ /**
+ * Get the Bookmarks
+ *
+ * @return
+ * @throws Exception
+ */
+ protected IBookmark[] getBookmarks() {
+ return getSelectedBookmarks();
+ }
+
+ protected void appendBookmarsWarnMessage(StringBuffer message,
+ IBookmark[] bookmarks) {
+ if (bookmarks.length <= 5) {
+ message.append(bookmarks.length == 1 ? Messages
+ .getString("DeleteAction.DeleteBookmarkQuestion") //$NON-NLS-1$
+ : Messages
+ .getString("DeleteAction.DeleteBookmarksQuestion")); //$NON-NLS-1$
+ for (int i = 0; i < bookmarks.length; i++) {
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(" - "); //$NON-NLS-1$
+ message.append(bookmarks[i].getName());
+ }
+ } else {
+ message.append(Messages
+ .getString("DeleteAction.DeleteSelectedBookmarksQuestion")); //$NON-NLS-1$
+ }
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+
+ /**
+ * Delete Bookmarks
+ *
+ * @param bookmarks
+ * the Bookmarks to delete
+ */
+ protected void deleteBookmarks(IBookmark[] bookmarks) {
+ for (IBookmark bookmark : bookmarks) {
+ bookmark.getBrowserConnection().getBookmarkManager()
+ .removeBookmark(bookmark);
+ }
+ }
+
+ /**
+ * Gets the Values
+ *
+ * @return the Values
+ * @throws Exception
+ */
+ protected Collection<IValue> getValues() throws Exception {
+ Set<IValue> valueList = new LinkedHashSet<IValue>();
+
+ // add selected attributes
+ for (IAttribute attribute : getSelectedAttributes()) {
+ if (attribute != null && attribute.getValueSize() > 0) {
+ valueList.addAll(Arrays.asList(attribute.getValues()));
+ }
+ }
+
+ // add selected hierarchies
+ for (AttributeHierarchy ah : getSelectedAttributeHierarchies()) {
+ for (IAttribute attribute : ah) {
+ if (attribute != null && attribute.getValueSize() > 0) {
+ valueList.addAll(Arrays.asList(attribute.getValues()));
+ }
+ }
+ }
+
+ // add selected values, but not if there attributes are also selected
+ for (IValue value : getSelectedValues()) {
+ valueList.add(value);
+ }
+
+ return valueList;
+ }
+
+ protected void appendValuesWarnMessage(StringBuffer message,
+ Collection<IValue> values) {
+ Map<AttributeTypeDescription, Integer> attributeNameToSelectedValuesCountMap = new HashMap<AttributeTypeDescription, Integer>();
+ Set<ObjectClassDescription> selectedObjectClasses = new HashSet<ObjectClassDescription>();
+ for (IValue value : values) {
+ String type = value.getAttribute().getType();
+ AttributeTypeDescription atd = value.getAttribute()
+ .getAttributeTypeDescription();
+ AttributeHierarchy ah = value.getAttribute().getEntry()
+ .getAttributeWithSubtypes(type);
+
+ // check if (part of) RDN is selected
+ if (value.isRdnPart()) {
+ message.append(NLS.bind(
+ Messages.getString("DeleteAction.DeletePartOfRDN"), value.toString())); //$NON-NLS-1$
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+
+ // check if a required objectClass is selected
+ if (value.getAttribute().isObjectClassAttribute()) {
+ selectedObjectClasses.add(value.getAttribute().getEntry()
+ .getBrowserConnection().getSchema()
+ .getObjectClassDescription(value.getStringValue()));
+ }
+
+ // check if ALL values of objectClass or a MUST attribute are
+ // selected
+ if (!attributeNameToSelectedValuesCountMap.containsKey(atd)) {
+ attributeNameToSelectedValuesCountMap.put(atd, new Integer(0));
+ }
+ int count = (attributeNameToSelectedValuesCountMap.get(atd))
+ .intValue() + 1;
+ attributeNameToSelectedValuesCountMap.put(atd, new Integer(count));
+ if (value.getAttribute().isObjectClassAttribute()
+ && count >= ah.getValueSize()) {
+ message.append(Messages
+ .getString("DeleteAction.DeleteObjectClass")); //$NON-NLS-1$
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ continue;
+ } else if (value.getAttribute().isMustAttribute()
+ && count >= ah.getValueSize()) {
+ message.append(NLS.bind(
+ Messages.getString("DeleteAction.DeleteMust"), type)); //$NON-NLS-1$
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+
+ // check if a value of an operational attribute is selected
+ if (!SchemaUtils.isModifiable(atd)) {
+ message.append(NLS.bind(
+ Messages.getString("DeleteAction.DeleteNonModifiable"), type)); //$NON-NLS-1$
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ continue;
+ }
+ }
+
+ // check if a required objectClass is selected
+ if (values.size() > 0 && !selectedObjectClasses.isEmpty()) {
+ IEntry entry = values.iterator().next().getAttribute().getEntry();
+ Schema schema = entry.getBrowserConnection().getSchema();
+ // get remaining attributes
+ Collection<ObjectClassDescription> remainingObjectClasses = entry
+ .getObjectClassDescriptions();
+ remainingObjectClasses.removeAll(selectedObjectClasses);
+ Set<AttributeTypeDescription> remainingAttributeSet = new HashSet<AttributeTypeDescription>();
+ for (ObjectClassDescription ocd : remainingObjectClasses) {
+ {
+ Collection<String> mustAttrs = SchemaUtils
+ .getMustAttributeTypeDescriptionNamesTransitive(
+ ocd, schema);
+ for (String mustAttr : mustAttrs) {
+ AttributeTypeDescription atd = entry
+ .getBrowserConnection().getSchema()
+ .getAttributeTypeDescription(mustAttr);
+ remainingAttributeSet.add(atd);
+ }
+ Collection<String> mayAttrs = SchemaUtils
+ .getMayAttributeTypeDescriptionNamesTransitive(ocd,
+ schema);
+ for (String mayAttr : mayAttrs) {
+ AttributeTypeDescription atd = entry
+ .getBrowserConnection().getSchema()
+ .getAttributeTypeDescription(mayAttr);
+ remainingAttributeSet.add(atd);
+ }
+ }
+ }
+ // check against attributes
+ IAttribute[] attributes = entry.getAttributes();
+ for (IAttribute attribute : attributes) {
+ if (attribute.isMayAttribute() || attribute.isMustAttribute()) {
+ if (!remainingAttributeSet.contains(attribute
+ .getAttributeTypeDescription())) {
+ message.append(NLS.bind(
+ Messages.getString("DeleteAction.DeleteNeededObjectClass"), attribute.getDescription())); //$NON-NLS-1$
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+ }
+ }
+ }
+
+ if (values.size() <= 5) {
+ message.append(values.size() == 1 ? Messages
+ .getString("DeleteAction.DeleteAttributeQuestion") //$NON-NLS-1$
+ : Messages
+ .getString("DeleteAction.DeleteAttributesQuestion")); //$NON-NLS-1$
+ for (IValue value : values) {
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(" - "); //$NON-NLS-1$
+ message.append(value.toString());
+ }
+ } else {
+ message.append(Messages
+ .getString("DeleteAction.DeleteSelectedAttributesQuestion")); //$NON-NLS-1$
+ }
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ message.append(BrowserCoreConstants.LINE_SEPARATOR);
+ }
+
+ /**
+ * Deletes Attributes and Values
+ *
+ * @param values
+ * the Values to delete
+ */
+ protected void deleteValues(Collection<IValue> values) {
+ new CompoundModification().deleteValues(values);
+ }
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PasteAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PasteAction.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PasteAction.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PasteAction.java Fri Aug 20 17:07:19 2010
@@ -22,12 +22,9 @@ package org.apache.directory.studio.ldap
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
/**
@@ -60,7 +57,7 @@ public abstract class PasteAction extend
*/
public String getCommandId()
{
- return IWorkbenchActionDefinitionIds.PASTE;
+ return "paste";//IWorkbenchActionDefinitionIds.PASTE;
}
@@ -74,16 +71,17 @@ public abstract class PasteAction extend
*/
protected Object getFromClipboard( Transfer dataType )
{
- Clipboard clipboard = null;
- try
- {
- clipboard = new Clipboard( Display.getCurrent() );
- return clipboard.getContents( dataType );
- }
- finally
- {
- if ( clipboard != null )
- clipboard.dispose();
- }
+// Clipboard clipboard = null;
+// try
+// {
+// clipboard = new Clipboard( Display.getCurrent() );
+// return clipboard.getContents( dataType );
+// }
+// finally
+// {
+// if ( clipboard != null )
+// clipboard.dispose();
+// }
+ return null;
}
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/PropertiesAction.java Fri Aug 20 17:07:19 2010
@@ -21,15 +21,14 @@
package org.apache.directory.studio.ldapbrowser.common.actions;
+import org.apache.directory.studio.connection.core.Utils;
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
-import org.apache.directory.studio.connection.core.Utils;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
/**
@@ -71,7 +70,7 @@ public class PropertiesAction extends Br
*/
public String getCommandId()
{
- return IWorkbenchActionDefinitionIds.PROPERTIES;
+ return "properties";//IWorkbenchActionDefinitionIds.PROPERTIES;
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RenameAction.java Fri Aug 20 17:07:19 2010
@@ -20,7 +20,6 @@
package org.apache.directory.studio.ldapbrowser.common.actions;
-
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.studio.ldapbrowser.common.dialogs.RenameEntryDialog;
import org.apache.directory.studio.ldapbrowser.common.dialogs.SimulateRenameDialogImpl;
@@ -35,277 +34,224 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
/**
* This Action renames Connections, Entries, Searches, or Bookmarks.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory
+ * Project</a>
*/
-public class RenameAction extends BrowserAction
-{
- /**
- * Creates a new instance of RenameAction.
- *
- */
- public RenameAction()
- {
- super();
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String getText()
- {
-
- IEntry[] entries = getEntries();
- ISearch[] searches = getSearches();
- IBookmark[] bookmarks = getBookmarks();
-
- if ( entries.length == 1 && searches.length == 0 && bookmarks.length == 0 )
- {
- return Messages.getString( "RenameAction.RenameEntry" ); //$NON-NLS-1$
- }
- else if ( searches.length == 1 && entries.length == 0 && bookmarks.length == 0 )
- {
- return Messages.getString( "RenameAction.RenameSearch" ); //$NON-NLS-1$
- }
- else if ( bookmarks.length == 1 && entries.length == 0 && searches.length == 0 )
- {
- return Messages.getString( "RenameAction.RenameBookmark" ); //$NON-NLS-1$
- }
- else
- {
- return Messages.getString( "RenameAction.Rename" ); //$NON-NLS-1$
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- public ImageDescriptor getImageDescriptor()
- {
- return null;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String getCommandId()
- {
- return IWorkbenchActionDefinitionIds.RENAME;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void run()
- {
- IEntry[] entries = getEntries();
- ISearch[] searches = getSearches();
- IBookmark[] bookmarks = getBookmarks();
-
- if ( entries.length == 1 && searches.length == 0 && bookmarks.length == 0 )
- {
- renameEntry( entries[0] );
- }
- else if ( searches.length == 1 && entries.length == 0 && bookmarks.length == 0 )
- {
- renameSearch( searches[0] );
- }
- else if ( bookmarks.length == 1 && entries.length == 0 && searches.length == 0 )
- {
- renameBookmark( bookmarks[0] );
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isEnabled()
- {
- try
- {
- IEntry[] entries = getEntries();
- ISearch[] searches = getSearches();
- IBookmark[] bookmarks = getBookmarks();
-
- return entries.length + searches.length + bookmarks.length == 1;
-
- }
- catch ( Exception e )
- {
- return false;
- }
- }
-
-
- /**
- * Gets the Entries
- *
- * @return
- * the Entries
- */
- protected IEntry[] getEntries()
- {
-
- IEntry entry = null;
-
- if ( getSelectedEntries().length == 1 )
- {
- entry = getSelectedEntries()[0];
- }
- else if ( getSelectedSearchResults().length == 1 )
- {
- entry = getSelectedSearchResults()[0].getEntry();
- }
- else if ( getSelectedValues().length == 1 && getSelectedValues()[0].isRdnPart() )
- {
- entry = getSelectedValues()[0].getAttribute().getEntry();
- }
-
- if ( entry != null && !( entry instanceof RootDSE ) )
- {
- return new IEntry[]
- { entry };
- }
- else
- {
- return new IEntry[0];
- }
- }
-
-
- /**
- * Renames an Entry.
- *
- * @param entry
- * the Entry to rename
- */
- protected void renameEntry( final IEntry entry )
- {
- RenameEntryDialog renameDialog = new RenameEntryDialog( getShell(), entry );
- if ( renameDialog.open() == Dialog.OK )
- {
- Rdn newRdn = renameDialog.getRdn();
- if ( newRdn != null && !newRdn.equals( entry.getRdn() ) )
- {
- new StudioBrowserJob(
- new RenameEntryRunnable( entry, newRdn, new SimulateRenameDialogImpl( getShell() ) ) ).execute();
- }
- }
- }
-
-
- /**
- * Get the Searches.
- *
- * @return
- * the Searches
- */
- protected ISearch[] getSearches()
- {
- if ( getSelectedSearches().length == 1 && !( getSelectedSearches()[0] instanceof IQuickSearch ) )
- {
- return getSelectedSearches();
- }
- else
- {
- return new ISearch[0];
- }
- }
-
-
- /**
- * Renames a Search.
- *
- * @param search
- * the Search to rename
- */
- protected void renameSearch( final ISearch search )
- {
- IInputValidator validator = new IInputValidator()
- {
- public String isValid( String newName )
- {
- if ( search.getName().equals( newName ) )
- return null;
- else if ( search.getBrowserConnection().getSearchManager().getSearch( newName ) != null )
- return Messages.getString( "RenameAction.ConnectionWithThisNameAlreadyExists" ); //$NON-NLS-1$
- else
- return null;
- }
- };
-
- InputDialog dialog = new InputDialog(
- getShell(),
- Messages.getString( "RenameAction.RenameSearchDialog" ), Messages.getString( "RenameAction.RenameSearchNewName" ), search.getName(), validator ); //$NON-NLS-1$ //$NON-NLS-2$
-
- dialog.open();
- String newName = dialog.getValue();
- if ( newName != null )
- {
- search.setName( newName );
- }
- }
-
-
- /**
- * Get the Bookmarks
- *
- * @return
- * the Bookmarks
- */
- protected IBookmark[] getBookmarks()
- {
- if ( getSelectedBookmarks().length == 1 )
- {
- return getSelectedBookmarks();
- }
- else
- {
- return new IBookmark[0];
- }
- }
-
-
- /**
- * Renames a Bookmark
- *
- * @param bookmark
- * the Bookmark to rename
- */
- protected void renameBookmark( final IBookmark bookmark )
- {
- IInputValidator validator = new IInputValidator()
- {
- public String isValid( String newName )
- {
- if ( bookmark.getName().equals( newName ) )
- return null;
- else if ( bookmark.getBrowserConnection().getBookmarkManager().getBookmark( newName ) != null )
- return Messages.getString( "RenameAction.BookmarkWithThisNameAlreadyExists" ); //$NON-NLS-1$
- else
- return null;
- }
- };
-
- InputDialog dialog = new InputDialog(
- getShell(),
- Messages.getString( "RenameAction.RenameBookmarkDialog" ), Messages.getString( "RenameAction.RenameBookmarkNewName" ), bookmark.getName(), validator ); //$NON-NLS-1$ //$NON-NLS-2$
-
- dialog.open();
- String newName = dialog.getValue();
- if ( newName != null )
- {
- bookmark.setName( newName );
- }
- }
+public class RenameAction extends BrowserAction {
+ /**
+ * Creates a new instance of RenameAction.
+ *
+ */
+ public RenameAction() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText() {
+
+ IEntry[] entries = getEntries();
+ ISearch[] searches = getSearches();
+ IBookmark[] bookmarks = getBookmarks();
+
+ if (entries.length == 1 && searches.length == 0
+ && bookmarks.length == 0) {
+ return Messages.getString("RenameAction.RenameEntry"); //$NON-NLS-1$
+ } else if (searches.length == 1 && entries.length == 0
+ && bookmarks.length == 0) {
+ return Messages.getString("RenameAction.RenameSearch"); //$NON-NLS-1$
+ } else if (bookmarks.length == 1 && entries.length == 0
+ && searches.length == 0) {
+ return Messages.getString("RenameAction.RenameBookmark"); //$NON-NLS-1$
+ } else {
+ return Messages.getString("RenameAction.Rename"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getCommandId() {
+ return "rename";// IWorkbenchActionDefinitionIds.RENAME;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run() {
+ IEntry[] entries = getEntries();
+ ISearch[] searches = getSearches();
+ IBookmark[] bookmarks = getBookmarks();
+
+ if (entries.length == 1 && searches.length == 0
+ && bookmarks.length == 0) {
+ renameEntry(entries[0]);
+ } else if (searches.length == 1 && entries.length == 0
+ && bookmarks.length == 0) {
+ renameSearch(searches[0]);
+ } else if (bookmarks.length == 1 && entries.length == 0
+ && searches.length == 0) {
+ renameBookmark(bookmarks[0]);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEnabled() {
+ try {
+ IEntry[] entries = getEntries();
+ ISearch[] searches = getSearches();
+ IBookmark[] bookmarks = getBookmarks();
+
+ return entries.length + searches.length + bookmarks.length == 1;
+
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * Gets the Entries
+ *
+ * @return the Entries
+ */
+ protected IEntry[] getEntries() {
+
+ IEntry entry = null;
+
+ if (getSelectedEntries().length == 1) {
+ entry = getSelectedEntries()[0];
+ } else if (getSelectedSearchResults().length == 1) {
+ entry = getSelectedSearchResults()[0].getEntry();
+ } else if (getSelectedValues().length == 1
+ && getSelectedValues()[0].isRdnPart()) {
+ entry = getSelectedValues()[0].getAttribute().getEntry();
+ }
+
+ if (entry != null && !(entry instanceof RootDSE)) {
+ return new IEntry[] { entry };
+ } else {
+ return new IEntry[0];
+ }
+ }
+
+ /**
+ * Renames an Entry.
+ *
+ * @param entry
+ * the Entry to rename
+ */
+ protected void renameEntry(final IEntry entry) {
+ RenameEntryDialog renameDialog = new RenameEntryDialog(getShell(),
+ entry);
+ if (renameDialog.open() == Dialog.OK) {
+ Rdn newRdn = renameDialog.getRdn();
+ if (newRdn != null && !newRdn.equals(entry.getRdn())) {
+ new StudioBrowserJob(new RenameEntryRunnable(entry, newRdn,
+ new SimulateRenameDialogImpl(getShell()))).execute();
+ }
+ }
+ }
+
+ /**
+ * Get the Searches.
+ *
+ * @return the Searches
+ */
+ protected ISearch[] getSearches() {
+ if (getSelectedSearches().length == 1
+ && !(getSelectedSearches()[0] instanceof IQuickSearch)) {
+ return getSelectedSearches();
+ } else {
+ return new ISearch[0];
+ }
+ }
+
+ /**
+ * Renames a Search.
+ *
+ * @param search
+ * the Search to rename
+ */
+ protected void renameSearch(final ISearch search) {
+ IInputValidator validator = new IInputValidator() {
+ public String isValid(String newName) {
+ if (search.getName().equals(newName))
+ return null;
+ else if (search.getBrowserConnection().getSearchManager()
+ .getSearch(newName) != null)
+ return Messages
+ .getString("RenameAction.ConnectionWithThisNameAlreadyExists"); //$NON-NLS-1$
+ else
+ return null;
+ }
+ };
+
+ InputDialog dialog = new InputDialog(
+ getShell(),
+ Messages.getString("RenameAction.RenameSearchDialog"), Messages.getString("RenameAction.RenameSearchNewName"), search.getName(), validator); //$NON-NLS-1$ //$NON-NLS-2$
+
+ dialog.open();
+ String newName = dialog.getValue();
+ if (newName != null) {
+ search.setName(newName);
+ }
+ }
+
+ /**
+ * Get the Bookmarks
+ *
+ * @return the Bookmarks
+ */
+ protected IBookmark[] getBookmarks() {
+ if (getSelectedBookmarks().length == 1) {
+ return getSelectedBookmarks();
+ } else {
+ return new IBookmark[0];
+ }
+ }
+
+ /**
+ * Renames a Bookmark
+ *
+ * @param bookmark
+ * the Bookmark to rename
+ */
+ protected void renameBookmark(final IBookmark bookmark) {
+ IInputValidator validator = new IInputValidator() {
+ public String isValid(String newName) {
+ if (bookmark.getName().equals(newName))
+ return null;
+ else if (bookmark.getBrowserConnection().getBookmarkManager()
+ .getBookmark(newName) != null)
+ return Messages
+ .getString("RenameAction.BookmarkWithThisNameAlreadyExists"); //$NON-NLS-1$
+ else
+ return null;
+ }
+ };
+
+ InputDialog dialog = new InputDialog(
+ getShell(),
+ Messages.getString("RenameAction.RenameBookmarkDialog"), Messages.getString("RenameAction.RenameBookmarkNewName"), bookmark.getName(), validator); //$NON-NLS-1$ //$NON-NLS-2$
+
+ dialog.open();
+ String newName = dialog.getValue();
+ if (newName != null) {
+ bookmark.setName(newName);
+ }
+ }
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/SelectAllAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/SelectAllAction.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/SelectAllAction.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/SelectAllAction.java Fri Aug 20 17:07:19 2010
@@ -20,7 +20,6 @@
package org.apache.directory.studio.ldapbrowser.common.actions;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -28,102 +27,84 @@ import java.util.List;
import org.apache.directory.studio.connection.core.ConnectionManager;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
/**
* This class implements the Select All Action.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory
+ * Project</a>
*/
-public class SelectAllAction extends BrowserAction
-{
- private Viewer viewer;
-
-
- /**
- * Creates a new instance of SelectAllAction.
- *
- * @param viewer
- * the attached viewer
- */
- public SelectAllAction( Viewer viewer )
- {
- this.viewer = viewer;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String getText()
- {
- return Messages.getString( "SelectAllAction.SelectAll" ); //$NON-NLS-1$
- }
-
-
- /**
- * {@inheritDoc}
- */
- public ImageDescriptor getImageDescriptor()
- {
- return null;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String getCommandId()
- {
- return IWorkbenchActionDefinitionIds.SELECT_ALL;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isEnabled()
- {
- return true;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void run()
- {
- if ( getInput() != null && getInput() instanceof IEntry )
- {
- List selectionList = new ArrayList();
- IAttribute[] attributes = ( ( IEntry ) getInput() ).getAttributes();
- if ( attributes != null )
- {
- selectionList.addAll( Arrays.asList( attributes ) );
- for ( int i = 0; i < attributes.length; i++ )
- {
- selectionList.addAll( Arrays.asList( attributes[i].getValues() ) );
- }
- }
- StructuredSelection selection = new StructuredSelection( selectionList );
- this.viewer.setSelection( selection );
- }
- else if ( getInput() != null && getInput() instanceof ConnectionManager )
- {
- StructuredSelection selection = new StructuredSelection( ( ( ConnectionManager ) getInput() )
- .getConnections() );
- this.viewer.setSelection( selection );
- }
- else if ( getSelectedConnections().length > 0 && viewer.getInput() instanceof ConnectionManager )
- {
- StructuredSelection selection = new StructuredSelection( ( ( ConnectionManager ) viewer.getInput() )
- .getConnections() );
- this.viewer.setSelection( selection );
- }
- }
+public class SelectAllAction extends BrowserAction {
+ private Viewer viewer;
+
+ /**
+ * Creates a new instance of SelectAllAction.
+ *
+ * @param viewer
+ * the attached viewer
+ */
+ public SelectAllAction(Viewer viewer) {
+ this.viewer = viewer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText() {
+ return Messages.getString("SelectAllAction.SelectAll"); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getCommandId() {
+ return "selectAll";// IWorkbenchActionDefinitionIds.SELECT_ALL;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEnabled() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run() {
+ if (getInput() != null && getInput() instanceof IEntry) {
+ List selectionList = new ArrayList();
+ IAttribute[] attributes = ((IEntry) getInput()).getAttributes();
+ if (attributes != null) {
+ selectionList.addAll(Arrays.asList(attributes));
+ for (int i = 0; i < attributes.length; i++) {
+ selectionList.addAll(Arrays.asList(attributes[i]
+ .getValues()));
+ }
+ }
+ StructuredSelection selection = new StructuredSelection(
+ selectionList);
+ this.viewer.setSelection(selection);
+ } else if (getInput() != null
+ && getInput() instanceof ConnectionManager) {
+ StructuredSelection selection = new StructuredSelection(
+ ((ConnectionManager) getInput()).getConnections());
+ this.viewer.setSelection(selection);
+ } else if (getSelectedConnections().length > 0
+ && viewer.getInput() instanceof ConnectionManager) {
+ StructuredSelection selection = new StructuredSelection(
+ ((ConnectionManager) viewer.getInput()).getConnections());
+ this.viewer.setSelection(selection);
+ }
+ }
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/proxy/BrowserActionProxy.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/proxy/BrowserActionProxy.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/proxy/BrowserActionProxy.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/proxy/BrowserActionProxy.java Fri Aug 20 17:07:19 2010
@@ -246,7 +246,7 @@ public abstract class BrowserActionProxy
setText( action.getText() );
setToolTipText( action.getText() );
setEnabled( action.isEnabled() );
- setImageDescriptor( action.getImageDescriptor() );
+// setImageDescriptor( action.getImageDescriptor() );
setChecked( action.isChecked() );
}
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/DeleteDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/DeleteDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/DeleteDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/DeleteDialog.java Fri Aug 20 17:07:19 2010
@@ -60,7 +60,7 @@ public class DeleteDialog extends Messag
public DeleteDialog( Shell parentShell, String title, String message, boolean askForTreeDeleteControl )
{
super( parentShell, title, null, message, QUESTION, new String[]
- { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, OK );
+ { "OK", "Cancel" /*IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL*/ }, OK );
this.askForTreeDeleteControl = askForTreeDeleteControl;
this.useTreeDeleteControl = false;
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/EntryExistsCopyStrategyDialogImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/EntryExistsCopyStrategyDialogImpl.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/EntryExistsCopyStrategyDialogImpl.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/EntryExistsCopyStrategyDialogImpl.java Fri Aug 20 17:07:19 2010
@@ -148,8 +148,8 @@ public class EntryExistsCopyStrategyDial
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ createButton( parent, IDialogConstants.OK_ID, "OK", true );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/FilterDialog.java Fri Aug 20 17:07:19 2010
@@ -28,12 +28,6 @@ import org.apache.directory.studio.ldapb
import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.VerticalRuler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -63,7 +57,7 @@ public class FilterDialog extends Dialog
private IBrowserConnection browserConnection;
/** The source viewer. */
- private SourceViewer sourceViewer;
+// private SourceViewer sourceViewer;
/** The filter source viewer configuration. */
private FilterSourceViewerConfiguration configuration;
@@ -123,13 +117,13 @@ public class FilterDialog extends Dialog
{
if ( buttonId == IDialogConstants.OK_ID )
{
- parser.parse( sourceViewer.getDocument().get() );
+// parser.parse( sourceViewer.getDocument().get() );
filter = parser.getModel().toString();
}
else if ( buttonId == FORMAT_BUTTON_ID )
{
- IRegion region = new Region( 0, sourceViewer.getDocument().getLength() );
- configuration.getContentFormatter( sourceViewer ).format( sourceViewer.getDocument(), region );
+// IRegion region = new Region( 0, sourceViewer.getDocument().getLength() );
+// configuration.getContentFormatter( sourceViewer ).format( sourceViewer.getDocument(), region );
}
// call super implementation
@@ -161,21 +155,21 @@ public class FilterDialog extends Dialog
composite.setLayoutData( gd );
// create and configure source viewer
- sourceViewer = new SourceViewer( composite, new VerticalRuler( 0 ), SWT.H_SCROLL | SWT.V_SCROLL );
- sourceViewer.getControl().setLayoutData( new GridData( GridData.FILL_BOTH ) );
- configuration = new FilterSourceViewerConfiguration( parser, browserConnection );
- sourceViewer.configure( configuration );
-
- // set document
- IDocument document = new Document( filter );
- sourceViewer.setDocument( document );
-
- // preformat
- IRegion region = new Region( 0, sourceViewer.getDocument().getLength() );
- configuration.getContentFormatter( sourceViewer ).format( sourceViewer.getDocument(), region );
-
- // set focus to the source viewer
- sourceViewer.getTextWidget().setFocus();
+// sourceViewer = new SourceViewer( composite, new VerticalRuler( 0 ), SWT.H_SCROLL | SWT.V_SCROLL );
+// sourceViewer.getControl().setLayoutData( new GridData( GridData.FILL_BOTH ) );
+// configuration = new FilterSourceViewerConfiguration( parser, browserConnection );
+// sourceViewer.configure( configuration );
+//
+// // set document
+// IDocument document = new Document( filter );
+// sourceViewer.setDocument( document );
+//
+// // preformat
+// IRegion region = new Region( 0, sourceViewer.getDocument().getLength() );
+// configuration.getContentFormatter( sourceViewer ).format( sourceViewer.getDocument(), region );
+//
+// // set focus to the source viewer
+// sourceViewer.getTextWidget().setFocus();
return composite;
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java Fri Aug 20 17:07:19 2010
@@ -21,15 +21,8 @@
package org.apache.directory.studio.ldapbrowser.common.dialogs;
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.JFaceResources;
@@ -37,7 +30,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@@ -95,45 +87,45 @@ public class HexDialog extends Dialog
}
else if ( buttonId == SAVE_BUTTON_ID )
{
- FileDialog fileDialog = new FileDialog( getShell(), SWT.SAVE );
- fileDialog.setText( Messages.getString( "HexDialog.SaveData" ) ); //$NON-NLS-1$
- // fileDialog.setFilterExtensions(new String[]{"*.jpg"});
- String returnedFileName = fileDialog.open();
- if ( returnedFileName != null )
- {
- try
- {
- File file = new File( returnedFileName );
- FileUtils.writeByteArrayToFile( file, currentData );
- }
- catch ( IOException e )
- {
- ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
- new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, IStatus.ERROR, Messages
- .getString( "HexDialog.CantWriteToFile" ), e ) ); //$NON-NLS-1$
- }
- }
+// FileDialog fileDialog = new FileDialog( getShell(), SWT.SAVE );
+// fileDialog.setText( Messages.getString( "HexDialog.SaveData" ) ); //$NON-NLS-1$
+// // fileDialog.setFilterExtensions(new String[]{"*.jpg"});
+// String returnedFileName = fileDialog.open();
+// if ( returnedFileName != null )
+// {
+// try
+// {
+// File file = new File( returnedFileName );
+// FileUtils.writeByteArrayToFile( file, currentData );
+// }
+// catch ( IOException e )
+// {
+// ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
+// new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, IStatus.ERROR, Messages
+// .getString( "HexDialog.CantWriteToFile" ), e ) ); //$NON-NLS-1$
+// }
+// }
}
else if ( buttonId == LOAD_BUTTON_ID )
{
- FileDialog fileDialog = new FileDialog( getShell(), SWT.OPEN );
- fileDialog.setText( Messages.getString( "HexDialog.LoadData" ) ); //$NON-NLS-1$
- String returnedFileName = fileDialog.open();
- if ( returnedFileName != null )
- {
- try
- {
- File file = new File( returnedFileName );
- currentData = FileUtils.readFileToByteArray( file );
- hexText.setText( toFormattedHex( currentData ) );
- }
- catch ( IOException e )
- {
- ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
- new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, IStatus.ERROR, Messages
- .getString( "HexDialog.CantReadFile" ), e ) ); //$NON-NLS-1$
- }
- }
+// FileDialog fileDialog = new FileDialog( getShell(), SWT.OPEN );
+// fileDialog.setText( Messages.getString( "HexDialog.LoadData" ) ); //$NON-NLS-1$
+// String returnedFileName = fileDialog.open();
+// if ( returnedFileName != null )
+// {
+// try
+// {
+// File file = new File( returnedFileName );
+// currentData = FileUtils.readFileToByteArray( file );
+// hexText.setText( toFormattedHex( currentData ) );
+// }
+// catch ( IOException e )
+// {
+// ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
+// new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, IStatus.ERROR, Messages
+// .getString( "HexDialog.CantReadFile" ), e ) ); //$NON-NLS-1$
+// }
+// }
}
else
{
@@ -162,8 +154,8 @@ public class HexDialog extends Dialog
{
createButton( parent, LOAD_BUTTON_ID, Messages.getString( "HexDialog.LoadDataButton" ), false ); //$NON-NLS-1$
createButton( parent, SAVE_BUTTON_ID, Messages.getString( "HexDialog.SaveDataButton" ), false ); //$NON-NLS-1$
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ createButton( parent, IDialogConstants.OK_ID,"OK", false );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MoveEntriesDialog.java Fri Aug 20 17:07:19 2010
@@ -114,8 +114,8 @@ public class MoveEntriesDialog extends D
*/
protected void createButtonsForButtonBar( Composite parent )
{
- okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ okButton = createButton( parent, IDialogConstants.OK_ID, "OK", true );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/RenameEntryDialog.java Fri Aug 20 17:07:19 2010
@@ -126,8 +126,8 @@ public class RenameEntryDialog extends D
*/
protected void createButtonsForButtonBar( Composite parent )
{
- okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ okButton = createButton( parent, IDialogConstants.OK_ID, "OK", true );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ScopeDialog.java Fri Aug 20 17:07:19 2010
@@ -103,8 +103,8 @@ public class ScopeDialog extends Dialog
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ createButton( parent, IDialogConstants.OK_ID, "OK", false );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectBrowserConnectionDialog.java Fri Aug 20 17:07:19 2010
@@ -148,8 +148,8 @@ public class SelectBrowserConnectionDial
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ createButton( parent, IDialogConstants.OK_ID, "OK", false );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java Fri Aug 20 17:07:19 2010
@@ -148,8 +148,8 @@ public class SelectEntryDialog extends D
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ createButton( parent, IDialogConstants.OK_ID, "OK", false );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SimulateRenameDialogImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SimulateRenameDialogImpl.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SimulateRenameDialogImpl.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SimulateRenameDialogImpl.java Fri Aug 20 17:07:19 2010
@@ -100,8 +100,8 @@ public class SimulateRenameDialogImpl ex
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ createButton( parent, IDialogConstants.OK_ID, "OK", false );
+ createButton( parent, IDialogConstants.CANCEL_ID,"Cancel", false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/TextDialog.java Fri Aug 20 17:07:19 2010
@@ -85,8 +85,8 @@ public class TextDialog extends Dialog
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ createButton( parent, IDialogConstants.OK_ID,"OK" /*IDialogConstants.OK_LABEL*/, false );
+ createButton( parent, IDialogConstants.CANCEL_ID, "Cancel" /* IDialogConstants.CANCEL_LABEL*/, false );
}
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/AttributesPreferencePage.java Fri Aug 20 17:07:19 2010
@@ -169,7 +169,7 @@ public class AttributesPreferencePage ex
{
style |= SWT.ITALIC;
}
- fontData.setStyle( style );
+// fontData.setStyle( style );
}
}