Revision 722

tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/ViewPropertySelectionDialog.java (revision 722)
27 27
//
28 28
package org.txm.rcp.swt.dialog;
29 29

  
30
import java.util.ArrayList;
30 31
import java.util.List;
31 32

  
32 33
import org.eclipse.jface.dialogs.Dialog;
......
69 70
	/** The selected properties view. */
70 71
	org.eclipse.swt.widgets.List selectedPropertiesView;
71 72

  
73
	private ArrayList<P> cancelSelectedProperties;
74

  
75
	private ArrayList<P> cancelAvailableProperties;
76

  
72 77
	/**
73 78
	 * Instantiates a new view property selection dialog.
74 79
	 *
......
79 84
	public ViewPropertySelectionDialog(IShellProvider parentShell,
80 85
			List<P> availableProperties,
81 86
			List<P> selectedProperties) {
82
		super(parentShell);
83

  
84
		this.availableProperties = availableProperties;
85
		this.selectedProperties = selectedProperties;
86
		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
87
		this(parentShell.getShell(), availableProperties, selectedProperties);
87 88
	}
88 89

  
89 90
	/**
......
96 97
	public ViewPropertySelectionDialog(Shell shell,
97 98
			List<P> availableProperties,
98 99
			List<P> selectedProperties) {
99
		super(shell);
100

  
101
		this.availableProperties = availableProperties;
102
		this.selectedProperties = selectedProperties;
103
		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
100
		this(shell, availableProperties, selectedProperties, -1);
104 101
	}
105 102

  
106 103
	/**
......
118 115

  
119 116
		this.availableProperties = availableProperties;
120 117
		this.selectedProperties = selectedProperties;
118
		this.cancelAvailableProperties = new ArrayList<P>(availableProperties);
119
		this.cancelSelectedProperties = new ArrayList<P>(selectedProperties);
120
		
121 121
		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
122 122
		this.maxprops = maxprops;
123 123
	}
......
328 328
			super.okPressed();
329 329
	}
330 330

  
331
	/* (non-Javadoc)
332
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
333
	 */
334
	@Override
335
	protected void cancelPressed() {
336
		this.selectedProperties.clear();
337
		this.selectedProperties.addAll(cancelSelectedProperties);
338
		
339
		this.availableProperties.clear();
340
		availableProperties.addAll(cancelAvailableProperties);
341
		
342
		super.cancelPressed();
343
	}
331 344
}

Also available in: Unified diff