Révision 1383
| tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/CreateMessagesTable.java (revision 1383) | ||
|---|---|---|
| 7 | 7 |
import java.util.Properties; |
| 8 | 8 |
import java.util.TreeSet; |
| 9 | 9 |
|
| 10 |
import org.odftoolkit.simple.Document; |
|
| 10 | 11 |
import org.odftoolkit.simple.SpreadsheetDocument; |
| 12 |
import org.odftoolkit.simple.TextDocument; |
|
| 11 | 13 |
import org.odftoolkit.simple.table.Cell; |
| 12 | 14 |
import org.odftoolkit.simple.table.Row; |
| 13 | 15 |
import org.odftoolkit.simple.table.Table; |
| ... | ... | |
| 28 | 30 |
this.lang = lang; |
| 29 | 31 |
} |
| 30 | 32 |
|
| 31 |
public boolean run(File output) throws Exception {
|
|
| 33 |
public boolean createODT(File output) throws Exception {
|
|
| 34 |
|
|
| 32 | 35 |
if (!dir.exists()) return false; |
| 33 | 36 |
File defaultPropertiesFile = new File(dir, "messages.properties"); |
| 34 | 37 |
if (!defaultPropertiesFile.exists()) return false; |
| ... | ... | |
| 42 | 45 |
Properties slave = new Properties(); |
| 43 | 46 |
slave.load(IOUtils.getReader(langPropertiesFile, "UTF-8")); |
| 44 | 47 |
|
| 45 |
SpreadsheetDocument spreadsheet = SpreadsheetDocument.newSpreadsheetDocument();
|
|
| 48 |
TextDocument doc = org.odftoolkit.simple.TextDocument.newTextDocument();
|
|
| 46 | 49 |
|
| 47 |
|
|
| 48 | 50 |
TreeSet<Object> keys = new TreeSet<Object>(PluginMessagesManager.comp); |
| 49 | 51 |
keys.addAll(master.keySet()); |
| 50 | 52 |
|
| 51 |
//Cell cell = table.getCellByPosition(0, 0); |
|
| 52 |
// cell.setStringValue("Hello World!");
|
|
| 53 |
Table table = doc.addTable(keys.size()+1,4); |
|
| 54 |
editTable(doc, table, keys, master, slave); |
|
| 55 |
|
|
| 56 |
System.out.println("Saving...");
|
|
| 57 |
doc.save(output); |
|
| 58 |
System.out.println("Done.");
|
|
| 53 | 59 |
|
| 54 |
Table table = spreadsheet.getTableList().get(0); |
|
| 55 |
table.appendRows(keys.size()+1); |
|
| 56 |
table.appendColumns(4); |
|
| 60 |
return true; |
|
| 61 |
} |
|
| 62 |
|
|
| 63 |
private void editTable(Document doc, Table table, TreeSet<Object> keys,Properties master, Properties slave ) {
|
|
| 64 |
|
|
| 57 | 65 |
table.getCellByPosition(0, 0).setStringValue("N");
|
| 58 | 66 |
table.getCellByPosition(1, 0).setStringValue("KEY");
|
| 59 | 67 |
table.getCellByPosition(2, 0).setStringValue("DEFAULT");
|
| ... | ... | |
| 67 | 75 |
table.getCellByPosition(3, n).setStringValue(""+slave.get(key));
|
| 68 | 76 |
n++; |
| 69 | 77 |
} |
| 78 |
} |
|
| 70 | 79 |
|
| 80 |
public boolean createODS(File output) throws Exception {
|
|
| 81 |
if (!dir.exists()) return false; |
|
| 82 |
File defaultPropertiesFile = new File(dir, "messages.properties"); |
|
| 83 |
if (!defaultPropertiesFile.exists()) return false; |
|
| 84 |
|
|
| 85 |
File langPropertiesFile = new File(dir, "messages_"+lang+".properties"); |
|
| 86 |
|
|
| 87 |
System.out.println("Building table...");
|
|
| 88 |
Properties master = new Properties(); |
|
| 89 |
master.load(IOUtils.getReader(defaultPropertiesFile, "UTF-8")); |
|
| 90 |
|
|
| 91 |
Properties slave = new Properties(); |
|
| 92 |
slave.load(IOUtils.getReader(langPropertiesFile, "UTF-8")); |
|
| 93 |
|
|
| 94 |
SpreadsheetDocument spreadsheet = SpreadsheetDocument.newSpreadsheetDocument(); |
|
| 95 |
|
|
| 96 |
|
|
| 97 |
TreeSet<Object> keys = new TreeSet<Object>(PluginMessagesManager.comp); |
|
| 98 |
keys.addAll(master.keySet()); |
|
| 99 |
|
|
| 100 |
//Cell cell = table.getCellByPosition(0, 0); |
|
| 101 |
// cell.setStringValue("Hello World!");
|
|
| 102 |
|
|
| 103 |
Table table = spreadsheet.getTableList().get(0); |
|
| 104 |
table.appendRows(keys.size()+1); |
|
| 105 |
table.appendColumns(4); |
|
| 106 |
editTable(spreadsheet, table, keys, master, slave); |
|
| 107 |
|
|
| 71 | 108 |
System.out.println("Saving...");
|
| 72 | 109 |
spreadsheet.save(output); |
| 73 | 110 |
System.out.println("Done.");
|
| ... | ... | |
| 75 | 112 |
} |
| 76 | 113 |
|
| 77 | 114 |
public static void main(String[] args) throws Exception {
|
| 78 |
System.out.println(new CreateMessagesTable("fr").run(new File("messages_fr.ods")));
|
|
| 115 |
System.out.println(new CreateMessagesTable("fr").createODT(new File("messages_fr.odt")));
|
|
| 79 | 116 |
} |
| 80 | 117 |
} |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 1383) | ||
|---|---|---|
| 245 | 245 |
impossibleToReadP0=** Impossible to read {0}
|
| 246 | 246 |
includeTheKeywordStructureInTheCount=include the keyword structure in the count |
| 247 | 247 |
info_txmIsReady=TXM is ready. |
| 248 |
infpSupTXMIsPublishedUnderTheGNUGPL2LicenseAmpltInfaHrefEqualshttpsColonwwwgnuorglicensesgpl20enhtmlSuphttpsColonwwwgnuorglicensesgpl20enhtmlInfaSupAmpgt=<p>TXM is published under the GNU GPL 2 license <<a href\="https\://www.gnu.org/licenses/gpl-2.0.en.html">https\://www.gnu.org/licenses/gpl-2.0.en.html</a>>. |
|
| 248 |
infpSupTXMIsPublishedUnderTheGNUGPL2LicenseAmpltInfaHrefEqualshttpsColonwwwgnuorglicensesgpl20enhtmlSuphttpsColonwwwgnuorglicensesgpl20enhtmlInfaSupAmpgt=<p>TXM is published under the GNU GPL 2 license <<a target="_blank" href\="https\://www.gnu.org/licenses/gpl-2.0.en.html">https\://www.gnu.org/licenses/gpl-2.0.en.html</a>>.
|
|
| 249 | 249 |
initializationOfThePlatform=Initialization of the platform |
| 250 | 250 |
initializingPlatform=Initializing platform... |
| 251 | 251 |
installPathColonP0=Install path\: {0}
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 1383) | ||
|---|---|---|
| 226 | 226 |
impossibleToReadP0=** Impossible de lire {0}
|
| 227 | 227 |
includeTheKeywordStructureInTheCount=inclure la structure contenant le pivot |
| 228 | 228 |
info_txmIsReady=TXM est prêt. |
| 229 |
infpSupTXMIsPublishedUnderTheGNUGPL2LicenseAmpltInfaHrefEqualshttpsColonwwwgnuorglicensesgpl20enhtmlSuphttpsColonwwwgnuorglicensesgpl20enhtmlInfaSupAmpgt=<p>TXM est diffusé sous licence GNU GPL 2 <<a href\="https\://www.gnu.org/licenses/gpl-2.0.fr.html">https\://www.gnu.org/licenses/gpl-2.0.fr.html</a> |
|
| 229 |
infpSupTXMIsPublishedUnderTheGNUGPL2LicenseAmpltInfaHrefEqualshttpsColonwwwgnuorglicensesgpl20enhtmlSuphttpsColonwwwgnuorglicensesgpl20enhtmlInfaSupAmpgt=<p>TXM est diffusé sous licence GNU GPL 2 <<a target="_blank" href\="https\://www.gnu.org/licenses/gpl-2.0.fr.html">https\://www.gnu.org/licenses/gpl-2.0.fr.html</a>
|
|
| 230 | 230 |
initializationOfThePlatform=Initialisation de la plateforme... |
| 231 | 231 |
initializingPlatform=Initialisation de la plateforme... |
| 232 | 232 |
installPathColonP0=Chemin d''installation \: {0}
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/HTMLMessageDialog.java (revision 1383) | ||
|---|---|---|
| 11 | 11 |
import org.eclipse.swt.accessibility.AccessibleAdapter; |
| 12 | 12 |
import org.eclipse.swt.accessibility.AccessibleEvent; |
| 13 | 13 |
import org.eclipse.swt.browser.Browser; |
| 14 |
import org.eclipse.swt.browser.CloseWindowListener; |
|
| 15 |
import org.eclipse.swt.browser.OpenWindowListener; |
|
| 16 |
import org.eclipse.swt.browser.VisibilityWindowListener; |
|
| 17 |
import org.eclipse.swt.browser.WindowEvent; |
|
| 14 | 18 |
import org.eclipse.swt.custom.CLabel; |
| 15 | 19 |
import org.eclipse.swt.graphics.Color; |
| 16 | 20 |
import org.eclipse.swt.graphics.Image; |
| 17 | 21 |
import org.eclipse.swt.graphics.Point; |
| 22 |
import org.eclipse.swt.layout.FillLayout; |
|
| 18 | 23 |
import org.eclipse.swt.layout.GridData; |
| 19 | 24 |
import org.eclipse.swt.layout.GridLayout; |
| 20 | 25 |
import org.eclipse.swt.widgets.Button; |
| 21 | 26 |
import org.eclipse.swt.widgets.Composite; |
| 22 | 27 |
import org.eclipse.swt.widgets.Control; |
| 28 |
import org.eclipse.swt.widgets.Display; |
|
| 23 | 29 |
import org.eclipse.swt.widgets.Label; |
| 24 | 30 |
import org.eclipse.swt.widgets.Shell; |
| 25 | 31 |
|
| ... | ... | |
| 160 | 166 |
|
| 161 | 167 |
|
| 162 | 168 |
messageLabel.setBackground(composite.getBackground()); |
| 169 |
initialize(composite.getDisplay(), messageLabel); |
|
| 163 | 170 |
} |
| 164 | 171 |
return composite; |
| 165 | 172 |
} |
| 173 |
|
|
| 174 |
static void initialize(final Display display, Browser browser) |
|
| 175 |
{
|
|
| 176 |
browser.addOpenWindowListener(new OpenWindowListener() {
|
|
| 177 |
@Override |
|
| 178 |
public void open(WindowEvent e) {
|
|
| 179 |
Shell shell = new Shell(e.display); |
|
| 180 |
shell.setText("New Window");
|
|
| 181 |
shell.setLayout(new FillLayout()); |
|
| 182 |
Browser browser1 = new Browser(shell, SWT.NONE); |
|
| 183 |
initialize(e.display, browser1); |
|
| 184 |
e.browser = browser1; |
|
| 185 |
} |
|
| 186 |
}); |
|
| 187 |
browser.addVisibilityWindowListener(new VisibilityWindowListener() |
|
| 188 |
{
|
|
| 189 |
@Override |
|
| 190 |
public void hide(WindowEvent e) |
|
| 191 |
{
|
|
| 192 |
Browser browser = (Browser) e.widget; |
|
| 193 |
Shell shell = browser.getShell(); |
|
| 194 |
shell.setVisible(false); |
|
| 195 |
} |
|
| 166 | 196 |
|
| 197 |
@Override |
|
| 198 |
public void show(WindowEvent e) |
|
| 199 |
{
|
|
| 200 |
Browser browser = (Browser) e.widget; |
|
| 201 |
final Shell shell = browser.getShell(); |
|
| 202 |
if (e.location != null) shell.setLocation(e.location); |
|
| 203 |
if (e.size != null) |
|
| 204 |
{
|
|
| 205 |
Point size = e.size; |
|
| 206 |
shell.setSize(shell.computeSize(size.x, size.y)); |
|
| 207 |
} |
|
| 208 |
shell.open(); |
|
| 209 |
} |
|
| 210 |
}); |
|
| 211 |
browser.addCloseWindowListener(new CloseWindowListener() {
|
|
| 212 |
@Override |
|
| 213 |
public void close(WindowEvent e) {
|
|
| 214 |
Browser browser1 = (Browser) e.widget; |
|
| 215 |
Shell shell = browser1.getShell(); |
|
| 216 |
shell.close(); |
|
| 217 |
} |
|
| 218 |
}); |
|
| 219 |
} |
|
| 220 |
|
|
| 167 | 221 |
public Image getImage() {
|
| 168 | 222 |
return image; |
| 169 | 223 |
} |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/CGUMessageDialog.java (revision 1383) | ||
|---|---|---|
| 3 | 3 |
import org.eclipse.jface.dialogs.Dialog; |
| 4 | 4 |
import org.eclipse.jface.layout.GridDataFactory; |
| 5 | 5 |
import org.eclipse.swt.SWT; |
| 6 |
import org.eclipse.swt.graphics.Color; |
|
| 7 | 6 |
import org.eclipse.swt.graphics.Image; |
| 8 | 7 |
import org.eclipse.swt.widgets.Button; |
| 9 | 8 |
import org.eclipse.swt.widgets.Composite; |
| tmp/org.txm.libs.office/.classpath (revision 1383) | ||
|---|---|---|
| 16 | 16 |
<classpathentry exported="true" kind="lib" path="lib/odfdom-java-0.8.11-incubating.jar"/> |
| 17 | 17 |
<classpathentry exported="true" kind="lib" path="lib/odfdom-java-0.8.7.jar"/> |
| 18 | 18 |
<classpathentry exported="true" kind="lib" path="lib/org.odftoolkit.odfdom.converter.core-1.0.6.jar"/> |
| 19 |
<classpathentry exported="true" kind="lib" path="lib/simple-odf-0.8.2-incubating.jar"/> |
|
| 19 |
<classpathentry exported="true" kind="lib" path="lib/simple-odf-0.8.2-incubating.jar" sourcepath="/home/mdecorde/.m2/repository/org/apache/odftoolkit/simple-odf/0.8.2-incubating/simple-odf-0.8.2-incubating-sources.jar"/>
|
|
| 20 | 20 |
<classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.7.25.jar"/> |
| 21 | 21 |
<classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.7.6.jar"/> |
| 22 | 22 |
<classpathentry exported="true" kind="lib" path="lib/taglets-0.8.11-incubating.jar"/> |
Formats disponibles : Unified diff