Project

General

Profile

« Previous | Next » 

Revision 50fa099c

Added by Katja Luther almost 10 years ago

editor changes for red list project (datasource view and create new datasource from file menu)

View differences:

eu.etaxonomy.taxeditor.editor/plugin.xml
167 167
               label="Specimen"
168 168
               style="push">
169 169
         </command>
170
         <separator
171
               name="eu.etaxonomy.navigation.menu.new.separator3">
172
         </separator>
173
         <command
174
               commandId="eu.etaxonomy.taxeditor.editor.command.new.datasource"
175
               label="Datasource"
176
               style="push">
177
         </command>
170 178
      </menuContribution>
171 179
      <menuContribution
172 180
            locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?before=eu.etaxonomy.taxeditor.store.showViewMenu.details">
......
1118 1126
            id="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
1119 1127
            name="Open Derivate View">
1120 1128
      </command>
1129
      <command
1130
            categoryId="eu.etaxonomy.taxeditor.editor.new.category"
1131
            defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.CreateDataSourceHandler"
1132
            id="eu.etaxonomy.taxeditor.editor.command.new.datasource"
1133
            name="New Datasource">
1134
      </command>
1121 1135

  
1122 1136
   </extension>
1123 1137
   <extension
eu.etaxonomy.taxeditor.store/plugin.xml
354 354
               commandId="eu.etaxonomy.taxeditor.store.datasource.change"
355 355
               label="Connect"
356 356
               style="push">
357
               <visibleWhen>
358
              <with
359
           		 variable="selection">
360
           		 <not>
361
         			<test
362
               			property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
363
         			</test>
364
	      		</not>
365
          		</with>
366
            </visibleWhen>
357 367
         </command>
358 368
         <command
359 369
               commandId="eu.etaxonomy.taxeditor.store.datasource.create"
......
364 374
               commandId="eu.etaxonomy.taxeditor.store.datasource.edit"
365 375
               label="Edit"
366 376
               style="push">
377
                <visibleWhen>
378
              <with
379
           		 variable="selection">
380
           		 <not>
381
         			<test
382
               			property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
383
         			</test>
384
	      		</not>
385
          		</with>
386
            </visibleWhen>
367 387
         </command>
368 388
         <command
369 389
               commandId="eu.etaxonomy.taxeditor.store.datasource.clone"
370 390
               label="Clone"
371 391
               style="push">
392
                <visibleWhen>
393
              <with
394
           		 variable="selection">
395
           		 <not>
396
         			<test
397
               			property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
398
         			</test>
399
	      		</not>
400
          		</with>
401
            </visibleWhen>
372 402
         </command>
373 403
         <separator
374 404
               name="eu.etaxonomy.taxeditor.store.datasource.separator"
......
378 408
               commandId="org.eclipse.ui.edit.delete"
379 409
               label="Delete"
380 410
               style="push">
411
               <visibleWhen>
412
              <with
413
           		 variable="selection">
414
           		 <not>
415
         			<test
416
               			property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
417
         			</test>
418
	      		</not>
419
          		</with>
420
            </visibleWhen>
381 421
         </command>
382 422
         <separator
383 423
               name="eu.etaxonomy.taxeditor.store.datasource.separator2"
......
387 427
               commandId="eu.etaxonomy.taxeditor.store.datasource.close"
388 428
               label="Close Active Connection"
389 429
               style="push">
430
               <visibleWhen>
431
              <with
432
           		 variable="selection">
433
           		 <not>
434
         			<test
435
               			property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
436
         			</test>
437
	      		</not>
438
          		</with>
439
            </visibleWhen>
390 440
         </command>
391 441
         <command
392 442
               commandId="eu.etaxonomy.taxeditor.store.datasource.update"
......
400 450
                  </reference>
401 451
               </not>
402 452
            </visibleWhen>
453
            
403 454
         </command>
404 455
      </menuContribution>
405 456
      <menuContribution
......
497 548
            </reference></enabledWhen>
498 549
      </handler>
499 550
   </extension>
551
   <extension
552
         point="org.eclipse.ui.commands">
553
      <command
554
            defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
555
            id="eu.etaxonomy.taxeditor.datasource.connect"
556
            name="Connect">
557
      </command>
558
   </extension>
500 559
   <extension
501 560
         name="Popup Menu Commands"
502 561
         point="org.eclipse.ui.commands">
......
921 980
         namespace="eu.etaxonomy.taxeditor.datasource.propertyTester"
922 981
         properties="isCompatible"
923 982
         type="org.eclipse.jface.viewers.IStructuredSelection">
983
   </propertyTester>
984
    <propertyTester
985
         class="eu.etaxonomy.taxeditor.view.datasource.handler.DataSourceMenuPropertyTester"
986
         id="eu.etaxonomy.taxeditor.datasource.propertyTester"
987
         namespace="eu.etaxonomy.taxeditor.datasource.propertyTester"
988
         properties="test"
989
         type="org.eclipse.jface.viewers.IStructuredSelection">
924 990
   </propertyTester>
925 991
   <propertyTester
926 992
         class="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/DataSourceMenuPropertyTester.java
25 25
public class DataSourceMenuPropertyTester extends PropertyTester {
26 26

  
27 27
	private static final String COMPATIBLE = "isCompatible";
28
	private static final String TEST = "test";
28 29

  
29 30
	/*
30 31
	 * (non-Javadoc)
......
39 40

  
40 41
		Object[] selectedElements = ((IStructuredSelection) receiver).toArray();
41 42

  
42
		if (selectedElements.length == 0) {
43
		if (selectedElements.length == 0 && property.equals(TEST)) {
43 44
			// nothing selected so all tests should fail
44
			return false;
45
			return true;
46
		}
47
		if (selectedElements.length == 0 && COMPATIBLE.equals(property)) {
48
			// nothing selected so all tests should fail
49
			return true;
45 50
		}
46 51

  
47 52
		if (COMPATIBLE.equals(property)) {
48 53
			return isCompatible(selectedElements);
49 54
		}
50 55
		
56
		
57
		
51 58

  
52 59
		return false;
53 60
	}
......
59 66
	 * @return
60 67
	 */
61 68
	private boolean isCompatible(Object[] selectedElements) {
69
		
70
		if (selectedElements.length == 0 ) {
71
			// nothing selected so all tests should fail
72
			return false;
73
		}
62 74
		for (Object object : selectedElements) {
63 75

  
64 76
			if (object instanceof CdmMetaDataAwareDataSourceContainer) {
......
67 79
			}
68 80
		}
69 81
		return false;
82
		
70 83
	}
71 84
}

Also available in: Unified diff