<commit_before>package org.cytoscape.internal.actions;

import java.awt.KeyboardFocusManager;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

import javax.swing.KeyStroke;

import org.cytoscape.application.swing.AbstractCyAction;
import org.cytoscape.internal.view.NetworkViewFrame;
import org.cytoscape.internal.view.NetworkViewMediator;
import org.cytoscape.util.swing.LookAndFeelUtil;

@SuppressWarnings("serial")
public class CloseWindowAction extends AbstractCyAction {
	
	private final NetworkViewMediator netViewMediator;
	
	public CloseWindowAction(final float menuGravity, final NetworkViewMediator netViewMediator) {
		super("Close Window");
		this.netViewMediator = netViewMediator;
		
		setPreferredMenu("File");
		setMenuGravity(menuGravity);
		insertSeparatorBefore = true;
		
		final int CTRL = LookAndFeelUtil.isMac() ? InputEvent.META_DOWN_MASK :  InputEvent.CTRL_DOWN_MASK;
		setAcceleratorKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_W, CTRL));
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		final Window window = getActiveWindows();
		
		if (window != null && window instanceof NetworkViewFrame)
			netViewMediator.reattachNetworkView(((NetworkViewFrame) window).getNetworkView());
	}
	
	@Override
	public boolean isEnabled() {
		final Window window = getActiveWindows();
		
		return super.isEnabled() && window != null && window instanceof NetworkViewFrame;
	}
	<commit_msg>Refs #3455: Removes duplicate menu item separator.<commit_after>package org.cytoscape.internal.actions;

import java.awt.KeyboardFocusManager;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

import javax.swing.KeyStroke;

import org.cytoscape.application.swing.AbstractCyAction;
import org.cytoscape.internal.view.NetworkViewFrame;
import org.cytoscape.internal.view.NetworkViewMediator;
import org.cytoscape.util.swing.LookAndFeelUtil;

@SuppressWarnings("serial")
public class CloseWindowAction extends AbstractCyAction {
	
	private final NetworkViewMediator netViewMediator;
	
	public CloseWindowAction(final float menuGravity, final NetworkViewMediator netViewMediator) {
		super("Close Window");
		this.netViewMediator = netViewMediator;
		
		setPreferredMenu("File");
		setMenuGravity(menuGravity);
		
		final int CTRL = LookAndFeelUtil.isMac() ? InputEvent.META_DOWN_MASK :  InputEvent.CTRL_DOWN_MASK;
		setAcceleratorKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_W, CTRL));
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		final Window window = getActiveWindows();
		
		if (window != null && window instanceof NetworkViewFrame)
			netViewMediator.reattachNetworkView(((NetworkViewFrame) window).getNetworkView());
	}
	
	@Override
	public boolean isEnabled() {
		final Window window = getActiveWindows();
		
		return super.isEnabled() && window != null && window instanceof NetworkViewFrame;
	}
	
{'fraction_non_alphanumeric': 0.0942004693261817, 'fraction_numerical': 0.0013409319477036541, 'mean_word_length': 6.121718377088306, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3145597', 'n_tokens_mistral': 978, 'n_tokens_neox': 885, 'n_words': 178}