1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/masterfs.suspend/build.xml Mon Jan 14 10:29:48 2013 +0100
1.3 @@ -0,0 +1,5 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<project basedir="." default="netbeans" name="contrib/masterfs.suspend">
1.6 + <description>Builds, tests, and runs the project org.netbeans.modules.masterfs.suspend</description>
1.7 + <import file="../../nbbuild/templates/projectized.xml"/>
1.8 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/masterfs.suspend/manifest.mf Mon Jan 14 10:29:48 2013 +0100
2.3 @@ -0,0 +1,5 @@
2.4 +Manifest-Version: 1.0
2.5 +OpenIDE-Module: org.netbeans.modules.masterfs.suspend
2.6 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/masterfs/suspend/Bundle.properties
2.7 +OpenIDE-Module-Specification-Version: 1.0
2.8 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/masterfs.suspend/nbproject/project.properties Mon Jan 14 10:29:48 2013 +0100
3.3 @@ -0,0 +1,2 @@
3.4 +javac.source=1.6
3.5 +javac.compilerargs=-Xlint -Xlint:-serial
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/masterfs.suspend/nbproject/project.xml Mon Jan 14 10:29:48 2013 +0100
4.3 @@ -0,0 +1,43 @@
4.4 +<?xml version="1.0" encoding="UTF-8"?>
4.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
4.6 + <type>org.netbeans.modules.apisupport.project</type>
4.7 + <configuration>
4.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
4.9 + <code-name-base>org.netbeans.modules.masterfs.suspend</code-name-base>
4.10 + <module-dependencies>
4.11 + <dependency>
4.12 + <code-name-base>org.netbeans.modules.masterfs</code-name-base>
4.13 + <run-dependency>
4.14 + <release-version>2</release-version>
4.15 + <specification-version>2.42</specification-version>
4.16 + </run-dependency>
4.17 + </dependency>
4.18 + <dependency>
4.19 + <code-name-base>org.openide.awt</code-name-base>
4.20 + <build-prerequisite/>
4.21 + <compile-dependency/>
4.22 + <run-dependency>
4.23 + <specification-version>7.55</specification-version>
4.24 + </run-dependency>
4.25 + </dependency>
4.26 + <dependency>
4.27 + <code-name-base>org.openide.util</code-name-base>
4.28 + <build-prerequisite/>
4.29 + <compile-dependency/>
4.30 + <run-dependency>
4.31 + <specification-version>8.29</specification-version>
4.32 + </run-dependency>
4.33 + </dependency>
4.34 + <dependency>
4.35 + <code-name-base>org.openide.windows</code-name-base>
4.36 + <build-prerequisite/>
4.37 + <compile-dependency/>
4.38 + <run-dependency>
4.39 + <specification-version>6.60</specification-version>
4.40 + </run-dependency>
4.41 + </dependency>
4.42 + </module-dependencies>
4.43 + <public-packages/>
4.44 + </data>
4.45 + </configuration>
4.46 +</project>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/masterfs.suspend/src/org/netbeans/modules/masterfs/suspend/Bundle.properties Mon Jan 14 10:29:48 2013 +0100
5.3 @@ -0,0 +1,8 @@
5.4 +OpenIDE-Module-Display-Category=Infrastructure
5.5 +OpenIDE-Module-Long-Description=\
5.6 + Sometimes one needs to perform extensive changes to one's sources from a command line (or other external tool) and wants to prevent the IDE from reacting to them. \
5.7 + This module provides "Suspend I/O" action into a Performance toolbar. \
5.8 + Once pressed, the IDE switches into "pause" mode. \
5.9 + Processing of external changes is delayed (until the IDE is resumed).
5.10 +OpenIDE-Module-Name=Suspend I/O
5.11 +OpenIDE-Module-Short-Description=Provides action in Performance toolbar to suspend the IDE
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/masterfs.suspend/src/org/netbeans/modules/masterfs/suspend/PauseAction.java Mon Jan 14 10:29:48 2013 +0100
6.3 @@ -0,0 +1,155 @@
6.4 +/*
6.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 + *
6.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
6.8 + *
6.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6.10 + * Other names may be trademarks of their respective owners.
6.11 + *
6.12 + * The contents of this file are subject to the terms of either the GNU
6.13 + * General Public License Version 2 only ("GPL") or the Common
6.14 + * Development and Distribution License("CDDL") (collectively, the
6.15 + * "License"). You may not use this file except in compliance with the
6.16 + * License. You can obtain a copy of the License at
6.17 + * http://www.netbeans.org/cddl-gplv2.html
6.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.19 + * specific language governing permissions and limitations under the
6.20 + * License. When distributing the software, include this License Header
6.21 + * Notice in each file and include the License file at
6.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
6.23 + * particular file as subject to the "Classpath" exception as provided
6.24 + * by Oracle in the GPL Version 2 section of the License file that
6.25 + * accompanied this code. If applicable, add the following below the
6.26 + * License Header, with the fields enclosed by brackets [] replaced by
6.27 + * your own identifying information:
6.28 + * "Portions Copyrighted [year] [name of copyright owner]"
6.29 + *
6.30 + * If you wish your version of this file to be governed by only the CDDL
6.31 + * or only the GPL Version 2, indicate your decision by adding
6.32 + * "[Contributor] elects to include this software in this distribution
6.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.34 + * single choice of license, a recipient has the option to distribute
6.35 + * your version of this file under either the CDDL, the GPL Version 2 or
6.36 + * to extend the choice of license to its licensees as provided above.
6.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
6.38 + * Version 2 license, then the option applies only if the new code is
6.39 + * made subject to such option by the copyright holder.
6.40 + *
6.41 + * Contributor(s):
6.42 + *
6.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
6.44 + */
6.45 +package org.netbeans.modules.masterfs.suspend;
6.46 +
6.47 +import java.awt.BorderLayout;
6.48 +import java.awt.Color;
6.49 +import java.awt.Component;
6.50 +import java.awt.EventQueue;
6.51 +import java.awt.Graphics;
6.52 +import java.awt.Graphics2D;
6.53 +import java.awt.event.ActionEvent;
6.54 +import java.awt.event.ActionListener;
6.55 +import javax.swing.JButton;
6.56 +import javax.swing.JDialog;
6.57 +import javax.swing.JFrame;
6.58 +import javax.swing.JPanel;
6.59 +import org.openide.awt.ActionID;
6.60 +import org.openide.awt.ActionReference;
6.61 +import org.openide.awt.ActionRegistration;
6.62 +import org.openide.util.NbBundle.Messages;
6.63 +import org.openide.util.RequestProcessor;
6.64 +import org.openide.windows.WindowManager;
6.65 +
6.66 +@ActionID(
6.67 + category = "System",
6.68 + id = "org.netbeans.core.ui.warmup.PauseAction"
6.69 +)
6.70 +@ActionRegistration(
6.71 + iconBase = "org/netbeans/modules/masterfs/suspend/pause.png",
6.72 + displayName = "#CTL_PauseAction"
6.73 +)
6.74 +@ActionReference(path = "Toolbars/Memory", position = 15000)
6.75 +@Messages({
6.76 + "CTL_PauseAction=Pause I/O Checks",
6.77 + "# {0} - number of pending events",
6.78 + "MSG_Resume=Resume (pending events: {0})"
6.79 +})
6.80 +public final class PauseAction implements ActionListener {
6.81 +
6.82 + private static final Color FILL_COLOR = new Color( 128, 128, 128, 128 );
6.83 + @Override
6.84 + public void actionPerformed(ActionEvent e) {
6.85 + suspend(1);
6.86 +
6.87 + JFrame mainWnd = ( JFrame ) WindowManager.getDefault().getMainWindow();
6.88 + Component oldGlass = mainWnd.getGlassPane();
6.89 + JPanel newGlass = new JPanel() {
6.90 +
6.91 + @Override
6.92 + public void paint( Graphics g ) {
6.93 + Graphics2D g2d = (Graphics2D)g.create();
6.94 + g2d.setColor( FILL_COLOR );
6.95 + g2d.fillRect( 0, 0, getWidth(), getHeight());
6.96 + g2d.dispose();
6.97 + }
6.98 + };
6.99 + newGlass.setOpaque( false );
6.100 + mainWnd.setGlassPane( newGlass );
6.101 + newGlass.setVisible( true );
6.102 + final JButton btnResume = new JButton();
6.103 + btnText(btnResume);
6.104 + final JDialog dlg = new JDialog( mainWnd, true );
6.105 + dlg.setUndecorated( true );
6.106 + dlg.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE );
6.107 + dlg.getContentPane().setLayout( new BorderLayout());
6.108 + dlg.getContentPane().add( btnResume, BorderLayout.CENTER );
6.109 + dlg.pack();
6.110 + dlg.setLocationRelativeTo( mainWnd );
6.111 + class C implements Runnable, ActionListener {
6.112 + private RequestProcessor.Task t;
6.113 +
6.114 + public C() {
6.115 + t = RequestProcessor.getDefault().create(this);
6.116 + t.schedule(1500);
6.117 + }
6.118 +
6.119 + @Override
6.120 + public void run() {
6.121 + if (!EventQueue.isDispatchThread()) {
6.122 + EventQueue.invokeLater(this);
6.123 + return;
6.124 + }
6.125 + btnText(btnResume);
6.126 + dlg.pack();
6.127 + t.schedule(1500);
6.128 + }
6.129 +
6.130 + @Override
6.131 + public void actionPerformed(ActionEvent e) {
6.132 + suspend(-1);
6.133 + btnResume.setEnabled(false);
6.134 + dlg.setVisible(false);
6.135 + }
6.136 + }
6.137 + C c = new C();
6.138 + btnResume.addActionListener( c );
6.139 + dlg.setVisible( true );
6.140 + newGlass.setVisible( false );
6.141 + mainWnd.setGlassPane( oldGlass );
6.142 + }
6.143 +
6.144 + final void btnText(JButton btnResume) {
6.145 + int pending = Integer.getInteger("org.netbeans.io.pending", 0); // NOI18N
6.146 + btnResume.setText(Bundle.MSG_Resume(pending));
6.147 + }
6.148 +
6.149 + static void suspend(int delta) {
6.150 + final String prop = "org.netbeans.io.suspend".intern(); // NOI18N
6.151 + synchronized (prop) {
6.152 + int prev = Integer.getInteger(prop, 0);
6.153 + prev += delta;
6.154 + System.setProperty(prop, "" + prev);
6.155 + prop.notifyAll();
6.156 + }
6.157 + }
6.158 +}
7.1 Binary file masterfs.suspend/src/org/netbeans/modules/masterfs/suspend/pause.png has changed
8.1 Binary file masterfs.suspend/src/org/netbeans/modules/masterfs/suspend/pause24.png has changed