Lines 46-51
Link Here
|
46 |
|
46 |
|
47 |
import java.io.File; |
47 |
import java.io.File; |
48 |
import java.io.IOException; |
48 |
import java.io.IOException; |
|
|
49 |
import java.util.MissingResourceException; |
49 |
import org.netbeans.api.project.ProjectManager; |
50 |
import org.netbeans.api.project.ProjectManager; |
50 |
import org.netbeans.modules.websvc.api.client.WebServicesClientSupport; |
51 |
import org.netbeans.modules.websvc.api.client.WebServicesClientSupport; |
51 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
52 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
Lines 54-95
Link Here
|
54 |
import org.openide.ErrorManager; |
55 |
import org.openide.ErrorManager; |
55 |
import org.openide.NotifyDescriptor; |
56 |
import org.openide.NotifyDescriptor; |
56 |
import org.openide.modules.InstalledFileLocator; |
57 |
import org.openide.modules.InstalledFileLocator; |
57 |
import org.openide.modules.ModuleInstall; |
|
|
58 |
import org.openide.util.NbBundle; |
58 |
import org.openide.util.NbBundle; |
|
|
59 |
import org.openide.util.lookup.ServiceProvider; |
59 |
|
60 |
|
60 |
/** |
61 |
/** |
61 |
* @author Peter Williams |
62 |
* @author Peter Williams |
62 |
*/ |
63 |
*/ |
63 |
public class Installer extends ModuleInstall { |
64 |
@ServiceProvider(path="Modules/Start", service=Runnable.class) |
64 |
|
65 |
public class Installer implements Runnable { |
65 |
public Installer() { |
66 |
@Override |
66 |
super(); |
67 |
public void run() { |
|
|
68 |
if (ProjectManager.mutex().isWriteAccess()) { |
69 |
init(); |
70 |
} else { |
71 |
ProjectManager.mutex().postWriteRequest(this); |
72 |
} |
67 |
} |
73 |
} |
68 |
|
74 |
|
69 |
public void restored() { |
75 |
private void init() throws MissingResourceException { |
70 |
ProjectManager.mutex().postWriteRequest(new Runnable(){ |
76 |
try { |
71 |
public void run() { |
77 |
EditableProperties ep = PropertyUtils.getGlobalProperties(); |
72 |
try { |
78 |
boolean changed = false; |
73 |
EditableProperties ep = PropertyUtils.getGlobalProperties(); |
79 |
File wsclient_update = InstalledFileLocator.getDefault().locate("ant/extra/wsclientuptodate.jar", null, false); |
74 |
boolean changed = false; |
80 |
if (wsclient_update == null) { |
75 |
File wsclient_update = InstalledFileLocator.getDefault().locate("ant/extra/wsclientuptodate.jar", null, false); |
81 |
String msg = NbBundle.getMessage(Installer.class, "MSG_WSClientUpdateMissing"); |
76 |
if (wsclient_update == null) { |
82 |
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); |
77 |
String msg = NbBundle.getMessage(Installer.class, "MSG_WSClientUpdateMissing"); |
83 |
} else { |
78 |
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); |
84 |
String wsclient_update_old = ep.getProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH); |
79 |
} else { |
85 |
if (wsclient_update_old == null || !wsclient_update_old.equals(wsclient_update.toString())) { |
80 |
String wsclient_update_old = ep.getProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH); |
86 |
ep.setProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH, wsclient_update.toString()); |
81 |
if (wsclient_update_old == null || !wsclient_update_old.equals(wsclient_update.toString())) { |
87 |
changed = true; |
82 |
ep.setProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH, wsclient_update.toString()); |
|
|
83 |
changed = true; |
84 |
} |
85 |
} |
86 |
if (changed) { |
87 |
PropertyUtils.putGlobalProperties(ep); |
88 |
} |
89 |
} catch (IOException ioe) { |
90 |
ErrorManager.getDefault().notify(ioe); |
91 |
} |
88 |
} |
92 |
} |
89 |
} |
93 |
}); |
90 |
if (changed) { |
|
|
91 |
PropertyUtils.putGlobalProperties(ep); |
92 |
} |
93 |
} catch (IOException ioe) { |
94 |
ErrorManager.getDefault().notify(ioe); |
95 |
} |
94 |
} |
96 |
} |
95 |
} |
97 |
} |