* @date 15.08.2017
*/
public class FactualDataPartE4 extends AbstractCdmEditorPartE4
- implements IPartContentHasDetails, IPartContentHasSupplementalData,
+ implements IPartContentHasDetails, IPartContentHasSupplementalData,
ICdmEntitySessionEnabled<CdmBase>, ICollapsableExpandable {
/**
}
Object partObject = createPartObject(activePart);
-
-
if ((partObject instanceof DetailsPartE4 && !(selection instanceof TaxonName))|| partObject instanceof SupplementalDataPartE4
|| partObject instanceof MediaViewPartE4 || partObject instanceof ConceptViewPartE4 || ((partObject instanceof AbstractCdmEditorPartE4) &&(((AbstractCdmEditorPartE4)partObject).getViewer().getInput() instanceof DescriptionElementBase))) {
return;
}
-
if(partObject instanceof IPartContentHasFactualData ){
-
if (!viewer.getControl().isDisposed()){
viewer.getControl().setEnabled(isEnabled());
-
}
IStructuredSelection structuredSelection = createSelection(selection);
private ConversationHolder conversation;
-// private ICdmEntitySession cdmEntitySession;
-
private IDataChangeBehavior dataChangeBehavior;
private Root root;
public class OpenReferencingObjectsViewHandler {
- List<UuidAndTitleCache<? extends ICdmBase>> selectedObjectList;
+ private List<UuidAndTitleCache<? extends ICdmBase>> selectedObjectList;
@Execute
public void execute(EPartService partService) {
public boolean canExecute(EPartService partService,
@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem) {
+
boolean canExecute = false;
MPart part = partService.findPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4);
canExecute = part.equals(activePart) //we explicitly want to allow calling the view recursively
|| part.getObject() == null ; //we show the menu item only if the view is not yet open (otherwise by setting the focus data will be shown anyway
//but this may change in future for some data where explicitly calling the view is required
-
-
selectedObjectList = null;
if (canExecute){
String commandId = menuItem.getCommand().getElementId();
* Creates a section as a part of the form.
*
* @return the section widget
- * @param section
- * a
- * {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
*/
public Section adapt(AbstractFormSection section) {
section.setMenu(section.getLayoutComposite().getMenu());
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-
package eu.etaxonomy.taxeditor.ui.element;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
-
-
/**
- * <p>RootElement class.</p>
- *
* @author n.hoffmann
* @created May 27, 2010
- * @version 1.0
*/
public class RootElement extends AbstractCdmFormElement {
super(formFactory, layoutComposite);
}
- /** {@inheritDoc} */
@Override
public void setBackground(Color color) {
for(ICdmFormElement element : getElements()){
element.setBackground(color);
}
}
-
-}
+}
\ No newline at end of file
return commandViewerNameMap;
}
-
- public static List<UuidAndTitleCache<? extends ICdmBase>> transformSelectionToUuidAndTitleCacheList(Object selectedObject) {
+ /**
+ * Trys to create a List of {@link UuidAndTitleCache} from the selection.<BR>
+ * Selections which are not recognized are not included in the list.<BR>
+ * As a minimum each returned element contains the type and the uuid.
+ * If available also the label and the CdmBase entity is added (later by using the subclass {@link DtoWithEntity}.
+ * Label creation is not forced (TODO maybe in future we should have a parameter forceLabelCreation)
+ * @param
+ * @return list of {@link UuidAndTitleCache}
+ */
+ public static List<UuidAndTitleCache<? extends ICdmBase>> transformSelectionToUuidAndTitleCacheList(Object selection) {
//make it all a list
List<Object> multipleSelection = new ArrayList<>();
- if(selectedObject instanceof IStructuredSelection){
- IStructuredSelection selection = ((IStructuredSelection) selectedObject);
- ((List<?>)selection.toList()).forEach(o->multipleSelection.add(o));
- }else if(selectedObject.getClass().isArray()){
- for (Object o : ((Object[])selectedObject)){
+ if(selection instanceof IStructuredSelection){
+ IStructuredSelection structuredSelection = ((IStructuredSelection) selection);
+ ((List<?>)structuredSelection.toList()).forEach(o->multipleSelection.add(o));
+ }else if(selection.getClass().isArray()){
+ for (Object o : ((Object[])selection)){
multipleSelection.add(o);
}
- }else if(selectedObject instanceof List){
- multipleSelection.addAll((List<?>)selectedObject);
+ }else if(selection instanceof List){
+ multipleSelection.addAll((List<?>)selection);
}else{
- multipleSelection.add(selectedObject);
+ multipleSelection.add(selection);
}
//filter all as uuidIdAndTitleCache
ContextInjectionFactory.inject(formFactory, context);
}
- /** {@inheritDoc} */
@Override
public Control getControl() {
if(body!=null){
return body;
}
- /** {@inheritDoc} */
@Override
public void setInput(Object input) {
this.input = input;
}
}
- /** {@inheritDoc} */
@Override
public Object getInput() {
return input;
}
- /** {@inheritDoc} */
@Override
public void refresh() {
showParts();
}catch(SWTException e){
logger.debug("Something went wrong for viewer.getControl().setEnabled(true) in " + this.getClass().getSimpleName(), e);
}
-
}
- if((previousSelection!=null && selection!=null) && (activePart != null && selectionProvidingPart != null && activePart.equals(selectionProvidingPart)) &&
- (previousSelection==selection
- || previousSelection.equals(selection)
- || new StructuredSelection(selection).equals(previousSelection))
+ if((previousSelection!=null && selection!=null)
+ && (activePart != null && selectionProvidingPart != null && activePart.equals(selectionProvidingPart))
+ && (previousSelection==selection
+ || previousSelection.equals(selection)
+ || new StructuredSelection(selection).equals(previousSelection))
) {
return;
}
return;
}
viewer.getControl().setEnabled(true);
- if(selection.getFirstElement()!=null){
+ if(element != null){
if (element instanceof Taxon){
Taxon taxon = HibernateProxyHelper.deproxy(element, Taxon.class);
if (node != null){
boolean doEnable = CdmStore.currentAuthentiationHasPermission(node,
RequiredPermissions.TAXON_EDIT);
- if (!doEnable){
+ if (!doEnable){
//check whether there are explicit TaxonNode rights
boolean taxonnodePermissionExists = false;
Collection<? extends GrantedAuthority> authorities = CdmStore.getCurrentAuthentiation().getAuthorities();
if (!taxonnodePermissionExists){
doEnable = true;
}
- }
+ }
//TODO: differ between the views
this.isEnabled = doEnable;
}
-
-
}
if (taxon.isMisapplication() || taxon.isProparteSynonym() ){
}
}
}
-
-
}
}
+
//unwrap term DTOs
if(element instanceof TermDto){
element = CdmStore.getService(ITermService.class).load(((TermDto) element).getUuid());
null,
e,
true);
-
}
}
-
}
+
reset();
if(thisPart!=null){
thisPart.setLabel(getViewName());
}
}
- /** {@inheritDoc} */
@Override
protected void showParts() {
// FIXME (CM) : Need to clean out this code.
showViewer(structuredSelection, activePart, viewer);
((SupplementalDataViewerE4)viewer).setEnabled(isEnabled());
-
return;
}
else{
}
}
- /**
- * {@inheritDoc}
- */
@Override
protected void showEmptyPage() {
super.showEmptyPage();
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-
package eu.etaxonomy.taxeditor.view.e4.supplementaldata;
import javax.inject.Inject;
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
/**
- *
* @author pplitzner
* @since Aug 10, 2017
- *
*/
public class SupplementalDataViewerE4 extends AbstractCdmDataViewerE4 {
private boolean showDebug;
- /** {@inheritDoc} */
@Override
public ISelection getSelection() {
return null;
}
- /** {@inheritDoc} */
@Override
public void setSelection(ISelection selection, boolean reveal) {
-
}
- /** {@inheritDoc} */
@Override
protected void showParts() {