com.ibm.carma.ui.dialog
Class NotSynchronizedDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.IconAndMessageDialog
              extended by org.eclipse.jface.dialogs.MessageDialog
                  extended by com.ibm.carma.ui.dialog.NotSynchronizedDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

public class NotSynchronizedDialog
extends org.eclipse.jface.dialogs.MessageDialog

This class is used to display a message to the user informing that the action is failing because they are either not connected, or are unable to find the target. It also present the user with the option of performing the action again. Also, if any errors occur, the are already displayed for the user.

It should be used something like this:

 try {
    cResource.getContainerContents(new NullProgressMonitor(), null);
 } catch (NotSynchronizedException e) {
    //here the developer should add all of the non-process targets 
    //to this vector to ensure they are all sync
    final Vector resourcesToSync = new Vector();
 
    status = Status.OK_STATUS;
    Display.getDefault().syncExec(new Runnable(){
       public void run() {
          if (NotSynchronizedDialog.openNotSynchronizedDialog(Display.getDefault().getActiveShell(), 
             (IResource[]) resourcesToSync.toArray(new IResource[0])) == 1)
                 status = Status.CANCEL_STATUS; //we've been cancelled
    }});
    
    if (status.isOk())
       continue;
    else
       return status;
 }
 


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
static java.lang.String COPYRIGHT
           
 
Fields inherited from class org.eclipse.jface.dialogs.MessageDialog
ERROR, INFORMATION, NONE, QUESTION, WARNING
 
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
 
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK
 
Method Summary
static int openNotSynchronizedDialog(org.eclipse.swt.widgets.Shell parentShell, java.util.Collection resources)
          This method will open a dialog for the user, explaining to them that the objects were not Synchronized and asking if they'd like us to attempt to find them and then continue with their action.
static int openNotSynchronizedDialog(org.eclipse.swt.widgets.Shell parentShell, java.lang.Object resource)
          This method will open a dialog for the user, explaining to them that the objects were not Synchronized and asking if they'd like us to attempt to find them and then continue with their action.
 
Methods inherited from class org.eclipse.jface.dialogs.MessageDialog
getImage, openConfirm, openError, openInformation, openQuestion, openWarning
 
Methods inherited from class org.eclipse.jface.dialogs.IconAndMessageDialog
getErrorImage, getInfoImage, getQuestionImage, getWarningImage
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, close, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, create, getBlockedHandler, getImage, setBlockedHandler, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
getDefaultImage, getDefaultImages, getDefaultOrientation, getReturnCode, getShell, getWindowManager, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setWindowManager
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Method Detail

openNotSynchronizedDialog

public static int openNotSynchronizedDialog(org.eclipse.swt.widgets.Shell parentShell,
                                            java.util.Collection resources)
This method will open a dialog for the user, explaining to them that the objects were not Synchronized and asking if they'd like us to attempt to find them and then continue with their action. If yes, we will run a Job that will synchronize the model where necessary and return 0, if no, we will return 1

Parameters:
parentShell -
resources - Must contain resources in CARMA projects
Returns:
0 if the user would like to continue, 1 to cancel

openNotSynchronizedDialog

public static int openNotSynchronizedDialog(org.eclipse.swt.widgets.Shell parentShell,
                                            java.lang.Object resource)
This method will open a dialog for the user, explaining to them that the objects were not Synchronized and asking if they'd like us to attempt to find them and then continue with their action. If yes, we will run a Job that will synchronize the model where necessary and return 0, if no, we will return 1

Parameters:
parentShell -
resource - Must contain an object with can be mapped to a CARMAResource
Returns:
0 if the user would like to continue, 1 to cancel