KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > schema > TypeRestrictionCellEditor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.editor.schema;
12
13 import org.eclipse.pde.internal.core.ischema.*;
14 import org.eclipse.swt.widgets.*;
15 import org.eclipse.jface.viewers.*;
16 import org.eclipse.swt.*;
17 import org.eclipse.pde.internal.ui.PDEUIMessages;
18 import org.eclipse.pde.internal.ui.util.SWTUtil;
19
20 public class TypeRestrictionCellEditor extends DialogCellEditor {
21     private Label label;
22     protected TypeRestrictionCellEditor(Composite parent) {
23     super(parent);
24 }
25 protected Control createContents(Composite cell) {
26     label = new Label(cell, SWT.LEFT);
27     label.setFont(cell.getFont());
28     label.setBackground(cell.getBackground());
29     return label;
30 }
31 protected Object JavaDoc openDialogBox(Control cellEditorWindow) {
32     Object JavaDoc value = getValue();
33     TypeRestrictionDialog dialog =
34         new TypeRestrictionDialog(
35             cellEditorWindow.getShell(),
36             (ISchemaRestriction) value);
37     dialog.create();
38     SWTUtil.setDialogSize(dialog, 300, 350);
39     dialog.getShell().setText(PDEUIMessages.RestrictionDialog_wtitle);
40     int result = dialog.open();
41     if (result == TypeRestrictionDialog.OK) {
42         value = dialog.getValue();
43     }
44     return value;
45 }
46 protected void updateContents(Object JavaDoc value) {
47     if (value != null)
48         label.setText(value.toString());
49     else
50         label.setText(""); //$NON-NLS-1$
51
}
52 }
53
Popular Tags