2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
11 import java
.util
.UUID
;
13 import org
.eclipse
.swt
.widgets
.Control
;
14 import org
.eclipse
.swt
.widgets
.Shell
;
15 import org
.eclipse
.swt
.widgets
.Text
;
17 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
18 import eu
.etaxonomy
.cdm
.api
.service
.IRightsService
;
19 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
20 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
21 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
22 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 public class RightsSelectionDialog
extends AbstractFilteredCdmResourceSelectionDialog
<Rights
> {
33 public static Rights
select(Shell shell
, ConversationHolder conversation
, Rights rights
){
34 RightsSelectionDialog dialog
= new RightsSelectionDialog(shell
, conversation
,
35 "Choose Rights", false, RightsSelectionDialog
.class.getCanonicalName(), rights
);
36 return getSelectionFromDialog(dialog
);
40 * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
42 protected RightsSelectionDialog(Shell shell
, ConversationHolder conversation
, String title
,
43 boolean multi
, String settings
, Rights rights
) {
44 super(shell
, conversation
, title
, multi
, settings
, rights
);
51 protected Rights
getPersistentObject(UUID uuid
) {
52 Object object
= CdmStore
.getService(IRightsService
.class).load(uuid
);
54 Rights rights
= (Rights
) HibernateProxyHelper
.deproxy(object
);
59 MessagingUtils
.error(this.getClass(), "Selected element is not rights", null);
67 protected String
[] getNewWizardText() {
76 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
77 // TODO Auto-generated method stub
85 protected void search() {
86 Control control
=getSearchField();
87 String pattern
= null;
89 pattern
= ((Text
)control
).getText();
92 if (pattern
== null || pattern
.equals("?")){
93 model
= CdmStore
.getService(IRightsService
.class).getUuidAndLabelText(null,null);
97 model
= CdmStore
.getService(IRightsService
.class).getUuidAndLabelText(limitOfInitialElements
,pattern
);