Revision bb99bc5b
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SearchDialog.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
|
13 | 13 |
|
14 |
import java.text.Collator; |
|
14 | 15 |
import java.util.ArrayList; |
15 | 16 |
import java.util.Collections; |
17 |
import java.util.Comparator; |
|
16 | 18 |
import java.util.List; |
17 | 19 |
|
18 | 20 |
import org.eclipse.core.commands.AbstractHandler; |
... | ... | |
52 | 54 |
import org.eclipse.swt.accessibility.AccessibleEvent; |
53 | 55 |
import org.eclipse.swt.events.ModifyEvent; |
54 | 56 |
import org.eclipse.swt.events.ModifyListener; |
55 |
import org.eclipse.swt.events.MouseAdapter; |
|
56 |
import org.eclipse.swt.events.MouseEvent; |
|
57 | 57 |
import org.eclipse.swt.events.SelectionAdapter; |
58 | 58 |
import org.eclipse.swt.events.SelectionEvent; |
59 | 59 |
import org.eclipse.swt.events.TraverseEvent; |
... | ... | |
87 | 87 |
|
88 | 88 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
89 | 89 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
90 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
|
90 | 91 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
91 | 92 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.CdmFilteredItemsSelectionDialog.ItemsListSeparator; |
92 | 93 |
|
... | ... | |
165 | 166 |
}); |
166 | 167 |
gd_1 = new GridData(GridData.FILL_HORIZONTAL); |
167 | 168 |
gd_1.horizontalIndent = 2; |
168 |
gd_1.grabExcessHorizontalSpace = false; |
|
169 | 169 |
gd_1.horizontalAlignment = SWT.CENTER; |
170 | 170 |
gd_1.widthHint = 575; |
171 | 171 |
searchField.setLayoutData(gd_1); |
... | ... | |
225 | 225 |
*/ |
226 | 226 |
private Label createHeader(Composite parent) { |
227 | 227 |
Composite header = new Composite(parent, SWT.NONE); |
228 |
GridData gd_header = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1); |
|
229 |
gd_header.widthHint = 575; |
|
230 |
header.setLayoutData(gd_header); |
|
228 | 231 |
|
229 | 232 |
GridLayout layout = new GridLayout(); |
230 |
layout.numColumns = 2;
|
|
233 |
layout.verticalSpacing = 1;
|
|
231 | 234 |
layout.marginWidth = 0; |
232 | 235 |
layout.marginHeight = 0; |
233 | 236 |
header.setLayout(layout); |
234 |
new Label(header, SWT.NONE); |
|
235 |
new Label(header, SWT.NONE); |
|
236 |
new Label(header, SWT.NONE); |
|
237 |
|
|
238 |
createViewMenu(header); |
|
237 | 239 |
|
238 | 240 |
Label headerLabel = new Label(header, SWT.NONE); |
239 | 241 |
headerLabel.setText((getMessage() != null && getMessage().trim() |
... | ... | |
254 | 256 |
gd_headerLabel.verticalAlignment = SWT.BOTTOM; |
255 | 257 |
gd_headerLabel.minimumHeight = 10; |
256 | 258 |
headerLabel.setLayoutData(gd_headerLabel); |
259 |
new Label(header, SWT.NONE); |
|
257 | 260 |
|
258 | 261 |
return headerLabel; |
259 | 262 |
} |
... | ... | |
288 | 291 |
|
289 | 292 |
GridData data = new GridData(); |
290 | 293 |
data.horizontalAlignment = GridData.END; |
294 |
data.grabExcessHorizontalSpace = true; |
|
291 | 295 |
toolBar.setLayoutData(data); |
292 | 296 |
|
293 |
toolBar.addMouseListener(new MouseAdapter() { |
|
294 |
@Override |
|
295 |
public void mouseDown(MouseEvent e) { |
|
296 |
showViewMenu(); |
|
297 |
} |
|
298 |
}); |
|
297 |
// toolBar.addMouseListener(new MouseAdapter() {
|
|
298 |
// @Override
|
|
299 |
// public void mouseDown(MouseEvent e) {
|
|
300 |
// showViewMenu();
|
|
301 |
// }
|
|
302 |
// });
|
|
299 | 303 |
|
300 | 304 |
toolItem.setImage(WorkbenchImages |
301 | 305 |
.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU)); |
... | ... | |
370 | 374 |
public void setListLabelProvider(ILabelProvider listLabelProvider) { |
371 | 375 |
getItemsListLabelProvider().setProvider(listLabelProvider); |
372 | 376 |
} |
373 |
|
|
377 |
protected Comparator getItemsComparator() { |
|
378 |
return new Comparator<UuidAndTitleCache>() { |
|
379 |
@Override |
|
380 |
public int compare(UuidAndTitleCache entity1, |
|
381 |
UuidAndTitleCache entity2) { |
|
382 |
Collator collator = Collator.getInstance(); |
|
383 |
if (entity1.getUuid().equals(entity2.getUuid())){ |
|
384 |
return 0; |
|
385 |
} |
|
386 |
int result = collator.compare(entity1.getTitleCache(), entity2.getTitleCache()); |
|
387 |
if (result == 0){ |
|
388 |
result = entity1.getUuid().compareTo(entity2.getUuid()); |
|
389 |
} |
|
390 |
return result; |
|
391 |
} |
|
392 |
}; |
|
393 |
} |
|
374 | 394 |
|
375 | 395 |
|
376 | 396 |
class ContentProvider implements |
... | ... | |
383 | 403 |
*/ |
384 | 404 |
public ContentProvider() { |
385 | 405 |
this.items = Collections.synchronizedList(new ArrayList(2048)); |
386 |
|
|
387 | 406 |
} |
388 | 407 |
|
389 | 408 |
/** |
... | ... | |
445 | 464 |
@Override |
446 | 465 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
447 | 466 |
} |
467 |
|
|
468 |
|
|
448 | 469 |
} |
449 | 470 |
|
450 | 471 |
|
... | ... | |
774 | 795 |
protected Point getInitialSize() { |
775 | 796 |
return new Point(593, 399); |
776 | 797 |
} |
798 |
|
|
777 | 799 |
} |
778 | 800 |
|
779 | 801 |
|
Also available in: Unified diff
add menu to namedAreaSelection dialog (need to be migrated)