This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 110136
Collapse All | Expand All

(-)apichanges.xml (+141 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- Search for CHANGEME in this document when copying and using it: -->
3
<!--
4
The contents of this file are subject to the terms of the Common Development
5
and Distribution License (the License). You may not use this file except in
6
compliance with the License.
7
8
You can obtain a copy of the License at http://www.netbeans.org/cddl.html
9
or http://www.netbeans.org/cddl.txt.
10
11
When distributing Covered Code, include this CDDL Header Notice in each file
12
and include the License file at http://www.netbeans.org/cddl.txt.
13
If applicable, add the following below the CDDL Header, with the fields
14
enclosed by brackets [] replaced by your own identifying information:
15
"Portions Copyrighted [year] [name of copyright owner]"
16
17
The Original Software is NetBeans. The Initial Developer of the Original
18
Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
19
Microsystems, Inc. All Rights Reserved.
20
-->
21
<?xml-stylesheet type="text/xml" href="../../nbbuild/javadoctools/apichanges.xsl"?>
22
<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../../nbbuild/javadoctools/apichanges.dtd">
23
24
<!--
25
26
INFO FOR PEOPLE ADDING CHANGES:
27
28
Check the DTD (apichanges.dtd) for details on the syntax. You do not
29
need to regenerate the HTML, as this is part of Javadoc generation; just
30
change the XML. Rough syntax of a change (several parts optional):
31
32
<change>
33
    <api name="compiler"/>
34
    <summary>Some brief description here, can use <b>XHTML</b></summary>
35
    <version major="1" minor="99"/>
36
    <date day="13" month="6" year="2001"/>
37
    <author login="jrhacker"/>
38
    <compatibility addition="yes"/>
39
    <description>
40
        The main description of the change here.
41
        Again can use full <b>XHTML</b> as needed.
42
    </description>
43
    <class package="org.openide.compiler" name="DoWhatIWantCompiler"/>
44
    <issue number="14309"/>
45
</change>
46
47
Also permitted elements: <package>, <branch>. <version> is API spec
48
version, recommended for all new changes. <compatibility> should say
49
if things were added/modified/deprecated/etc. and give all information
50
related to upgrading old code. List affected top-level classes and
51
link to issue numbers if applicable. See the DTD for more details.
52
53
Changes need not be in any particular order, they are sorted in various
54
ways by the stylesheet anyway.
55
56
Dates are assumed to mean "on the trunk". If you *also* make the same
57
change on a stabilization branch, use the <branch> tag to indicate this
58
and explain why the change was made on a branch in the <description>.
59
60
Please only change this file on the trunk! Rather: you can change it
61
on branches if you want, but these changes will be ignored; only the
62
trunk version of this file is important.
63
64
Deprecations do not count as incompatible, assuming that code using the
65
deprecated calls continues to see their documented behavior. But do
66
specify deprecation="yes" in <compatibility>.
67
68
This file is not a replacement for Javadoc: it is intended to list changes,
69
not describe the complete current behavior, for which ordinary documentation
70
is the proper place.
71
72
-->
73
74
<apichanges>
75
76
    <!-- First, a list of API names you may use: -->
77
    <apidefs>
78
        <apidef name="general">Java Source UI API</apidef>
79
        <!-- etc. -->
80
    </apidefs>
81
82
    <!-- ACTUAL CHANGES BEGIN HERE: -->
83
84
    <changes>
85
86
87
        <change id="ScanDialog">
88
            <api name="general"/>
89
            <summary>Added support for notifying user about running background scan.</summary>
90
            <version major="1" minor="2"/>
91
            <date day="18" month="7" year="2007"/>
92
            <author login="tzezula"/>
93
            <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible">
94
            </compatibility>
95
            <description>
96
             Added support for notifying user about running background scan. When the 
97
            background scan is running the support displays a dialog notifying user about it.
98
            When the background scan finishes the dialog is closed and the action is executed.
99
            </description>
100
            <class package="org.netbeans.api.java.source.ui" name="ScanDialog"/>
101
            <issue number="97542"/>
102
        </change>
103
        
104
    </changes>
105
106
    <!-- Now the surrounding HTML text and document structure: -->
107
108
    <htmlcontents>
109
<!--
110
111
                            NO NO NO NO NO!
112
113
         ==============>    DO NOT EDIT ME!  <==============
114
115
          AUTOMATICALLY GENERATED FROM APICHANGES.XML, DO NOT EDIT
116
117
                SEE CHANGEME/apichanges.xml
118
119
-->
120
    <head>
121
      <title>Change History for the Java Source UI API</title>
122
      <link rel="stylesheet" href="prose.css" type="text/css"/>
123
    </head>
124
    <body>
125
126
<p class="overviewlink"><a href="overview-summary.html">Overview</a></p>
127
128
<h1>Introduction</h1>
129
130
<p>This document lists changes made to the Java Source UI API<!--</a>-->.</p>
131
132
<!-- The actual lists of changes, as summaries and details: -->
133
      <hr/>
134
      <standard-changelists module-code-name="org.netbeans.modules.java.sourceui"/>
135
136
      <hr/><p>@FOOTER@</p>
137
138
    </body>
139
  </htmlcontents>
140
141
</apichanges>
(-)nbproject/project.properties (-1 / +1 lines)
Lines 1-3 Link Here
1
javac.compilerargs=-Xlint -Xlint:-serial
1
javac.compilerargs=-Xlint -Xlint:-serial
2
javac.source=1.5
2
javac.source=1.5
3
spec.version.base=1.1
3
spec.version.base=1.2
(-)nbproject/project.xml (+17 lines)
Lines 32-37 Link Here
32
                    </run-dependency>
32
                    </run-dependency>
33
                </dependency>
33
                </dependency>
34
                <dependency>
34
                <dependency>
35
                    <code-name-base>org.netbeans.modules.java.platform</code-name-base>
36
                    <build-prerequisite/>
37
                    <compile-dependency/>
38
                    <run-dependency>
39
                        <release-version>1</release-version>
40
                        <specification-version>1.9</specification-version>
41
                    </run-dependency>
42
                </dependency>
43
                <dependency>
35
                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
44
                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
36
                    <build-prerequisite/>
45
                    <build-prerequisite/>
37
                    <compile-dependency/>
46
                    <compile-dependency/>
Lines 64-69 Link Here
64
                    <run-dependency>
73
                    <run-dependency>
65
                        <release-version>1</release-version>
74
                        <release-version>1</release-version>
66
                        <specification-version>1.13</specification-version>
75
                        <specification-version>1.13</specification-version>
76
                    </run-dependency>
77
                </dependency>
78
                <dependency>
79
                    <code-name-base>org.openide.dialogs</code-name-base>
80
                    <build-prerequisite/>
81
                    <compile-dependency/>
82
                    <run-dependency>
83
                        <specification-version>7.5</specification-version>
67
                    </run-dependency>
84
                    </run-dependency>
68
                </dependency>
85
                </dependency>
69
                <dependency>
86
                <dependency>
(-)src/org/netbeans/api/java/source/ui/Bundle.properties (+2 lines)
Lines 29-31 Link Here
29
class_constant_javadoc=java.lang.Class constant.
29
class_constant_javadoc=java.lang.Class constant.
30
javadoc_content_not_found=<font color=\"#7c0000\">Javadoc not found.</font> Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager.
30
javadoc_content_not_found=<font color=\"#7c0000\">Javadoc not found.</font> Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager.
31
31
32
LBL_CancelAction=Cancel {0}
33
MSG_WaitScan=Please wait, classpath scanning in progress...
(-)src/org/netbeans/api/java/source/ui/ScanDialog.java (+132 lines)
Added Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 * 
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 * 
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 * 
15
 * Portions Copyrighted 2007 Sun Microsystems, Inc.
16
 */
17
package org.netbeans.api.java.source.ui;
18
19
import java.awt.Dialog;
20
import java.awt.event.ActionEvent;
21
import java.awt.event.ActionListener;
22
import java.io.IOException;
23
import java.net.URL;
24
import java.util.concurrent.Future;
25
import javax.swing.JLabel;
26
import javax.swing.SwingConstants;
27
import javax.swing.SwingUtilities;
28
import javax.swing.border.EmptyBorder;
29
import org.netbeans.api.java.platform.JavaPlatform;
30
import org.netbeans.api.java.source.ClasspathInfo;
31
import org.netbeans.api.java.source.CompilationController;
32
import org.netbeans.api.java.source.JavaSource;
33
import org.netbeans.api.java.source.SourceUtils;
34
import org.netbeans.api.java.source.Task;
35
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
36
import org.openide.DialogDescriptor;
37
import org.openide.DialogDisplayer;
38
import org.openide.util.Exceptions;
39
import org.openide.util.NbBundle;
40
41
/**
42
 * Support for notifying user about the background scan.
43
 * @since 1.2
44
 * @author Tomas Zezula
45
 */
46
public class ScanDialog {
47
48
    /**
49
     * This is a helper method to provide support for delaying invocations of actions
50
     * depending on java model. 
51
     * <br>Behavior of this method is following:<br>
52
     * If classpath scanning is not in progress, runnable's run() is called. <br>
53
     * If classpath scanning is in progress, modal cancellable notification dialog with specified
54
     * tile is opened.
55
     * </ul>
56
     * As soon as classpath scanning finishes, this dialog is closed and runnable's run() is called.
57
     * This method must be called in AWT EventQueue. Runnable is performed in AWT thread.
58
     *
59
     * @param runnable Runnable instance which will be called.
60
     * @param actionName Title of wait dialog.
61
     * @return true action was cancelled <br>
62
     *         false action was performed
63
     */
64
    public static boolean runWhenScanFinished (final Runnable runnable, final String actionName) {
65
        assert runnable != null;
66
        assert actionName != null;
67
        assert SwingUtilities.isEventDispatchThread();
68
        if (SourceUtils.isScanInProgress()) {
69
            
70
            class AL implements ActionListener {
71
                
72
                private Dialog dialog;
73
                private Future<Void> monitor;
74
                
75
                public synchronized void start (final Future<Void> monitor) {
76
                    assert monitor != null; 
77
                    this.monitor = monitor;
78
                    if (dialog != null) {
79
                        dialog.setVisible(true);                                        
80
                    }
81
                }
82
                
83
                public void actionPerformed(ActionEvent e) {                    
84
                    monitor.cancel(false);
85
                    close ();
86
                }
87
                
88
                synchronized  void close () {
89
                    if (dialog != null) {
90
                        dialog.setVisible(false);
91
                        dialog.dispose();
92
                        dialog = null;
93
                    }
94
                }
95
            };
96
            final AL listener = new AL ();            
97
            JLabel label = new JLabel(NbBundle.getMessage(ScanDialog.class,"MSG_WaitScan"),
98
                    javax.swing.UIManager.getIcon("OptionPane.informationIcon"), SwingConstants.LEFT);
99
            label.setBorder(new EmptyBorder(12,12,11,11));
100
            DialogDescriptor dd = new DialogDescriptor(label, actionName, true, new Object[]{NbBundle.getMessage(ScanDialog.class,"LBL_CancelAction",actionName)}, null, 0, null, listener);
101
            listener.dialog = DialogDisplayer.getDefault().createDialog(dd);
102
            listener.dialog.pack();
103
            final ClasspathInfo info = ClasspathInfo.create(JavaPlatform.getDefault().getBootstrapLibraries(),
104
                ClassPathSupport.createClassPath(new URL[0]),
105
                ClassPathSupport.createClassPath(new URL[0]));
106
            final JavaSource js = JavaSource.create(info);
107
            try {
108
                Future<Void> monitor = js.runWhenScanFinished(new Task<CompilationController>() {
109
                    public void run(CompilationController parameter) throws Exception {
110
                        SwingUtilities.invokeLater(new Runnable () {
111
                            public void run () {
112
                                listener.close();
113
                                runnable.run();
114
                            }
115
                        });                        
116
                    }
117
                }, true);
118
                if (!monitor.isDone()) {
119
                    listener.start(monitor);                       
120
                }
121
                return monitor.isCancelled();
122
            }catch (IOException e) {
123
                Exceptions.printStackTrace(e);
124
                return true;
125
            }
126
        } else {
127
            runnable.run();
128
            return false;
129
        }
130
    }
131
    
132
}

Return to bug 110136