Révision 2834
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenWelcomePage.java (revision 2834) | ||
---|---|---|
27 | 27 |
// |
28 | 28 |
package org.txm.rcp.commands; |
29 | 29 |
|
30 |
import java.io.IOException; |
|
31 |
import java.net.MalformedURLException; |
|
32 |
import java.net.URL; |
|
33 | 30 |
import java.util.Locale; |
34 | 31 |
|
35 | 32 |
import org.eclipse.core.commands.AbstractHandler; |
... | ... | |
37 | 34 |
import org.eclipse.core.commands.ExecutionException; |
38 | 35 |
import org.eclipse.core.runtime.Platform; |
39 | 36 |
import org.txm.rcp.Activator; |
40 |
import org.txm.utils.logger.Log; |
|
41 | 37 |
|
42 | 38 |
/** |
43 | 39 |
* Open the internal browser of TXM with a file |
... | ... | |
49 | 45 |
/** The Constant ID. */ |
50 | 46 |
public final static String ID = "org.txm.rcp.commands.OpenWelcomePage"; //$NON-NLS-1$ |
51 | 47 |
|
52 |
public static String WELCOME = "https://txm.gitpages.huma-num.fr/textometrie/";
|
|
48 |
public static String WELCOME = "https://pages.textometrie.org/textometrie/files/software/TXM/";
|
|
53 | 49 |
|
54 | 50 |
/* |
55 | 51 |
* (non-Javadoc) |
... | ... | |
62 | 58 |
|
63 | 59 |
public static boolean openWelcomePage() { |
64 | 60 |
|
65 |
try { // ensure network is enable |
|
66 |
URL url = new URL(WELCOME+"index.html"); |
|
67 |
url.openStream().close(); |
|
68 |
} |
|
69 |
catch (Exception e) { |
|
70 |
return false; |
|
71 |
} |
|
72 |
|
|
73 | 61 |
String locale = Locale.getDefault().getLanguage(); |
74 |
String version = Platform.getBundle(Activator.PLUGIN_ID).getVersion().toString(); |
|
62 |
String version = Platform.getBundle(Activator.PLUGIN_ID).getVersion().toString()+"beta";
|
|
75 | 63 |
int idx = version.lastIndexOf("."); //$NON-NLS-1$ |
76 | 64 |
if (idx > 0) version = version.substring(0, idx); // remove the "qualifier" part |
77 | 65 |
|
78 |
String urlString = WELCOME + locale; |
|
79 |
try { |
|
80 |
URL url = new URL(urlString); |
|
81 |
try { |
|
82 |
url.openStream().close(); |
|
83 |
} |
|
84 |
catch (IOException e) { |
|
85 |
Log.finer(e.getMessage()); |
|
86 |
// Log.printStackTrace(e); |
|
87 |
urlString = WELCOME; |
|
88 |
url = new URL(urlString); |
|
89 |
} |
|
90 |
return OpenBrowser.openfile(urlString) != null; |
|
91 |
} |
|
92 |
catch (MalformedURLException e) { |
|
93 |
Log.severe(e.getMessage()); |
|
94 |
Log.printStackTrace(e); |
|
95 |
return false; |
|
96 |
} |
|
66 |
return OpenBrowser.openfile(OpenLocalizedWebPage.getValidURL(WELCOME+version+"/"+locale, (WELCOME+version))) != null; |
|
97 | 67 |
} |
98 | 68 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/CGUMessageDialog.java (revision 2834) | ||
---|---|---|
1 | 1 |
package org.txm.rcp.swt.dialog; |
2 | 2 |
|
3 |
import java.io.IOException; |
|
4 | 3 |
import java.net.URI; |
5 |
import java.net.URISyntaxException; |
|
6 | 4 |
|
7 | 5 |
import org.eclipse.jface.dialogs.Dialog; |
8 | 6 |
import org.eclipse.jface.window.Window; |
9 |
import org.eclipse.osgi.util.NLS; |
|
10 | 7 |
import org.eclipse.swt.SWT; |
11 | 8 |
import org.eclipse.swt.events.MouseEvent; |
12 | 9 |
import org.eclipse.swt.events.MouseListener; |
... | ... | |
23 | 20 |
import org.eclipse.swt.widgets.Display; |
24 | 21 |
import org.eclipse.swt.widgets.ExpandBar; |
25 | 22 |
import org.eclipse.swt.widgets.ExpandItem; |
26 |
import org.eclipse.swt.widgets.Group; |
|
27 | 23 |
import org.eclipse.swt.widgets.Label; |
28 | 24 |
import org.eclipse.swt.widgets.Shell; |
29 |
import org.eclipse.swt.widgets.Text; |
|
30 | 25 |
import org.eclipse.ui.internal.ide.ChooseWorkspaceData; |
31 | 26 |
import org.txm.rcp.IImageKeys; |
32 |
import org.txm.rcp.commands.OpenBrowser; |
|
33 | 27 |
import org.txm.rcp.messages.TXMUIMessages; |
34 | 28 |
import org.txm.rcp.swt.SelectDirectoryWidget; |
35 | 29 |
|
... | ... | |
159 | 153 |
GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, true); |
160 | 154 |
bar.setLayoutData(gdata); |
161 | 155 |
|
162 |
w = new SelectDirectoryWidget(bar, SWT.NONE, launchData.getInitialDefault(), TXMUIMessages.selectWorkingDirectory); |
|
156 |
String defaultPath = System.getProperty("user.home")+"/TXM"; |
|
157 |
if (launchData != null) { |
|
158 |
defaultPath = launchData.getInitialDefault(); |
|
159 |
} |
|
160 |
w = new SelectDirectoryWidget(bar, SWT.NONE, defaultPath, TXMUIMessages.selectWorkingDirectory); |
|
163 | 161 |
//w.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false)); |
164 | 162 |
|
165 | 163 |
// "Options" |
... | ... | |
195 | 193 |
@Override |
196 | 194 |
protected void buttonPressed(int buttonId) { |
197 | 195 |
checked = checkMessageButton.getSelection(); |
198 |
launchData.workspaceSelected(w.getPath()); |
|
196 |
if (launchData != null) { |
|
197 |
launchData.workspaceSelected(w.getPath()); |
|
198 |
} |
|
199 | 199 |
super.buttonPressed(buttonId); |
200 |
|
|
200 | 201 |
} |
201 | 202 |
|
202 | 203 |
public boolean hasCheckBeenPressed() { |
... | ... | |
207 | 208 |
} |
208 | 209 |
|
209 | 210 |
public static void main(String[] args) { |
210 |
// CGUMessageDialog dialog = new CGUMessageDialog(Display.getDefault().getActiveShell()); |
|
211 |
// /** |
|
212 |
// * CGUMessageDialog dialog = new CGUMessageDialog(Display.getCurrent().getActiveShell(), |
|
213 |
// TXMUIMessages.termsOfService, |
|
214 |
// IImageKeys.getImage(IImageKeys.TXM_ICON), |
|
215 |
// TXMUIMessages.infpSupTXMIsPublishedUnderTheGNUGPL2LicenseAmpltInfaHrefEqualshttpsColonwwwgnuorglicensesgpl20enhtmlSuphttpsColonwwwgnuorglicensesgpl20enhtmlInfaSupAmpgt, |
|
216 |
// IImageKeys.getImage(IImageKeys.TXM), |
|
217 |
// TXMUIMessages.iAcceptTheLicenceAndIUndertakeToCiteTXMForAcknowledgingMyUseOfTXMInMyResearchWorkSeeTheCitationSectionOfTheInfhttpColontextometrieenslyonfrspipphprubrique61SupPage, |
|
218 |
// dialogButtonLabels, 0) { |
|
219 |
// }; |
|
220 |
// */ |
|
221 |
// dialog.open(); |
|
211 |
System.out.println("Opening CGU dialog..."); |
|
212 |
Display display = new Display(); |
|
213 |
Shell shell = new Shell(display); |
|
214 |
CGUMessageDialog dialog = new CGUMessageDialog(shell, null); |
|
215 |
dialog.open(); |
|
222 | 216 |
} |
223 | 217 |
|
224 | 218 |
// protected Control createMessageArea(Composite composite) { |
Formats disponibles : Unified diff