1 11 package org.eclipse.swt.widgets; 12 13 14 import org.eclipse.swt.*; 15 16 75 76 public abstract class Dialog { 77 int style; 78 Shell parent; 79 String title; 80 81 94 public Dialog (Shell parent) { 95 this (parent, SWT.PRIMARY_MODAL); 96 } 97 98 124 public Dialog (Shell parent, int style) { 125 checkParent (parent); 126 this.parent = parent; 127 this.style = style; 128 title = ""; 129 } 130 131 143 protected void checkSubclass () { 144 if (!Display.isValidClass (getClass ())) { 145 error (SWT.ERROR_INVALID_SUBCLASS); 146 } 147 } 148 149 161 void checkParent (Shell parent) { 162 if (parent == null) error (SWT.ERROR_NULL_ARGUMENT); 163 parent.checkWidget (); 164 } 165 166 174 void error (int code) { 175 SWT.error(code); 176 } 177 178 189 public Shell getParent () { 190 return parent; 191 } 192 193 208 public int getStyle () { 209 return style; 210 } 211 212 225 public String getText () { 226 return title; 227 } 228 229 244 public void setText (String string) { 245 if (string == null) error (SWT.ERROR_NULL_ARGUMENT); 246 title = string; 247 } 248 249 } 250 | Popular Tags |