1 20 21 package org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser; 22 23 24 import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription; 25 import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription; 26 import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleDescription; 27 import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription; 28 import org.eclipse.swt.SWT; 29 import org.eclipse.swt.layout.GridData; 30 import org.eclipse.swt.layout.GridLayout; 31 import org.eclipse.swt.widgets.Composite; 32 import org.eclipse.swt.widgets.Label; 33 import org.eclipse.swt.widgets.Text; 34 import org.eclipse.ui.forms.events.ExpansionAdapter; 35 import org.eclipse.ui.forms.events.ExpansionEvent; 36 import org.eclipse.ui.forms.widgets.FormToolkit; 37 import org.eclipse.ui.forms.widgets.Hyperlink; 38 import org.eclipse.ui.forms.widgets.ScrolledForm; 39 import org.eclipse.ui.forms.widgets.Section; 40 41 42 49 public class AttributeTypeDescriptionDetailsPage extends SchemaDetailsPage 50 { 51 52 53 private Section mainSection; 54 55 56 private Text numericOidText; 57 58 59 private Text namesText; 60 61 62 private Text descText; 63 64 65 private Text usageText; 66 67 68 private Section flagSection; 69 70 71 private Label singleValuedText; 72 73 74 private Label isObsoleteText; 75 76 77 private Label collectiveText; 78 79 80 private Label noUserModificationText; 81 82 83 private Section syntaxSection; 84 85 86 private Text syntaxDescText; 87 88 89 private Text lengthText; 90 91 92 private Hyperlink syntaxLink; 93 94 95 private Section matchingRulesSection; 96 97 98 private Hyperlink equalityLink; 99 100 101 private Hyperlink substringLink; 102 103 104 private Hyperlink orderingLink; 105 106 107 private Section otherMatchSection; 108 109 110 private Hyperlink[] otherMatchLinks; 111 112 113 private Section usedAsMustSection; 114 115 116 private Hyperlink[] usedAsMustLinks; 117 118 119 private Section usedAsMaySection; 120 121 122 private Hyperlink[] usedAsMayLinks; 123 124 125 private Section supertypeSection; 126 127 128 private Hyperlink superLink; 129 130 131 private Section subtypesSection; 132 133 134 private Hyperlink[] subAttributeTypeLinks; 135 136 137 143 public AttributeTypeDescriptionDetailsPage( SchemaPage schemaPage, FormToolkit toolkit ) 144 { 145 super( schemaPage, toolkit ); 146 } 147 148 149 152 protected void createContents( final ScrolledForm detailForm ) 153 { 154 155 this.detailForm = detailForm; 156 detailForm.getBody().setLayout( new GridLayout() ); 157 158 mainSection = toolkit.createSection( detailForm.getBody(), SWT.NONE ); 160 mainSection.setText( "Details" ); 161 mainSection.marginWidth = 0; 162 mainSection.marginHeight = 0; 163 mainSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 164 toolkit.createCompositeSeparator( mainSection ); 165 166 flagSection = toolkit.createSection( detailForm.getBody(), SWT.NONE ); 168 flagSection.setText( "Flags" ); 169 flagSection.marginWidth = 0; 170 flagSection.marginHeight = 0; 171 flagSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 172 toolkit.createCompositeSeparator( flagSection ); 173 174 Composite flagClient = toolkit.createComposite( flagSection, SWT.WRAP ); 176 GridLayout flagLayout = new GridLayout(); 177 flagLayout.numColumns = 4; 178 flagLayout.marginWidth = 0; 179 flagLayout.marginHeight = 0; 180 flagClient.setLayout( flagLayout ); 181 flagSection.setClient( flagClient ); 182 183 singleValuedText = toolkit.createLabel( flagClient, "Single valued", SWT.CHECK ); 184 singleValuedText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 185 singleValuedText.setEnabled( false ); 186 187 noUserModificationText = toolkit.createLabel( flagClient, "Read only", SWT.CHECK ); 188 noUserModificationText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 189 noUserModificationText.setEnabled( false ); 190 191 collectiveText = toolkit.createLabel( flagClient, "Collective", SWT.CHECK ); 192 collectiveText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 193 collectiveText.setEnabled( false ); 194 195 isObsoleteText = toolkit.createLabel( flagClient, "Obsolete", SWT.CHECK ); 196 isObsoleteText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 197 isObsoleteText.setEnabled( false ); 198 199 syntaxSection = toolkit.createSection( detailForm.getBody(), SWT.NONE ); 201 syntaxSection.setText( "Syntax" ); 202 syntaxSection.marginWidth = 0; 203 syntaxSection.marginHeight = 0; 204 syntaxSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 205 toolkit.createCompositeSeparator( syntaxSection ); 206 207 Composite syntaxClient = toolkit.createComposite( syntaxSection, SWT.WRAP ); 209 GridLayout syntaxLayout = new GridLayout(); 210 syntaxLayout.numColumns = 2; 211 syntaxLayout.marginWidth = 0; 212 syntaxLayout.marginHeight = 0; 213 syntaxClient.setLayout( syntaxLayout ); 214 syntaxSection.setClient( syntaxClient ); 215 216 toolkit.createLabel( syntaxClient, "Syntax OID:", SWT.NONE ); 217 syntaxLink = toolkit.createHyperlink( syntaxClient, "", SWT.WRAP ); 218 syntaxLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 219 syntaxLink.addHyperlinkListener( this ); 220 221 toolkit.createLabel( syntaxClient, "Syntax Description:", SWT.NONE ); 222 syntaxDescText = toolkit.createText( syntaxClient, "", SWT.NONE ); 223 syntaxDescText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 224 syntaxDescText.setEditable( false ); 225 226 toolkit.createLabel( syntaxClient, "Length:", SWT.NONE ); 227 lengthText = toolkit.createText( syntaxClient, "", SWT.NONE ); 228 lengthText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 229 lengthText.setEditable( false ); 230 231 matchingRulesSection = toolkit.createSection( detailForm.getBody(), SWT.NONE ); 233 matchingRulesSection.setText( "Matching Rules" ); 234 matchingRulesSection.marginWidth = 0; 235 matchingRulesSection.marginHeight = 0; 236 matchingRulesSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 237 toolkit.createCompositeSeparator( matchingRulesSection ); 238 239 Composite matchClient = toolkit.createComposite( matchingRulesSection, SWT.WRAP ); 241 GridLayout matchLayout = new GridLayout(); 242 matchLayout.numColumns = 2; 243 matchLayout.marginWidth = 0; 244 matchLayout.marginHeight = 0; 245 matchClient.setLayout( matchLayout ); 246 matchingRulesSection.setClient( matchClient ); 247 248 toolkit.createLabel( matchClient, "Equality match:", SWT.NONE ); 249 equalityLink = toolkit.createHyperlink( matchClient, "", SWT.WRAP ); 250 equalityLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 251 equalityLink.addHyperlinkListener( this ); 252 253 toolkit.createLabel( matchClient, "Substring match:", SWT.NONE ); 254 substringLink = toolkit.createHyperlink( matchClient, "", SWT.WRAP ); 255 substringLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 256 substringLink.addHyperlinkListener( this ); 257 258 toolkit.createLabel( matchClient, "Ordering match:", SWT.NONE ); 259 orderingLink = toolkit.createHyperlink( matchClient, "", SWT.WRAP ); 260 orderingLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 261 orderingLink.addHyperlinkListener( this ); 262 263 otherMatchSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE ); 265 otherMatchSection.setText( "Other Matching Rules" ); 266 otherMatchSection.marginWidth = 0; 267 otherMatchSection.marginHeight = 0; 268 otherMatchSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 269 toolkit.createCompositeSeparator( otherMatchSection ); 270 otherMatchSection.addExpansionListener( new ExpansionAdapter() 271 { 272 public void expansionStateChanged( ExpansionEvent e ) 273 { 274 detailForm.reflow( true ); 275 } 276 } ); 277 278 usedAsMustSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE ); 280 usedAsMustSection.setText( "Used as MUST" ); 281 usedAsMustSection.marginWidth = 0; 282 usedAsMustSection.marginHeight = 0; 283 usedAsMustSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 284 toolkit.createCompositeSeparator( usedAsMustSection ); 285 usedAsMustSection.addExpansionListener( new ExpansionAdapter() 286 { 287 public void expansionStateChanged( ExpansionEvent e ) 288 { 289 detailForm.reflow( true ); 290 } 291 } ); 292 293 usedAsMaySection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE ); 295 usedAsMaySection.setText( "Used as MAY" ); 296 usedAsMaySection.marginWidth = 0; 297 usedAsMaySection.marginHeight = 0; 298 usedAsMaySection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 299 toolkit.createCompositeSeparator( usedAsMaySection ); 300 usedAsMaySection.addExpansionListener( new ExpansionAdapter() 301 { 302 public void expansionStateChanged( ExpansionEvent e ) 303 { 304 detailForm.reflow( true ); 305 } 306 } ); 307 308 supertypeSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE ); 310 supertypeSection.setText( "Supertype" ); 311 supertypeSection.marginWidth = 0; 312 supertypeSection.marginHeight = 0; 313 supertypeSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 314 toolkit.createCompositeSeparator( supertypeSection ); 315 supertypeSection.addExpansionListener( new ExpansionAdapter() 316 { 317 public void expansionStateChanged( ExpansionEvent e ) 318 { 319 detailForm.reflow( true ); 320 } 321 } ); 322 323 subtypesSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE ); 325 subtypesSection.setText( "Subtypes" ); 326 subtypesSection.marginWidth = 0; 327 subtypesSection.marginHeight = 0; 328 subtypesSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 329 toolkit.createCompositeSeparator( subtypesSection ); 330 subtypesSection.addExpansionListener( new ExpansionAdapter() 331 { 332 public void expansionStateChanged( ExpansionEvent e ) 333 { 334 detailForm.reflow( true ); 335 } 336 } ); 337 338 createRawSection(); 340 } 341 342 343 346 public void setInput( Object input ) 347 { 348 AttributeTypeDescription atd = null; 349 if ( input instanceof AttributeTypeDescription ) 350 { 351 atd = ( AttributeTypeDescription ) input; 352 } 353 354 createMainContent( atd ); 356 357 singleValuedText.setEnabled( atd != null && atd.isSingleValued() ); 359 isObsoleteText.setEnabled( atd != null && atd.isObsolete() ); 360 collectiveText.setEnabled( atd != null && atd.isCollective() ); 361 noUserModificationText.setEnabled( atd != null && atd.isNoUserModification() ); 362 flagSection.layout(); 363 364 String lsdOid = null; 366 LdapSyntaxDescription lsd = null; 367 String lsdLength = null; 368 if ( atd != null ) 369 { 370 lsdOid = atd.getSyntaxDescriptionNumericOIDTransitive(); 371 if ( lsdOid != null && atd.getSchema().hasLdapSyntaxDescription( lsdOid ) ) 372 { 373 lsd = atd.getSchema().getLdapSyntaxDescription( lsdOid ); 374 } 375 lsdLength = atd.getSyntaxDescriptionLengthTransitive(); 376 } 377 syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOID() : lsdOid ) ); 378 syntaxLink.setHref( lsd ); 379 syntaxLink.setUnderlined( lsd != null ); 380 syntaxLink.setEnabled( lsd != null ); 381 syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDesc() : null ) ); 382 lengthText.setText( getNonNullString( lsdLength ) ); 383 syntaxSection.layout(); 384 385 String emrOid = null; 387 MatchingRuleDescription emr = null; 388 if ( atd != null ) 389 { 390 emrOid = atd.getEqualityMatchingRuleDescriptionOIDTransitive(); 391 if ( emrOid != null && atd.getSchema().hasMatchingRuleDescription( emrOid ) ) 392 { 393 emr = atd.getSchema().getMatchingRuleDescription( emrOid ); 394 } 395 } 396 equalityLink.setText( getNonNullString( emr != null ? emr.toString() : emrOid ) ); 397 equalityLink.setHref( emr ); 398 equalityLink.setUnderlined( emr != null ); 399 equalityLink.setEnabled( emr != null ); 400 401 String smrOid = null; 402 MatchingRuleDescription smr = null; 403 if ( atd != null ) 404 { 405 smrOid = atd.getSubstringMatchingRuleDescriptionOIDTransitive(); 406 if ( smrOid != null && atd.getSchema().hasMatchingRuleDescription( smrOid ) ) 407 { 408 smr = atd.getSchema().getMatchingRuleDescription( smrOid ); 409 } 410 } 411 substringLink.setText( getNonNullString( smr != null ? smr.toString() : smrOid ) ); 412 substringLink.setHref( smr ); 413 substringLink.setUnderlined( smr != null ); 414 substringLink.setEnabled( smr != null ); 415 416 String omrOid = null; 417 MatchingRuleDescription omr = null; 418 if ( atd != null ) 419 { 420 omrOid = atd.getOrderingMatchingRuleDescriptionOIDTransitive(); 421 if ( omrOid != null && atd.getSchema().hasMatchingRuleDescription( omrOid ) ) 422 { 423 omr = atd.getSchema().getMatchingRuleDescription( omrOid ); 424 } 425 } 426 orderingLink.setText( getNonNullString( omr != null ? omr.toString() : omrOid ) ); 427 orderingLink.setHref( omr ); 428 orderingLink.setUnderlined( omr != null ); 429 orderingLink.setEnabled( omr != null ); 430 matchingRulesSection.layout(); 431 432 createOtherMatchContent( atd ); 434 createUsedAsMustContent( atd ); 435 createUsedAsMayContent( atd ); 436 createSupertypeContent( atd ); 437 createSubtypesContent( atd ); 438 createRawContents( atd ); 439 440 detailForm.reflow( true ); 441 } 442 443 444 451 private void createMainContent( AttributeTypeDescription atd ) 452 { 453 if ( mainSection.getClient() != null ) 455 { 456 mainSection.getClient().dispose(); 457 } 458 459 Composite mainClient = toolkit.createComposite( mainSection, SWT.WRAP ); 461 GridLayout mainLayout = new GridLayout( 2, false ); 462 mainClient.setLayout( mainLayout ); 463 mainSection.setClient( mainClient ); 464 465 if ( atd != null ) 467 { 468 toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE ); 469 numericOidText = toolkit.createText( mainClient, getNonNullString( atd.getNumericOID() ), SWT.NONE ); 470 numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 471 numericOidText.setEditable( false ); 472 473 toolkit.createLabel( mainClient, "Attribute names:", SWT.NONE ); 474 namesText = toolkit.createText( mainClient, getNonNullString( atd.toString() ), SWT.NONE ); 475 namesText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 476 namesText.setEditable( false ); 477 478 toolkit.createLabel( mainClient, "Descripton:", SWT.WRAP ); 479 descText = toolkit.createText( mainClient, getNonNullString( atd.getDesc() ), SWT.WRAP | SWT.MULTI ); 480 GridData gd = new GridData( GridData.FILL_HORIZONTAL ); 481 gd.widthHint = detailForm.getForm().getSize().x - 100 - 60; 482 descText.setLayoutData( gd ); 483 descText.setEditable( false ); 484 485 toolkit.createLabel( mainClient, "Usage:", SWT.NONE ); 486 usageText = toolkit.createText( mainClient, getNonNullString( atd.getUsage() ), SWT.NONE ); 487 usageText.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL ) ); 488 usageText.setEditable( false ); 489 490 } 491 492 mainSection.layout(); 493 } 494 495 496 503 private void createOtherMatchContent( AttributeTypeDescription atd ) 504 { 505 if ( otherMatchSection.getClient() != null ) 507 { 508 otherMatchSection.getClient().dispose(); 509 } 510 511 Composite otherMatchClient = toolkit.createComposite( otherMatchSection, SWT.WRAP ); 513 otherMatchClient.setLayout( new GridLayout() ); 514 otherMatchSection.setClient( otherMatchClient ); 515 516 if ( atd != null ) 519 { 520 String [] names = atd.getOtherMatchingRuleDescriptionNames(); 521 if ( names != null && names.length > 0 ) 522 { 523 otherMatchSection.setText( "Other Matching Rules (" + names.length + ")" ); 524 otherMatchLinks = new Hyperlink[names.length]; 525 for ( int i = 0; i < names.length; i++ ) 526 { 527 if ( atd.getSchema().hasMatchingRuleDescription( names[i] ) ) 528 { 529 MatchingRuleDescription mrd = atd.getSchema().getMatchingRuleDescription( names[i] ); 530 otherMatchLinks[i] = toolkit.createHyperlink( otherMatchClient, mrd.toString(), SWT.WRAP ); 531 otherMatchLinks[i].setHref( mrd ); 532 otherMatchLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 533 otherMatchLinks[i].setUnderlined( true ); 534 otherMatchLinks[i].setEnabled( true ); 535 otherMatchLinks[i].addHyperlinkListener( this ); 536 } 537 else 538 { 539 otherMatchLinks[i] = toolkit.createHyperlink( otherMatchClient, names[i], SWT.WRAP ); 540 otherMatchLinks[i].setHref( null ); 541 otherMatchLinks[i].setUnderlined( false ); 542 otherMatchLinks[i].setEnabled( false ); 543 } 544 } 545 } 546 else 547 { 548 otherMatchSection.setText( "Other Matching Rules (0)" ); 549 otherMatchLinks = new Hyperlink[0]; 550 Text otherText = toolkit.createText( otherMatchClient, getNonNullString( null ), SWT.NONE ); 551 otherText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 552 otherText.setEditable( false ); 553 } 554 } 555 else 556 { 557 otherMatchSection.setText( "Other Matching Rules" ); 558 } 559 560 otherMatchSection.layout(); 561 } 562 563 564 571 private void createSupertypeContent( AttributeTypeDescription atd ) 572 { 573 if ( supertypeSection.getClient() != null ) 575 { 576 supertypeSection.getClient().dispose(); 577 } 578 579 Composite superClient = toolkit.createComposite( supertypeSection, SWT.WRAP ); 581 superClient.setLayout( new GridLayout() ); 582 supertypeSection.setClient( superClient ); 583 584 if ( atd != null ) 587 { 588 String superName = atd.getSuperiorAttributeTypeDescriptionName(); 589 if ( superName != null ) 590 { 591 supertypeSection.setText( "Supertype (" + "1" + ")" ); 592 if ( atd.getSchema().hasAttributeTypeDescription( superName ) ) 593 { 594 AttributeTypeDescription supAtd = atd.getSchema().getAttributeTypeDescription( superName ); 595 superLink = toolkit.createHyperlink( superClient, supAtd.toString(), SWT.WRAP ); 596 superLink.setHref( supAtd ); 597 superLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 598 superLink.setUnderlined( true ); 599 superLink.setEnabled( true ); 600 superLink.addHyperlinkListener( this ); 601 } 602 else 603 { 604 superLink = toolkit.createHyperlink( superClient, superName, SWT.WRAP ); 605 superLink.setHref( null ); 606 superLink.setUnderlined( false ); 607 superLink.setEnabled( false ); 608 } 609 } 610 else 611 { 612 supertypeSection.setText( "Supertype (0)" ); 613 superLink = null; 614 Text supText = toolkit.createText( superClient, getNonNullString( null ), SWT.NONE ); 615 supText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 616 supText.setEditable( false ); 617 } 618 } 619 else 620 { 621 supertypeSection.setText( "Supertype" ); 622 } 623 624 supertypeSection.layout(); 625 } 626 627 628 635 private void createSubtypesContent( AttributeTypeDescription atd ) 636 { 637 if ( subtypesSection.getClient() != null ) 639 { 640 subtypesSection.getClient().dispose(); 641 } 642 643 Composite subClient = toolkit.createComposite( subtypesSection, SWT.WRAP ); 645 subClient.setLayout( new GridLayout() ); 646 subtypesSection.setClient( subClient ); 647 648 if ( atd != null ) 650 { 651 AttributeTypeDescription[] subATDs = atd.getDerivedAttributeTypeDescriptions(); 652 if ( subATDs != null && subATDs.length > 0 ) 653 { 654 subtypesSection.setText( "Subtypes (" + subATDs.length + ")" ); 655 subAttributeTypeLinks = new Hyperlink[subATDs.length]; 656 for ( int i = 0; i < subATDs.length; i++ ) 657 { 658 subAttributeTypeLinks[i] = toolkit.createHyperlink( subClient, subATDs[i].toString(), SWT.WRAP ); 659 subAttributeTypeLinks[i].setHref( subATDs[i] ); 660 subAttributeTypeLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 661 subAttributeTypeLinks[i].setUnderlined( true ); 662 subAttributeTypeLinks[i].setEnabled( true ); 663 subAttributeTypeLinks[i].addHyperlinkListener( this ); 664 } 665 } 666 else 667 { 668 subtypesSection.setText( "Subtypes (0)" ); 669 subAttributeTypeLinks = new Hyperlink[0]; 670 Text subText = toolkit.createText( subClient, getNonNullString( null ), SWT.NONE ); 671 subText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 672 subText.setEditable( false ); 673 } 674 } 675 else 676 { 677 subtypesSection.setText( "Subtypes" ); 678 } 679 680 subtypesSection.layout(); 681 682 } 683 684 685 692 private void createUsedAsMustContent( AttributeTypeDescription atd ) 693 { 694 if ( usedAsMustSection.getClient() != null ) 696 { 697 usedAsMustSection.getClient().dispose(); 698 } 699 700 Composite mustClient = toolkit.createComposite( usedAsMustSection, SWT.WRAP ); 702 mustClient.setLayout( new GridLayout() ); 703 usedAsMustSection.setClient( mustClient ); 704 705 if ( atd != null ) 707 { 708 ObjectClassDescription[] usedAsMusts = atd.getUsedAsMust(); 709 if ( usedAsMusts != null && usedAsMusts.length > 0 ) 710 { 711 usedAsMustSection.setText( "Used as MUST (" + usedAsMusts.length + ")" ); 712 usedAsMustLinks = new Hyperlink[usedAsMusts.length]; 713 for ( int i = 0; i < usedAsMusts.length; i++ ) 714 { 715 usedAsMustLinks[i] = toolkit.createHyperlink( mustClient, usedAsMusts[i].toString(), SWT.WRAP ); 716 usedAsMustLinks[i].setHref( usedAsMusts[i] ); 717 usedAsMustLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 718 usedAsMustLinks[i].setUnderlined( true ); 719 usedAsMustLinks[i].setEnabled( true ); 720 usedAsMustLinks[i].addHyperlinkListener( this ); 721 } 722 } 723 else 724 { 725 usedAsMustSection.setText( "Used as MUST (0)" ); 726 usedAsMustLinks = new Hyperlink[0]; 727 Text mustText = toolkit.createText( mustClient, getNonNullString( null ), SWT.NONE ); 728 mustText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 729 mustText.setEditable( false ); 730 } 731 } 732 else 733 { 734 usedAsMustSection.setText( "Used as MUST" ); 735 } 736 737 usedAsMustSection.layout(); 738 739 } 740 741 742 749 private void createUsedAsMayContent( AttributeTypeDescription atd ) 750 { 751 if ( usedAsMaySection.getClient() != null ) 753 { 754 usedAsMaySection.getClient().dispose(); 755 } 756 757 Composite mayClient = toolkit.createComposite( usedAsMaySection, SWT.WRAP ); 759 mayClient.setLayout( new GridLayout() ); 760 usedAsMaySection.setClient( mayClient ); 761 762 if ( atd != null ) 764 { 765 ObjectClassDescription[] usedAsMays = atd.getUsedAsMay(); 766 if ( usedAsMays != null && usedAsMays.length > 0 ) 767 { 768 usedAsMaySection.setText( "Used as MAY (" + usedAsMays.length + ")" ); 769 usedAsMayLinks = new Hyperlink[usedAsMays.length]; 770 for ( int i = 0; i < usedAsMays.length; i++ ) 771 { 772 usedAsMayLinks[i] = toolkit.createHyperlink( mayClient, usedAsMays[i].toString(), SWT.WRAP ); 773 usedAsMayLinks[i].setHref( usedAsMays[i] ); 774 usedAsMayLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 775 usedAsMayLinks[i].setUnderlined( true ); 776 usedAsMayLinks[i].setEnabled( true ); 777 usedAsMayLinks[i].addHyperlinkListener( this ); 778 } 779 } 780 else 781 { 782 usedAsMaySection.setText( "Used as MAY (0)" ); 783 usedAsMayLinks = new Hyperlink[0]; 784 Text mayText = toolkit.createText( mayClient, getNonNullString( null ), SWT.NONE ); 785 mayText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); 786 mayText.setEditable( false ); 787 } 788 } 789 else 790 { 791 usedAsMaySection.setText( "Used as MAY" ); 792 } 793 794 usedAsMaySection.layout(); 795 } 796 797 } 798 | Popular Tags |