core/com.nokia.carbide.cpp.sysdoc.hover/src/com/nokia/carbide/cpp/sysdoc/internal/hover/uitlis/DialogHelper.java
changeset 0 fb279309251b
child 592 e03ece49757c
child 1527 5a88810b7972
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *				Deniz TURAN
       
    14  * Description: 
       
    15  * 				
       
    16  */
       
    17 package com.nokia.carbide.cpp.sysdoc.internal.hover.uitlis;
       
    18 
       
    19 import org.eclipse.jface.dialogs.MessageDialog;
       
    20 
       
    21 import com.nokia.carbide.cpp.sysdoc.hover.Activator;
       
    22 import com.nokia.carbide.cpp.sysdoc.internal.hover.core.HoverManager;
       
    23 
       
    24 /**
       
    25  * An helper class to display dialog window to show error messages
       
    26  */
       
    27 public class DialogHelper {
       
    28 
       
    29 	public static void displayErrorDialog(final String msg) {
       
    30 		displayErrorDialog(msg, "Developer Libary Hover Help Error",
       
    31 				MessageDialog.ERROR);
       
    32 	}
       
    33 
       
    34 	public static void displayErrorDialog(final String msg, final String title,
       
    35 			final int icon) {
       
    36 
       
    37 		Runnable mssageRunnable = new Runnable() {
       
    38 			public void run() {
       
    39 				MessageDialog message = new MessageDialog(Activator
       
    40 						.getDefault().getWorkbench().getDisplay()
       
    41 						.getActiveShell(), title, null, msg, icon,
       
    42 						new String[] { "OK" }, 1);
       
    43 				message.open();
       
    44 
       
    45 			}
       
    46 		};
       
    47 		if (!HoverManager.isTestMode()) {
       
    48 			ExecutorAgent.run(mssageRunnable);
       
    49 		}
       
    50 	}
       
    51 }