Fix by classmate

Posted in open-source, update on April 4, 2009 by nkhan26

Le Yang, along some background information and help by Kevin Vu, created a fix for bug 240698. Bug 240698 is exactly the same a my bug, just a different scenario. Even though the scenarios were different, the files related to the bugs were exactly the same. Using Le’s fix, mentioned on his blog, there was no second save dialogue prompt. Therefore, Le’s fix works for this bug as well.

I’ve tested this solution with different scenarios (multiple files, multiple servers), and it works fine. It seems that I was going about fixing this the wrong way. I was trying to link the SaveEditors method on the first prompt, to the saveDirty method in the second prompt (mentioned in a previous blog entry). One thing he did notice was that the saveEditors method was duplicated in prelaunch. Once this was understood, his solution sounds correct. I will be testing more, and give updates, but this was an excellent job by Le.

Problems with package interaction

Posted in open-source, update on March 25, 2009 by nkhan26

From what I’m seeing, it seems like the problem lies with package interaction with each other. The “org.eclipse.wst.server.ui”, which prompts the first save dialogue, does not seem to commit any changes to the workbench when user says “No”. The “org.eclipse.debug.ui” package, where the second prompts appears from, checks if the editors are “dirty”. The methods in the SaveScopeResourcesHandler.java checks to see if the editors opened are not saved, which should be the behaviour. An interaction between the two is needed, or a new method to check if the user is prompted first, before checking if the file “isDirty” (not saved). Still researching, but the process is making more sense now.

Not finding AbstractUIPlugin.java class

Posted in open-source, update on March 24, 2009 by nkhan26

In the DebugUIPlugin.java class, the preLaunchSave method is called that prompts the second save dialogue. Placing some print out statements showed that the “saveDirty” string returns “prompt”:

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

It’s getting the message mainly from the getPreferenceStore() method in AbstractUIPlugin.java class, which is located in the “org.eclipse.ui.plugin” package, which I’m unable to find currently. I’m still searching for that class. However, I did found the details about that class, and that method on the net:

public IPreferenceStore getPreferenceStore() {
        // Create the preference store lazily.
        if (preferenceStore == null) {
            preferenceStore = new ScopedPreferenceStore(new InstanceScope(),getBundle().getSymbolicName());
 
       }
         return preferenceStore;
     }

So now, I’m trying to figure out where did the “getBundle()” method came from. Finding the AbstractUIPlugin class would be a start.

Still working, little progress

Posted in open-source, update on March 24, 2009 by nkhan26

I’m still working on Bug 227760. As mentioned earlier in the description of the bug, the save dialogue is prompted twice. Once, where mentioned earlier, and the second place I found is, in the “org.eclipse.debug.ui”, in the “org.eclipse.debug.internal.ui”. The file getting called is the “SaveScopeREsourcesHandler.java” and the prompt occurs in the handle status method.
The dialogue gets called in this condition:

if (projects != null) {
            IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
            String save = store.getString(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH);
            int ret = showSaveDialog(projects, !save.equals(MessageDialogWithToggle.NEVER), save.equals(MessageDialogWithToggle.PROMPT));
            if(ret == IDialogConstants.OK_ID) {
            	doSave();
            	return Boolean.TRUE;
            }
            return Boolean.FALSE;
        }
        else {
            boolean cancel = DebugUIPlugin.preLaunchSave();
            return Boolean.valueOf(cancel);
        }

The DebugUIPlugin.java class is called in the else condition, which invokes the second dialogue.The DebugUIPlugin class has the method that checks and calls the save 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));
    }

Playing around with this code, for example disabling the “.PROMPT”, did not display the message. Therefore, we may be dealing with the “saveDirty”. Someone worked on a similar saveDirty dialogue in the class, and I will ask him & look into his blog for help on this. Will update again soon.

Useful Research

Posted in open-source, update on February 24, 2009 by nkhan26

Using the Eclipse help documentation online, useful information was found that can be helpful towards understanding how the “org.eclipse.wst.server.ui” package functions.

First off, in the API Reference for org.eclipse.wst.server.ui, only three classes are mentioned in the class summary: ServerUICore, ServerUIUtil and ServerLaunchConfigurationTab. This is a description of the main package, where the ServerUICore is the most important class:

“ServerUICore is the main entry-point for the API. From here, clients can get the wizard pages for a particular server type, get a label provider for all server types, or launch Run on Server directly.”

Very little else is offered in the eclipse help about this package. However, much more useful information can be found in the Web Application Development User Guide in the eclipse help documentation.

This guide contains lots of information about web application, including server tools, which Bug 227760 is related to. In the server tools section, one can understand the usages and how to’s on servers. Reading these, I came across some veru useful information that can help me out. In theStarting a server section, it gives the instructions on how to start a server.It also mentions:

“If you have selected the Automatically publish when starting servers check box on the Server preferences page (Window > Preferences > Server ), the workbench checks to see if your project and files on the server are synchronized prior to starting the server.”

This makes sense of what a server does when starting, as this can be seen while debugging my bug. There are more useful information in this documentation and I need to read more into it.

Bug 227760 Source Code Location

Posted in open-source, update on February 19, 2009 by nkhan26

Following the details on the Bug 227760 description page, and from detials of the “depends on” bug, the location of this bug lies primarily with the  “org.eclipse.wst.server.ui.internal.view.servers” in the “org.eclipse.wst.server.ui” package. Placing break points in various files, they were all hit, so a general understanding of how the save dialogue works was revealed.

The first breakpoint was inserted in the “StartAction.java” file at line 152 – “start(server, launchMode, shell)”. This is hit just before the save dialogue, just after the user has started the tomcat server. It then checks the server state and hits the “if (!ServerUIPlugin.saveEditors())”. This leads to the “ServerUIPlugin.java” – SaveEditors() method, which leads to the GetSaveEditors() method in the “ServerUIPreferences.java” class. It the goes through some “.class” files, before the WTP prompts the first “Save Dialogue”. When “No” is selected, it starts again in the “StartAction.java” class, followed by the “ServerUIPlugin.java” class. It then goes through many “.class” files and stays within the “Workbench.class” for a while before hitting the second “Save Dialogue”.

Through debuggin, it can safely be assumed that this bug is within the “org.eclipse.wst.server” package. Now, variable tracing and a lot more debugging is required to start resolving this bug.

Researching Bug 227760

Posted in open-source, update on February 12, 2009 by nkhan26

Currently researching to find the source related to Bug 227760. From what I found so far, the bug seems to be in the

org.eclipse.wst.server.ui.internal.view.servers

package. I’ve inserted some breakpoints in the “StartAction”, “SErverUIPlugin” and “ServerUIPreferences”, which all has connections to the save dialogue. When runing, all breakpoins were hit, so I have something to work with. Very close to finishing 0.1 release.

Current Screenshot:

Run & Debuggin in package

Run & Debuggin in package

Follow

Get every new post delivered to your Inbox.