You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/03/27 16:27:30 UTC
svn commit: r1669604 [6/14] - in
/directory/studio/trunk/plugins/templateeditor: ./ resources/
resources/icons/ resources/templates/ src/ src/main/ src/main/java/
src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/directory/ src/main...
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorListbox.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorListbox.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorListbox.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorListbox.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,233 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import org.apache.directory.studio.templateeditor.model.widgets.TemplateListbox;
+import org.apache.directory.studio.templateeditor.model.widgets.ValueItem;
+
+
+/**
+ * This class implements an editor list box.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorListbox extends EditorWidget<TemplateListbox>
+{
+ /** The list viewer */
+ private ListViewer listViewer;
+
+ /** The selection listener */
+ private ISelectionChangedListener selectionListener = new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) listViewer.getSelection();
+ if ( !selection.isEmpty() )
+ {
+ // Deleting the old attribute
+ deleteAttribute();
+
+ // Re-creating the attribute with the selected values
+ Iterator<?> iterator = selection.iterator();
+ while ( iterator.hasNext() )
+ {
+ ValueItem item = ( ValueItem ) iterator.next();
+ addAttributeValue( ( String ) item.getValue() );
+ }
+ }
+ }
+ };
+
+
+ /**
+ * Creates a new instance of EditorListbox.
+ *
+ * @param editor
+ * the associated editor
+ * @param templateListbox
+ * the associated template list box
+ * @param toolkit
+ * the associated toolkit
+ */
+ public EditorListbox( IEntryEditor editor, TemplateListbox templateListbox, FormToolkit toolkit )
+ {
+ super( templateListbox, editor, toolkit );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createWidget( Composite parent )
+ {
+ // Creating and initializing the widget UI
+ Composite composite = initWidget( parent );
+
+ // Updating the widget's content
+ updateWidget();
+
+ // Adding the listeners
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Creates and initializes the widget UI.
+ *
+ * @param parent
+ * the parent composite
+ * @return the associated composite
+ */
+ private Composite initWidget( Composite parent )
+ {
+ // Getting the style of the listbox
+ int style = SWT.BORDER /*| SWT.V_SCROLL | SWT.H_SCROLL*/;
+ if ( getWidget().isMultipleSelection() )
+ {
+ style |= SWT.MULTI;
+ }
+ else
+ {
+ style |= SWT.SINGLE;
+ }
+
+ // Creating the list
+ List list = new List( parent, style );
+ list.setLayoutData( getGridata() );
+
+ // Creating the associated viewer
+ listViewer = new ListViewer( list );
+ listViewer.getList().setEnabled( getWidget().isEnabled() );
+ listViewer.setContentProvider( new ArrayContentProvider() );
+ listViewer.setLabelProvider( new LabelProvider()
+ {
+ public String getText( Object element )
+ {
+ return ( ( ValueItem ) element ).getLabel();
+ }
+ } );
+
+ listViewer.setInput( getWidget().getItems() );
+
+ return parent;
+ }
+
+
+ /**
+ * Updates the widget's content.
+ */
+ private void updateWidget()
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.getValueSize() > 0 ) )
+ {
+ // Registering the values of the items in a map for easy
+ // access
+ Map<Object, ValueItem> itemsMap = new HashMap<Object, ValueItem>();
+ for ( ValueItem valueItem : getWidget().getItems() )
+ {
+ itemsMap.put( valueItem.getValue(), valueItem );
+ }
+
+ // Creating a list of the selected objects
+ java.util.List<ValueItem> selectedList = new ArrayList<ValueItem>();
+
+ // Checking each value
+ for ( IValue value : attribute.getValues() )
+ {
+ ValueItem valueItem = itemsMap.get( value.getRawValue() );
+ if ( valueItem != null )
+ {
+ selectedList.add( valueItem );
+ }
+ }
+
+ // Setting the selection to the viewer
+ if ( selectedList.size() > 0 )
+ {
+ listViewer.setSelection( new StructuredSelection( selectedList.toArray() ) );
+ }
+ }
+ else
+ {
+ listViewer.setSelection( null );
+ }
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ listViewer.addSelectionChangedListener( selectionListener );
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void removeListeners()
+ {
+ listViewer.removeSelectionChangedListener( selectionListener );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ removeListeners();
+ updateWidget();
+ addListeners();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+}
\ No newline at end of file
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorPassword.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorPassword.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorPassword.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorPassword.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,307 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.valueeditors.password.PasswordDialog;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import org.apache.directory.studio.templateeditor.EntryTemplatePlugin;
+import org.apache.directory.studio.templateeditor.EntryTemplatePluginConstants;
+import org.apache.directory.studio.templateeditor.model.widgets.TemplatePassword;
+
+
+/**
+ * This class implements an editor spinner.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorPassword extends EditorWidget<TemplatePassword>
+{
+ /** The current password value */
+ private byte[] currentPassword;
+
+ /** The password text field */
+ private Text passwordTextField;
+
+ /** The "Edit..." button */
+ private ToolItem editToolItem;
+
+ /** The "Show Password" checkbox*/
+ private Button showPasswordCheckbox;
+
+
+ /**
+ * Creates a new instance of EditorPassword.
+ *
+ * @param editor
+ * the associated editor
+ * @param templatePassword
+ * the associated template password
+ * @param toolkit
+ * the associated toolkit
+ */
+ public EditorPassword( IEntryEditor editor, TemplatePassword templatePassword, FormToolkit toolkit )
+ {
+ super( templatePassword, editor, toolkit );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createWidget( Composite parent )
+ {
+ // Creating and initializing the widget UI
+ Composite composite = initWidget( parent );
+
+ // Updating the widget's content
+ updateWidget();
+
+ // Adding the listeners
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Creates and initializes the widget UI.
+ *
+ * @param parent
+ * the parent composite
+ * @return
+ * the associated composite
+ */
+ private Composite initWidget( Composite parent )
+ {
+ // Creating the widget composite
+ Composite composite = getToolkit().createComposite( parent );
+ composite.setLayoutData( getGridata() );
+
+ // Calculating the number of columns needed
+ int numberOfColumns = 1;
+ if ( getWidget().isShowEditButton() )
+ {
+ numberOfColumns++;
+ }
+
+ // Creating the layout
+ GridLayout gl = new GridLayout( numberOfColumns, false );
+ gl.marginHeight = gl.marginWidth = 0;
+ gl.horizontalSpacing = gl.verticalSpacing = 0;
+ composite.setLayout( gl );
+
+ // Creating the password text field
+ passwordTextField = getToolkit().createText( composite, null, SWT.BORDER );
+ passwordTextField.setEditable( false );
+ GridData gd = new GridData( SWT.FILL, SWT.CENTER, true, false );
+ gd.widthHint = 50;
+ passwordTextField.setLayoutData( gd );
+
+ // Setting the echo char for the password text field
+ if ( getWidget().isHidden() )
+ {
+ passwordTextField.setEchoChar( '\u2022' );
+ }
+ else
+ {
+ passwordTextField.setEchoChar( '\0' );
+ }
+
+ // Creating the edit password button
+ if ( getWidget().isShowEditButton() )
+ {
+ ToolBar toolbar = new ToolBar( composite, SWT.HORIZONTAL | SWT.FLAT );
+
+ editToolItem = new ToolItem( toolbar, SWT.PUSH );
+ editToolItem.setToolTipText( Messages.getString( "EditorPassword.EditPassword" ) ); //$NON-NLS-1$
+ editToolItem.setImage( EntryTemplatePlugin.getDefault().getImage(
+ EntryTemplatePluginConstants.IMG_TOOLBAR_EDIT_PASSWORD ) );
+ }
+
+ // Creating the show password checkbox
+ if ( getWidget().isShowShowPasswordCheckbox() )
+ {
+ showPasswordCheckbox = getToolkit().createButton( composite,
+ Messages.getString( "EditorPassword.ShowPassword" ), SWT.CHECK ); //$NON-NLS-1$
+ }
+
+ return composite;
+ }
+
+
+ /**
+ * Updates the widget's content.
+ */
+ private void updateWidget()
+ {
+ // Getting the current password value in the attribute
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.getValueSize() > 0 ) )
+ {
+ currentPassword = attribute.getValues()[0].getBinaryValue();
+ }
+ else
+ {
+ currentPassword = null;
+ }
+
+ // Updating the password text field
+ if ( currentPassword != null )
+ {
+ passwordTextField.setText( new String( currentPassword ) );
+ }
+ else
+ {
+ passwordTextField.setText( "" ); //$NON-NLS-1$
+ }
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ // Edit Password toolbar item
+ if ( ( editToolItem != null ) && ( !editToolItem.isDisposed() ) )
+ {
+ editToolItem.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ editToolItemAction();
+ }
+ } );
+ }
+
+ // Show Password checkbox
+ if ( ( showPasswordCheckbox != null ) && ( !showPasswordCheckbox.isDisposed() ) )
+ {
+ showPasswordCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ showPasswordAction();
+ }
+ } );
+ }
+ }
+
+
+ /**
+ * This method is called when the edit tool item is clicked.
+ */
+ private void editToolItemAction()
+ {
+ // Creating and displaying a password dialog
+ PasswordDialog passwordDialog = new PasswordDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(), currentPassword, getEntry() );
+ if ( passwordDialog.open() == Dialog.OK )
+ {
+ if ( passwordDialog.getNewPassword() != currentPassword )
+ {
+ currentPassword = passwordDialog.getNewPassword();
+ passwordTextField.setText( new String( currentPassword ) );
+ updateEntry();
+ }
+ }
+ }
+
+
+ /**
+ * This action is called when the 'Show Password' checkbox is clicked.
+ */
+ private void showPasswordAction()
+ {
+ if ( showPasswordCheckbox.getSelection() )
+ {
+ passwordTextField.setEchoChar( '\0' );
+ }
+ else
+ {
+ passwordTextField.setEchoChar( '\u2022' );
+ }
+ }
+
+
+ /**
+ * This method is called when the entry has been updated in the UI.
+ */
+ private void updateEntry()
+ {
+ // Getting the attribute
+ IAttribute attribute = getAttribute();
+ if ( attribute == null )
+ {
+ if ( ( currentPassword != null ) && ( currentPassword.length != 0 ) )
+ {
+ // Creating a new attribute with the value
+ addNewAttribute( currentPassword );
+ }
+ }
+ else
+ {
+ if ( ( currentPassword != null ) && ( currentPassword.length != 0 ) )
+ {
+ // Modifying the existing attribute
+ modifyAttributeValue( currentPassword );
+ }
+ else
+ {
+ // Deleting the attribute
+ deleteAttribute();
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ updateWidget();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+}
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorRadioButtons.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorRadioButtons.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorRadioButtons.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorRadioButtons.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,223 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import org.apache.directory.studio.templateeditor.model.widgets.TemplateRadioButtons;
+import org.apache.directory.studio.templateeditor.model.widgets.ValueItem;
+
+
+/**
+ * This class implements an editor radio buttons.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorRadioButtons extends EditorWidget<TemplateRadioButtons>
+{
+ /** The map of (ValueItem,Button) elements used in the UI */
+ private Map<ValueItem, Button> valueItemsToButtonsMap = new HashMap<ValueItem, Button>();
+ private Map<Button, ValueItem> buttonsToValueItemsMap = new HashMap<Button, ValueItem>();
+
+ /** The currently selected item */
+ private ValueItem selectedItem;
+
+ /** The selection listener */
+ private SelectionListener selectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ // Saving the selected item
+ selectedItem = buttonsToValueItemsMap.get( e.getSource() );
+
+ // Updating the entry
+ updateEntry();
+ }
+ };
+
+
+ /**
+ * Creates a new instance of EditorRadioButtons.
+ *
+ * @param editor
+ * the associated editor
+ * @param templateRadioButtons
+ * the associated template radio buttons
+ * @param toolkit
+ * the associated toolkit
+ */
+ public EditorRadioButtons( IEntryEditor editor, TemplateRadioButtons templateRadioButtons,
+ FormToolkit toolkit )
+ {
+ super( templateRadioButtons, editor, toolkit );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createWidget( Composite parent )
+ {
+ // Creating and initializing the widget UI
+ Composite composite = initWidget( parent );
+
+ // Updating the widget's content
+ updateWidget();
+
+ // Adding the listeners
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Creates and initializes the widget UI.
+ *
+ * @param parent
+ * the parent composite
+ * @return
+ * the associated composite
+ */
+ private Composite initWidget( Composite parent )
+ {
+ // Creating the widget composite
+ Composite composite = getToolkit().createComposite( parent );
+ composite.setLayout( new GridLayout() );
+ composite.setLayoutData( getGridata() );
+
+ // Creating the layout
+ GridLayout gl = new GridLayout();
+ gl.marginHeight = gl.marginWidth = 0;
+ gl.horizontalSpacing = gl.verticalSpacing = 0;
+ composite.setLayout( gl );
+
+ // Creating the Radio Buttons
+ for ( ValueItem valueItem : getWidget().getButtons() )
+ {
+ Button button = getToolkit().createButton( composite, valueItem.getLabel(), SWT.RADIO );
+ button.setEnabled( getWidget().isEnabled() );
+ valueItemsToButtonsMap.put( valueItem, button );
+ buttonsToValueItemsMap.put( button, valueItem );
+ }
+
+ return composite;
+ }
+
+
+ /**
+ * Updates the widget's content.
+ */
+ private void updateWidget()
+ {
+ // Getting the attribute value
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.isString() ) && ( attribute.getValueSize() > 0 ) )
+ {
+ String value = attribute.getStringValue();
+ for ( ValueItem valueItem : valueItemsToButtonsMap.keySet() )
+ {
+ Button button = valueItemsToButtonsMap.get( valueItem );
+ if ( button != null && !button.isDisposed() )
+ {
+ button.setSelection( value.equals( valueItem.getValue() ) );
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ for ( final ValueItem valueItem : valueItemsToButtonsMap.keySet() )
+ {
+ Button button = valueItemsToButtonsMap.get( valueItem );
+ if ( button != null )
+ {
+ button.addSelectionListener( selectionListener );
+ }
+ }
+ }
+
+
+ /**
+ * This method is called when the entry has been updated in the UI.
+ */
+ private void updateEntry()
+ {
+ // Getting the attribute
+ IAttribute attribute = getAttribute();
+ if ( attribute == null )
+ {
+ if ( selectedItem != null )
+ {
+ // Creating a new attribute with the value
+ addNewAttribute( selectedItem.getValue() );
+ }
+ }
+ else
+ {
+ if ( ( selectedItem != null ) && ( !selectedItem.equals( "" ) ) ) //$NON-NLS-1$
+ {
+ // Modifying the existing attribute
+ modifyAttributeValue( selectedItem.getValue() );
+ }
+ else
+ {
+ // Deleting the attribute
+ deleteAttribute();
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ updateWidget();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+}
\ No newline at end of file
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSection.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSection.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSection.java Fri Mar 27 15:27:27 2015
@@ -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.studio.templateeditor.editor.widgets;
+
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+import org.apache.directory.studio.templateeditor.model.widgets.TemplateSection;
+
+
+/**
+ * This class implements an editor section.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorSection extends EditorWidget<TemplateSection>
+{
+ /**
+ * Creates a new instance of EditorSection.
+ *
+ * @param editor
+ * the associated editor
+ * @param templateSection
+ * the associated template section
+ * @param toolkit
+ * the associated toolkit
+ */
+ public EditorSection( IEntryEditor editor, TemplateSection templateSection, FormToolkit toolkit )
+ {
+ super( templateSection, editor, toolkit );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createWidget( Composite parent )
+ {
+ // Calculating the style
+ int style = Section.TITLE_BAR;
+ if ( getWidget().getDescription() != null )
+ {
+ style |= Section.DESCRIPTION;
+ }
+ if ( getWidget().isExpandable() )
+ {
+ style |= Section.TWISTIE;
+ }
+ if ( getWidget().isExpanded() )
+ {
+ style |= Section.EXPANDED;
+ }
+
+ // Creating the section
+ Section section = getToolkit().createSection( parent, style );
+ section.setLayoutData( getGridata() );
+
+ // Creating the client composite
+ Composite clientComposite = getToolkit().createComposite( section );
+ section.setClient( clientComposite );
+
+ // Setting the layout for the client composite
+ clientComposite.setLayout( new GridLayout( getWidget().getNumberOfColumns(), getWidget().isEqualColumns() ) );
+ clientComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ // Title
+ if ( ( getWidget().getTitle() != null ) && ( !"".equals( getWidget().getTitle() ) ) ) //$NON-NLS-1$
+ {
+ section.setText( getWidget().getTitle() );
+ }
+
+ // Description
+ if ( ( getWidget().getDescription() != null ) && ( !"".equals( getWidget().getDescription() ) ) ) //$NON-NLS-1$
+ {
+ section.setDescription( getWidget().getDescription() );
+ }
+
+ return clientComposite;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ // Nothing to do
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+}
\ No newline at end of file
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSpinner.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSpinner.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSpinner.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorSpinner.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,165 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import org.apache.directory.studio.templateeditor.model.widgets.TemplateSpinner;
+
+
+/**
+ * This class implements an editor spinner.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorSpinner extends EditorWidget<TemplateSpinner>
+{
+ /** The spinner */
+ private Spinner spinner;
+
+ /** The selection listener */
+ private SelectionListener selectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ // Getting the value
+ String value = spinner.getText();
+
+ // Updating the attribute's value
+ updateAttributeValue( value );
+ }
+ };
+
+
+ /**
+ * Creates a new instance of EditorSpinner.
+ *
+ * @param editor
+ * the associated editor
+ * @param templateSpinner
+ * the associated template spinner
+ * @param toolkit
+ * the associated toolkit
+ */
+ public EditorSpinner( IEntryEditor editor, TemplateSpinner templateSpinner, FormToolkit toolkit )
+ {
+ super( templateSpinner, editor, toolkit );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createWidget( Composite parent )
+ {
+ // Creating and initializing the widget UI
+ Composite composite = initWidget( parent );
+
+ // Updating the widget's content
+ updateWidget();
+
+ // Adding the listeners
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Creates and initializes the widget UI.
+ *
+ * @param parent
+ * the parent composite
+ * @return
+ * the associated composite
+ */
+ private Composite initWidget( Composite parent )
+ {
+ // Creating the spinner
+ spinner = new Spinner( parent, SWT.BORDER );
+ spinner.setLayoutData( getGridata() );
+
+ // Setting the spinner values
+ spinner.setDigits( getWidget().getDigits() );
+ spinner.setIncrement( getWidget().getIncrement() );
+ spinner.setMaximum( getWidget().getMaximum() );
+ spinner.setMinimum( getWidget().getMinimum() );
+ spinner.setPageIncrement( getWidget().getPageIncrement() );
+
+ return parent;
+ }
+
+
+ /**
+ * Updates the widget's content.
+ */
+ private void updateWidget()
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.isString() ) && ( attribute.getValueSize() > 0 ) )
+ {
+ try
+ {
+ spinner.setSelection( Integer.parseInt( attribute.getStringValue() ) );
+ }
+ catch ( NumberFormatException e )
+ {
+ // Nothing to do, we fail gracefully
+ }
+ }
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ // Adding the listener
+ spinner.addSelectionListener( selectionListener );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ updateWidget();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+}
\ No newline at end of file
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTable.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTable.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTable.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,405 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import org.apache.directory.studio.templateeditor.EntryTemplatePlugin;
+import org.apache.directory.studio.templateeditor.EntryTemplatePluginConstants;
+import org.apache.directory.studio.templateeditor.model.widgets.TemplateTable;
+
+
+/**
+ * This class implements an editor table.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorTable extends EditorWidget<TemplateTable>
+{
+ /** The widget's composite */
+ private Composite composite;
+
+ /** The table viewer */
+ private TableViewer tableViewer;
+
+ /** The 'Add...' button */
+ private ToolItem addToolItem;
+
+ /** The 'Edit...' button */
+ private ToolItem editToolItem;
+
+ /** The 'Delete...' button */
+ private ToolItem deleteToolItem;
+
+
+ /**
+ * Creates a new instance of EditorTable.
+ *
+ * @param editor
+ * the associated editor
+ * @param templateTable
+ * the associated template table
+ * @param toolkit
+ * the associated toolkit
+ */
+ public EditorTable( IEntryEditor editor, TemplateTable templateTable, FormToolkit toolkit )
+ {
+ super( templateTable, editor, toolkit );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createWidget( Composite parent )
+ {
+ // Creating and initializing the widget UI
+ Composite composite = initWidget( parent );
+
+ // Updating the widget's content
+ updateWidget();
+
+ // Adding the listeners
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Creates and initializes the widget UI.
+ *
+ * @param parent
+ * the parent composite
+ * @return
+ * the associated composite
+ */
+ private Composite initWidget( Composite parent )
+ {
+ // Creating the widget composite
+ composite = getToolkit().createComposite( parent );
+ composite.setLayoutData( getGridata() );
+
+ // Creating the layout
+ GridLayout gl = new GridLayout( ( needsToolbar() ? 2 : 1 ), false );
+ gl.marginHeight = gl.marginWidth = 0;
+ gl.horizontalSpacing = gl.verticalSpacing = 0;
+ composite.setLayout( gl );
+
+ // Table Viewer
+ Table table = getToolkit().createTable( composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
+ table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+ tableViewer = new TableViewer( table );
+ tableViewer.setContentProvider( new ArrayContentProvider() );
+ tableViewer.setComparator( new ViewerComparator( new Comparator<String>()
+ {
+ public int compare( String s1, String s2 )
+ {
+ if ( s1 == null )
+ {
+ return 1;
+ }
+ else if ( s2 == null )
+ {
+ return -1;
+ }
+ else
+ {
+ return s1.compareToIgnoreCase( s2 );
+ }
+ }
+ } ) );
+
+ // Toolbar (if needed)
+ if ( needsToolbar() )
+ {
+ ToolBar toolbar = new ToolBar( composite, SWT.VERTICAL );
+ toolbar.setLayoutData( new GridData( SWT.NONE, SWT.FILL, false, true ) );
+
+ // Add Button
+ if ( getWidget().isShowAddButton() )
+ {
+ addToolItem = new ToolItem( toolbar, SWT.PUSH );
+ addToolItem.setToolTipText( Messages.getString( "EditorTable.Add" ) ); //$NON-NLS-1$
+ addToolItem.setImage( EntryTemplatePlugin.getDefault().getImage(
+ EntryTemplatePluginConstants.IMG_TOOLBAR_ADD_VALUE ) );
+ }
+
+ // Edit Button
+ if ( getWidget().isShowEditButton() )
+ {
+ editToolItem = new ToolItem( toolbar, SWT.PUSH );
+ editToolItem.setToolTipText( Messages.getString( "EditorTable.Edit" ) ); //$NON-NLS-1$
+ editToolItem.setImage( EntryTemplatePlugin.getDefault().getImage(
+ EntryTemplatePluginConstants.IMG_TOOLBAR_EDIT_VALUE ) );
+ editToolItem.setEnabled( false );
+ }
+
+ // Delete Button
+ if ( getWidget().isShowDeleteButton() )
+ {
+ deleteToolItem = new ToolItem( toolbar, SWT.PUSH );
+ deleteToolItem.setToolTipText( Messages.getString( "EditorTable.Delete" ) ); //$NON-NLS-1$
+ deleteToolItem.setImage( EntryTemplatePlugin.getDefault().getImage(
+ EntryTemplatePluginConstants.IMG_TOOLBAR_DELETE_VALUE ) );
+ deleteToolItem.setEnabled( false );
+ }
+ }
+
+ return composite;
+ }
+
+
+ /**
+ * Indicates if the widget needs a toolbar for actions.
+ *
+ * @return
+ * <code>true</code> if the widget needs a toolbar for actions,
+ * <code>false</code> if not
+ */
+ private boolean needsToolbar()
+ {
+ return getWidget().isShowAddButton() || getWidget().isShowEditButton() || getWidget().isShowDeleteButton();
+ }
+
+
+ /**
+ * Updates the widget's content.
+ */
+ private void updateWidget()
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.isString() ) && ( attribute.getValueSize() > 0 ) )
+ {
+ tableViewer.setInput( attribute.getStringValues() );
+ }
+ else
+ {
+ tableViewer.setInput( new String[0] );
+ }
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ // Add button
+ if ( ( addToolItem != null ) && ( !addToolItem.isDisposed() ) )
+ {
+ addToolItem.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ addToolItemAction();
+ }
+ } );
+ }
+
+ // Edit button
+ if ( ( editToolItem != null ) && ( !editToolItem.isDisposed() ) )
+ {
+ editToolItem.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ editToolItemAction();
+ }
+ } );
+ }
+
+ // Delete button
+ if ( ( deleteToolItem != null ) && ( !deleteToolItem.isDisposed() ) )
+ {
+ deleteToolItem.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ deleteToolItemAction();
+ }
+ } );
+ }
+
+ // Table Viewer
+ if ( ( tableViewer != null ) && ( !tableViewer.getTable().isDisposed() ) )
+ {
+ tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ updateButtonsStates();
+ }
+ } );
+
+ tableViewer.addDoubleClickListener( new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ if ( ( editToolItem != null ) && ( !editToolItem.isDisposed() ) )
+ {
+ editToolItemAction();
+ }
+ }
+ } );
+ }
+ }
+
+
+ /**
+ * This method is called when the 'Add...' toolbar item is clicked.
+ */
+ private void addToolItemAction()
+ {
+ TextDialog textDialog = new TextDialog( tableViewer.getTable().getShell(), "" ); //$NON-NLS-1$
+ if ( textDialog.open() == Dialog.OK )
+ {
+ String value = textDialog.getText();
+
+ addAttributeValue( value );
+ tableViewer.setSelection( new StructuredSelection( value ) );
+ }
+ }
+
+
+ /**
+ * This method is called when the 'Edit...' toolbar item is clicked.
+ */
+ private void editToolItemAction()
+ {
+ StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+ if ( !selection.isEmpty() )
+ {
+ String selectedValue = ( String ) selection.getFirstElement();
+
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.isString() ) && ( attribute.getValueSize() > 0 ) )
+ {
+ IValue value = null;
+
+ for ( IValue attributeValue : attribute.getValues() )
+ {
+ if ( selectedValue.equals( attributeValue.getStringValue() ) )
+ {
+ value = attributeValue;
+ break;
+ }
+ }
+
+ if ( value != null )
+ {
+ TextDialog textDialog = new TextDialog( tableViewer.getTable().getShell(), selectedValue );
+ if ( textDialog.open() == Dialog.OK )
+ {
+ String newValue = textDialog.getText();
+ if ( !selectedValue.equals( newValue ) )
+ {
+ deleteAttributeValue( selectedValue );
+ addAttributeValue( newValue );
+ tableViewer.setSelection( new StructuredSelection( newValue ) );
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * This method is called when the 'Delete...' toolbar item is clicked.
+ */
+ private void deleteToolItemAction()
+ {
+ StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+ if ( !selection.isEmpty() )
+ {
+ // Launching a confirmation dialog
+ if ( MessageDialog.openConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages
+ .getString( "EditorTable.Confirmation" ), Messages.getString( "EditorTable.ConfirmationDeleteValue" ) ) ) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ deleteAttributeValue( ( String ) selection.getFirstElement() );
+ }
+ }
+ }
+
+
+ /**
+ * Updates the states of the buttons.
+ */
+ private void updateButtonsStates()
+ {
+ StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+
+ if ( ( editToolItem != null ) && ( !editToolItem.isDisposed() ) )
+ {
+ editToolItem.setEnabled( !selection.isEmpty() );
+ }
+
+ if ( ( deleteToolItem != null ) && ( !deleteToolItem.isDisposed() ) )
+ {
+ deleteToolItem.setEnabled( !selection.isEmpty() );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ updateWidget();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+}
\ No newline at end of file
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTextField.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTextField.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTextField.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorTextField.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,253 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import org.apache.directory.studio.templateeditor.model.widgets.TemplateTextField;
+import org.apache.directory.studio.templateeditor.model.widgets.WidgetAlignment;
+
+
+/**
+ * This class implements an editor text field.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorTextField extends EditorWidget<TemplateTextField>
+{
+ /** The text field */
+ private Text textfield;
+
+ /** The modify listener */
+ private ModifyListener modifyListener = new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ // Getting the value
+ String value = textfield.getText();
+
+ // Replacing '$' by '/n' if needed
+ if ( getWidget().isDollarSignIsNewLine() )
+ {
+ value = value.replace( '\n', '$' );
+ }
+
+ // Updating the attribute's value
+ updateAttributeValue( value );
+ }
+ };
+
+
+ /**
+ * Creates a new instance of EditorTextField.
+ *
+ * @param editor
+ * the associated editor
+ * @param templateTextField
+ * the associated template text field
+ * @param toolkit
+ * the associated toolkit
+ */
+ public EditorTextField( IEntryEditor editor, TemplateTextField templateTextField, FormToolkit toolkit )
+ {
+ super( templateTextField, editor, toolkit );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createWidget( Composite parent )
+ {
+ // Creating and initializing the widget UI
+ Composite composite = initWidget( parent );
+
+ // Updating the widget's content
+ updateWidget();
+
+ // Adding the listeners
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Creates and initializes the widget UI.
+ *
+ * @param parent
+ * the parent composite
+ * @return
+ * the associated composite
+ */
+ private Composite initWidget( Composite parent )
+ {
+ // Creating the text field
+ textfield = getToolkit().createText( parent, "", getStyle() ); //$NON-NLS-1$
+ GridData gd = getGridata();
+ textfield.setLayoutData( gd );
+
+ // Setting the characters limit
+ if ( getWidget().getCharactersLimit() != -1 )
+ {
+ textfield.setTextLimit( getWidget().getCharactersLimit() );
+ }
+
+ // Calculating height for multiple rows
+ int numberOfRows = getWidget().getNumberOfRows();
+ if ( numberOfRows != 1 )
+ {
+ GC gc = new GC( parent );
+ gc.setFont( textfield.getFont() );
+ FontMetrics fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+ gd.heightHint = fontMetrics.getHeight() * numberOfRows;
+ }
+
+ textfield.pack();
+
+ return parent;
+ }
+
+
+ /**
+ * Gets the style of the widget.
+ *
+ * @return
+ * the style of the widget
+ */
+ private int getStyle()
+ {
+ int style = SWT.BORDER | SWT.WRAP;
+
+ // Multiple lines?
+ if ( getWidget().getNumberOfRows() == 1 )
+ {
+ style |= SWT.SINGLE;
+ }
+ else
+ {
+ style |= SWT.MULTI;
+ }
+
+ // Horizontal alignment set to end?
+ if ( getWidget().getHorizontalAlignment() == WidgetAlignment.END )
+ {
+ style |= SWT.RIGHT;
+ }
+ // Horizontal alignment set to center?
+ else if ( getWidget().getHorizontalAlignment() == WidgetAlignment.CENTER )
+ {
+ style |= SWT.CENTER;
+ }
+
+ return style;
+ }
+
+
+ /**
+ * Updates the widget's content.
+ */
+ private void updateWidget()
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.isString() ) && ( attribute.getValueSize() > 0 ) )
+ {
+ // Saving the current caret position by getting the current selection
+ Point selection = textfield.getSelection();
+
+ // Getting the text to display
+ String text = attribute.getStringValue();
+
+ // Replacing '$' by '/n' (if needed)
+ if ( getWidget().isDollarSignIsNewLine() )
+ {
+ text = text.replace( '$', '\n' );
+ }
+
+ // Assigning the text to the label
+ textfield.setText( text );
+
+ // Restoring the current caret position
+ textfield.setSelection( selection );
+ }
+ else
+ {
+ // There's no value to display
+ textfield.setText( "" ); //$NON-NLS-1$
+ }
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ if ( ( textfield != null ) && ( !textfield.isDisposed() ) )
+ {
+ textfield.addModifyListener( modifyListener );
+ }
+ }
+
+
+ /**
+ * Removes the listeners.
+ */
+ private void removeListeners()
+ {
+ if ( ( textfield != null ) && ( !textfield.isDisposed() ) )
+ {
+ textfield.removeModifyListener( modifyListener );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update()
+ {
+ removeListeners();
+ updateWidget();
+ addListeners();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose()
+ {
+ removeListeners();
+ }
+}
\ No newline at end of file
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidget.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidget.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidget.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,345 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
+import org.apache.directory.studio.entryeditors.IEntryEditor;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import org.apache.directory.studio.templateeditor.model.widgets.TemplateWidget;
+import org.apache.directory.studio.templateeditor.model.widgets.WidgetAlignment;
+
+
+/**
+ * This abstract class implements the base for an editor widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class EditorWidget<E extends TemplateWidget>
+{
+ /** The widget*/
+ private E widget;
+
+ /** The associated editor */
+ private IEntryEditor entryEditor;
+
+ /** The toolkit */
+ private FormToolkit toolkit;
+
+
+ /**
+ * Creates a new instance of EditorWidget.
+ *
+ * @param widget
+ * the widget
+ * @param entryEditor
+ * the entryEditor
+ */
+ public EditorWidget( E widget, IEntryEditor entryEditor, FormToolkit toolkit )
+ {
+ this.widget = widget;
+ this.entryEditor = entryEditor;
+ this.toolkit = toolkit;
+ }
+
+
+ /**
+ * Gets the widget.
+ *
+ * @return
+ * the widget
+ */
+ public E getWidget()
+ {
+ return widget;
+ }
+
+
+ /**
+ * Creates the widget.
+ *
+ * @param parent
+ * the parent widget
+ * @return
+ * the associated composite
+ */
+ public Composite createWidget( Composite parent )
+ {
+ return parent;
+ }
+
+
+ /**
+ * Gets the associated editor page.
+ *
+ * @return
+ * the associated editor page
+ */
+ public IEntryEditor getEditor()
+ {
+ return entryEditor;
+ }
+
+
+ /**
+ * Gets the toolkit.
+ *
+ * @return
+ * the form toolkit
+ */
+ public FormToolkit getToolkit()
+ {
+ return toolkit;
+ }
+
+
+ /**
+ * Gets the entry.
+ *
+ * @return
+ * the entry
+ */
+ protected IEntry getEntry()
+ {
+ EntryEditorInput input = getEditor().getEntryEditorInput();
+ return input.getSharedWorkingCopy( getEditor() );
+ }
+
+
+ /**
+ * Updates the widget.
+ */
+ public abstract void update();
+
+
+ /**
+ * Disposes the widget
+ */
+ public abstract void dispose();
+
+
+ /**
+ * Gets the {@link GridData} object associated with the widget properties.
+ *
+ * @return
+ * the {@link GridData} object associated with the widget properties
+ */
+ protected GridData getGridata()
+ {
+ // Creating the grid data with alignment and grab excess values
+ GridData gd = new GridData( convertWidgetAlignmentToSWTValue( widget.getHorizontalAlignment() ),
+ convertWidgetAlignmentToSWTValue( widget.getVerticalAlignment() ), widget.isGrabExcessHorizontalSpace(),
+ widget.isGrabExcessVerticalSpace(), widget.getHorizontalSpan(), widget.getVerticalSpan() );
+
+ // Setting width (if needed)
+ if ( widget.getImageWidth() != TemplateWidget.DEFAULT_SIZE )
+ {
+ gd.widthHint = widget.getImageWidth();
+ }
+
+ // Setting height (if needed)
+ if ( widget.getImageHeight() != TemplateWidget.DEFAULT_SIZE )
+ {
+ gd.heightHint = widget.getImageHeight();
+ }
+
+ return gd;
+ }
+
+
+ /**
+ * Converts the given widget alignment to the equivalent value in SWT.
+ *
+ * @param alignment
+ * the widget alignment
+ * @return
+ * the given widget alignment to the equivalent value in SWT
+ */
+ private static int convertWidgetAlignmentToSWTValue( WidgetAlignment alignment )
+ {
+ switch ( alignment )
+ {
+ case NONE:
+ return SWT.NONE;
+ case BEGINNING:
+ return SWT.BEGINNING;
+ case CENTER:
+ return SWT.CENTER;
+ case END:
+ return SWT.END;
+ case FILL:
+ return SWT.FILL;
+ default:
+ return SWT.NONE;
+ }
+ }
+
+
+ /**
+ * Gets the attribute from the entry.
+ * <p>
+ * The attribute type description from the associated
+ * widget is used to get the attribute from the entry.
+ *
+ * @return
+ * the attribute from the entry
+ */
+ protected IAttribute getAttribute()
+ {
+ if ( ( getEntry() != null ) && ( getWidget() != null ) )
+ {
+ return getEntry().getAttribute( getWidget().getAttributeType() );
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Updates the attribute's value on the entry.
+ *
+ * @param value
+ * the value
+ */
+ protected void updateAttributeValue( Object value )
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute == null ) )
+ {
+ if ( !"".equals( value ) ) //$NON-NLS-1$
+ {
+ // Creating a new attribute with the value
+ addNewAttribute( value );
+ }
+ }
+ else
+ {
+ if ( !"".equals( value ) ) //$NON-NLS-1$
+ {
+ // Modifying the existing attribute
+ modifyAttributeValue( value );
+ }
+ else
+ {
+ // Deleting the attribute
+ deleteAttribute();
+ }
+ }
+ }
+
+
+ /**
+ * Adds a new attribute (based on the attribute type value from the widget)
+ * with the given value.
+ *
+ * @param value
+ * the value
+ */
+ protected void addNewAttribute( Object value )
+ {
+ if ( ( getEntry() != null ) && ( getWidget() != null ) )
+ {
+ Attribute newAttribute = new Attribute( getEntry(), getWidget().getAttributeType() );
+ newAttribute.addValue( new Value( newAttribute, value ) );
+ getEntry().addAttribute( newAttribute );
+ }
+ }
+
+
+ /**
+ * Modifies the attribute value with the given one.
+ *
+ * @param value
+ * the value
+ */
+ protected void modifyAttributeValue( Object value )
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.getValueSize() > 0 ) )
+ {
+ attribute.deleteValue( attribute.getValues()[0] );
+ attribute.addValue( new Value( attribute, value ) );
+ }
+ }
+
+
+ /**
+ * Deletes the attribute.
+ */
+ protected void deleteAttribute()
+ {
+ if ( ( getEntry() != null ) && ( getWidget() != null ) && ( getAttribute() != null ) )
+ {
+ getEntry().deleteAttribute( getAttribute() );
+ }
+ }
+
+
+ /**
+ * Adds a value to the attribute.
+ *
+ * @param value
+ * the value to add
+ */
+ protected void addAttributeValue( String value )
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.isString() ) )
+ {
+ attribute.addValue( new Value( attribute, value ) );
+ }
+ else
+ {
+ addNewAttribute( value );
+ }
+ }
+
+
+ /**
+ * Deletes a value from the attribute.
+ *
+ * @param value
+ * the value to delete
+ */
+ protected void deleteAttributeValue( String value )
+ {
+ IAttribute attribute = getAttribute();
+ if ( ( attribute != null ) && ( attribute.isString() ) && ( attribute.getValueSize() > 0 ) )
+ {
+ for ( IValue attributeValue : attribute.getValues() )
+ {
+ if ( attributeValue.getStringValue().equals( value ) )
+ {
+ attribute.deleteValue( attributeValue );
+ break;
+ }
+ }
+ }
+ }
+}
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidgetUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidgetUtils.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidgetUtils.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorWidgetUtils.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,107 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorWidgetUtils
+{
+ /**
+ * Gets the values of the attribute as a string.
+ *
+ * @param entry
+ * the entry
+ * @param attributeType
+ * the attribute type
+ * @return
+ * the values of the attribute as a string
+ */
+ public static String getConcatenatedValues( IEntry entry, String attributeType )
+ {
+ if ( ( entry != null ) && ( attributeType != null ) )
+ {
+ // Getting the requested attribute
+ IAttribute attribute = entry.getAttribute( attributeType );
+ if ( attribute != null )
+ {
+ if ( attribute.getValues().length != 0 )
+ {
+ // Checking the type of the value(s)
+ if ( attribute.isBinary() )
+ {
+ // Binary value(s)
+ if ( attribute.getBinaryValues().length == 1 )
+ {
+ return Messages.getString( "EditorWidgetUtils.BinaryValue" ); //$NON-NLS-1$
+ }
+ else
+ {
+ return Messages.getString( "EditorWidgetUtils.BinaryValues" ); //$NON-NLS-1$
+ }
+ }
+ else if ( attribute.isString() )
+ {
+ // String value(s)
+ return EditorWidgetUtils.concatenateValues( attribute.getStringValues() );
+ }
+ }
+ }
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+
+ /**
+ * Concatenates the given values.
+ * <p>
+ * Giving an array containing the following <code>["a", "b", "c"]</code>
+ * produces this string <em>a, b, c</em>.
+ *
+ * @param values
+ * the values
+ * @return
+ * a string with the concatenated values
+ */
+ private static String concatenateValues( String[] values )
+ {
+ StringBuilder sb = new StringBuilder();
+
+ if ( values != null )
+ {
+ for ( String value : values )
+ {
+ sb.append( value );
+ sb.append( ", " ); //$NON-NLS-1$
+ }
+
+ sb.delete( sb.length() - 2, sb.length() );
+ }
+
+ return sb.toString();
+ }
+}
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/Messages.java?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/Messages.java (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/Messages.java Fri Mar 27 15:27:27 2015
@@ -0,0 +1,54 @@
+/*
+ * 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.studio.templateeditor.editor.widgets;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+/**
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.templateeditor.editor.widgets.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+ private Messages()
+ {
+ }
+
+
+ public static String getString( String key )
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch ( MissingResourceException e )
+ {
+ return '!' + key + '!';
+ }
+ }
+}
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages.properties?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages.properties (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages.properties Fri Mar 27 15:27:27 2015
@@ -0,0 +1,51 @@
+# 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.
+EditorDate.EditDate=Edit Date...
+EditorDate.NoValue=<No Value>
+EditorFileChooser.Browse=Browse...
+EditorFileChooser.Bytes={0} bytes
+EditorFileChooser.Clear=Clear...
+EditorFileChooser.Confirmation=Confirmation
+EditorFileChooser.ConfirmationClearFile=Are you sure you want to clear this file?
+EditorFileChooser.ErrorReadingMessageDialogMessage=An error occurred while reading the file from disk.
+EditorFileChooser.ErrorReadingMessageDialogTitle=Error while reading the file
+EditorFileChooser.ErrorSavingMessageDialogMessage=An error occurred while saving the file to disk.
+EditorFileChooser.ErrorSavingMessageDialogTitle=Error while saving the file
+EditorFileChooser.KB={0} KB ({1} bytes)
+EditorFileChooser.MB={0} MB ({1} bytes)
+EditorFileChooser.NoValue=<No value>
+EditorFileChooser.SaveAs=Save As...
+EditorImage.Browse=Browse...
+EditorImage.Clear=Clear...
+EditorImage.Confirmation=Confirmation
+EditorImage.ConfirmationClearImage=Are you sure you want to clear this image?
+EditorImage.ErrorReadingMessageDialogMessage=An error occurred while reading the image from disk.
+EditorImage.ErrorReadingMessageDialogTitle=Error while reading the image
+EditorImage.ErrorSavingMessageDialogMessage=An error occurred while saving the image to disk.
+EditorImage.ErrorSavingMessageDialogTitle=Error while saving the image
+EditorImage.SaveAs=Save As...
+EditorLink.ErrorMessageDialogMessage=An error occurred while opening the link.
+EditorLink.ErrorMessageDialogTitle=Error while opening the link
+EditorPassword.EditPassword=Edit Password...
+EditorPassword.ShowPassword=Show password
+EditorTable.Add=Add...
+EditorTable.Confirmation=Confirmation
+EditorTable.ConfirmationDeleteValue=Are you sure you want to delete this value?
+EditorTable.Delete=Delete...
+EditorTable.Edit=Edit...
+EditorWidgetUtils.BinaryValue=[Binary Value]
+EditorWidgetUtils.BinaryValues=[Binary Values]
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_de.properties?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_de.properties (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_de.properties Fri Mar 27 15:27:27 2015
@@ -0,0 +1,57 @@
+# 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.
+EditorDate.EditDate=Datum bearbeiten...
+EditorDate.NoValue =<Kein Wert>
+
+EditorFileChooser.Browse=Browsen...
+EditorFileChooser.Bytes ={0} Bytes
+EditorFileChooser.Clear =L\u00F6schen...
+EditorFileChooser.Confirmation=Best\u00E4tigung
+EditorFileChooser.ConfirmationClearFile=Sind Sie sicher die Daten zu l\u00F6schen?
+EditorFileChooser.ErrorReadingMessageDialogMessage=Ein Fehler ist beim Lesen der Datei aufgetreten.
+EditorFileChooser.ErrorReadingMessageDialogTitle=Fehler beim Lesen der Datei
+EditorFileChooser.ErrorSavingMessageDialogMessage=Ein Fehler ist beim Speichern der Datei aufgetreten.
+EditorFileChooser.ErrorSavingMessageDialogTitle=Fehler beim Speichern der Datei.
+EditorFileChooser.KB ={0} KB ({1} Bytes)
+EditorFileChooser.MB ={0} MB ({1} Bytes)
+EditorFileChooser.NoValue=<Kein Wert>
+EditorFileChooser.SaveAs=Speichern unter...
+
+EditorImage.Browse=Browsen...
+EditorImage.Clear =L\u00F6schen...
+EditorImage.Confirmation=Best\u00E4tigung
+EditorImage.ConfirmationClearImage=Sind Sie sicher das Bild zu l\u00F6schen?
+EditorImage.ErrorReadingMessageDialogMessage=Ein Fehler ist beim Lesen der Datei aufgetreten.
+EditorImage.ErrorReadingMessageDialogTitle=Fehler beim Lesen der Datei
+EditorImage.ErrorSavingMessageDialogMessage=Ein Fehler ist beim Speichern der Datei aufgetreten.
+EditorImage.ErrorSavingMessageDialogTitle=Fehler beim Speichern der Datei.
+EditorImage.SaveAs=Speichern unter...
+
+EditorLink.ErrorMessageDialogMessage=Ein Fehler ist beim \u00D6ffnen des Links aufgetreten.
+EditorLink.ErrorMessageDialogTitle =Fehler beim \u00D6ffnen des Links
+
+EditorPassword.EditPassword=Passwort bearbeiten...
+EditorPassword.ShowPassword=Password anzeigen
+
+EditorTable.Add=Hinzuf\u00FCgen...
+EditorTable.Confirmation=Best\u00E4tigung
+EditorTable.ConfirmationDeleteValue=Sind Sie sicher den Wert zu l\u00F6schen?
+EditorTable.Delete=L\u00F6schen...
+EditorTable.Edit=Bearbeiten...
+
+EditorWidgetUtils.BinaryValue=[Bin\u00E4rer Wert]
+EditorWidgetUtils.BinaryValues=[Bin\u00E4re Werte]
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_fr.properties?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_fr.properties (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/messages_fr.properties Fri Mar 27 15:27:27 2015
@@ -0,0 +1,51 @@
+# 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.
+EditorDate.EditDate=Modifier la date...
+EditorDate.NoValue=<Aucune valeur>
+EditorFileChooser.Browse=Parcourir...
+EditorFileChooser.Bytes={0} octets
+EditorFileChooser.Clear=Effacer...
+EditorFileChooser.Confirmation=Confirmation
+EditorFileChooser.ConfirmationClearFile=Etes-vous s\u00FBr de vouloir effacer ce fichier ?
+EditorFileChooser.ErrorReadingMessageDialogMessage=Une erreur est survenue lors de la lecture du fichier sur le disque.
+EditorFileChooser.ErrorReadingMessageDialogTitle=Erreur lors de la lecture du fichier
+EditorFileChooser.ErrorSavingMessageDialogMessage=Une erreur est survenue lors de l''enregistrement du fichier sur le disque.
+EditorFileChooser.ErrorSavingMessageDialogTitle=Erreur lors de l''enregistrement du fichier
+EditorFileChooser.KB={0} Ko ({1} octets)
+EditorFileChooser.MB={0} Mo ({1} octets)
+EditorFileChooser.NoValue=<Aucune valeur>
+EditorFileChooser.SaveAs=Enregistrer sous...
+EditorImage.Browse=Parcourir...
+EditorImage.Clear=Effacer...
+EditorImage.Confirmation=Confirmation
+EditorImage.ConfirmationClearImage=Etes-vous s\u00FBr de vouloir effacer cette image ?
+EditorImage.ErrorReadingMessageDialogMessage=Une erreur est survenue lors de la lecture de l''image sur le disque.
+EditorImage.ErrorReadingMessageDialogTitle=Erreur lors de la lecture de l''image
+EditorImage.ErrorSavingMessageDialogMessage=Une erreur est survenue lors de l''enregistrement de l''image sur le disque.
+EditorImage.ErrorSavingMessageDialogTitle=Erreur lors de l''enregistrement de l'image
+EditorImage.SaveAs=Enregistrer sous...
+EditorLink.ErrorMessageDialogMessage=Une erreur est survenue lors de l''ouverture du lien.
+EditorLink.ErrorMessageDialogTitle=Erreur lors de l''ouverture du lien.
+EditorPassword.EditPassword=Modifier le mot de passe...
+EditorPassword.ShowPassword=Afficher le mot de passe
+EditorTable.Add=Ajouter...
+EditorTable.Confirmation=Confirmation
+EditorTable.ConfirmationDeleteValue=Etes-vous s\u00FBr de vouloir supprimer cette valeur ?
+EditorTable.Delete=Supprimer...
+EditorTable.Edit=Modifier...
+EditorWidgetUtils.BinaryValue=[Valeur binaire]
+EditorWidgetUtils.BinaryValues=[Valeurs binaires]
Added: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/messages.properties?rev=1669604&view=auto
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/messages.properties (added)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/messages.properties Fri Mar 27 15:27:27 2015
@@ -0,0 +1,30 @@
+# 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.
+EntryTemplatePlugin.UnableToGetPluginProperties=Unable to get the plugin properties.
+TemplatesManager.AnErrorOccurredWhenParsingTheTemplate2Params=An error occurred when parsing the template ({0}): {1}
+TemplatesManager.AnErrorOccurredWhenParsingTheTemplate3Params=An error occurred when parsing the template ({0}:{1}): {2}
+TemplatesManager.AnErrorOccurredWhenRemovingTheFileAssociatedWithTheTemplate=An error occurred when removing the file associated with the template {0}.
+TemplatesManager.TheFileAssociatedWithTheTemplateCanNotBeModified=The file associated with the template {0} can not be modified.
+TemplatesManager.TheFileAssociatedWithTheTemplateCouldNotBeFoundAt=The file associated with the template could not be found at {0}.
+TemplatesManager.TheTemplateCouldNotBeRemovedBecauseOfTheFollowingError=The template "{0}" ({1}) could not be removed because of the following error:
+TemplatesManager.TheTemplateDoesNotExistInTheTemplateManager=The template does not exist in the template manager.
+TemplatesManager.TheTemplateFileCouldNotBeAddedBecauseATemplateWithSameIDAlreadyExist=The template file ({0}) could not be added because a template with the same ID already exists.
+TemplatesManager.TheTemplateFileCouldNotBeAddedBecauseItCantBeRead=The template file ({0}) could not be added because it can't be read.
+TemplatesManager.TheTemplateFileCouldNotBeAddedBecauseItDoesNotExist=The template file ({0}) could not be added because it does not exist.
+TemplatesManager.TheTemplateFileCouldNotBeAddedBecauseOfTheFollowingError=The template file ({0}) could not be added because of the following error: {1}.
+TemplatesManager.TheTemplateFileCouldNotBeCopiedToThePluginsFolder=The template file ({0}) could not be copied to the plugin's folder.
+TemplatesManager.URLCreatedForTheTemplateIsNull=URL created for the template is null