Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Saving the Project in the background without closing open dialogs
icon5.gif  Saving the Project in the background without closing open dialogs [message #753362] Wed, 26 October 2011 20:40 Go to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi,

In one of my plug-ins, I save all open files in the background, without getting confirmation from the user with the following command:
        Display.getDefault().syncExec(new Thread()
        {
            public void run()
            {
                PlatformUI.getWorkbench().saveAllEditors(false);
            }
        });

It works very well, however to do this, it closes all open dialogs to do this action. For example, let's say that the user invoked a content assist, while trying to decide what to choose from that dialog, my plug-in closes that dialog (since it saves the file). I guess this is due to the fact that I am trying to do the action with the UI thread, and to get a hold to the UI thread, it first closes its current dialog.

Is there a way to overcome this (i.e., delay the save until all active dialogs are closed or save the files in the workbench without forcing to close the active dialogs)?

Thanks,

[Updated on: Wed, 26 October 2011 20:40]

Report message to a moderator

Re: Saving the Project in the background without closing open dialogs [message #753979 is a reply to message #753362] Mon, 31 October 2011 10:39 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
You ask tough questions! :-)

Maybe before calling saveAllEditors(..) you could check if a dialog is
open by looking for the current active shell? But I must admit I am not
a expert for this...

You should also ask this in the Platform newsgroup as this is a Platform
API.
Re: Saving the Project in the background without closing open dialogs [message #754715 is a reply to message #753979] Fri, 04 November 2011 01:02 Go to previous messageGo to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi Deepak,

Thanks for the answer as usual. I guess when you are trying to work on non-supported functionality (as it is the case with most of the time in research Smile), the questions become harder Smile

I looked at the current shell and properties a little, however couldn't figure out a way to learn if a popup is opened or not. I will try the platform API group as you suggested.

Sorry that I cannot generally decide which group I should ask my question (I don't know sometimes if my question is about core functionality or UI). So, I generally start with JDT team...
Re: Saving the Project in the background without closing open dialogs [message #754719 is a reply to message #754715] Fri, 04 November 2011 02:00 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 11/4/2011 6:32 AM, Kivanc Muslu wrote:
> I looked at the current shell and properties a little, however couldn't
> figure out a way to learn if a popup is opened or not.
I think it is possible to figure out if the active shell is the eclipse
workbench window or not. You will probably need to save a reference to
the eclipse workbench window object when you are sure that no dialog is
open.

> Sorry that I cannot generally decide which group I should ask my
> question (I don't know sometimes if my question is about core
> functionality or UI). So, I generally start with JDT team...
No problem :) As a rule of thumb, if the question is about an API and
the api package name includes 'jdt' then the questions come here. Else
they may be more appropriate in the platform forum.
Previous Topic:Handle cycle dependencies using JDT
Next Topic:Problems Installing Plugins on Eclipse
Goto Forum:
  


Current Time: Fri Apr 19 09:45:33 GMT 2024

Powered by FUDForum. Page generated in 0.01996 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top