Révision 2840

tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java (revision 2840)
74 74
	@Override
75 75
	public Object execute(ExecutionEvent event) {
76 76

  
77
		if (OSDetector.isFamilyWindows() 
78
				&& !isWindowsAdministratorUser()) {
79
			int ret = TXMMessageBox.show(HandlerUtil.getActiveShell(event), TXMUIMessages.updateWarning, TXMUIMessages.abortingWindowsUpdate, SWT.ICON_WARNING);
77
		boolean b = OSDetector.isFamilyWindows() && !isWindowsAdministratorUser();
78
		b = true;
79
		if (b) {
80
			int ret = TXMMessageBox.show(HandlerUtil.getActiveShell(event), TXMUIMessages.updateWarning, TXMUIMessages.abortingWindowsUpdate, SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
80 81
			if (ret == SWT.CANCEL) {
81 82
				Log.warning("Update canceled");
82 83
				return null;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenLocalizedWebPage.java (revision 2840)
30 30
import java.net.URL;
31 31
import java.util.Locale;
32 32

  
33
import javax.net.ssl.HttpsURLConnection;
34

  
33 35
import org.eclipse.core.commands.AbstractHandler;
34 36
import org.eclipse.core.commands.ExecutionEvent;
35 37
import org.eclipse.core.commands.ExecutionException;
36 38
import org.eclipse.core.runtime.Platform;
39
import org.eclipse.osgi.util.NLS;
37 40
import org.txm.rcp.Activator;
38 41
import org.txm.utils.logger.Log;
39 42

  
......
54 57
	public static final String URL_TXMDEPOT = GITPAGES+"txm-software/";
55 58
	public static final String HTMLPAGES = URL_TEXTOMETRIE + "html/";
56 59
	public static final String FILESPAGES = URL_TEXTOMETRIE + "files/";
57
	
60

  
58 61
	public static final String TEXTOMETRIE = "textometrie"; //$NON-NLS-1$
59 62
	public static final String TEXTOMETRIE_DOCS = "textometrie_docs"; //$NON-NLS-1$
60 63
	public static final String SF = "sf"; //$NON-NLS-1$
......
84 87

  
85 88
		return null;
86 89
	}
87
	
90

  
88 91
	static public String getValidURL(String urltoTest, String alternativeUrl) {
89 92
		try {
90 93
			URL url = new URL(urltoTest);
91
			try {
94
			if (url.getProtocol().equals("https")) {
95
				HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
96
				connection.disconnect();
97
			} else {
92 98
				url.openStream().close();
93
			} catch (Exception e) {
94
				Log.severe(e.getMessage());
95
				Log.printStackTrace(e);
96
				return alternativeUrl;
97 99
			}
100

  
98 101
		} catch (Exception e) {
99
			Log.severe(e.getMessage());
100
	//		Log.printStackTrace(e);
102
			Log.fine(NLS.bind("Error while testing the \"{0}\" web page: {1}", urltoTest, e.getMessage()));
103
			return alternativeUrl;
101 104
		}
102 105
		return urltoTest;
103 106
	}
......
109 112
	 * @return the txm browser
110 113
	 */
111 114
	static public Object openfile(String key) {
112
		
115

  
113 116
		String version = Platform.getBundle(Activator.PLUGIN_ID).getVersion().toString();
114 117
		int idx = version.lastIndexOf("."); //$NON-NLS-1$
115 118
		if (idx > 0) version = version.substring(0, idx); // remove the "qualifier" part
116
		
119

  
117 120
		String locale = Locale.getDefault().getLanguage();
118
		
121

  
119 122
		if (TEXTOMETRIE.equals(key)) {
120 123
			return OpenBrowser.openfile(getValidURL(URL_TEXTOMETRIE+locale, URL_TEXTOMETRIE)); //$NON-NLS-1$
121 124
		} else if (FAQ.equals(key)) {

Formats disponibles : Unified diff