1 12 13 package org.eclipse.ui.texteditor; 14 15 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.layout.GridData; 17 import org.eclipse.swt.layout.GridLayout; 18 import org.eclipse.swt.widgets.Composite; 19 20 import org.eclipse.jface.dialogs.Dialog; 21 import org.eclipse.jface.dialogs.DialogPage; 22 import org.eclipse.jface.dialogs.IMessageProvider; 23 24 29 class MessageDialogPage extends DialogPage { 30 31 MessageRegion fMessageRegion; 32 33 34 public MessageDialogPage(Composite parent) { 35 createControl(parent); 36 } 37 38 public void createControl(Composite parent) { 39 Composite composite1= new Composite(parent, SWT.NONE); 40 composite1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 41 GridLayout layout = new GridLayout(); 42 layout.marginWidth = 0; 43 layout.marginHeight = 0; 44 composite1.setLayout(layout); 45 fMessageRegion= new MessageRegion(); 46 fMessageRegion.createContents(composite1); 47 GridData messageData= new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); 48 fMessageRegion.setMessageLayoutData(messageData); 49 setControl(composite1); 50 Dialog.applyDialogFont(composite1); 51 } 52 53 public void setMessage(String newMessage,int newType) { 54 super.setMessage(newMessage, newType); 55 fMessageRegion.updateText(newMessage, newType); 56 } 57 58 public void setErrorMessage(String newMessage) { 59 super.setErrorMessage(newMessage); 60 fMessageRegion.updateText(newMessage, IMessageProvider.ERROR); 61 } 62 } 63 | Popular Tags |