File tree Expand file tree Collapse file tree 5 files changed +43
-1
lines changed
eclipseui/org/eclipse/ui/internal Expand file tree Collapse file tree 5 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2025, Red Hat, Inc. and others.
3+ *
4+ * This program and the accompanying materials
5+ * are made available under the terms of the Eclipse Public License 2.0
6+ * which accompanies this distribution, and is available at
7+ * https://www.eclipse.org/legal/epl-2.0/
8+ *
9+ * SPDX-License-Identifier: EPL-2.0
10+ *******************************************************************************/
11+ package org .eclipse .ui .internal ;
12+
13+ import org .eclipse .core .commands .AbstractHandler ;
14+ import org .eclipse .core .commands .ExecutionEvent ;
15+ import org .eclipse .core .commands .ExecutionException ;
16+ import org .eclipse .core .runtime .IStatus ;
17+ import org .eclipse .ui .PlatformUI ;
18+
19+ public class PersistWorkbenchHandler extends AbstractHandler {
20+
21+ @ Override
22+ public Object execute (ExecutionEvent event ) throws ExecutionException {
23+ if (PlatformUI .getWorkbench () instanceof Workbench workbench ) {
24+ workbench .persist (false );
25+ return IStatus .OK ;
26+ }
27+ return IStatus .ERROR ;
28+ }
29+
30+ }
Original file line number Diff line number Diff line change @@ -1216,7 +1216,7 @@ public void run() {
12161216 * Will also skip saving the model to the disk since that is
12171217 * done later in shutdown.
12181218 */
1219- private void persist (final boolean shutdown ) {
1219+ void persist (final boolean shutdown ) {
12201220 // persist editors that can be and possibly close the others
12211221 SafeRunner .run (new SafeRunnable () {
12221222 @ Override
Original file line number Diff line number Diff line change 2626 </with >
2727 </enabledWhen >
2828 </handler >
29+ <handler
30+ class =" org.eclipse.ui.internal.PersistWorkbenchHandler"
31+ commandId =" org.eclipse.ui.persistWorkbenchState" >
32+ </handler >
2933 </extension >
3034</plugin >
Original file line number Diff line number Diff line change @@ -293,6 +293,8 @@ command.up.description = Navigate up one level
293293command.up.name = Up
294294command.toggleCoolbar.name = Toggle Main Toolbar Visibility
295295command.toggleCoolbar.description = Toggles the visibility of the window toolbar
296+ command.persistWorkbenchState.name = Persist Workbench state
297+ command.persistWorkbenchState.description = Forces persistence of the current workbench state for potential future recovery
296298
297299context.editingText.description = Editing Text Context
298300context.editingText.name = Editing Text
Original file line number Diff line number Diff line change 14371437 id =" org.eclipse.ui.toggleShowKeys"
14381438 name =" %command.showKeysToggle.name" >
14391439 </command >
1440+ <command
1441+ categoryId =" org.eclipse.ui.category.window"
1442+ description =" %command.persistWorkbenchState.description"
1443+ id =" org.eclipse.ui.persistWorkbenchState"
1444+ name =" %command.persistWorkbenchState.name" >
1445+ </command >
14401446 </extension >
14411447
14421448 <extension
You can’t perform that action at this time.
0 commit comments