KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > browser > ui > dialogs > properties > SubSchemaPropertyPage


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 package org.apache.directory.ldapstudio.browser.ui.dialogs.properties;
22
23
24 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
25
26 import org.eclipse.jface.viewers.ArrayContentProvider;
27 import org.eclipse.jface.viewers.LabelProvider;
28 import org.eclipse.jface.viewers.ListViewer;
29 import org.eclipse.swt.SWT;
30 import org.eclipse.swt.layout.GridData;
31 import org.eclipse.swt.layout.GridLayout;
32 import org.eclipse.swt.layout.RowData;
33 import org.eclipse.swt.layout.RowLayout;
34 import org.eclipse.swt.widgets.Composite;
35 import org.eclipse.swt.widgets.Control;
36 import org.eclipse.swt.widgets.TabFolder;
37 import org.eclipse.swt.widgets.TabItem;
38 import org.eclipse.ui.IWorkbenchPropertyPage;
39 import org.eclipse.ui.dialogs.PropertyPage;
40
41
42 public class SubSchemaPropertyPage extends PropertyPage implements IWorkbenchPropertyPage
43 {
44
45     private TabFolder tabFolder;
46
47     private TabItem ocTab;
48
49     private TabItem atTab;
50
51
52     public SubSchemaPropertyPage()
53     {
54         super();
55         super.noDefaultAndApplyButton();
56     }
57
58
59     protected Control createContents( Composite parent )
60     {
61
62         this.tabFolder = new TabFolder( parent, SWT.TOP );
63         RowLayout mainLayout = new RowLayout();
64         mainLayout.fill = true;
65         mainLayout.marginWidth = 0;
66         mainLayout.marginHeight = 0;
67         this.tabFolder.setLayout( mainLayout );
68
69         Composite ocComposite = new Composite( this.tabFolder, SWT.NONE );
70         ocComposite.setLayoutData( new RowData( 10, 10 ) );
71         GridLayout ocLayout = new GridLayout();
72         ocComposite.setLayout( ocLayout );
73         ListViewer ocViewer = new ListViewer( ocComposite );
74         ocViewer.getList().setLayoutData( new GridData( GridData.FILL_BOTH ) );
75         ocViewer.setContentProvider( new ArrayContentProvider() );
76         ocViewer.setLabelProvider( new LabelProvider() );
77         if ( EntryPropertyPage.getEntry( getElement() ) != null )
78         {
79             IEntry entry = EntryPropertyPage.getEntry( getElement() );
80             if ( entry != null )
81             {
82                 Object JavaDoc[] ocds = entry.getSubschema().getObjectClassNames();
83                 ocViewer.setInput( ocds );
84             }
85         }
86         this.ocTab = new TabItem( this.tabFolder, SWT.NONE );
87         this.ocTab.setText( "Object Classes" );
88         this.ocTab.setControl( ocComposite );
89
90         Composite atComposite = new Composite( this.tabFolder, SWT.NONE );
91         atComposite.setLayoutData( new RowData( 10, 10 ) );
92         GridLayout atLayout = new GridLayout();
93         atComposite.setLayout( atLayout );
94         ListViewer atViewer = new ListViewer( atComposite );
95         atViewer.getList().setLayoutData( new GridData( GridData.FILL_BOTH ) );
96         atViewer.setContentProvider( new ArrayContentProvider() );
97         atViewer.setLabelProvider( new LabelProvider() );
98         if ( EntryPropertyPage.getEntry( getElement() ) != null )
99         {
100             IEntry entry = EntryPropertyPage.getEntry( getElement() );
101             if ( entry != null )
102             {
103                 Object JavaDoc[] atds = entry.getSubschema().getAllAttributeNames();
104                 atViewer.setInput( atds );
105             }
106         }
107         this.atTab = new TabItem( this.tabFolder, SWT.NONE );
108         this.atTab.setText( "Attribute Types" );
109         this.atTab.setControl( atComposite );
110
111         return this.tabFolder;
112     }
113
114 }
115
Popular Tags