Project

General

Profile

« Previous | Next » 

Revision f3fb72fd

Added by Patrick Plitzner over 7 years ago

fix #6062 Add property tester for "Open in..." bulk editor menu items

  • moved isGroupEditor property test to bulk editor plugin

View differences:

eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
310 310
            name="%command.name.OPEN_BULK_EDITOR_FOR_TAXON_NODE">
311 311
      </command>
312 312
      <command
313
            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntity"
314 313
            id="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"
315 314
            name="Open bulk editor for identifiable entity">
316 315
         <commandParameter
......
435 434
            </test>
436 435
         </with>
437 436
      </definition>
437
      <definition
438
            id="isBulkEditorSupported">
439
         <with
440
               variable="selection">
441
            <test
442
                  property="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester.isBulkEditorSupported">
443
            </test>
444
         </with>
445
      </definition>
446
      <definition
447
            id="isGroupEditor">
448
         <with
449
               variable="activeEditor">
450
            <test
451
                  property="taxeditor-bulkeditor.propertyTester.isGroupEditor">
452
            </test>
453
         </with>
454
      </definition>
438 455
   </extension>
439 456
   <extension
440 457
         point="org.eclipse.core.expressions.propertyTesters">
......
452 469
            properties="isTeam, isPerson"
453 470
            type="java.lang.Object">
454 471
      </propertyTester>
472
      <propertyTester
473
            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester"
474
            id="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester"
475
            namespace="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester"
476
            properties="isBulkEditorSupported"
477
            type="org.eclipse.jface.viewers.IStructuredSelection">
478
      </propertyTester>
455 479
   </extension>
456 480
   <extension
457 481
         point="org.eclipse.ui.handlers">
......
511 535
            class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertPerson2TeamHandler"
512 536
            commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team">
513 537
      </handler>
538
      <handler
539
            class="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntity"
540
            commandId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity">
541
         <activeWhen>
542
            <reference
543
                  definitionId="isBulkEditorSupported">
544
            </reference>
545
         </activeWhen>
546
      </handler>
514 547
      
515 548
   </extension>
516 549
   <extension
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java
1
package eu.etaxonomy.taxeditor.bulkeditor.command;
2

  
3
import org.eclipse.core.expressions.PropertyTester;
4
import org.eclipse.jface.viewers.IStructuredSelection;
5

  
6
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
7

  
8
public class BulkEditorSelectionPropertyTester extends PropertyTester {
9

  
10
    public static final String IS_BULK_EDITOR_SUPPORTED = "isBulkEditorSupported";
11
    
12
	@Override
13
	public boolean test(Object receiver, String property, Object[] args,
14
			Object expectedValue) {
15
		if(IS_BULK_EDITOR_SUPPORTED.equals(property)){
16
			if(receiver instanceof IStructuredSelection){
17
				IStructuredSelection selection = (IStructuredSelection) receiver;
18
				Object selectedElement = selection.getFirstElement();
19
				if(selectedElement!=null){
20
					return BulkEditorInputType.getByType(selectedElement.getClass())!=null;
21
				}
22
			}
23
		}
24
		return false;
25
	}
26
	
27
}
eu.etaxonomy.taxeditor.editor/plugin.xml
1882 1882
            </test>
1883 1883
         </with>
1884 1884
      </definition>
1885
      <definition
1886
            id="isGroupEditor">
1887
         <with
1888
               variable="activeEditor">
1889
            <test
1890
                  property="taxeditor-bulkeditor.propertyTester.isGroupEditor">
1891
            </test>
1892
         </with>
1893
      </definition>
1894 1885
      <definition
1895 1886
            id="isIndividualsAssociation">
1896 1887
         <with
......
1978 1969
            properties="isMedia,isDescription,isDescriptionElement,isDeletable,isFeatureNodeContainer,isImageGallery,isTaxonEditor,isBulkEditor,isDerivateEditor, isIndividualsAssociation"
1979 1970
            type="org.eclipse.jface.viewers.TreeSelection">
1980 1971
      </propertyTester>
1981
      <propertyTester
1982
            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"
1983
            id="taxeditor-bulkeditor.PropertyTester"
1984
            namespace="taxeditor-bulkeditor.propertyTester"
1985
            properties="isGroupEditor"
1986
            type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">
1987
      </propertyTester>
1988 1972
      <propertyTester
1989 1973
            class="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester"
1990 1974
            id="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester"

Also available in: Unified diff