diff --git a/chemclipse/plugins/org.eclipse.chemclipse.rcp.app.ui/Application.e4xmi b/chemclipse/plugins/org.eclipse.chemclipse.rcp.app.ui/Application.e4xmi index d13180701a..9856c48fbb 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.rcp.app.ui/Application.e4xmi +++ b/chemclipse/plugins/org.eclipse.chemclipse.rcp.app.ui/Application.e4xmi @@ -28,7 +28,10 @@ + + + diff --git a/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close.png b/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close.png new file mode 100644 index 0000000000..38ab8a4801 Binary files /dev/null and b/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close.png differ diff --git a/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close_all.png b/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close_all.png new file mode 100644 index 0000000000..55ef1bb687 Binary files /dev/null and b/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close_all.png differ diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/fragment.e4xmi b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/fragment.e4xmi index bd13febd93..dc7423a054 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/fragment.e4xmi +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/fragment.e4xmi @@ -8,6 +8,8 @@ + + @@ -16,6 +18,8 @@ + + @@ -87,4 +91,8 @@ + + + + diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseAllHandler.java b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseAllHandler.java new file mode 100644 index 0000000000..aacd40efef --- /dev/null +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseAllHandler.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2021 Lablicate GmbH. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthias Mailänder - initial API and implementation + *******************************************************************************/ +package org.eclipse.chemclipse.ux.extension.ui.handlers; + +import org.eclipse.chemclipse.ux.extension.ui.editors.IChemClipseEditor; +import org.eclipse.e4.core.di.annotations.CanExecute; +import org.eclipse.e4.core.di.annotations.Execute; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.workbench.modeling.EPartService; + +public class CloseAllHandler { + + @CanExecute + boolean canExecute(EPartService partService) { + + for(MPart part : partService.getParts()) { + if(part.getObject() instanceof IChemClipseEditor) { + return true; + } + } + return false; + } + + @Execute + void execute(EPartService partService) { + + for(MPart part : partService.getParts()) { + if(part.getObject() instanceof IChemClipseEditor) { + partService.hidePart(part, true); + } + } + } +} diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseHandler.java b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseHandler.java new file mode 100644 index 0000000000..d497723812 --- /dev/null +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseHandler.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2021 Lablicate GmbH. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthias Mailänder - initial API and implementation + *******************************************************************************/ +package org.eclipse.chemclipse.ux.extension.ui.handlers; + +import javax.inject.Named; + +import org.eclipse.chemclipse.ux.extension.ui.editors.IChemClipseEditor; +import org.eclipse.e4.core.di.annotations.CanExecute; +import org.eclipse.e4.core.di.annotations.Execute; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.e4.ui.workbench.modeling.EPartService; + +public class CloseHandler { + + @CanExecute + boolean canExecute(@Named(IServiceConstants.ACTIVE_PART) MPart part) { + + if(part != null) { + if(part.getObject() instanceof IChemClipseEditor) { + return true; + } + } + return false; + } + + @Execute + void execute(EPartService partService, @Named(IServiceConstants.ACTIVE_PART) MPart part) { + + if(part != null) { + Object object = part.getObject(); + if(object != null) { + if(object instanceof IChemClipseEditor) { + partService.hidePart(part, true); + } + } + } + } +}