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 168257
Collapse All | Expand All

(-)a/autoupdate.services/nbproject/project.xml (-1 / +1 lines)
Lines 53-59 Link Here
53
                    <build-prerequisite/>
53
                    <build-prerequisite/>
54
                    <compile-dependency/>
54
                    <compile-dependency/>
55
                    <run-dependency>
55
                    <run-dependency>
56
                        <specification-version>7.5</specification-version>
56
                        <specification-version>7.25</specification-version>
57
                    </run-dependency>
57
                    </run-dependency>
58
                </dependency>
58
                </dependency>
59
            </module-dependencies>
59
            </module-dependencies>
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/services/OperationSupportImpl.java (-27 / +4 lines)
Lines 612-618 Link Here
612
        }
612
        }
613
613
614
        public void doRestart (Restarter restarter, ProgressHandle progress) throws OperationException {
614
        public void doRestart (Restarter restarter, ProgressHandle progress) throws OperationException {
615
            createRestartMarker();
615
            LifecycleManager.getDefault().markForRestart();
616
            LifecycleManager.getDefault ().exit ();
616
            LifecycleManager.getDefault ().exit ();
617
            // if exit&restart fails => use restart later as fallback
617
            // if exit&restart fails => use restart later as fallback
618
            doRestartLater (restarter);
618
            doRestartLater (restarter);
Lines 620-643 Link Here
620
620
621
        public void doRestartLater (Restarter restarter) {
621
        public void doRestartLater (Restarter restarter) {
622
            // shedule module for restart
622
            // shedule module for restart
623
            createRestartMarker();
623
            LifecycleManager.getDefault().markForRestart();
624
            if(affectedModules!=null) {
624
            if(affectedModules!=null) {
625
            for (UpdateElement el : affectedModules) {
625
            for (UpdateElement el : affectedModules) {
626
                UpdateUnitFactory.getDefault().scheduleForRestart (el);
626
                UpdateUnitFactory.getDefault().scheduleForRestart (el);
627
            }
627
            }
628
            }
628
            }
629
        }
629
        }
630
        private void createRestartMarker() {
631
            try {
632
                File targetUserdir = new File(System.getProperty("netbeans.user")); // NOI18N
633
                File restartFile = new File(targetUserdir, "var/restart");//NOI18N
634
                if(!restartFile.exists()) {
635
                    restartFile.createNewFile();
636
                }
637
            } catch (IOException ex) {
638
                LOGGER.log(Level.INFO, "Can`t create restart file marker", ex);
639
            }
640
        }
641
    }
630
    }
642
631
643
    private static class ForCustomUninstall extends OperationSupportImpl {
632
    private static class ForCustomUninstall extends OperationSupportImpl {
Lines 691-697 Link Here
691
        }
680
        }
692
681
693
        public void doRestart (Restarter restarter, ProgressHandle progress) throws OperationException {
682
        public void doRestart (Restarter restarter, ProgressHandle progress) throws OperationException {
694
            createRestartMarker();
683
            LifecycleManager.getDefault().markForRestart();
695
            LifecycleManager.getDefault ().exit ();
684
            LifecycleManager.getDefault ().exit ();
696
            // if exit&restart fails => use restart later as fallback
685
            // if exit&restart fails => use restart later as fallback
697
            doRestartLater (restarter);
686
            doRestartLater (restarter);
Lines 699-722 Link Here
699
688
700
        public void doRestartLater (Restarter restarter) {
689
        public void doRestartLater (Restarter restarter) {
701
            // shedule module for restart
690
            // shedule module for restart
702
            createRestartMarker();
691
            LifecycleManager.getDefault().markForRestart();
703
            if(affectedModules!=null) {
692
            if(affectedModules!=null) {
704
            for (UpdateElement el : affectedModules) {
693
            for (UpdateElement el : affectedModules) {
705
                UpdateUnitFactory.getDefault().scheduleForRestart (el);
694
                UpdateUnitFactory.getDefault().scheduleForRestart (el);
706
            }
695
            }
707
            }
696
            }
708
        }
697
        }
709
        private void createRestartMarker() {
710
            try {
711
                File targetUserdir = new File(System.getProperty("netbeans.user")); // NOI18N
712
                File restartFile = new File(targetUserdir, "var/restart");//NOI18N
713
                if(!restartFile.exists()) {
714
                    restartFile.createNewFile();
715
                }
716
            } catch (IOException ex) {
717
                LOGGER.log(Level.INFO, "Can`t create restart file marker", ex);
718
            }
719
720
        }
721
    }
698
    }
722
}
699
}
(-)a/core.startup/src/org/netbeans/core/startup/ModuleLifecycleManager.java (+17 lines)
Lines 39-44 Link Here
39
39
40
package org.netbeans.core.startup;
40
package org.netbeans.core.startup;
41
41
42
import java.io.File;
43
import java.io.IOException;
42
import java.util.concurrent.atomic.AtomicBoolean;
44
import java.util.concurrent.atomic.AtomicBoolean;
43
import org.netbeans.CLIHandler;
45
import org.netbeans.CLIHandler;
44
import org.netbeans.TopSecurityManager;
46
import org.netbeans.TopSecurityManager;
Lines 89-92 Link Here
89
        }
91
        }
90
    }
92
    }
91
93
94
    public @Override void markForRestart() throws UnsupportedOperationException {
95
        String userdir = System.getProperty("netbeans.user"); // NOI18N
96
        if (userdir == null) {
97
            throw new UnsupportedOperationException("no userdir"); // NOI18N
98
        }
99
        File restartFile = new File(userdir, "var/restart"); // NOI18N
100
        if (!restartFile.exists()) {
101
            try {
102
                restartFile.createNewFile();
103
            } catch (IOException x) {
104
                throw new UnsupportedOperationException(x);
105
            }
106
        }
107
    }
108
92
}
109
}
(-)a/o.n.core/nbproject/project.xml (-1 / +1 lines)
Lines 156-162 Link Here
156
                    <build-prerequisite/>
156
                    <build-prerequisite/>
157
                    <compile-dependency/>
157
                    <compile-dependency/>
158
                    <run-dependency>
158
                    <run-dependency>
159
                        <specification-version>7.22</specification-version>
159
                        <specification-version>7.25</specification-version>
160
                    </run-dependency>
160
                    </run-dependency>
161
                </dependency>
161
                </dependency>
162
                <dependency>
162
                <dependency>
(-)a/o.n.core/src/org/netbeans/core/NbTopManager.java (-1 / +5 lines)
Lines 61-66 Link Here
61
import javax.swing.event.ChangeListener;
61
import javax.swing.event.ChangeListener;
62
import org.netbeans.TopSecurityManager;
62
import org.netbeans.TopSecurityManager;
63
import org.netbeans.core.startup.MainLookup;
63
import org.netbeans.core.startup.MainLookup;
64
import org.netbeans.core.startup.ModuleLifecycleManager;
64
import org.netbeans.core.startup.ModuleSystem;
65
import org.netbeans.core.startup.ModuleSystem;
65
import org.netbeans.core.startup.layers.SessionManager;
66
import org.netbeans.core.startup.layers.SessionManager;
66
import org.netbeans.core.ui.SwingBrowser;
67
import org.netbeans.core.ui.SwingBrowser;
Lines 389-395 Link Here
389
        for (int i = 0; i < modifs.length; i++) {
390
        for (int i = 0; i < modifs.length; i++) {
390
            try {
391
            try {
391
                dobj = modifs[i];
392
                dobj = modifs[i];
392
                SaveCookie sc = dobj.getCookie(SaveCookie.class);
393
                SaveCookie sc = dobj.getLookup().lookup(SaveCookie.class);
393
394
394
                if (sc != null) {
395
                if (sc != null) {
395
                    org.openide.awt.StatusDisplayer.getDefault().setStatusText(
396
                    org.openide.awt.StatusDisplayer.getDefault().setStatusText(
Lines 560-565 Link Here
560
        public void exit() {
561
        public void exit() {
561
            NbTopManager.exit();
562
            NbTopManager.exit();
562
        }
563
        }
564
        public @Override void markForRestart() throws UnsupportedOperationException {
565
            new ModuleLifecycleManager().markForRestart();
566
        }
563
    }
567
    }
564
568
565
    /** Get the module subsystem. */
569
    /** Get the module subsystem. */
(-)a/openide.util/apichanges.xml (+17 lines)
Lines 49-54 Link Here
49
    <apidef name="actions">Actions API</apidef>
49
    <apidef name="actions">Actions API</apidef>
50
</apidefs>
50
</apidefs>
51
<changes>
51
<changes>
52
    <change id="LifecycleManager.markForRestart">
53
        <api name="util"/>
54
        <summary>Added way to request that the platform restart.</summary>
55
        <version major="7" minor="25"/>
56
        <date day="14" month="7" year="2009"/>
57
        <author login="jglick"/>
58
        <compatibility addition="yes"/>
59
        <description>
60
            <p>
61
                 Can now use <code>LifecycleManager.markForRestart</code> to cause
62
                 the application to restart after exiting. Formerly needed to
63
                 create special files in the userdir or use similar tricks.
64
            </p>
65
        </description>
66
        <class package="org.openide" name="LifecycleManager"/>
67
        <issue number="168257"/>
68
    </change>
52
    <change id="org.openide.util.Lookup.paths">
69
    <change id="org.openide.util.Lookup.paths">
53
        <api name="lookup"/>
70
        <api name="lookup"/>
54
        <summary>Added
71
        <summary>Added
(-)a/openide.util/nbproject/project.properties (-1 / +1 lines)
Lines 42-48 Link Here
42
module.jar.dir=lib
42
module.jar.dir=lib
43
cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
43
cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
44
44
45
spec.version.base=7.24.0
45
spec.version.base=7.25.0
46
46
47
# For XMLSerializer, needed for XMLUtil.write to work w/ namespaces under JDK 1.4:
47
# For XMLSerializer, needed for XMLUtil.write to work w/ namespaces under JDK 1.4:
48
48
(-)a/openide.util/src/org/openide/LifecycleManager.java (+10 lines)
Lines 83-88 Link Here
83
     */
83
     */
84
    public abstract void exit();
84
    public abstract void exit();
85
85
86
    /**
87
     * Request that the application restart immediately after next being shut down.
88
     * You may want to then call {@link #exit} to go ahead and restart now.
89
     * @throws UnsupportedOperationException if this request cannot be honored
90
     * @since org.openide.util 7.25
91
     */
92
    public void markForRestart() throws UnsupportedOperationException {
93
        throw new UnsupportedOperationException();
94
    }
95
86
    /** Fallback instance. */
96
    /** Fallback instance. */
87
    private static final class Trivial extends LifecycleManager {
97
    private static final class Trivial extends LifecycleManager {
88
        public Trivial() {
98
        public Trivial() {

Return to bug 168257