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/07/30 00:29:47 UTC
svn commit: r1693356 [2/2] - in
/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor:
./ dialogs/ model/ sourceeditor/ valueeditors/ widgets/
Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java?rev=1693356&r1=1693355&r2=1693356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java (original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java Wed Jul 29 22:29:46 2015
@@ -67,37 +67,18 @@ import org.eclipse.swt.widgets.Table;
*/
public class ACIItemProtectedItemsComposite extends Composite
{
-
/** The context. */
private ACIItemValueWithContext context;
/** The inner composite for all the content */
private Composite composite = null;
- /** The description label */
- private Label label = null;
-
- /** The table control for the table viewer */
- private Table table = null;
-
/** The table viewer containing all protected items */
private CheckboxTableViewer tableViewer = null;
- /** The composite containing the buttons */
- private Composite buttonComposite = null;
-
/** The edit button */
private Button editButton = null;
- /** The select all button */
- private Button selectAllButton = null;
-
- /** The deselect all button */
- private Button deselectAllButton = null;
-
- /** The reverse button */
- private Button reverseSelectionButton = null;
-
/** The possible protected items, used as input for the table viewer */
private ProtectedItemWrapper[] protectedItemWrappers = ProtectedItemWrapperFactory.createProtectedItemWrappers();
@@ -156,7 +137,7 @@ public class ACIItemProtectedItemsCompos
composite.setLayoutData( gridData );
composite.setLayout( gridLayout );
- label = new Label( composite, SWT.NONE );
+ Label label = new Label( composite, SWT.NONE );
label.setText( Messages.getString( "ACIItemProtectedItemsComposite.description" ) ); //$NON-NLS-1$
label.setLayoutData( labelGridData );
@@ -178,7 +159,7 @@ public class ACIItemProtectedItemsCompos
tableGridData.horizontalAlignment = GridData.FILL;
//tableGridData.heightHint = 100;
- table = new Table( composite, SWT.BORDER | SWT.CHECK );
+ Table table = new Table( composite, SWT.BORDER | SWT.CHECK );
table.setHeaderVisible( false );
table.setLayoutData( tableGridData );
table.setLinesVisible( false );
@@ -253,7 +234,7 @@ public class ACIItemProtectedItemsCompos
gridData.grabExcessVerticalSpace = false;
gridData.verticalAlignment = GridData.FILL;
- buttonComposite = new Composite( composite, SWT.NONE );
+ Composite buttonComposite = new Composite( composite, SWT.NONE );
buttonComposite.setLayoutData( gridData );
buttonComposite.setLayout( gridLayout );
@@ -269,7 +250,7 @@ public class ACIItemProtectedItemsCompos
} );
editButton.setEnabled( false );
- selectAllButton = new Button( buttonComposite, SWT.NONE );
+ Button selectAllButton = new Button( buttonComposite, SWT.NONE );
selectAllButton.setText( Messages.getString( "ACIItemProtectedItemsComposite.selectAll.button" ) ); //$NON-NLS-1$
selectAllButton.setLayoutData( selectAllButtonGridData );
selectAllButton.addSelectionListener( new SelectionAdapter()
@@ -281,7 +262,7 @@ public class ACIItemProtectedItemsCompos
}
} );
- deselectAllButton = new Button( buttonComposite, SWT.NONE );
+ Button deselectAllButton = new Button( buttonComposite, SWT.NONE );
deselectAllButton.setText( Messages.getString( "ACIItemProtectedItemsComposite.deselectAll.button" ) ); //$NON-NLS-1$
deselectAllButton.setLayoutData( deselectAllButtonGridData );
deselectAllButton.addSelectionListener( new SelectionAdapter()
@@ -293,7 +274,7 @@ public class ACIItemProtectedItemsCompos
}
} );
- reverseSelectionButton = new Button( buttonComposite, SWT.NONE );
+ Button reverseSelectionButton = new Button( buttonComposite, SWT.NONE );
reverseSelectionButton.setText( Messages.getString( "ACIItemProtectedItemsComposite.revers.button" ) ); //$NON-NLS-1$
reverseSelectionButton.setLayoutData( reverseSelectionButtonGridData );
reverseSelectionButton.addSelectionListener( new SelectionAdapter()
Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java?rev=1693356&r1=1693355&r2=1693356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java (original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java Wed Jul 29 22:29:46 2015
@@ -174,7 +174,6 @@ public class ACIItemSourceEditorComposit
*/
public void setContext( ACIItemValueWithContext context )
{
-
}
Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemTabFolderComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemTabFolderComposite.java?rev=1693356&r1=1693355&r2=1693356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemTabFolderComposite.java (original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemTabFolderComposite.java Wed Jul 29 22:29:46 2015
@@ -55,21 +55,9 @@ public class ACIItemTabFolderComposite e
/** The tab folder */
private TabFolder tabFolder;
- /** The visual tab */
- private TabItem visualTab;
-
- /** The inner container of the visual tab */
- private Composite visualContainer;
-
/** The visual editor composite */
private ACIItemVisualEditorComposite visualComposite;
- /** Tehe source tab */
- private TabItem sourceTab;
-
- /** The inner container of the source tab */
- private Composite sourceContainer;
-
/** The source editor composite */
private ACIItemSourceEditorComposite sourceComposite;
@@ -104,7 +92,8 @@ public class ACIItemTabFolderComposite e
{
tabFolder.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
tabSelected();
}
@@ -119,7 +108,7 @@ public class ACIItemTabFolderComposite e
private void createSourceTab()
{
// create inner container
- sourceContainer = new Composite( tabFolder, SWT.NONE );
+ Composite sourceContainer = new Composite( tabFolder, SWT.NONE );
GridLayout layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 0;
sourceContainer.setLayout( layout );
@@ -130,7 +119,7 @@ public class ACIItemTabFolderComposite e
sourceComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
// create tab
- sourceTab = new TabItem( tabFolder, SWT.NONE, SOURCE_TAB_INDEX );
+ TabItem sourceTab = new TabItem( tabFolder, SWT.NONE, SOURCE_TAB_INDEX );
sourceTab.setText( Messages.getString( "ACIItemTabFolderComposite.source.tab" ) ); //$NON-NLS-1$
sourceTab.setControl( sourceContainer );
}
@@ -143,7 +132,7 @@ public class ACIItemTabFolderComposite e
private void createVisualTab()
{
// create inner container
- visualContainer = new Composite( tabFolder, SWT.NONE );
+ Composite visualContainer = new Composite( tabFolder, SWT.NONE );
visualContainer.setLayout( new GridLayout() );
visualContainer.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
@@ -152,7 +141,7 @@ public class ACIItemTabFolderComposite e
visualComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
// create tab
- visualTab = new TabItem( tabFolder, SWT.NONE, VISUAL_TAB_INDEX );
+ TabItem visualTab = new TabItem( tabFolder, SWT.NONE, VISUAL_TAB_INDEX );
visualTab.setText( Messages.getString( "ACIItemTabFolderComposite.visual.tab" ) ); //$NON-NLS-1$
visualTab.setControl( visualContainer );
}
Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserClassesComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserClassesComposite.java?rev=1693356&r1=1693355&r2=1693356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserClassesComposite.java (original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserClassesComposite.java Wed Jul 29 22:29:46 2015
@@ -63,37 +63,18 @@ import org.eclipse.swt.widgets.Table;
*/
public class ACIItemUserClassesComposite extends Composite
{
-
/** The context. */
private ACIItemValueWithContext context;
/** The inner composite for all the content */
private Composite composite = null;
- /** The description label */
- private Label label = null;
-
- /** The table control for the table viewer */
- private Table table = null;
-
/** The table viewer containing all user classes */
private CheckboxTableViewer tableViewer = null;
- /** The composite containing the buttons */
- private Composite buttonComposite = null;
-
/** The edit button */
private Button editButton = null;
- /** The select all button */
- private Button selectAllButton = null;
-
- /** The deselect all button */
- private Button deselectAllButton = null;
-
- /** The reverse button */
- private Button reverseSelectionButton = null;
-
/** The possible user classes, used as input for the table viewer */
private UserClassWrapper[] userClassWrappers = UserClassWrapperFactory.createUserClassWrappers();
@@ -131,7 +112,6 @@ public class ACIItemUserClassesComposite
*/
private void createComposite()
{
-
GridData labelGridData = new GridData();
labelGridData.horizontalSpan = 2;
labelGridData.verticalAlignment = GridData.CENTER;
@@ -152,12 +132,11 @@ public class ACIItemUserClassesComposite
composite.setLayoutData( gridData );
composite.setLayout( gridLayout );
- label = new Label( composite, SWT.NONE );
+ Label label = new Label( composite, SWT.NONE );
label.setText( Messages.getString( "ACIItemUserClassesComposite.description" ) ); //$NON-NLS-1$
label.setLayoutData( labelGridData );
createTable();
-
createButtonComposite();
}
@@ -172,9 +151,8 @@ public class ACIItemUserClassesComposite
tableGridData.grabExcessHorizontalSpace = true;
tableGridData.verticalAlignment = GridData.FILL;
tableGridData.horizontalAlignment = GridData.FILL;
- //tableGridData.heightHint = 100;
- table = new Table( composite, SWT.BORDER | SWT.CHECK );
+ Table table = new Table( composite, SWT.BORDER | SWT.CHECK );
table.setHeaderVisible( false );
table.setLayoutData( tableGridData );
table.setLinesVisible( false );
@@ -185,20 +163,25 @@ public class ACIItemUserClassesComposite
tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
{
+ @Override
public void selectionChanged( SelectionChangedEvent event )
{
userClassSelected();
}
} );
+
tableViewer.addCheckStateListener( new ICheckStateListener()
{
+ @Override
public void checkStateChanged( CheckStateChangedEvent event )
{
userClassChecked();
}
} );
+
tableViewer.addDoubleClickListener( new IDoubleClickListener()
{
+ @Override
public void doubleClick( DoubleClickEvent event )
{
if ( editButton.isEnabled() )
@@ -249,52 +232,61 @@ public class ACIItemUserClassesComposite
gridData.grabExcessVerticalSpace = false;
gridData.verticalAlignment = GridData.FILL;
- buttonComposite = new Composite( composite, SWT.NONE );
+ Composite buttonComposite = new Composite( composite, SWT.NONE );
buttonComposite.setLayoutData( gridData );
buttonComposite.setLayout( gridLayout );
editButton = new Button( buttonComposite, SWT.NONE );
editButton.setText( Messages.getString( "ACIItemUserClassesComposite.edit.button" ) ); //$NON-NLS-1$
editButton.setLayoutData( editButtonGridData );
+
editButton.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
editUserClass();
}
} );
+
editButton.setEnabled( false );
- selectAllButton = new Button( buttonComposite, SWT.NONE );
+ Button selectAllButton = new Button( buttonComposite, SWT.NONE );
selectAllButton.setText( Messages.getString( "ACIItemUserClassesComposite.selectAll.button" ) ); //$NON-NLS-1$
selectAllButton.setLayoutData( selectAllButtonGridData );
+
selectAllButton.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
tableViewer.setCheckedElements( userClassWrappers );
refreshTable();
}
} );
- deselectAllButton = new Button( buttonComposite, SWT.NONE );
+ Button deselectAllButton = new Button( buttonComposite, SWT.NONE );
deselectAllButton.setText( Messages.getString( "ACIItemUserClassesComposite.deselectAll.button" ) ); //$NON-NLS-1$
deselectAllButton.setLayoutData( deselectAllButtonGridData );
+
deselectAllButton.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
tableViewer.setCheckedElements( new ProtectedItem[0] );
refreshTable();
}
} );
- reverseSelectionButton = new Button( buttonComposite, SWT.NONE );
+ Button reverseSelectionButton = new Button( buttonComposite, SWT.NONE );
reverseSelectionButton.setText( Messages.getString( "ACIItemUserClassesComposite.revert.buton" ) ); //$NON-NLS-1$
reverseSelectionButton.setLayoutData( reverseSelectionButtonGridData );
+
reverseSelectionButton.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
List<Object> elements = new ArrayList<Object>();
elements.addAll( Arrays.asList( userClassWrappers ) );
@@ -303,8 +295,8 @@ public class ACIItemUserClassesComposite
refreshTable();
}
} );
-
}
+
/**
* The label provider used for this table viewer.
@@ -313,7 +305,6 @@ public class ACIItemUserClassesComposite
*/
private class UserClassesLabelProvider extends LabelProvider
{
-
/**
* Returns the error icon if the user class is checked and invalid.
*
@@ -326,6 +317,7 @@ public class ACIItemUserClassesComposite
if ( element instanceof UserClassWrapper )
{
UserClassWrapper wrapper = ( UserClassWrapper ) element;
+
if ( tableViewer.getChecked( wrapper ) )
{
try
@@ -416,7 +408,15 @@ public class ACIItemUserClassesComposite
public void setVisible( boolean visible )
{
super.setVisible( visible );
- ( ( GridData ) getLayoutData() ).heightHint = visible ? -1 : 0;
+
+ if ( visible )
+ {
+ ( ( GridData ) getLayoutData() ).heightHint = -1;
+ }
+ else
+ {
+ ( ( GridData ) getLayoutData() ).heightHint = 0;
+ }
}
@@ -426,19 +426,19 @@ public class ACIItemUserClassesComposite
*/
private UserClassWrapper getSelectedUserClassWrapper()
{
- UserClassWrapper userClassWrapper = null;
-
IStructuredSelection selection = ( IStructuredSelection ) tableViewer.getSelection();
+
if ( !selection.isEmpty() )
{
Object element = selection.getFirstElement();
+
if ( element instanceof UserClassWrapper )
{
- userClassWrapper = ( UserClassWrapper ) element;
+ return ( UserClassWrapper ) element;
}
}
- return userClassWrapper;
+ return null;
}
@@ -451,7 +451,7 @@ public class ACIItemUserClassesComposite
{
UserClassWrapper userClassWrapper = getSelectedUserClassWrapper();
- if ( userClassWrapper == null || !userClassWrapper.isEditable() )
+ if ( ( userClassWrapper == null ) || !userClassWrapper.isEditable() )
{
editButton.setEnabled( false );
}
@@ -480,6 +480,7 @@ public class ACIItemUserClassesComposite
UserClassWrapper userClassWrapper = getSelectedUserClassWrapper();
AbstractDialogStringValueEditor editor = userClassWrapper.getValueEditor();
+
if ( editor != null )
{
MultiValuedDialog dialog = new MultiValuedDialog( getShell(), userClassWrapper.getDisplayName(),
@@ -497,5 +498,4 @@ public class ACIItemUserClassesComposite
{
tableViewer.refresh();
}
-
}
Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserPermissionsComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserPermissionsComposite.java?rev=1693356&r1=1693355&r2=1693356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserPermissionsComposite.java (original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserPermissionsComposite.java Wed Jul 29 22:29:46 2015
@@ -22,7 +22,6 @@ package org.apache.directory.studio.acii
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import org.apache.directory.api.ldap.aci.GrantAndDenial;
@@ -58,27 +57,17 @@ import org.eclipse.swt.widgets.Table;
*/
public class ACIItemUserPermissionsComposite extends Composite
{
-
/** The context. */
private ACIItemValueWithContext context;
/** The inner composite for all the content */
private Composite composite = null;
- /** The description label */
- private Label label = null;
-
- /** The table control for the table viewer */
- private Table table = null;
-
/** The table viewer containing all user classes */
private TableViewer tableViewer = null;
- /** The composite containing the buttons */
- private Composite buttonComposite = null;
-
/** The add button */
- private Button addButton = null;
+ //private Button addButton = null;
/** The edit button */
private Button editButton = null;
@@ -87,7 +76,7 @@ public class ACIItemUserPermissionsCompo
private Button deleteButton = null;
/** The selected user permissions, also input of the table viewer */
- List<UserPermissionWrapper> userPermissionWrappers = new ArrayList<UserPermissionWrapper>();
+ private List<UserPermissionWrapper> userPermissionWrappers = new ArrayList<UserPermissionWrapper>();
/**
* UserPermissionWrapper are used as input of the table viewer.
@@ -124,52 +113,76 @@ public class ACIItemUserPermissionsCompo
}
else
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
+
if ( ( userPermission.getPrecedence() != null ) && ( userPermission.getPrecedence() > -1 ) )
{
buffer.append( '(' );
buffer.append( userPermission.getPrecedence() );
- buffer.append( ')' );
- buffer.append( ' ' );
+ buffer.append( ") " );
}
- for ( Iterator<ProtectedItem> it = ( ( Collection<ProtectedItem> ) userPermission.getProtectedItems() )
- .iterator(); it.hasNext(); )
- {
- ProtectedItem item = it.next();
- String s = ProtectedItemWrapper.classToDisplayMap.get( item.getClass() );
- buffer.append( s );
- if ( it.hasNext() )
+ boolean isFirst = true;
+
+ for ( ProtectedItem item : userPermission.getProtectedItems() )
+ {
+ if ( isFirst )
+ {
+ isFirst = false;
+ }
+ else
{
buffer.append( ',' );
}
+
+ buffer.append( ProtectedItemWrapper.CLASS_TO_DISPLAY_MAP.get( item.getClass() ) );
}
- buffer.append( ':' );
- buffer.append( ' ' );
- for ( Iterator<GrantAndDenial> it = ( ( Collection<GrantAndDenial> ) userPermission
- .getGrantsAndDenials() ).iterator(); it.hasNext(); )
- {
- GrantAndDenial gd = it.next();
- buffer.append( gd.isGrant() ? '+' : '-' );
- buffer.append( gd.getMicroOperation().getName() );
+
+ buffer.append( ": " );
- if ( it.hasNext() )
+ isFirst = true;
+
+ for ( GrantAndDenial gd : userPermission.getGrantsAndDenials() )
+ {
+ if ( isFirst )
+ {
+ isFirst = false;
+ }
+ else
{
buffer.append( ',' );
}
+
+ if ( gd.isGrant() )
+ {
+ buffer.append( '+' );
+ }
+ else
+ {
+ buffer.append( '-' );
+ }
+
+ buffer.append( gd.getMicroOperation().getName() );
}
- String s = buffer.toString();
- s = s.replace( '\r', ' ' );
- s = s.replace( '\n', ' ' );
- if ( s.length() > 50 )
+ String result = buffer.toString();
+ result = result.replace( '\r', ' ' );
+ result = result.replace( '\n', ' ' );
+
+ if ( buffer.length() > 50 )
+ {
+ buffer.setLength( 0 );
+
+ buffer.append( result.substring( 0, 25 ) );
+ buffer.append( "..." );
+ buffer.append( result.substring( result.length() - 25, result.length() ) );
+
+ return buffer.toString();
+ }
+ else
{
- String temp = s;
- s = temp.substring( 0, 25 );
- s = s + "..."; //$NON-NLS-1$
- s = s + temp.substring( temp.length() - 25, temp.length() );
+ return result;
}
- return s;
}
}
}
@@ -208,7 +221,6 @@ public class ACIItemUserPermissionsCompo
*/
private void createComposite()
{
-
GridData labelGridData = new GridData();
labelGridData.horizontalSpan = 2;
labelGridData.verticalAlignment = GridData.CENTER;
@@ -229,12 +241,11 @@ public class ACIItemUserPermissionsCompo
composite.setLayoutData( gridData );
composite.setLayout( gridLayout );
- label = new Label( composite, SWT.NONE );
+ Label label = new Label( composite, SWT.NONE );
label.setText( Messages.getString( "ACIItemUserPermissionsComposite.descripton" ) ); //$NON-NLS-1$
label.setLayoutData( labelGridData );
createTable();
-
createButtonComposite();
}
@@ -251,7 +262,7 @@ public class ACIItemUserPermissionsCompo
tableGridData.horizontalAlignment = GridData.FILL;
//tableGridData.heightHint = 100;
- table = new Table( composite, SWT.BORDER );
+ Table table = new Table( composite, SWT.BORDER );
table.setHeaderVisible( false );
table.setLayoutData( tableGridData );
table.setLinesVisible( false );
@@ -262,6 +273,7 @@ public class ACIItemUserPermissionsCompo
tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
{
+ @Override
public void selectionChanged( SelectionChangedEvent event )
{
userPermissionSelected();
@@ -270,6 +282,7 @@ public class ACIItemUserPermissionsCompo
tableViewer.addDoubleClickListener( new IDoubleClickListener()
{
+ @Override
public void doubleClick( DoubleClickEvent event )
{
editUserPermission();
@@ -311,16 +324,18 @@ public class ACIItemUserPermissionsCompo
gridData.grabExcessVerticalSpace = false;
gridData.verticalAlignment = GridData.FILL;
- buttonComposite = new Composite( composite, SWT.NONE );
+ Composite buttonComposite = new Composite( composite, SWT.NONE );
buttonComposite.setLayoutData( gridData );
buttonComposite.setLayout( gridLayout );
- addButton = new Button( buttonComposite, SWT.NONE );
+ Button addButton = new Button( buttonComposite, SWT.NONE );
addButton.setText( Messages.getString( "ACIItemUserPermissionsComposite.add.button" ) ); //$NON-NLS-1$
addButton.setLayoutData( addButtonGridData );
+
addButton.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
addUserPermission();
}
@@ -329,25 +344,31 @@ public class ACIItemUserPermissionsCompo
editButton = new Button( buttonComposite, SWT.NONE );
editButton.setText( Messages.getString( "ACIItemUserPermissionsComposite.edit.button" ) ); //$NON-NLS-1$
editButton.setLayoutData( editButtonGridData );
+
editButton.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
editUserPermission();
}
} );
+
editButton.setEnabled( false );
deleteButton = new Button( buttonComposite, SWT.NONE );
deleteButton.setText( Messages.getString( "ACIItemUserPermissionsComposite.delete.button" ) ); //$NON-NLS-1$
deleteButton.setLayoutData( deleteButtonGridData );
+
deleteButton.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ @Override
+ public void widgetSelected( SelectionEvent event )
{
deleteUserPermission();
}
} );
+
deleteButton.setEnabled( false );
}
@@ -361,7 +382,15 @@ public class ACIItemUserPermissionsCompo
public void setVisible( boolean visible )
{
super.setVisible( visible );
- ( ( GridData ) getLayoutData() ).heightHint = visible ? -1 : 0;
+
+ if ( visible )
+ {
+ ( ( GridData ) getLayoutData() ).heightHint = -1;
+ }
+ else
+ {
+ ( ( GridData ) getLayoutData() ).heightHint = 0;
+ }
}
@@ -420,19 +449,19 @@ public class ACIItemUserPermissionsCompo
*/
private UserPermissionWrapper getSelectedUserPermissionWrapper()
{
- UserPermissionWrapper userPermissionWrapper = null;
-
IStructuredSelection selection = ( IStructuredSelection ) tableViewer.getSelection();
+
if ( !selection.isEmpty() )
{
Object element = selection.getFirstElement();
+
if ( element instanceof UserPermissionWrapper )
{
- userPermissionWrapper = ( UserPermissionWrapper ) element;
+ return ( UserPermissionWrapper ) element;
}
}
- return userPermissionWrapper;
+ return null;
}
@@ -443,7 +472,8 @@ public class ACIItemUserPermissionsCompo
private void addUserPermission()
{
UserPermissionDialog dialog = new UserPermissionDialog( getShell(), null, context );
- if ( dialog.open() == UserPermissionDialog.OK && dialog.getUserPermission() != null )
+
+ if ( ( dialog.open() == UserPermissionDialog.OK ) && ( dialog.getUserPermission() != null ) )
{
UserPermissionWrapper userPermissionWrapper = new UserPermissionWrapper( dialog.getUserPermission() );
userPermissionWrappers.add( userPermissionWrapper );
@@ -460,10 +490,12 @@ public class ACIItemUserPermissionsCompo
private void editUserPermission()
{
UserPermissionWrapper oldUserPermissionWrapper = getSelectedUserPermissionWrapper();
+
if ( oldUserPermissionWrapper != null )
{
UserPermissionDialog dialog = new UserPermissionDialog( getShell(),
oldUserPermissionWrapper.userPermission, context );
+
if ( dialog.open() == UserPermissionDialog.OK )
{
oldUserPermissionWrapper.userPermission = dialog.getUserPermission();
@@ -479,6 +511,7 @@ public class ACIItemUserPermissionsCompo
private void deleteUserPermission()
{
UserPermissionWrapper userPermissionWrapper = getSelectedUserPermissionWrapper();
+
if ( userPermissionWrapper != null )
{
userPermissionWrappers.remove( userPermissionWrapper );
@@ -506,5 +539,4 @@ public class ACIItemUserPermissionsCompo
deleteButton.setEnabled( true );
}
}
-
}
Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/Messages.java?rev=1693356&r1=1693355&r2=1693356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/Messages.java (original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/Messages.java Wed Jul 29 22:29:46 2015
@@ -28,7 +28,7 @@ import java.util.ResourceBundle;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class Messages
+public final class Messages
{
/** The resource name */
private static final ResourceBundle RESOURCE_BUNDLE =
Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/WidgetModifyEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/WidgetModifyEvent.java?rev=1693356&r1=1693355&r2=1693356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/WidgetModifyEvent.java (original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/WidgetModifyEvent.java Wed Jul 29 22:29:46 2015
@@ -30,7 +30,7 @@ import java.util.EventObject;
*/
public class WidgetModifyEvent extends EventObject
{
-
+ /** Serialization UUID */
private static final long serialVersionUID = 2421335730580648878L;
@@ -43,5 +43,4 @@ public class WidgetModifyEvent extends E
{
super( source );
}
-
}