You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2011/12/14 19:15:18 UTC
svn commit: r1214391 - in /directory/studio/trunk/plugins/rcp: ./
src/main/java/org/apache/directory/studio/
src/main/java/org/apache/directory/studio/preferences/
Author: pamarcelot
Date: Wed Dec 14 18:15:18 2011
New Revision: 1214391
URL: http://svn.apache.org/viewvc?rev=1214391&view=rev
Log:
Fix for DIRSTUDIO-320 (Studio exits without showing a confirmation dialog).
Added:
directory/studio/trunk/plugins/rcp/plugin_de.properties
directory/studio/trunk/plugins/rcp/plugin_fr.properties
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/RcpPreferencesInitializer.java
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/ShutdownPreferencesPage.java
Modified:
directory/studio/trunk/plugins/rcp/plugin.properties
directory/studio/trunk/plugins/rcp/plugin.xml
directory/studio/trunk/plugins/rcp/pom.xml
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchAdvisor.java
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/PluginConstants.java
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages.properties
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_de.properties
directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_fr.properties
Modified: directory/studio/trunk/plugins/rcp/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/plugin.properties?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/plugin.properties (original)
+++ directory/studio/trunk/plugins/rcp/plugin.properties Wed Dec 14 18:15:18 2011
@@ -21,3 +21,8 @@ Action_ManageConfiguration_id=org.apache
Action_OpenFile_id=org.apache.directory.studio.openFile
Action_ReportABug_id=org.apache.directory.studio.reportABug
Action_Update_id=org.apache.directory.studio.newUpdates
+
+Pref_StudioPage_id=org.apache.directory.studio.StudioPreferencePage
+
+PrefPage_ShutdownPreferencesPage_id=org.apache.directory.studio.preferences.ShutdownPreferencesPage
+PrefPage_ShutdownPreferencesPage_name=Shutdown
Modified: directory/studio/trunk/plugins/rcp/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/plugin.xml?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/plugin.xml (original)
+++ directory/studio/trunk/plugins/rcp/plugin.xml Wed Dec 14 18:15:18 2011
@@ -103,5 +103,19 @@
</presentation>
</config>
</extension>
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.apache.directory.studio.preferences.RcpPreferencesInitializer"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="%Pref_StudioPage_id"
+ class="org.apache.directory.studio.preferences.ShutdownPreferencesPage"
+ id="%PrefPage_ShutdownPreferencesPage_id"
+ name="%PrefPage_ShutdownPreferencesPage_name"/>
+ </extension>
</plugin>
Added: directory/studio/trunk/plugins/rcp/plugin_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/plugin_de.properties?rev=1214391&view=auto
==============================================================================
--- directory/studio/trunk/plugins/rcp/plugin_de.properties (added)
+++ directory/studio/trunk/plugins/rcp/plugin_de.properties Wed Dec 14 18:15:18 2011
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+aboutText=TODO:Apache Directory Studio\n\n\Version: ${pom.version}\n\n\u00A9 2006-2011 Apache Software Foundation - All right reserved.\n\Visit http://directory.apache.org/studio\n\n\This product is licensed under the terms of the Apache License 2.0.\n\n\Some icons from FAMFAMFAM http://www.famfamfam.com/lab/icons/silk
+PrefPage_ShutdownPreferencesPage_name=TODO:Shutdown
Added: directory/studio/trunk/plugins/rcp/plugin_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/plugin_fr.properties?rev=1214391&view=auto
==============================================================================
--- directory/studio/trunk/plugins/rcp/plugin_fr.properties (added)
+++ directory/studio/trunk/plugins/rcp/plugin_fr.properties Wed Dec 14 18:15:18 2011
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+aboutText=Apache Directory Studio\n\n\Version: ${pom.version}\n\n\u00A9 2006-2011 Apache Software Foundation - Tous droits réservés.\n\Visit http://directory.apache.org/studio\n\n\Ce produit est licencié selon les termes de la Apache License 2.0.\n\n\Certaines icones sont de FAMFAMFAM http://www.famfamfam.com/lab/icons/silk
+PrefPage_ShutdownPreferencesPage_name=Extinction
Modified: directory/studio/trunk/plugins/rcp/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/pom.xml?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/pom.xml (original)
+++ directory/studio/trunk/plugins/rcp/pom.xml Wed Dec 14 18:15:18 2011
@@ -199,6 +199,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>preferences</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.eclipse</groupId>
<artifactId>jface</artifactId>
<scope>provided</scope>
Modified: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchAdvisor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchAdvisor.java?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchAdvisor.java (original)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchAdvisor.java Wed Dec 14 18:15:18 2011
@@ -21,6 +21,7 @@
package org.apache.directory.studio;
+import org.apache.directory.studio.preferences.ShutdownPreferencesPage;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
@@ -120,7 +121,7 @@ public class ApplicationWorkbenchAdvisor
*/
public boolean preShutdown()
{
- return true;
+ return ShutdownPreferencesPage.promptOnExit();
}
Modified: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java (original)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java Wed Dec 14 18:15:18 2011
@@ -21,6 +21,7 @@
package org.apache.directory.studio;
+import org.apache.directory.studio.preferences.ShutdownPreferencesPage;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProduct;
import org.eclipse.core.runtime.Platform;
@@ -68,7 +69,6 @@ import org.eclipse.ui.application.Workbe
*/
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
{
-
private IEditorPart lastActiveEditor = null;
private IPerspectiveDescriptor lastPerspective = null;
private IWorkbenchPage lastActivePage;
@@ -373,4 +373,9 @@ public class ApplicationWorkbenchWindowA
recomputeTitle();
}
+
+ public boolean preWindowShellClose()
+ {
+ return ShutdownPreferencesPage.promptOnExit();
+ }
}
Modified: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/PluginConstants.java?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/PluginConstants.java (original)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/PluginConstants.java Wed Dec 14 18:15:18 2011
@@ -58,4 +58,7 @@ public final class PluginConstants
public static final String ACTION_UPDATE_ID = Activator.getDefault().getPluginProperties().getString(
"Action_Update_id" ); //$NON-NLS-1$
+ /** The Update ActionID */
+ public static final String PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW = "exitPromptOnCloseLastWindow";
+
}
Modified: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages.properties?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages.properties (original)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages.properties Wed Dec 14 18:15:18 2011
@@ -59,3 +59,10 @@ OpenFileAction.Error=Error!
ReportABugAction.Report_a_bug=Report a bug...
ReportABugAction.Open_a_web_browser=Open a Web browser for creating a new bug report
ReportABugAction.JIRA_URL=https://issues.apache.org/jira/browse/DIRSTUDIO
+
+# Strings used by ShutdownPreferencesPage Class
+ShutdownPreferencesPage.PromptOnExitTitle=Confirm Exit
+ShutdownPreferencesPage.PromptOnExitMessage=Exit Apache Directory Studio?
+ShutdownPreferencesPage.PromptOnExitToggleMessage=&Always exit without prompt
+ShutdownPreferencesPage.PageTitle=Shutdown
+ShutdownPreferencesPage.ConfirmExitClosingLastWindow=Confirm exit when closing last window
Modified: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_de.properties?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_de.properties (original)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_de.properties Wed Dec 14 18:15:18 2011
@@ -58,4 +58,10 @@ OpenFileAction.Error=Fehler\!
# Strings used by ReportABugAction Class
ReportABugAction.Report_a_bug=Melde einen Fehler...
ReportABugAction.Open_a_web_browser=\u00D6ffne einen Web Browser um einen neuen Fehler zu melden
-ReportABugAction.JIRA_URL=https://issues.apache.org/jira/browse/DIRSTUDIO
+
+# Strings used by ShutdownPreferencesPage Class
+ShutdownPreferencesPage.PromptOnExitTitle=TODO:Confirm Exit
+ShutdownPreferencesPage.PromptOnExitMessage=TODO:Exit Apache Directory Studio?
+ShutdownPreferencesPage.PromptOnExitToggleMessage=TODO:&Always exit without prompt
+ShutdownPreferencesPage.PageTitle=Shutdown
+ShutdownPreferencesPage.ConfirmExitClosingLastWindow=Confirm exit when closing last window
Modified: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_fr.properties?rev=1214391&r1=1214390&r2=1214391&view=diff
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_fr.properties (original)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/messages_fr.properties Wed Dec 14 18:15:18 2011
@@ -57,3 +57,10 @@ OpenFileAction.Error=Erreur !
# Strings used by ReportABugAction Class
ReportABugAction.Report_a_bug=Signaler une anomalie...
ReportABugAction.Open_a_web_browser=Ouvrir un navigateur pour cr\u00E9er un nouveau rapport d'anomalie
+
+# Strings used by ShutdownPreferencesPage Class
+ShutdownPreferencesPage.PromptOnExitTitle=Confirmer l'extinction
+ShutdownPreferencesPage.PromptOnExitMessage=Quitter Apache Directory Studio ?
+ShutdownPreferencesPage.PromptOnExitToggleMessage=&Toujours quitter sans confirmation
+ShutdownPreferencesPage.PageTitle=Extinction
+ShutdownPreferencesPage.ConfirmExitClosingLastWindow=Confirmer l'extinction lors de la fermeture de la dernière fenêtre
Added: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/RcpPreferencesInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/RcpPreferencesInitializer.java?rev=1214391&view=auto
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/RcpPreferencesInitializer.java (added)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/RcpPreferencesInitializer.java Wed Dec 14 18:15:18 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.preferences;
+
+
+import org.apache.directory.studio.Activator;
+import org.apache.directory.studio.PluginConstants;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+
+/**
+ * This class is used to set default preference values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class RcpPreferencesInitializer extends AbstractPreferenceInitializer
+{
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeDefaultPreferences()
+ {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ store.setDefault( PluginConstants.PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, true );
+ }
+}
Added: directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/ShutdownPreferencesPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/ShutdownPreferencesPage.java?rev=1214391&view=auto
==============================================================================
--- directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/ShutdownPreferencesPage.java (added)
+++ directory/studio/trunk/plugins/rcp/src/main/java/org/apache/directory/studio/preferences/ShutdownPreferencesPage.java Wed Dec 14 18:15:18 2011
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.preferences;
+
+
+import org.apache.directory.studio.Activator;
+import org.apache.directory.studio.Messages;
+import org.apache.directory.studio.PluginConstants;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Shutdown Preferences Page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ShutdownPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage
+{
+ // UI fields
+ private Button confirmExitClosingLastWindowCheckbox;
+
+
+ /**
+ * Creates a new instance of EntryEditorsPreferencePage.
+ */
+ public ShutdownPreferencesPage()
+ {
+ super( Messages.getString( "ShutdownPreferencesPage.PageTitle" ) );
+ super.setPreferenceStore( Activator.getDefault().getPreferenceStore() );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init( IWorkbench workbench )
+ {
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Control createContents( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ GridLayout gl = new GridLayout();
+ gl.marginHeight = gl.marginWidth = 0;
+ composite.setLayout( gl );
+ composite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ confirmExitClosingLastWindowCheckbox = new Button( composite, SWT.CHECK );
+ confirmExitClosingLastWindowCheckbox.setText( Messages
+ .getString( "ShutdownPreferencesPage.ConfirmExitClosingLastWindow" ) ); //$NON-NLS-1$
+
+ refreshUI();
+
+ return composite;
+ }
+
+
+ /**
+ * Refreshes the UI.
+ */
+ private void refreshUI()
+ {
+ confirmExitClosingLastWindowCheckbox.setSelection( getPreferenceStore().getBoolean(
+ PluginConstants.PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW ) );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean performOk()
+ {
+ getPreferenceStore().setValue( PluginConstants.PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW,
+ confirmExitClosingLastWindowCheckbox.getSelection() );
+
+ return true;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void performDefaults()
+ {
+ getPreferenceStore().setValue( PluginConstants.PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW,
+ getPreferenceStore().getDefaultBoolean( PluginConstants.PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW ) );
+
+ super.performDefaults();
+ }
+
+
+ /**
+ * Prompts the user (or not, depending on the preferences) while exiting the application.
+ *
+ * @return <code>true</code> if the application needs to be exited,
+ * <code>false</code> if not.
+ */
+ public static boolean promptOnExit()
+ {
+ // Checking for multiple workbench windows
+ if ( PlatformUI.getWorkbench().getWorkbenchWindowCount() > 1 )
+ {
+ return true;
+ }
+
+ // Getting the preferred exit mode from the preferences
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ boolean promptOnExit = store.getBoolean( PluginConstants.PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW );
+
+ if ( promptOnExit )
+ {
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm( PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(),
+ Messages.getString( "ShutdownPreferencesPage.PromptOnExitTitle" ), //$NON-NLS-1$
+ Messages.getString( "ShutdownPreferencesPage.PromptOnExitMessage" ), //$NON-NLS-1$
+ Messages.getString( "ShutdownPreferencesPage.PromptOnExitToggleMessage" ), false, null, null ); //$NON-NLS-1$
+
+ // Checking the dialog's return code
+ if ( dialog.getReturnCode() != IDialogConstants.OK_ID )
+ {
+ return false;
+ }
+
+ // Saving the preferred exit mode value to the preferences
+ if ( dialog.getToggleState() )
+ {
+ store.setValue( PluginConstants.PREFERENCE_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, false );
+ Activator.getDefault().savePluginPreferences();
+ }
+ }
+
+ return true;
+ }
+}
\ No newline at end of file