Debugging the Fix

I’ve created and uploaded a patch for bug 227760, and also a wiki page.

Debugging with the fix, signals a slight different behaviour in the way classes are called upon. Since the

if (!ServerUIPlugin.saveEditors())

is not being used anymore, the classes are called a bit differently. Previously, you started at the “start(server, launchMode, shell);” in, before going to the “if” condition mentioned above. This condition led to the “” class, then to “” class breifly, then to the “” class (see post: Bug 227760 Source Code Location for more details). When this was was implemented, the “” class led to various preference classes being called upon, before the first prompt is received. This being is being carried out in the “SaveEditors()” method:

public static boolean saveEditors() {
        byte b = ServerUIPlugin.getPreferences().getSaveEditors();
        if (b == ServerUIPreferences.SAVE_EDITORS_NEVER)
            return true;
        return ServerUIPlugin.getInstance().getWorkbench().saveAllEditors(b == ServerUIPreferences.SAVE_EDITORS_PROMPT);

This then led to the return statement, before finishing the “start(IServer server, String launchMode, final Shell shell)” method in “”. This then led from the “” class, to the “” class, then to various preferences class (like EclipsePreference.class), then to “handleStatus(IStatus status, Object source)” method in the “”, which led to the second prompt.

When the fix was applied, the behaviour was more like the latter behaviour mentioned. Since there is no “if (!ServerUIPlugin.saveEditors())”, the “” class is not called upon. This is what removes the first “save dialogue”, and the latter behaviour ensues. Therefore, the “” class is called upon, which leads to the “” class, which goes through various prefrences “.class” files, which leads to the “”, which leads to the “”, where the preLaunchSave method checks and calls for the save dialogue prompt:

public static boolean preLaunchSave() {
        String saveDirty = getDefault().getPreferenceStore().getString(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH);
        if (saveDirty.equals(MessageDialogWithToggle.NEVER)) {
            return true;
        return saveAllEditors(saveDirty.equals(MessageDialogWithToggle.PROMPT));

This shows exactly the effect of making the changes to the “” to remove the uneccesary check. The methods being called in the “” class, and the “” class, are all related to saving open editors. Other methods in these two classes are not being used for this step. Since the save dialogue is prompted later in the pre-launch, the first check is not required. Therefore, thepatch, that was attached through bugzilla, should be a possible fix.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: