-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from Mailaender/file-close
Added Close and Close All to the file menu
- Loading branch information
Showing
6 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+463 Bytes
chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+727 Bytes
chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/close_all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
....ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseAllHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...pse.ux.extension.ui/src/org/eclipse/chemclipse/ux/extension/ui/handlers/CloseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} | ||
} | ||
} |