Revision 1888

tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 1888)
999 999
gnuLicenceName=GNU General Public License version 2
1000 1000
iAcceptTheLicenceAndAgreeToQuoteTXMInMyWork=J'accepte les termes de la licence et je m'engage à citer TXM dans mes publications
1001 1001
seeTheQuoteSectionIn=(voir la section 'Citer le logiciel TXM' de la page d'accueil du site 
1002
selectWorkingDirectoryP0=Répertoire de travail
1002
selectWorkingDirectory=Répertoire de travail
1003 1003
options=Options...
1004 1004
firstLaunchOfTXM=Premier lancement de TXM
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java (revision 1888)
535 535

  
536 536
	public static String TXMisDistributedUnderLicence;
537 537

  
538
	public static String selectWorkingDirectoryP0;
538
	public static String selectWorkingDirectory;
539 539

  
540 540
	public static String firstLaunchOfTXM;
541 541
	
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 1888)
1003 1003
gnuLicenceName=GNU General Public License version 2
1004 1004
iAcceptTheLicenceAndAgreeToQuoteTXMInMyWork=I accept TXM license terms and I accept to quote TXM in my publications.
1005 1005
seeTheQuoteSectionIn=(see the "How to Cite the Textometry project" section in the textometrie.org web site: 
1006
selectWorkingDirectoryP0=Working directory
1006
selectWorkingDirectory=Working directory
1007 1007
options=Options...
1008 1008
firstLaunchOfTXM=First launch of TXM
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java (revision 1888)
33 33
import org.eclipse.core.commands.AbstractHandler;
34 34
import org.eclipse.core.commands.ExecutionEvent;
35 35
import org.eclipse.core.commands.ExecutionException;
36
import org.eclipse.core.resources.ResourcesPlugin;
36 37
import org.eclipse.core.runtime.IProgressMonitor;
37 38
import org.eclipse.core.runtime.IStatus;
38 39
import org.eclipse.core.runtime.Status;
39 40
import org.eclipse.equinox.app.IApplication;
40 41
import org.eclipse.osgi.util.NLS;
42
import org.eclipse.swt.widgets.DirectoryDialog;
41 43
import org.eclipse.swt.widgets.Display;
42 44
import org.eclipse.swt.widgets.Shell;
43 45
import org.eclipse.ui.PlatformUI;
......
79 81
					syncExec(new Runnable() {
80 82
						@Override
81 83
						public void run() {
82
							change();
84
							change(null);
83 85
						}
84 86
					});
85 87

  
......
97 99
		return event;
98 100
	}
99 101

  
100
	public static boolean change() {
102
	public static boolean change(String defaultValue) {
103
		if (defaultValue == null) {
104
			defaultValue = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getAbsolutePath();
105
		}
106
		ChooseWorkspaceData launchData = new ChooseWorkspaceData(defaultValue);
107
		DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell());
108
		dialog.setText(TXMUIMessages.selectWorkingDirectory);
109
		dialog.setMessage("This will restart TXM.");
110
		dialog.setFilterPath(defaultValue);
111
		String path = dialog.open();
112
		if (path == null || defaultValue.equals(path)) {
113
			return false;
114
		}
115
		launchData.workspaceSelected(path);
101 116
		
102
		ChooseWorkspaceData launchData = new ChooseWorkspaceData("");
103
		ChooseWorkspaceDialog dialog =
104
				new ChooseWorkspaceDialog(Display.getCurrent().getActiveShell(), launchData, true, true);
105
		dialog.setTitle("Select TXM working directory to use. This will restart TXM.");
106
		// don't force prompt : setShowDialogValue is set on error
107
		dialog.prompt(true);
108

  
109
		// check choosen path
110
		String selWS = launchData.getSelection();
111
		if (selWS == null)
112
			return false;// user cancelled (no restart)
113

  
114 117
		// Switch workspace :
115 118
		URL url = null;
116 119
		try {
117
			url = new URL("file", "", selWS);
120
			url = new URL("file", "", path);
118 121
			launchData.writePersistedData();
119 122
			ChooseWorkspaceData.setShowDialogValue(false);
120 123
			PlatformUI.getWorkbench().restart(); // need to restart TXM to apply changes
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/CGUMessageDialog.java (revision 1888)
159 159
		GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, true);
160 160
		bar.setLayoutData(gdata);
161 161
		
162
		w = new SelectDirectoryWidget(bar, SWT.NONE, launchData.getInitialDefault(), TXMUIMessages.selectWorkingDirectoryP0);
162
		w = new SelectDirectoryWidget(bar, SWT.NONE, launchData.getInitialDefault(), TXMUIMessages.selectWorkingDirectory);
163 163
		//w.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
164 164
		
165 165
		// "Options"

Also available in: Unified diff