1 11 package org.eclipse.jdt.ui.wizards; 12 13 import org.eclipse.core.runtime.IStatus; 14 15 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.layout.GridLayout; 17 import org.eclipse.swt.widgets.Composite; 18 19 import org.eclipse.jface.dialogs.Dialog; 20 import org.eclipse.jface.viewers.IStructuredSelection; 21 22 import org.eclipse.ui.PlatformUI; 23 24 import org.eclipse.jdt.core.IJavaElement; 25 26 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 27 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; 28 29 38 public class NewInterfaceWizardPage extends NewTypeWizardPage { 39 40 private final static String PAGE_NAME= "NewInterfaceWizardPage"; 42 45 public NewInterfaceWizardPage() { 46 super(false, PAGE_NAME); 47 48 setTitle(NewWizardMessages.NewInterfaceWizardPage_title); 49 setDescription(NewWizardMessages.NewInterfaceWizardPage_description); 50 } 51 52 54 61 public void init(IStructuredSelection selection) { 62 IJavaElement jelem= getInitialJavaElement(selection); 63 64 initContainerPage(jelem); 65 initTypePage(jelem); 66 doStatusUpdate(); 67 } 68 69 71 private void doStatusUpdate() { 72 IStatus[] status= new IStatus[] { 74 fContainerStatus, 75 isEnclosingTypeSelected() ? fEnclosingTypeStatus : fPackageStatus, 76 fTypeNameStatus, 77 fModifierStatus, 78 fSuperInterfacesStatus 79 }; 80 81 updateStatus(status); 83 } 84 85 86 89 protected void handleFieldChanged(String fieldName) { 90 super.handleFieldChanged(fieldName); 91 92 doStatusUpdate(); 93 } 94 95 96 98 101 public void createControl(Composite parent) { 102 initializeDialogUnits(parent); 103 104 Composite composite= new Composite(parent, SWT.NONE); 105 composite.setFont(parent.getFont()); 106 107 int nColumns= 4; 108 109 GridLayout layout= new GridLayout(); 110 layout.numColumns= nColumns; 111 composite.setLayout(layout); 112 113 createContainerControls(composite, nColumns); 114 createPackageControls(composite, nColumns); 115 createEnclosingTypeControls(composite, nColumns); 116 117 createSeparator(composite, nColumns); 118 119 createTypeNameControls(composite, nColumns); 120 createModifierControls(composite, nColumns); 121 122 createSuperInterfacesControls(composite, nColumns); 123 124 createCommentControls(composite, nColumns); 125 enableCommentControl(true); 126 127 setControl(composite); 128 129 Dialog.applyDialogFont(composite); 130 PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_INTERFACE_WIZARD_PAGE); 131 } 132 133 136 public void setVisible(boolean visible) { 137 super.setVisible(visible); 138 if (visible) { 139 setFocus(); 140 } 141 } 142 143 } 144 | Popular Tags |