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 2006/12/18 18:53:22 UTC
svn commit: r488368 [21/23] - in /directory/sandbox/pamarcelot/ldapstudio:
ldapstudio-browser-ui/ ldapstudio-browser-ui/META-INF/
ldapstudio-browser-ui/about_files/ ldapstudio-browser-ui/icons/
ldapstudio-browser-ui/icons/ovr16/ ldapstudio-browser-ui/s...
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorLabelProvider.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorLabelProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorLabelProvider.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierachie;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProvider;
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProviderManager;
+
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.ITableFontProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+
+public class SearchResultEditorLabelProvider extends LabelProvider implements ITableLabelProvider, ITableFontProvider,
+ ITableColorProvider
+{
+
+ private ValueProviderManager valueProviderManager;
+
+ private ISearch search;
+
+ private boolean showDn;
+
+
+ public SearchResultEditorLabelProvider( TableViewer viewer, ValueProviderManager valueProviderManager )
+ {
+ this.valueProviderManager = valueProviderManager;
+ }
+
+
+ public void inputChanged( ISearch newSearch, boolean showDn )
+ {
+ this.search = newSearch;
+ this.showDn = showDn;
+ }
+
+
+ public final String getColumnText( Object obj, int index )
+ {
+
+ if ( obj != null && obj instanceof ISearchResult )
+ {
+ String property;
+ try
+ {
+ ISearchResult result = ( ISearchResult ) obj;
+
+ if ( this.showDn && index == 0 )
+ {
+ property = BrowserUIConstants.DN;
+ }
+ else if ( this.showDn && index > 0 )
+ {
+ property = this.search.getReturningAttributes()[index - 1];
+ }
+ else
+ {
+ property = this.search.getReturningAttributes()[index];
+ }
+
+ if ( property == BrowserUIConstants.DN )
+ {
+ return result.getDn().toString();
+ }
+ else
+ {
+ AttributeHierachie ah = result.getAttributeWithSubtypes( property );
+ return getDisplayValue( ah );
+ }
+
+ }
+ catch ( ArrayIndexOutOfBoundsException aioobe )
+ {
+ // occurs on "invisible" columns
+ return "";
+ }
+
+ }
+ else if ( obj != null )
+ {
+ return obj.toString();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+
+ public final Image getColumnImage( Object obj, int index )
+ {
+ return null;
+ }
+
+
+ private String getDisplayValue( AttributeHierachie ah )
+ {
+
+ ValueProvider vp = this.valueProviderManager.getCurrentValueProvider( ah );
+ if ( vp == null )
+ {
+ return "";
+ }
+
+ String value = vp.getDisplayValue( ah );
+ if ( value.length() > 50 )
+ {
+ value = value.substring( 0, 47 ) + "...";
+ }
+ return value;
+ }
+
+
+ public Font getFont( Object element, int index )
+ {
+
+ if ( element instanceof ISearchResult )
+ {
+ ISearchResult result = ( ISearchResult ) element;
+ String property = null;
+
+ if ( this.showDn && index == 0 )
+ {
+ property = BrowserUIConstants.DN;
+ }
+ else if ( this.showDn && index > 0 && index - 1 < result.getSearch().getReturningAttributes().length )
+ {
+ property = result.getSearch().getReturningAttributes()[index - 1];
+ }
+ else if ( index < result.getSearch().getReturningAttributes().length )
+ {
+ property = result.getSearch().getReturningAttributes()[index];
+ }
+
+ if ( property != null && property == BrowserUIConstants.DN )
+ {
+ return null;
+ }
+ else if ( property != null )
+ {
+ AttributeHierachie ah = result.getAttributeWithSubtypes( property );
+ if ( ah != null )
+ {
+ for ( int i = 0; i < ah.getAttributes().length; i++ )
+ {
+ IAttribute attribute = ah.getAttributes()[i];
+ if ( attribute.isObjectClassAttribute() )
+ {
+ FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
+ .getPreferenceStore(), BrowserUIConstants.PREFERENCE_OBJECTCLASS_FONT );
+ return BrowserUIPlugin.getDefault().getFont( fontData );
+ }
+ else if ( attribute.isMustAttribute() )
+ {
+ FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
+ .getPreferenceStore(), BrowserUIConstants.PREFERENCE_MUSTATTRIBUTE_FONT );
+ return BrowserUIPlugin.getDefault().getFont( fontData );
+ }
+ else if ( attribute.isOperationalAttribute() )
+ {
+ FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
+ .getPreferenceStore(), BrowserUIConstants.PREFERENCE_OPERATIONALATTRIBUTE_FONT );
+ return BrowserUIPlugin.getDefault().getFont( fontData );
+ }
+ else
+ {
+ FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
+ .getPreferenceStore(), BrowserUIConstants.PREFERENCE_MAYATTRIBUTE_FONT );
+ return BrowserUIPlugin.getDefault().getFont( fontData );
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+
+ public Color getForeground( Object element, int index )
+ {
+ return null;
+ }
+
+
+ public Color getBackground( Object element, int index )
+ {
+ return null;
+ }
+
+}
\ No newline at end of file
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorManager.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorManager.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorManager.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+public class SearchResultEditorManager
+{
+
+ private static SearchResultEditor editor;
+
+
+ public static void setInput( ISearch search )
+ {
+
+ IEditorInput input = new SearchResultEditorInput( search );
+
+ if ( editor == null && search != null )
+ {
+ try
+ {
+ editor = ( SearchResultEditor ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor( input, SearchResultEditor.getId(), false );
+ }
+ catch ( PartInitException e )
+ {
+ e.printStackTrace();
+ }
+ }
+ else if ( editor != null )
+ {
+ editor.setInput( input );
+ if ( search != null )
+ {
+ if ( !PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().isPartVisible( editor ) )
+ {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop( editor );
+ }
+ }
+ }
+ }
+
+
+ static void editorClosed()
+ {
+ editor = null;
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.INavigationLocation;
+import org.eclipse.ui.NavigationLocation;
+
+
+public class SearchResultEditorNavigationLocation extends NavigationLocation
+{
+
+ protected SearchResultEditorNavigationLocation( SearchResultEditor editor )
+ {
+ super( editor );
+ }
+
+
+ public String getText()
+ {
+ ISearch search = getSearch();
+ if ( search != null )
+ {
+ return search.getName();
+ }
+ else
+ {
+ return super.getText();
+ }
+ }
+
+
+ public void saveState( IMemento memento )
+ {
+ ISearch search = getSearch();
+ memento.putString( "SEARCH", search.getName() );
+ memento.putString( "CONNECTION", search.getConnection().getName() );
+ }
+
+
+ public void restoreState( IMemento memento )
+ {
+ IConnection connection = BrowserCorePlugin.getDefault().getConnectionManager().getConnection(
+ memento.getString( "CONNECTION" ) );
+ ISearch search = connection.getSearchManager().getSearch( memento.getString( "SEARCH" ) );
+ super.setInput( new SearchResultEditorInput( search ) );
+ }
+
+
+ public void restoreLocation()
+ {
+ IEditorPart editorPart = getEditorPart();
+ if ( editorPart != null && editorPart instanceof SearchResultEditor )
+ {
+ SearchResultEditor searchResultEditor = ( SearchResultEditor ) editorPart;
+ searchResultEditor.setInput( ( SearchResultEditorInput ) getInput() );
+ }
+ }
+
+
+ public boolean mergeInto( INavigationLocation currentLocation )
+ {
+ return false;
+ }
+
+
+ public void update()
+ {
+ }
+
+
+ private ISearch getSearch()
+ {
+
+ Object editorInput = getInput();
+ if ( editorInput != null && editorInput instanceof SearchResultEditorInput )
+ {
+ SearchResultEditorInput searchResultEditorInput = ( SearchResultEditorInput ) editorInput;
+ ISearch search = searchResultEditorInput.getSearch();
+ if ( search != null )
+ {
+ return search;
+ }
+ }
+
+ return null;
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorPasteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorPasteAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorPasteAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorPasteAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.core.jobs.CreateValuesJob;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.ui.actions.PasteAction;
+import org.apache.directory.ldapstudio.browser.ui.dnd.ValuesTransfer;
+
+
+/**
+ * Special paste action to copy the values of a copied attr-val to another
+ * attribute.
+ */
+public class SearchResultEditorPasteAction extends PasteAction
+{
+
+ public SearchResultEditorPasteAction()
+ {
+ super();
+ }
+
+
+ public String getText()
+ {
+ IValue[] values = getValuesToPaste();
+ if ( values != null )
+ {
+ return values.length > 1 ? "Paste Values" : "Paste Value";
+ }
+
+ return "Paste";
+ }
+
+
+ public boolean isEnabled()
+ {
+ if ( this.getValuesToPaste() != null )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ public void run()
+ {
+ IValue[] values = getValuesToPaste();
+ if ( values != null )
+ {
+
+ String attributeDescription = getSelectedAttributeHierarchies()[0].getAttribute().getDescription();
+
+ String[] attributeDescriptions = new String[values.length];
+ Object[] rawValues = new Object[values.length];
+ for ( int v = 0; v < values.length; v++ )
+ {
+ attributeDescriptions[v] = attributeDescription;
+ rawValues[v] = values[v].getRawValue();
+ }
+ IEntry entry = getSelectedAttributeHierarchies()[0].getAttribute().getEntry();
+
+ new CreateValuesJob( entry, attributeDescriptions, rawValues ).execute();
+ }
+ }
+
+
+ /**
+ * Conditions: - an search result and a multiattribute are selected -
+ * there are IValues in clipboard
+ *
+ * @return
+ */
+ private IValue[] getValuesToPaste()
+ {
+ if ( getSelectedEntries().length + getSelectedBookmarks().length + getSelectedValues().length
+ + getSelectedAttributes().length + getSelectedSearches().length + getSelectedConnections().length == 0
+ && getSelectedSearchResults().length == 1
+ && getSelectedAttributeHierarchies().length == 1
+ && getSelectedAttributeHierarchies()[0].size() == 1 )
+ {
+
+ Object content = this.getFromClipboard( ValuesTransfer.getInstance() );
+ if ( content != null && content instanceof IValue[] )
+ {
+ IValue[] values = ( IValue[] ) content;
+ return values;
+ }
+
+ // Object content =
+ // this.getFromClipboard(LdifAttrValLinesTransfer.getInstance());
+ // if (content != null && content instanceof LdifAttrValLine[])
+ // {
+ // LdifAttrValLine[] lines = (LdifAttrValLine[]) content;
+ // return lines;
+ // }
+ }
+
+ return null;
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorQuickFilterWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorQuickFilterWidget.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorQuickFilterWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorQuickFilterWidget.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+
+public class SearchResultEditorQuickFilterWidget
+{
+
+ private SearchResultEditorFilter filter;
+
+ private Composite parent;
+
+ private Composite composite;
+
+ private Composite innerComposite;
+
+ private Text quickFilterValueText;
+
+ private Button clearQuickFilterButton;
+
+
+ public SearchResultEditorQuickFilterWidget( SearchResultEditorFilter filter )
+ {
+ this.filter = filter;
+ }
+
+
+ public void createComposite( Composite parent )
+ {
+ this.parent = parent;
+
+ this.composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+ GridLayout gl = new GridLayout();
+ gl.marginHeight = 2;
+ gl.marginWidth = 2;
+ composite.setLayout( gl );
+
+ this.innerComposite = null;
+ }
+
+
+ private void create()
+ {
+ innerComposite = BaseWidgetUtils.createColumnContainer( this.composite, 2, 1 );
+
+ this.quickFilterValueText = new Text( innerComposite, SWT.BORDER );
+ this.quickFilterValueText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+ this.quickFilterValueText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ filter.setQuickFilterValue( quickFilterValueText.getText() );
+ clearQuickFilterButton.setEnabled( !"".equals( quickFilterValueText.getText() ) );
+ if ( !"".equals( quickFilterValueText.getText() ) )
+ {
+ RGB fgRgb = PreferenceConverter.getColor( BrowserUIPlugin.getDefault().getPreferenceStore(),
+ BrowserUIConstants.PREFERENCE_QUICKFILTER_FOREGROUND_COLOR );
+ RGB bgRgb = PreferenceConverter.getColor( BrowserUIPlugin.getDefault().getPreferenceStore(),
+ BrowserUIConstants.PREFERENCE_QUICKFILTER_BACKGROUND_COLOR );
+ Color fgColor = BrowserUIPlugin.getDefault().getColor( fgRgb );
+ Color bgColor = BrowserUIPlugin.getDefault().getColor( bgRgb );
+ quickFilterValueText.setForeground( fgColor );
+ quickFilterValueText.setBackground( bgColor );
+ FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
+ .getPreferenceStore(), BrowserUIConstants.PREFERENCE_QUICKFILTER_FONT );
+ Font font = BrowserUIPlugin.getDefault().getFont( fontData );
+ quickFilterValueText.setFont( font );
+ }
+ else
+ {
+ quickFilterValueText.setBackground( null );
+ }
+ }
+ } );
+
+ this.clearQuickFilterButton = new Button( innerComposite, SWT.PUSH );
+ this.clearQuickFilterButton.setToolTipText( "Clear Quick Filter" );
+ this.clearQuickFilterButton.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_CLEAR ) );
+ this.clearQuickFilterButton.setEnabled( false );
+ this.clearQuickFilterButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ if ( !"".equals( quickFilterValueText.getText() ) )
+ quickFilterValueText.setText( "" );
+ }
+ } );
+
+ setEnabled( composite.isEnabled() );
+
+ composite.layout( true, true );
+ parent.layout( true, true );
+
+ }
+
+
+ private void destroy()
+ {
+ if ( !"".equals( quickFilterValueText.getText() ) )
+ quickFilterValueText.setText( "" );
+ innerComposite.dispose();
+ innerComposite = null;
+
+ composite.layout( true, true );
+ parent.layout( true, true );
+ }
+
+
+ public void dispose()
+ {
+ if ( this.innerComposite != null && !this.innerComposite.isDisposed() )
+ {
+ this.quickFilterValueText.dispose();
+ this.quickFilterValueText = null;
+ this.clearQuickFilterButton = null;
+ this.innerComposite = null;
+ }
+ if ( this.filter != null )
+ {
+ this.composite.dispose();
+ this.composite = null;
+ this.parent = null;
+ this.filter = null;
+ }
+ }
+
+
+ public void setEnabled( boolean enabled )
+ {
+ if ( this.composite != null && !this.composite.isDisposed() )
+ {
+ this.composite.setEnabled( enabled );
+ }
+ if ( this.innerComposite != null && !this.innerComposite.isDisposed() )
+ {
+ this.innerComposite.setEnabled( enabled );
+ this.quickFilterValueText.setEnabled( enabled );
+ this.clearQuickFilterButton.setEnabled( enabled );
+ }
+ }
+
+
+ public void setActive( boolean visible )
+ {
+ if ( visible && this.innerComposite == null && composite != null )
+ {
+ create();
+ this.quickFilterValueText.setFocus();
+ }
+ else if ( !visible && this.innerComposite != null && composite != null )
+ {
+ destroy();
+ }
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorSorter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorSorter.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorSorter.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorSorter.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,335 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants;
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierachie;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.TableColumn;
+
+
+public class SearchResultEditorSorter extends ViewerSorter implements SelectionListener
+{
+
+ protected static final int SORT_ORDER_NONE = 0;
+
+ protected static final int SORT_ORDER_ASCENDING = 1;
+
+ protected static final int SORT_ORDER_DESCENDING = 2;
+
+ protected SearchResultEditorContentProvider contentProvider;
+
+ private ISearch search;
+
+ private TableColumn[] columns;
+
+ private boolean showDn;
+
+ private int sortBy;
+
+ private int sortOrder;
+
+
+ public SearchResultEditorSorter()
+ {
+ super();
+ }
+
+
+ public void connect( SearchResultEditorContentProvider contentProvider )
+ {
+
+ this.contentProvider = contentProvider;
+
+ this.sortBy = 0;
+ this.sortOrder = SORT_ORDER_NONE;
+
+ this.columns = this.contentProvider.getViewer().getTable().getColumns();
+ for ( int i = 0; i < this.columns.length; i++ )
+ {
+ this.columns[i].addSelectionListener( this );
+ }
+ }
+
+
+ public void inputChanged( ISearch newSearch, boolean showDn )
+ {
+
+ this.search = newSearch;
+ this.showDn = showDn;
+
+ for ( int i = 0; this.columns != null && i < this.columns.length; i++ )
+ {
+ this.columns[i].removeSelectionListener( this );
+ }
+ this.columns = this.contentProvider.getViewer().getTable().getColumns();
+ for ( int i = 0; i < this.columns.length; i++ )
+ {
+ this.columns[i].addSelectionListener( this );
+ }
+
+ // check sort column
+ int visibleColumns = this.search.getReturningAttributes().length;
+ if ( this.showDn )
+ visibleColumns++;
+ if ( visibleColumns < this.sortBy + 1 )
+ {
+ this.setSortColumn( 0 );
+ this.setSortColumn( 0 );
+ this.setSortColumn( 0 );
+ }
+ }
+
+
+ public void dispose()
+ {
+ for ( int i = 0; this.columns != null && i < this.columns.length; i++ )
+ {
+ if ( !this.columns[i].isDisposed() )
+ this.columns[i].removeSelectionListener( this );
+ }
+ this.columns = null;
+ this.search = null;
+ this.contentProvider = null;
+ }
+
+
+ public void widgetDefaultSelected( SelectionEvent e )
+ {
+ }
+
+
+ public void widgetSelected( SelectionEvent e )
+ {
+ if ( e.widget instanceof TableColumn )
+ {
+ int index = this.contentProvider.getViewer().getTable().indexOf( ( ( TableColumn ) e.widget ) );
+ this.setSortColumn( index );
+ }
+ }
+
+
+ private void setSortColumn( int index )
+ {
+ if ( this.sortBy == index )
+ {
+ // toggle sort order
+ this.sortOrder = this.sortOrder == SORT_ORDER_ASCENDING ? SORT_ORDER_DESCENDING
+ : this.sortOrder == SORT_ORDER_DESCENDING ? SORT_ORDER_NONE : SORT_ORDER_ASCENDING;
+ }
+ else
+ {
+ // set new sort by
+ this.sortBy = index;
+ this.sortOrder = SORT_ORDER_ASCENDING;
+ }
+ if ( this.sortOrder == BrowserCoreConstants.SORT_ORDER_NONE )
+ {
+ this.sortBy = BrowserCoreConstants.SORT_BY_NONE;
+ }
+
+ TableColumn[] columns = this.contentProvider.getViewer().getTable().getColumns();
+ for ( int i = 0; i < columns.length; i++ )
+ {
+ columns[i].setImage( null );
+ }
+
+ if ( this.sortOrder == SORT_ORDER_ASCENDING )
+ {
+ ( columns[index] )
+ .setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_SORT_ASCENDING ) );
+ }
+ else if ( this.sortOrder == SORT_ORDER_DESCENDING )
+ {
+ ( columns[index] )
+ .setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_SORT_DESCENDING ) );
+ }
+ else
+ {
+ ( columns[index] ).setImage( null );
+ }
+
+ this.contentProvider.refresh();
+
+ }
+
+
+ public boolean isSorted()
+ {
+ // return this.sortOrder != SORT_ORDER_NONE;
+ return true;
+ }
+
+
+ public void sort( final Viewer viewer, Object[] elements )
+ {
+
+ if ( isSorted() )
+ {
+ Arrays.sort( elements, new Comparator()
+ {
+ public int compare( Object a, Object b )
+ {
+ return SearchResultEditorSorter.this.compare( viewer, a, b );
+ }
+ } );
+ }
+
+ }
+
+
+ public int compare( Viewer viewer, Object o1, Object o2 )
+ {
+
+ if ( this.search == null )
+ {
+ return this.equal();
+ }
+
+ // if(o1 == null && o2 == null) {
+ // return this.equal();
+ // }
+ // else if(o1 == null && o2 != null) {
+ // return this.lessThan();
+ // }
+ // else if(o1 != null && o2 == null) {
+ // return this.greaterThan();
+ // }
+ // else {
+ // if(!(o1 instanceof ISearchResult) && !(o2 instanceof ISearchResult))
+ // {
+ // return this.equal();
+ // }
+ // else if(!(o1 instanceof ISearchResult) && (o2 instanceof
+ // ISearchResult)) {
+ // return this.lessThan();
+ // }
+ // else if((o1 instanceof ISearchResult) && !(o2 instanceof
+ // ISearchResult)) {
+ // return this.greaterThan();
+ // }
+ // else {
+ ISearchResult sr1 = ( ISearchResult ) o1;
+ ISearchResult sr2 = ( ISearchResult ) o2;
+
+ IEntry entry1 = sr1.getEntry();
+ IEntry entry2 = sr2.getEntry();
+
+ String attributeName;
+ if ( showDn && this.sortBy == 0 )
+ {
+ attributeName = BrowserUIConstants.DN;
+ }
+ else if ( showDn && this.sortBy > 0 )
+ {
+ attributeName = this.search.getReturningAttributes()[this.sortBy - 1];
+ }
+ else
+ {
+ attributeName = this.search.getReturningAttributes()[this.sortBy];
+ }
+
+ if ( attributeName == BrowserUIConstants.DN )
+ {
+ return compare( entry1.getDn().toString(), entry2.getDn().toString() );
+ }
+ else
+ {
+ AttributeHierachie ah1 = entry1.getAttributeWithSubtypes( attributeName );
+ AttributeHierachie ah2 = entry2.getAttributeWithSubtypes( attributeName );
+ if ( ah1 == null && ah2 == null )
+ {
+ return this.equal();
+ }
+ else if ( ah1 == null && ah2 != null )
+ {
+ return this.lessThan();
+ }
+ else if ( ah1 != null && ah2 == null )
+ {
+ return this.greaterThan();
+ }
+ else
+ {
+ IAttribute attribute1 = ah1.getAttribute();
+ IAttribute attribute2 = ah2.getAttribute();
+
+ String value1 = getValue( attribute1 );
+ String value2 = getValue( attribute2 );
+ return compare( value1, value2 );
+ }
+ }
+ // }
+ // }
+ }
+
+
+ private String getValue( IAttribute attribute )
+ {
+ if ( attribute.getValueSize() > 0 )
+ {
+ return attribute.getStringValue();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+
+ private int lessThan()
+ {
+ return this.sortOrder == SORT_ORDER_ASCENDING ? -1 : 1;
+ }
+
+
+ private int equal()
+ {
+ return 0;
+ }
+
+
+ private int greaterThan()
+ {
+ return this.sortOrder == SORT_ORDER_ASCENDING ? 1 : -1;
+ }
+
+
+ private int compare( String s1, String s2 )
+ {
+ return this.sortOrder == SORT_ORDER_ASCENDING ? s1.compareToIgnoreCase( s2 ) : s2.compareToIgnoreCase( s1 );
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,548 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.EmptyValueAddedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EntryUpdateListener;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateListener;
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierachie;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.actions.OpenSearchResultAction;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+
+public class SearchResultEditorUniversalListener implements IPartListener, SearchUpdateListener, EntryUpdateListener
+{
+
+ private SearchResultEditor editor;
+
+ private TableViewer viewer;
+
+ private SearchResultEditorCursor cursor;
+
+ private OpenBestEditorAction startEditAction;
+
+ private ISearch selectedSearch;
+
+ private Hyperlink dnLink;
+
+ private TableEditor tableEditor;
+
+
+ public SearchResultEditorUniversalListener( SearchResultEditor editor )
+ {
+ this.editor = editor;
+
+ this.startEditAction = this.editor.getActionGroup().getOpenBestEditorAction();
+ this.viewer = this.editor.getMainWidget().getViewer();
+ this.cursor = this.editor.getConfiguration().getCursor( this.viewer );
+
+ dnLink = new Hyperlink( viewer.getTable(), SWT.NONE );
+ dnLink.setLayoutData( new GridData( SWT.BOTTOM, SWT.LEFT, true, true ) );
+ dnLink.setText( "" );
+ dnLink.setMenu( viewer.getTable().getMenu() );
+ dnLink.addHyperlinkListener( new IHyperlinkListener()
+ {
+ public void linkActivated( HyperlinkEvent e )
+ {
+ ISearchResult sr = ( ISearchResult ) e.widget.getData();
+ OpenSearchResultAction action = new OpenSearchResultAction();
+ action.setSelectedSearchResults( new ISearchResult[]
+ { sr } );
+ action.run();
+ }
+
+
+ public void linkEntered( HyperlinkEvent e )
+ {
+ }
+
+
+ public void linkExited( HyperlinkEvent e )
+ {
+ }
+ } );
+ tableEditor = new TableEditor( viewer.getTable() );
+ tableEditor.horizontalAlignment = SWT.LEFT;
+ tableEditor.verticalAlignment = SWT.BOTTOM;
+ tableEditor.grabHorizontal = true;
+ tableEditor.grabVertical = true;
+
+ this.initListeners();
+ }
+
+
+ private void initListeners()
+ {
+
+ cursor.addMouseMoveListener( new MouseMoveListener()
+ {
+ public void mouseMove( MouseEvent e )
+ {
+ if ( !cursor.isDisposed() )
+ {
+ TableItem item = cursor.getRow();
+ if ( cursor.getColumn() == 0
+ && "DN".equalsIgnoreCase( cursor.getRow().getParent().getColumns()[0].getText() ) )
+ {
+ checkDnLink( item );
+ }
+ }
+ }
+ } );
+
+ viewer.getTable().addMouseMoveListener( new MouseMoveListener()
+ {
+ public void mouseMove( MouseEvent e )
+ {
+ if ( !viewer.getTable().isDisposed() )
+ {
+ TableItem item = viewer.getTable().getItem( new Point( e.x, e.y ) );
+ viewer.getTable().getColumns()[0].getWidth();
+ if ( e.x > 0 && e.x < viewer.getTable().getColumns()[0].getWidth()
+ && "DN".equalsIgnoreCase( viewer.getTable().getColumns()[0].getText() ) )
+ {
+ checkDnLink( item );
+ }
+ }
+ }
+ } );
+
+ dnLink.addMouseTrackListener( new MouseTrackListener()
+ {
+ public void mouseEnter( MouseEvent e )
+ {
+ }
+
+
+ public void mouseExit( MouseEvent e )
+ {
+ if ( !dnLink.isDisposed() )
+ {
+ dnLink.setVisible( false );
+ tableEditor.setEditor( null );
+ }
+ }
+
+
+ public void mouseHover( MouseEvent e )
+ {
+ }
+ } );
+
+ cursor.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ // viewer.setSelection(new StructuredSelection(getRow()), true);
+ // viewer.getTable().setSelection(new TableItem[]{getRow()});
+ viewer.setSelection( null, true );
+ viewer.getTable().setSelection( new TableItem[0] );
+
+ ISearchResult result = cursor.getSelectedSearchResult();
+ String property = cursor.getSelectedProperty();
+ if ( property != null && result != null && viewer.getCellModifier().canModify( result, property ) )
+ {
+ cursor.setBackground( Display.getDefault().getSystemColor( SWT.COLOR_LIST_SELECTION ) );
+ }
+ else
+ {
+ cursor.setBackground( Display.getDefault().getSystemColor( SWT.COLOR_TITLE_INACTIVE_FOREGROUND ) );
+ }
+
+ // cursor.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
+ }
+
+
+ public void widgetDefaultSelected( SelectionEvent e )
+ {
+ viewer.setSelection( null, true );
+ viewer.getTable().setSelection( new TableItem[0] );
+ if ( startEditAction.isEnabled() )
+ startEditAction.run();
+ }
+ } );
+
+ cursor.addMouseListener( new MouseAdapter()
+ {
+ public void mouseDoubleClick( MouseEvent e )
+ {
+ viewer.setSelection( null, true );
+ viewer.getTable().setSelection( new TableItem[0] );
+ if ( startEditAction.isEnabled() )
+ startEditAction.run();
+ }
+
+
+ public void mouseDown( MouseEvent e )
+ {
+ }
+
+
+ public void mouseUp( MouseEvent e )
+ {
+ }
+ } );
+
+ cursor.addKeyListener( new KeyListener()
+ {
+ public void keyPressed( KeyEvent e )
+ {
+ if ( e.character != '\0' && e.character != SWT.CR && e.character != SWT.LF && e.character != SWT.BS
+ && e.character != SWT.DEL && e.character != SWT.TAB && e.character != SWT.ESC
+ && ( e.stateMask == 0 || e.stateMask == SWT.SHIFT ) )
+ {
+
+ if ( startEditAction.isEnabled()
+ && startEditAction.getBestValueProvider().getCellEditor() instanceof TextCellEditor )
+ {
+ startEditAction.run();
+ CellEditor editor = viewer.getCellEditors()[cursor.getColumn()];
+ if ( editor instanceof TextCellEditor )
+ {
+ editor.setValue( String.valueOf( e.character ) );
+ ( ( Text ) editor.getControl() ).setSelection( 1 );
+ }
+ }
+
+ }
+ }
+
+
+ public void keyReleased( KeyEvent e )
+ {
+ }
+ } );
+
+ editor.getSite().getPage().addPartListener( this );
+ EventRegistry.addSearchUpdateListener( this );
+ EventRegistry.addEntryUpdateListener( this );
+ }
+
+
+ public void dispose()
+ {
+ EventRegistry.removeSearchUpdateListener( this );
+ EventRegistry.removeEntryUpdateListener( this );
+ editor.getSite().getPage().removePartListener( this );
+
+ this.selectedSearch = null;
+ this.startEditAction = null;
+ this.cursor = null;
+ this.viewer = null;
+ this.editor = null;
+ }
+
+
+ public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
+ {
+ if ( this.selectedSearch == searchUpdateEvent.getSearch() )
+ {
+ this.refreshInput();
+ }
+ }
+
+
+ public void entryUpdated( EntryModificationEvent event )
+ {
+
+ if ( event instanceof EmptyValueAddedEvent && !this.editor.getActionGroup().isEditorActive() )
+ {
+ EmptyValueAddedEvent evae = ( EmptyValueAddedEvent ) event;
+ IAttribute att = evae.getAddedValue().getAttribute();
+ AttributeHierachie ah = cursor.getSelectedAttributeHierarchie();
+ if ( ah != null && ah.contains( att ) )
+ {
+ viewer.setSelection( null, true );
+ viewer.getTable().setSelection( new TableItem[0] );
+ if ( startEditAction.isEnabled() )
+ {
+ startEditAction.run();
+ }
+ }
+ }
+ else
+ {
+ this.viewer.refresh( true );
+ cursor.notifyListeners( SWT.Selection, new Event() );
+ }
+ }
+
+
+ void setInput( ISearch search )
+ {
+ if ( search != this.viewer.getInput() )
+ {
+ this.selectedSearch = search;
+ this.refreshInput();
+ this.editor.getActionGroup().setInput( search );
+ }
+ }
+
+
+ void refreshInput()
+ {
+
+ // create at least on column
+ this.ensureColumnCount( 1 );
+
+ // get all columns
+ TableColumn[] columns = this.viewer.getTable().getColumns();
+
+ // number of uses columns
+ int usedColumns;
+
+ if ( this.selectedSearch != null )
+ {
+
+ // get displayed attributes
+ boolean showDn = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
+ BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN )
+ || this.selectedSearch.getReturningAttributes().length == 0;
+ String[] attributes;
+ if ( showDn )
+ {
+ attributes = new String[this.selectedSearch.getReturningAttributes().length + 1];
+ attributes[0] = "DN";
+ System
+ .arraycopy( this.selectedSearch.getReturningAttributes(), 0, attributes, 1, attributes.length - 1 );
+ }
+ else
+ {
+ attributes = this.selectedSearch.getReturningAttributes();
+ }
+
+ // create missing columns
+ if ( attributes.length > columns.length )
+ {
+ this.ensureColumnCount( attributes.length );
+ columns = this.viewer.getTable().getColumns();
+ }
+
+ // set column headers
+ for ( int i = 0; i < attributes.length; i++ )
+ {
+ columns[i].setText( attributes[i] );
+ }
+ this.viewer.setColumnProperties( attributes );
+
+ // set input
+ ( ( SearchResultEditorLabelProvider ) this.viewer.getLabelProvider() ).inputChanged( this.selectedSearch,
+ showDn );
+
+ this.viewer.setInput( this.selectedSearch );
+ // this.viewer.refresh();
+
+ // update cell editors
+ CellEditor[] editors = new CellEditor[attributes.length];
+ this.viewer.setCellEditors( editors );
+
+ if ( attributes.length > 0 )
+ {
+ int width = this.viewer.getTable().getClientArea().width / attributes.length;
+ for ( int i = 0; i < attributes.length; i++ )
+ {
+ columns[i].setWidth( width );
+ }
+ }
+
+ // layout columns
+ // for(int i=0; i<attributes.length; i++) {
+ // columns[i].pack();
+ // }
+ usedColumns = attributes.length;
+ }
+ else
+ {
+ this.viewer.setInput( null );
+ columns[0].setText( "DN" );
+ columns[0].pack();
+ usedColumns = 1;
+ }
+
+ // make unused columns invisible
+ for ( int i = usedColumns; i < columns.length; i++ )
+ {
+ columns[i].setWidth( 0 );
+ columns[i].setText( " " );
+ }
+
+ // refresh content provider (sorter and filter)
+ this.editor.getConfiguration().getContentProvider( this.editor.getMainWidget() ).refresh();
+
+ // this.cursor.setFocus();
+ }
+
+
+ private void ensureColumnCount( int count )
+ {
+ TableColumn[] columns = this.viewer.getTable().getColumns();
+ if ( columns.length < count )
+ {
+ for ( int i = columns.length; i < count; i++ )
+ {
+ TableColumn column = new TableColumn( this.viewer.getTable(), SWT.LEFT );
+ column.setText( "" );
+ column.setWidth( 0 );
+ column.setResizable( true );
+ column.setMoveable( true );
+ }
+ }
+ }
+
+
+ private void checkDnLink( TableItem item )
+ {
+
+ if ( dnLink == null || dnLink.isDisposed() || tableEditor == null || this.viewer.getTable().isDisposed()
+ || cursor.isDisposed() )
+ {
+ return;
+ }
+
+ boolean showLinks = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
+ BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS );
+ if ( showLinks )
+ {
+
+ boolean linkVisible = false;
+
+ if ( item != null )
+ {
+ Object data = item.getData();
+
+ if ( data instanceof ISearchResult )
+ {
+ ISearchResult sr = ( ISearchResult ) data;
+
+ item.getFont();
+ viewer.getTable().getColumn( 0 ).getWidth();
+ viewer.getTable().getItemHeight();
+
+ // dnLink.setText("<a>"+sr.getDn().toString()+"</a>");
+ dnLink.setData( sr );
+ dnLink.setText( sr.getDn().toString() );
+ dnLink.setUnderlined( true );
+ dnLink.setFont( item.getFont() );
+ dnLink.setForeground( item.getForeground() );
+ dnLink.setBackground( item.getBackground() );
+ dnLink.setBounds( item.getBounds( 0 ) );
+ tableEditor.setEditor( dnLink, item, 0 );
+
+ linkVisible = true;
+ }
+
+ }
+
+ if ( !linkVisible )
+ {
+ dnLink.setVisible( false );
+ tableEditor.setEditor( null );
+ }
+ }
+ }
+
+ IContextActivation contextActivation;
+
+
+ public void partActivated( IWorkbenchPart part )
+ {
+ if ( part == this.editor )
+ {
+
+ this.editor.getActionGroup().activateGlobalActionHandlers();
+
+ IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+ IContextService.class );
+ contextActivation = contextService
+ .activateContext( "org.apache.directory.ldapstudio.browser.action.context" );
+
+ }
+ }
+
+
+ public void partDeactivated( IWorkbenchPart part )
+ {
+ if ( part == this.editor && contextActivation != null )
+ {
+
+ IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+ IContextService.class );
+ contextService.deactivateContext( contextActivation );
+ contextActivation = null;
+
+ this.editor.getActionGroup().deactivateGlobalActionHandlers();
+
+ }
+ }
+
+
+ public void partOpened( IWorkbenchPart part )
+ {
+ }
+
+
+ public void partClosed( IWorkbenchPart part )
+ {
+ }
+
+
+ public void partBroughtToTop( IWorkbenchPart part )
+ {
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorWidget.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorWidget.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorWidget.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.ui.widgets.ViewFormWidget;
+import org.eclipse.jface.viewers.TableViewer;
+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.Table;
+
+
+public class SearchResultEditorWidget extends ViewFormWidget
+{
+
+ private SearchResultEditorConfiguration configuration;
+
+ private SearchResultEditorQuickFilterWidget quickFilterWidget;
+
+ private Table table;
+
+ private TableViewer viewer;
+
+
+ public SearchResultEditorWidget( SearchResultEditorConfiguration configuration )
+ {
+ this.configuration = configuration;
+ }
+
+
+ protected Control createContent( Composite parent )
+ {
+
+ // create quick filter
+ this.quickFilterWidget = new SearchResultEditorQuickFilterWidget( this.configuration.getFilter() );
+ this.quickFilterWidget.createComposite( parent );
+
+ // create table widget and viewer
+ this.table = new Table( parent, SWT.BORDER | SWT.HIDE_SELECTION | SWT.VIRTUAL );
+ this.table.setHeaderVisible( true );
+ this.table.setLinesVisible( true );
+ this.table.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+ this.viewer = new TableViewer( this.table );
+ this.viewer.setUseHashlookup( true );
+
+ // setup providers
+ this.viewer.setContentProvider( configuration.getContentProvider( this ) );
+ this.viewer.setLabelProvider( configuration.getLabelProvider( this.viewer ) );
+
+ // set table cell editors
+ this.viewer.setCellModifier( configuration.getCellModifier( this.viewer ) );
+
+ return this.table;
+ }
+
+
+ public void setInput( Object input )
+ {
+ this.viewer.setInput( input );
+ }
+
+
+ public void setFocus()
+ {
+ this.configuration.getCursor( this.viewer ).setFocus();
+ }
+
+
+ public void dispose()
+ {
+ if ( this.viewer != null )
+ {
+ this.configuration.dispose();
+
+ if ( this.quickFilterWidget != null )
+ {
+ this.quickFilterWidget.dispose();
+ this.quickFilterWidget = null;
+ }
+
+ // this.table.dispose();
+ this.table = null;
+ this.viewer = null;
+ }
+
+ super.dispose();
+ }
+
+
+ public TableViewer getViewer()
+ {
+ return viewer;
+ }
+
+
+ public SearchResultEditorQuickFilterWidget getQuickFilterWidget()
+ {
+ return quickFilterWidget;
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowDNAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowDNAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowDNAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowDNAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.eclipse.jface.action.Action;
+
+
+public class ShowDNAction extends Action
+{
+
+ public ShowDNAction()
+ {
+ super( "Show DN", AS_CHECK_BOX );
+ super.setToolTipText( getText() );
+ super.setEnabled( true );
+
+ super.setChecked( BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
+ BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN ) );
+ }
+
+
+ public void run()
+ {
+ BrowserUIPlugin.getDefault().getPreferenceStore().setValue(
+ BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN, super.isChecked() );
+ }
+
+
+ public void setChecked( boolean checked )
+ {
+ super.setChecked( checked );
+ }
+
+
+ public boolean isChecked()
+ {
+ return super.isChecked();
+ }
+
+
+ public void dispose()
+ {
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowLinksAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowLinksAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowLinksAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowLinksAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.eclipse.jface.action.Action;
+
+
+public class ShowLinksAction extends Action
+{
+
+ public ShowLinksAction()
+ {
+ super( "DN as link", AS_CHECK_BOX );
+ super.setToolTipText( getText() );
+ super.setEnabled( true );
+
+ super.setChecked( BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
+ BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS ) );
+ }
+
+
+ public void run()
+ {
+ BrowserUIPlugin.getDefault().getPreferenceStore().setValue(
+ BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS, super.isChecked() );
+ }
+
+
+ public void setChecked( boolean checked )
+ {
+ super.setChecked( checked );
+ }
+
+
+ public boolean isChecked()
+ {
+ return super.isChecked();
+ }
+
+
+ public void dispose()
+ {
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowQuickFilterAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowQuickFilterAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowQuickFilterAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/ShowQuickFilterAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+public class ShowQuickFilterAction extends Action
+{
+
+ public static final String SHOW_QUICKFILTER_DIALOGSETTING_KEY = ShowQuickFilterAction.class.getName()
+ + ".showQuickFilter";
+
+ private SearchResultEditorQuickFilterWidget quickFilterWidget;
+
+
+ public ShowQuickFilterAction( SearchResultEditorQuickFilterWidget quickFilterWidget )
+ {
+ super( "Show Quick Filter", AS_CHECK_BOX );
+ super.setToolTipText( "Show Quick Filter" );
+ super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_FILTER ) );
+ super.setActionDefinitionId( IWorkbenchActionDefinitionIds.FIND_REPLACE );
+ super.setEnabled( true );
+
+ this.quickFilterWidget = quickFilterWidget;
+
+ if ( BrowserUIPlugin.getDefault().getDialogSettings().get( SHOW_QUICKFILTER_DIALOGSETTING_KEY ) == null )
+ {
+ BrowserUIPlugin.getDefault().getDialogSettings().put( SHOW_QUICKFILTER_DIALOGSETTING_KEY, false );
+ }
+ super.setChecked( BrowserUIPlugin.getDefault().getDialogSettings().getBoolean(
+ SHOW_QUICKFILTER_DIALOGSETTING_KEY ) );
+ this.quickFilterWidget.setActive( super.isChecked() );
+ }
+
+
+ public void run()
+ {
+
+ boolean checked = super.isChecked();
+ super.setChecked( !checked );
+
+ BrowserUIPlugin.getDefault().getDialogSettings().put( SHOW_QUICKFILTER_DIALOGSETTING_KEY, super.isChecked() );
+
+ if ( this.quickFilterWidget != null )
+ {
+ this.quickFilterWidget.setActive( super.isChecked() );
+ }
+ }
+
+
+ public void setChecked( boolean checked )
+ {
+ // super.setChecked(checked);
+ }
+
+
+ public boolean isChecked()
+ {
+ return super.isChecked();
+ }
+
+
+ public void dispose()
+ {
+ this.quickFilterWidget = null;
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/templates/templates.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/templates/templates.xml?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/templates/templates.xml (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/templates/templates.xml Mon Dec 18 09:52:58 2006
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.filter.and"
+ name="&"
+ description="AND filter"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.filter"
+ enabled="true"
+ deleted="false">&(${cursor})</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.filter.or"
+ name="|"
+ description="OR filter"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.filter"
+ enabled="true"
+ deleted="false">|(${cursor})</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.filter.not"
+ name="!"
+ description="NOT filter"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.filter"
+ enabled="true"
+ deleted="false">!(${cursor})</template>
+
+
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifContentRecord"
+ name="dn: "
+ description="LDIF content record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifFile"
+ enabled="true"
+ image="icons/ldif_add.gif"
+ icon="icons/ldif_add.gif"
+ deleted="false">dn: ${dn}
+objectClass: ${objectClass}
+${cursor}
+</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifChangeAddRecord"
+ name="changetype: add"
+ description="LDIF change add record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifFile"
+ enabled="true"
+ deleted="false">dn: ${dn}
+changetype: add
+objectClass: ${objectClass}
+${cursor}
+</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifChangeModifyRecord"
+ name="changetype: modify"
+ description="LDIF change modify record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifFile"
+ enabled="true"
+ deleted="false">dn: ${dn}
+changetype: modify
+${cursor}
+</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifChangeDeleteRecord"
+ name="changetype: delete"
+ description="LDIF change delete record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifFile"
+ enabled="true"
+ deleted="false">dn: ${dn}
+changetype: delete
+${cursor}
+</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifChangeModdnRecord"
+ name="changetype: moddn"
+ description="LDIF change modify dn record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifFile"
+ enabled="true"
+ deleted="false">dn: ${dn}
+changetype: moddn
+newrdn: ${newrdn}
+deleteoldrdn: 1
+newsuperior: ${newsuperior}
+${cursor}
+</template>
+
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecordAddModification"
+ name="add: "
+ description="Add value"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecord"
+ enabled="true" >add: ${attribute}
+${attribute}: ${value}
+-
+${cursor}</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecordReplaceModification"
+ name="replace: "
+ description="Replace value"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecord"
+ enabled="true" >replace: ${attribute}
+${attribute}: ${value}
+-
+${cursor}</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecordDeleteModification"
+ name="delete: "
+ description="Delete value"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecord"
+ enabled="true" >delete: ${attribute}
+${attribute}: ${value}
+-
+${cursor}</template>
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecordDelete2Modification"
+ name="delete: "
+ description="Delete attribute"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldifModificationRecord"
+ enabled="true" >delete: ${attribute}
+-
+${cursor}</template>
+
+
+
+
+<!--
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifChangeModifyRecordAdd"
+ name="changetype: modify (add)"
+ description="LDIF modify record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldif"
+ enabled="true"
+ deleted="false">dn: ${dn}
+changetype: modify
+add: ${attribute}
+${attribute}: ${value}
+-
+${cursor}
+</template>
+-->
+<!--
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifChangeModifyRecordReplace"
+ name="changetype: modify (replace)"
+ description="LDIF modify record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldif"
+ enabled="true"
+ deleted="false">dn: ${dn}
+changetype: modify
+replace: ${attribute}
+${attribute}: ${value}
+-
+${cursor}
+</template>
+-->
+<!--
+ <template
+ id="org.apache.directory.ldapstudio.browser.ui.templates.ldif.ldifChangeModifyRecordDelete"
+ name="changetype: modify (delete)"
+ description="LDIF modify record"
+ context="org.apache.directory.ldapstudio.browser.ui.templates.ldif"
+ enabled="true"
+ deleted="false">dn: ${dn}
+changetype: modify
+delete: ${attribute}
+${attribute}: ${value}
+-
+${cursor}
+</template>
+-->
+
+
+
+</templates>
\ No newline at end of file
Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java?view=diff&rev=488368&r1=488367&r2=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java (original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java Mon Dec 18 09:52:58 2006
@@ -20,15 +20,18 @@
package org.apache.directory.ldapstudio.browser;
+
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+
/**
* The activator class controls the plug-in life cycle
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class Activator extends AbstractUIPlugin {
+public class Activator extends AbstractUIPlugin
+{
// The plug-in ID
public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.browser"; //$NON-NLS-1$
@@ -36,39 +39,47 @@
// The shared instance
private static Activator plugin;
+
/**
- * The constructor
- */
- public Activator() {
- plugin = this;
+ * The constructor
+ */
+ public Activator()
+ {
+ plugin = this;
}
+
/*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
}
+
/*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ plugin = null;
+ super.stop( context );
}
+
/**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
}
}