Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SaveOnFocusLostListener.java')
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SaveOnFocusLostListener.java88
1 files changed, 0 insertions, 88 deletions
diff --git a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SaveOnFocusLostListener.java b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SaveOnFocusLostListener.java
deleted file mode 100644
index 26fba1d5d..000000000
--- a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SaveOnFocusLostListener.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.common.ui.editor;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.xtext.ui.editor.XtextEditor;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class SaveOnFocusLostListener implements IPartListener {
-
- private XtextEditor editor;
- private String store;
- private String key;
-
- public SaveOnFocusLostListener(XtextEditor editor, String store, String key) {
- this.editor = editor;
- this.store = store;
- this.key = key;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
- */
- @Override
- public void partActivated(IWorkbenchPart part) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
- */
- @Override
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
- @Override
- public void partClosed(IWorkbenchPart part) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- @Override
- public void partDeactivated(IWorkbenchPart part) {
- if (!(editor instanceof IValidatingEditor))
- return;
-
- if (part instanceof ISaveOnFocusLostEditor) {
- if (((ISaveOnFocusLostEditor) part).isClosing()) {
- return;
- }
- }
-
- boolean save = Platform.getPreferencesService().getBoolean(store, key, true, null);
-
- if (save && editor.isDirty())
- if (((IValidatingEditor)editor).isValid())
- editor.doSave(new NullProgressMonitor());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
- */
- @Override
- public void partOpened(IWorkbenchPart part) {
- }
-
-}

Back to the top