Revision 2355

tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java (revision 2355)
60 60
import org.txm.utils.logger.Log;
61 61

  
62 62
import groovy.lang.Binding;
63
import groovy.lang.Script;
63 64
/**
64 65
 * Handler to Execute a Groovy script. 
65 66
 * 
......
261 262
					Timer timer = new Timer();
262 263
					binding.setProperty("timer", timer); //$NON-NLS-1$
263 264
					
265
					Log.info(NLS.bind("Compiling {0}...", scriptfile.getName()));
266
					Script script = gse.createScript(relativepath, binding);
264 267
					Log.info(NLS.bind(TXMUIMessages.executingGroovyScript, scriptfile.getName()));
265
					
266
					gse.run(relativepath, binding);
268
					script.run();
267 269
					Log.info(TXMUIMessages.bind(TXMUIMessages.doneP0Ms, timer.ellaspeTime()));
268 270
				} catch (ThreadDeath td) {
269 271
					return Status.CANCEL_STATUS;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java (revision 2355)
614 614
	public static String LoadBinaryCorporaDirectory_selectTheTXMCorpusToLoad;
615 615

  
616 616
	public static String selectAnotherTXMCorporaToRestore;
617

  
618
	public static String resetAll;
619

  
620
	public static String password;
617 621
	
622
	public static String login;
623
	
624
	public static String connect;
625

  
626
	public static String loginToP0;
627
	
618 628
	static {
619 629
		// initialize resource bundle
620 630
		Utf8NLS.initializeMessages(BUNDLE_NAME, TXMUIMessages.class);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 2355)
7 7
Explorer_4 = 🡅
8 8
Explorer_5 = ⭮
9 9
Explorer_7 = ⌂
10

  
11

  
12
resetAll=Reset All
13
password=Password
14
login=Login
15
loginToP0=Login to {0}
16
connect=Connect
10 17

  
11 18
FileTreeContentProvider_4 = '
12 19

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 2355)
7 7
Explorer_4 = 🡅
8 8
Explorer_5 = ⭮
9 9
Explorer_7 = ⌂
10

  
11
resetAll=Remise à zéro
12
password=Mot de passe
13
login=Identifiant
14
loginToP0=Connexion à {0}
15
connect=Se connecter
10 16

  
11 17
FileTreeContentProvider_4 = '
12 18

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/UsernamePasswordDialog.java (revision 2355)
12 12

  
13 13
import org.eclipse.jface.dialogs.Dialog;
14 14
import org.eclipse.jface.dialogs.IDialogConstants;
15
import org.eclipse.osgi.util.NLS;
15 16
import org.eclipse.swt.SWT;
16 17
import org.eclipse.swt.layout.GridData;
17 18
import org.eclipse.swt.layout.GridLayout;
......
20 21
import org.eclipse.swt.widgets.Label;
21 22
import org.eclipse.swt.widgets.Shell;
22 23
import org.eclipse.swt.widgets.Text;
24
import org.txm.rcp.messages.TXMUIMessages;
23 25

  
24 26
public class UsernamePasswordDialog extends Dialog {
25 27
	private static final int RESET_ID = IDialogConstants.NO_TO_ALL_ID + 1;
......
28 30
	private Text passwordField;
29 31
	boolean must[];
30 32
	String user  = null, password = null;
31
	String kr_name;
33
	String address;
34
	String details;
35
	String title;
32 36
	
33 37
	public UsernamePasswordDialog(Shell parentShell, boolean must[], String kr_name) {
34 38
		super(parentShell);
35 39
		this.must = must;
36
		this.kr_name = kr_name;
40
		this.address = kr_name;
37 41
	}
38 42
	
39 43
	/* (non-Javadoc)
......
42 46
	@Override
43 47
	protected void configureShell(Shell newShell) {
44 48
		super.configureShell(newShell);
45
		newShell.setText("Login to "+kr_name);
49
		
50
		if (title == null) {
51
			title = NLS.bind(TXMUIMessages.loginToP0, address);
52
		}
53
		newShell.setText(title);
54
		int l = Math.max(title.length()*10, 500);
55
		newShell.setSize(l, 200);
46 56
	}
57
	
58
	@Override
59
	protected boolean isResizable() {
60
	    return true;
61
	}
47 62

  
48 63
	protected Control createDialogArea(Composite parent) {
49 64
		Composite comp = (Composite) super.createDialogArea(parent);
50 65

  
51 66
		GridLayout layout = (GridLayout) comp.getLayout();
52 67
		layout.numColumns = 2;
68
		
69
		if (details != null) {
70
			Label detailsLabel = new Label(comp, SWT.RIGHT);
71
			detailsLabel.setText(details);
72
			GridData gdata = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, true, 2,1);
73
			detailsLabel.setLayoutData(gdata);
74
		}
53 75

  
54 76
		if (must[0]) {
55 77
			Label usernameLabel = new Label(comp, SWT.RIGHT);
56
			usernameLabel.setText("Username: ");
78
			usernameLabel.setText(TXMUIMessages.login);
57 79

  
58 80
			usernameField = new Text(comp, SWT.SINGLE);
59 81
			GridData data = new GridData(GridData.FILL_HORIZONTAL);
60 82
			usernameField.setLayoutData(data);
83
			
84
			if (user != null) {
85
				usernameField.setText(user);
86
			}
61 87
		}
62 88
		if (must[1]) {
63 89
			Label passwordLabel = new Label(comp, SWT.RIGHT);
64
			passwordLabel.setText("Password: ");
90
			passwordLabel.setText(TXMUIMessages.password);
65 91

  
66 92
			passwordField = new Text(comp, SWT.SINGLE | SWT.PASSWORD);
67 93
			GridData data = new GridData(GridData.FILL_HORIZONTAL);
......
72 98

  
73 99
	protected void createButtonsForButtonBar(Composite parent) {
74 100
		super.createButtonsForButtonBar(parent);
75
		createButton(parent, RESET_ID, "Reset All", false);
101
		createButton(parent, RESET_ID, TXMUIMessages.resetAll, false);
102
		this.getButton(OK).setText(TXMUIMessages.connect);
76 103
	}
77 104

  
78 105
	protected void buttonPressed(int buttonId) {
......
105 132
	public String getPassword() {
106 133
		return password;
107 134
	}
135

  
136
	/**
137
	 * must be called before opening the dialog
138
	 * @param user
139
	 */
140
	public void setUsername(String user) {
141
		this.user = user;
142
	}
143
	
144
	/**
145
	 * must be called before opening the dialog
146
	 * @param user
147
	 */
148
	public void setDetails(String defails) {
149
		this.details = defails;
150
	}
151
	
152
	/**
153
	 * must be called before opening the dialog
154
	 * @param user
155
	 */
156
	public void setTitle(String title) {
157
		this.title = title;
158
	}
108 159
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/QueryAssistDialog.java (revision 2355)
154 154
			// directory
155 155
			chercheLabel = new Label(mainPanel, SWT.NONE);
156 156
			chercheLabel.setAlignment(SWT.CENTER);
157
			chercheLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, true, false, 2 , 1));
157
			chercheLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, true, false, 1, 1));
158 158
			chercheLabel.setText(TXMUIMessages.imLookingForColon);
159

  
159
			
160 160
			scrollComposite = new ScrolledComposite(mainPanel, SWT.V_SCROLL|SWT.H_SCROLL);
161 161
			scrollComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
162 162

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java (revision 2355)
12 12
import org.eclipse.swt.widgets.Display;
13 13
import org.eclipse.ui.handlers.HandlerUtil;
14 14
import org.txm.objects.Project;
15
import org.txm.objects.Text;
15 16
import org.txm.rcp.commands.CloseEditorsUsing;
16 17
import org.txm.rcp.commands.RestartTXM;
17 18
import org.txm.rcp.handlers.scripts.ExecuteImportScript;
......
29 30
		ISelection sel = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
30 31
		if (!(sel instanceof IStructuredSelection)) return null;
31 32
		IStructuredSelection selection = (IStructuredSelection) sel;
32

  
33
		
33 34
		Object s = selection.getFirstElement();
34
		if (!(s instanceof MainCorpus))
35
		if (!(s instanceof MainCorpus)) {
35 36
			return null;
37
		}
36 38
		MainCorpus corpus = (MainCorpus) s;
39
		
40
		// force corpus to be recomputed
41
		String forceDirty = event.getParameter("org.txm.rcp.commands.workspace.UpdateCorpus.force"); //$NON-NLS-1$
42
		if ("true".equals(forceDirty)) {
43
			corpus.getProject().setDirty();
44
		}
45
		
37 46
		update(corpus);
38 47

  
39 48
		return corpus;
40 49
	}
41

  
50
	
42 51
	public static JobHandler update(final MainCorpus corpus) {
43 52

  
44 53
		final Project project = corpus.getProject();
......
66 75
		project.setNeedToBuild();
67 76
		project.setDoMultiThread(false); //too soon
68 77
		project.setDoUpdate(true);
69
		project.setImportModuleName("xtz");
78
		String currentModule = project.getImportModuleName();
79
		if (!(currentModule.equals("xtz") || currentModule.equals("transcriber"))) {
80
			project.setImportModuleName("xtz");
81
		}
70 82

  
71 83
		JobHandler job = new JobHandler("Updating corpus "+corpus+" using "+project) {
72 84

  
tmp/org.txm.rcp/plugin.xml (revision 2355)
1074 1074
               </visibleWhen>
1075 1075
            </command>
1076 1076
            <command
1077
                  commandId="org.txm.rcp.commands.workspace.UpdateCorpus"
1078
                  icon="icons/functions/update.png"
1079
                  label="Force re-import corpus"
1080
                  style="push">
1081
               <visibleWhen
1082
                     checkEnabled="false">
1083
                  <or>
1084
                     <reference
1085
                           definitionId="OneMainCorpusSelected">
1086
                     </reference>
1087
                  </or>
1088
               </visibleWhen>
1089
               <parameter
1090
                     name="org.txm.rcp.commands.workspace.UpdateCorpus.force"
1091
                     value="true">
1092
               </parameter>
1093
            </command>
1094
            <command
1077 1095
                  commandId="org.txm.rcp.handlers.results.DeleteObject"
1078 1096
                  icon="icons/functions/Delete.png"
1079 1097
                  style="push">

Also available in: Unified diff