summaryrefslogtreecommitdiff
path: root/l10ntools/java/receditor
diff options
context:
space:
mode:
Diffstat (limited to 'l10ntools/java/receditor')
-rwxr-xr-xl10ntools/java/receditor/build.xml169
-rw-r--r--l10ntools/java/receditor/java/transex3/controller/EditorController.java334
-rw-r--r--l10ntools/java/receditor/java/transex3/controller/Main.java10
-rw-r--r--l10ntools/java/receditor/java/transex3/model/ResourceFile.java77
-rw-r--r--l10ntools/java/receditor/java/transex3/model/SdfEntity.java211
-rw-r--r--l10ntools/java/receditor/java/transex3/model/SdfString.java167
-rw-r--r--l10ntools/java/receditor/java/transex3/view/Editor.java97
-rw-r--r--l10ntools/java/receditor/java/transex3/view/SdfTable.java24
-rwxr-xr-xl10ntools/java/receditor/makefile.mk35
-rwxr-xr-xl10ntools/java/receditor/receditor.MF1
10 files changed, 1125 insertions, 0 deletions
diff --git a/l10ntools/java/receditor/build.xml b/l10ntools/java/receditor/build.xml
new file mode 100755
index 000000000000..4a88f61e4fc5
--- /dev/null
+++ b/l10ntools/java/receditor/build.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<project name="receditor" default="main" basedir=".">
+
+ <!-- ================================================================= -->
+ <!-- settings -->
+ <!-- ================================================================= -->
+
+ <!-- name of this sub target used in recursive builds -->
+ <property name="target" value="receditor"/>
+
+ <!-- name of jar file created, without .jar extension -->
+ <property name="jarname" value="receditor"/>
+
+ <!-- relative path to project directory -->
+ <property name="prj" value="."/>
+
+ <!-- build output directory -->
+ <property name="out" value="build"/>
+
+ <!-- build directories -->
+ <property name="build.dir" value="${out}"/>
+ <property name="build.class" value="${build.dir}/class/receditor"/>
+ <property name="build.misc" value="${build.dir}/misc/receditor"/>
+
+ <!-- start of java source code package structure -->
+ <property name="java.dir" value="java"/>
+
+ <!-- define how to handle CLASSPATH environment -->
+ <property name="build.sysclasspath" value="ignore"/>
+
+ <!-- classpath settings for compile and javadoc tasks -->
+ <path id="classpath">
+ <pathelement location="."/>
+ <pathelement location="${build.class}"/>
+ </path>
+
+ <!-- name to display in documentation -->
+ <!-- <property name="docname" value="l10n converter"/> -->
+
+ <!-- set "modern" java compiler -->
+ <property name="build.compiler" value="modern"/>
+
+ <!-- set wether we want to compile with debug information -->
+ <property name="debug" value="on"/>
+
+ <!-- set wether we want to compile with optimisation -->
+ <property name="optimize" value="off"/>
+
+ <!-- set wether we want to compile with or without deprecation -->
+ <property name="deprecation" value="on"/>
+
+ <target name="info">
+ <echo message="--------------------"/>
+ <echo message="${target}"/>
+ <echo message="--------------------"/>
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- custom targets -->
+ <!-- ================================================================= -->
+
+ <!-- the main target, called in recursive builds -->
+ <target name="main" depends="info,prepare,compile,jar"/>
+
+ <!-- prepare output directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.class}"/>
+ <mkdir dir="${build.misc}"/>
+ </target>
+
+
+ <target name="res" depends="prepare">
+ <copy todir="${build.class}">
+ <fileset dir="${java.dir}">
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="compile" depends="prepare,res">
+ <javac destdir="${build.class}"
+ debug="${debug}"
+ deprecation="${deprication}"
+ optimize="${optimize}"
+ classpathref="classpath">
+ <src path="${java.dir}"/>
+ <include name="**/*.java"/>
+ </javac>
+ </target>
+
+ <!-- clean up -->
+ <target name="clean" depends="prepare">
+ <delete includeEmptyDirs="true">
+ <fileset dir="${build.class}">
+ <patternset>
+ <include name="${package}/**/*.class"/>
+ </patternset>
+ </fileset>
+ </delete>
+ </target>
+
+ <!-- create jar file -->
+ <target name="jar" depends="prepare,compile" if="build.class">
+ <jar jarfile="${build.class}/${jarname}.jar"
+ basedir="${build.class}"
+ manifest="${jarname}.MF">
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+ </jar>
+ </target>
+
+ <target name="test" depends="prepare">
+ </target>
+
+</project>
+
diff --git a/l10ntools/java/receditor/java/transex3/controller/EditorController.java b/l10ntools/java/receditor/java/transex3/controller/EditorController.java
new file mode 100644
index 000000000000..38462d665304
--- /dev/null
+++ b/l10ntools/java/receditor/java/transex3/controller/EditorController.java
@@ -0,0 +1,334 @@
+package transex3.controller;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.Runtime;
+import java.util.*;
+
+import javax.swing.ListSelectionModel;
+import javax.swing.WindowConstants;
+import javax.swing.event.*;
+
+import transex3.model.*;
+
+import java.io.*;
+import javax.swing.*;
+//import transex3.model.*;
+public class EditorController {
+ public final String[] RESTYPES = { ".src",".hrc",".xcu",".xrm",".xhp" };
+ public final String RECFILE = ".recommand";
+ // Editor View
+ static transex3.view.Editor aEditor = null;
+ // Editor Model
+ static Vector sdfstrings = new Vector();
+ static HashMap hashedsdfstrings = new HashMap();
+ int oldindex = 0;
+ //HashMap hashedfilenames = new HashMap();
+ // Search for source Strings
+ public String fetchSourceStrings( String rootdir ){
+
+ //String outputfile = "h:\\workspace\\recommandEditor\\null2";
+ File tempfile = null;
+
+ try {
+ tempfile = File.createTempFile( "receditor" , "tmp" );
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ System.err.println("Can not create temp file\n");
+ e1.printStackTrace();
+ }
+
+ String outputfile = tempfile.getAbsolutePath();
+ try
+ {
+ //System.out.println("localize_sl -QQ -skip_links -e -l en-US -f "+outputfile+" -d "+rootdir);
+ System.out.println("localize_sl -QQ -skip_links -e -l en-US -f "+outputfile );
+ java.lang.Process aProc = Runtime.getRuntime().exec("localize_sl -QQ -skip_links -e -l en-US -f "+outputfile);
+
+ //java.lang.Process aProc = Runtime.getRuntime().exec("localize_sl -QQ -e -l en-US -f "+outputfile+" -d "+rootdir);
+ BufferedReader aBR = new BufferedReader( new InputStreamReader( aProc.getInputStream() ) );
+ String line = aBR.readLine();
+ while( line != null && line.length() > 0 ){
+ //System.out.print( line );
+ line = aBR.readLine();
+ }
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return outputfile;
+ }
+ // Search for recommand files
+ public void findRecommandFiles( File rootdir , Vector list ){
+ System.out.print(".");
+ System.out.flush();
+ File[] aFileArray = rootdir.listFiles();
+ if( aFileArray != null ){
+ for( int cnt = 0; aFileArray.length > cnt ; cnt++ ){
+ if( aFileArray[ cnt ].isDirectory() && !aFileArray[ cnt ].getAbsolutePath().endsWith(".lnk") )
+ findRecommandFiles( aFileArray[ cnt ] , list);
+ else if( aFileArray[ cnt ].isFile() && isRecommandFile( aFileArray[ cnt ] ) )
+ list.add( aFileArray[ cnt ]);
+ }
+ }
+ }
+ private boolean isResourceType( File aFile ){
+ String filename = aFile.getName();
+ boolean isResType = false;
+ for(int cnt = 0; cnt < RESTYPES.length ; cnt++){
+ if( filename.endsWith( RESTYPES[ cnt ] ) )
+ isResType = true;
+ }
+ return isResType;
+ }
+ private boolean isRecommandFile( File aFile ){
+ return aFile.getName().endsWith( RECFILE );
+ }
+ public void clearAllRows( JTable aTable ){
+ for ( int n = 0; n < aTable.getRowCount() ; n++ ){
+ aTable.setValueAt( null , n , 0 );
+ aTable.setValueAt( null , n , 1 );
+ aTable.setValueAt( null , n , 2 );
+ aTable.setValueAt( null , n , 3 );
+ aTable.setValueAt( null , n , 4 );
+ }
+ }
+ // Add all data to view
+ void updateData(){
+ JTable recTable =transex3.controller.EditorController.aEditor.getRectable();
+
+ SdfString aSdfString = (SdfString) sdfstrings.get( oldindex );
+ Vector newStrings = new Vector();
+ for ( int n = 1; n < recTable.getRowCount() ; n++ ){
+ String lang = (String) recTable.getValueAt(n , 0 );
+ String text = (String) recTable.getValueAt(n , 1 );
+ String htext = (String) recTable.getValueAt(n , 2 );
+ String qhtext = (String) recTable.getValueAt(n , 3 );
+ String ttext = (String) recTable.getValueAt(n , 4 );
+ if( lang != null && text != null ){
+ //System.out.println("Data "+ lang + " " + text );
+ SdfEntity aSdfEntity = new SdfEntity();
+ aSdfEntity.setLangid( lang );
+ aSdfEntity.setText( text );
+ aSdfEntity.setHelptext( htext );
+ aSdfEntity.setQuickhelptext( qhtext );
+ aSdfEntity.setTitle( ttext );
+ newStrings.add( aSdfEntity );
+ aSdfString.setLanguageStrings( newStrings );
+ }
+ }
+ }
+
+ public void initView(){
+ Object[][] sourceStringData = new Object[ sdfstrings.size() ][ 4 ];
+ Object[][] firstData = new Object[100][5];
+ // Set the files
+ Iterator aIter = sdfstrings.iterator();
+ int counter = 0;
+ while( aIter.hasNext() ){
+ SdfString aSdfString = (SdfString) aIter.next();
+ sourceStringData[ counter ][ 0 ] = aSdfString.getSourceString().getProject()+"\\"+aSdfString.getSourceString().getSource_file();
+ sourceStringData[ counter ][ 1 ] = aSdfString.getSourceString().getGid();
+ sourceStringData[ counter ][ 2 ] = aSdfString.getSourceString().getLid();
+ sourceStringData[ counter ][ 3 ] = aSdfString.getSourceString().getText();
+ if( counter == 0 ){
+ firstData[ 0 ][ 0 ] = "en-US";
+ firstData[ 0 ][ 1 ] = aSdfString.getSourceString().getText();
+ firstData[ 0 ][ 2 ] = aSdfString.getSourceString().getHelptext();
+ firstData[ 0 ][ 3 ] = aSdfString.getSourceString().getQuickhelptext();
+ firstData[ 0 ][ 4 ] = aSdfString.getSourceString().getTitle();
+ aSdfString = (SdfString) sdfstrings.get( 0 );
+ Vector values = aSdfString.getLanguageStrings();
+ for( int n = 0; n < values.size() ; n++ )
+ {
+ SdfEntity aEntity = (SdfEntity) values.get( n );
+ firstData[ n+1 ][ 0 ] = aEntity.getLangid();
+ firstData[ n+1 ][ 1 ] = aEntity.getText();
+ firstData[ n+1 ][ 2 ] = aEntity.getHelptext();
+ firstData[ n+1 ][ 3 ] = aEntity.getQuickhelptext();
+ firstData[ n+1 ][ 4 ] = aEntity.getTitle();
+ }
+ }
+ counter++;
+ }
+ // Set the source srtings
+
+
+ //aEditor = new transex3.view.Editor( sourceStringData , filedata.toArray() );
+ aEditor = new transex3.view.Editor( sourceStringData , firstData );
+
+ aEditor.setBounds(100,100,800,900);
+ aEditor.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );
+ aEditor.setVisible(true);
+ aEditor.repaint();
+ aEditor.addWindowListener( new WindowAdapter(){
+ public void windowClosed(WindowEvent e ){
+ System.exit( 0 );
+ }
+ });
+
+ aEditor.getMiExit().addActionListener( new ActionListener(){
+ public void actionPerformed( ActionEvent e ){
+ System.exit( 0 );
+ }
+ });
+
+ aEditor.getMiSave().addActionListener( new ActionListener(){
+ public void actionPerformed( ActionEvent e ){
+ Iterator aIter = sdfstrings.iterator();
+ String lastFile="";
+ while( aIter.hasNext() )
+ {
+ SdfString aSdfString = (SdfString )aIter.next();
+ if( aSdfString.getFileId().compareTo( lastFile ) != 0 ){
+ //aSdfString.removeFile();
+ }
+ aSdfString.writeString();
+ lastFile = aSdfString.getFileId();
+ }
+ }
+ });
+
+ //aEditor.getRectable().putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
+ aEditor.getRectable().addFocusListener( new FocusListener(){
+ public void focusLost(FocusEvent e){
+ //super.focusLost( e );
+ //System.out.println("focus lost");
+ JTable aTable = aEditor.getRectable();
+ if( aTable.getSelectedRow() != -1 && aTable.getSelectedColumn() != -1 )
+ aTable.getCellEditor( aTable.getSelectedRow(), aTable.getSelectedColumn() ).stopCellEditing();
+ updateData();
+ }
+ public void focusGained( FocusEvent e){
+ //super.focusGained( e );
+ //System.out.println("focus gained");
+ }
+ });
+ //setDefaultEditor(Object.class, new transex3.view.FocusCellEditor(new JTextField()));
+
+ aEditor.getRectable().getModel().addTableModelListener( new TableModelListener() {
+ public void tableChanged( TableModelEvent e ){
+ //System.out.println( e );
+ }});
+
+
+ aEditor.getRectable().getSelectionModel().addListSelectionListener( new ListSelectionListener(){
+ public void valueChanged( ListSelectionEvent e ){
+ JTable aTable = aEditor.getRectable();
+ //if( aTable.getSelectedRow() != -1 && aTable.getSelectedColumn() != -1 )
+ //aTable.getCellEditor( aTable.getSelectedRow(), aTable.getSelectedColumn() ).stopCellEditing();
+
+ updateData();
+ }
+ });
+
+ aEditor.getTable().setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
+ aEditor.getTable().getSelectionModel().addListSelectionListener( new ListSelectionListener(){
+ public void valueChanged( ListSelectionEvent e ){
+ //System.out.println("Selected = " +e.getFirstIndex()+"\n");
+ JTable table =transex3.controller.EditorController.aEditor.getTable();
+ JTable recTable =transex3.controller.EditorController.aEditor.getRectable();
+ SdfString aSdfString;
+ JTable aTable = aEditor.getRectable();
+ if( aTable.getSelectedRow() != -1 && aTable.getSelectedColumn() != -1 )
+ aTable.getCellEditor( aTable.getSelectedRow(), aTable.getSelectedColumn() ).stopCellEditing();
+
+ updateData();
+ clearAllRows( recTable );
+
+ aSdfString = (SdfString) sdfstrings.get( table.getSelectedRow() );
+ recTable.setValueAt( "en-US" , 0, 0 );
+ recTable.setValueAt( aSdfString.getSourceString().getText() , 0, 1 );
+ recTable.setValueAt( aSdfString.getSourceString().getHelptext() , 0, 2 );
+ recTable.setValueAt( aSdfString.getSourceString().getQuickhelptext() , 0, 3 );
+ recTable.setValueAt( aSdfString.getSourceString().getTitle() , 0, 4 );
+ Vector values = aSdfString.getLanguageStrings();
+ for( int n = 0; n < values.size() ; n++ )
+ {
+ SdfEntity aEntity = (SdfEntity) values.get( n );
+ recTable.setValueAt( aEntity.getLangid() , n+1 , 0 );
+ recTable.setValueAt( aEntity.getText() , n+1 , 1 );
+ recTable.setValueAt( aEntity.getHelptext() , n+1 , 2 );
+ recTable.setValueAt( aEntity.getQuickhelptext() , n+1 , 3 );
+ recTable.setValueAt( aEntity.getTitle() , n+1 , 4 );
+ }
+ oldindex = table.getSelectedRow();
+ }
+ });
+ //System.out.println("initView successfully");
+ }
+ public void initInitialStrings(){
+ String rootdir = java.lang.System.getProperty("SOLARSRC");
+ String sourcestringsfile = null;
+ Vector recList = new Vector();
+ sourcestringsfile = fetchSourceStrings( rootdir );
+ //findRecommandFiles( new File( rootdir ) , recList );
+ readStrings( sourcestringsfile , recList );
+ File sfile = new File ( sourcestringsfile );
+ sfile.delete();
+ initView();
+ aEditor.repaint();
+ }
+ // Connect recommand strings with source strings
+ public void readStrings( String sourcefiles , Vector recfiles ) {
+ BufferedReader aBR = null;
+ try {
+ //System.out.println("DBG: sourcefiles = " +sourcefiles);
+ aBR = new BufferedReader( new FileReader( sourcefiles ) );
+ String current = aBR.readLine();
+ SdfString aSdfString = null;
+ SdfEntity aSdfEntity = null;
+ while( current != null ){
+ aSdfEntity = new SdfEntity();
+ aSdfEntity.setProperties( current );
+ aSdfString = new SdfString();
+ aSdfString.addSourceString( aSdfEntity );
+ hashedsdfstrings.put( aSdfString.getId() , aSdfString );
+ //System.out.println("Put ID '"+aSdfString.getId()+"'");
+ sdfstrings.add( aSdfString );
+ current = aBR.readLine();
+
+ }
+ Iterator aIter=recfiles.iterator();
+ File aFile;
+ BufferedReader aBR2 = null;
+ //System.out.println("Connecting strings");
+ while( aIter.hasNext() ){
+ aFile = (File) aIter.next();
+ aBR2 = new BufferedReader( new FileReader( aFile ) ) ;
+ String current2 = aBR2.readLine();
+
+ while ( current2 != null ){
+ SdfEntity aEntity = new SdfEntity();
+ aEntity.setProperties( current2 );
+
+ if( hashedsdfstrings.containsKey( aEntity.getId() ) )
+ {
+ aSdfString = (SdfString) hashedsdfstrings.get( aEntity.getId() );
+ aSdfString.addLanguageString( aEntity );
+ }
+ else
+ {
+ System.out.println("DBG: Can't find source string '"+aEntity.getId()+"'" );
+ }
+ current2 = aBR2.readLine();
+ }
+ }
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch ( IOException e){
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/l10ntools/java/receditor/java/transex3/controller/Main.java b/l10ntools/java/receditor/java/transex3/controller/Main.java
new file mode 100644
index 000000000000..e8dd06ce9f85
--- /dev/null
+++ b/l10ntools/java/receditor/java/transex3/controller/Main.java
@@ -0,0 +1,10 @@
+package transex3.controller;
+
+public class Main {
+
+ public static void main( String args[] ){
+ EditorController aEditor = new EditorController();
+ aEditor.initInitialStrings();
+ }
+}
+
diff --git a/l10ntools/java/receditor/java/transex3/model/ResourceFile.java b/l10ntools/java/receditor/java/transex3/model/ResourceFile.java
new file mode 100644
index 000000000000..51fabb3a4b7a
--- /dev/null
+++ b/l10ntools/java/receditor/java/transex3/model/ResourceFile.java
@@ -0,0 +1,77 @@
+package transex3.model;
+
+import java.util.*;
+
+public class ResourceFile {
+ Vector sdfStrings = new Vector();
+ HashMap sdfHashMap = new HashMap();
+ String filepathid = null;
+ String modulename = null;
+ String filename = null;
+
+
+ public String getModuleName(){
+ return modulename;
+ }
+ public String getFilePath(){
+ return filepathid;
+ }
+ public String getFileName(){
+ return filename;
+ }
+/* public List readSoureStrings( java.io.File aSdfFile ){
+ List sdfList=null;
+ return sdfList;
+ };*/
+ public void addString( SdfString aSdfstring ){
+ sdfStrings.add( aSdfstring );
+ sdfHashMap.put( aSdfstring.getFileId() , aSdfstring );
+ if( filepathid == null )
+ filepathid = aSdfstring.getFilePath();
+ if( modulename == null )
+ modulename = aSdfstring.getModuleName();
+ if( filename == null )
+ filename = aSdfstring.getFileName();
+ }
+
+
+ public void ParseString( String aSourceString ){
+ //sourceString = new SdfEntity();
+ SdfEntity aSdfEntity = new SdfEntity();
+ aSdfEntity.setProperties( aSourceString );
+ SdfString sdfstring = null;
+ if( sdfHashMap.containsKey( aSdfEntity.getFileId() ) ){
+ sdfstring = (SdfString) sdfHashMap.get( aSdfEntity.getFileId() );
+ }
+ else
+ {
+ sdfstring = new SdfString();
+ addString( sdfstring );
+ }
+ sdfstring.addLanguageString( aSdfEntity );
+
+
+ }
+ /*public void ParseSdfFile( java.util.Vector aSdfList ){
+ ListIterator aLI = aSdfList.listIterator();
+ String current;
+ String[] splitted;
+ SdfEntity aSdfEntity;
+ SdfString aSdfString = new SdfString();
+ while( aLI.hasNext() ){
+ aSdfEntity = new SdfEntity();
+ aSdfEntity.setProperties( (String) aLI.next() );
+ SdfString aString;
+
+ if( sdfHashMap.containsKey( aSdfEntity.getFileId() ) )
+ aString = (SdfString) sdfHashMap.get( aSdfEntity.getFileId() );
+ else
+ {
+ aString = new SdfString();
+ addString( aString );
+ }
+ aString.addLanguageString( aSdfEntity );
+ }
+
+ }*/
+}
diff --git a/l10ntools/java/receditor/java/transex3/model/SdfEntity.java b/l10ntools/java/receditor/java/transex3/model/SdfEntity.java
new file mode 100644
index 000000000000..4b293421fd28
--- /dev/null
+++ b/l10ntools/java/receditor/java/transex3/model/SdfEntity.java
@@ -0,0 +1,211 @@
+package transex3.model;
+
+public class SdfEntity {
+ private String project;
+ private String source_file;
+ private String dummy1;
+ private String resource_type;
+ private String gid;
+ private String lid;
+ private String helpid;
+ private String platform;
+ private String dummy2;
+ private String langid;
+ private String text;
+ private String helptext;
+ private String quickhelptext;
+ private String title;
+ private String date;
+
+ public static int PROJECT_POS = 0;
+ public static int SOURCE_FILE_POS = 1;
+ public static int DUMMY1_POS = 2;
+ public static int RESOURCE_TYPE_POS = 3;
+ public static int GID_POS = 4;
+ public static int LID_POS = 5;
+ public static int HELPID_POS = 6;
+ public static int PLATFORM_POS = 7;
+ public static int DUMMY2_POS = 8;
+ public static int LANGID_POS = 9;
+ public static int TEXT_POS = 10;
+ public static int HELPTEXT_POS = 11;
+ public static int QUICKHELPTEXT_POS = 12;
+ public static int TITLE_POS = 13;
+ public static int DATE_POS = 14;
+
+ public SdfEntity(){}
+ public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
+ super();
+ this.project = project;
+ this.source_file = source_file;
+ this.dummy1 = dummy1;
+ this.resource_type = resource_type;
+ this.gid = gid;
+ this.lid = lid;
+ this.helpid = helpid;
+ this.platform = platform;
+ this.dummy2 = dummy2;
+ this.langid = langid;
+ this.text = text;
+ this.helptext = helptext;
+ this.quickhelptext = quickhelptext;
+ this.title = title;
+ this.date = date;
+ }
+
+ public void setProperties( String line ){
+
+ String[] splitted = line.split("\t");
+
+ setProject( splitted[ SdfEntity.PROJECT_POS ] );
+ setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] );
+ setDummy1( splitted[ SdfEntity.DUMMY1_POS ] );
+ setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
+ setGid( splitted[ SdfEntity.GID_POS ] );
+ setLid( splitted[ SdfEntity.LID_POS ] );
+ setHelpid( splitted[ SdfEntity.HELPID_POS ] );
+ setPlatform( splitted[ SdfEntity.PLATFORM_POS ] );
+ setDummy2( splitted[ SdfEntity.DUMMY2_POS ] );
+ setLangid( splitted[ SdfEntity.LANGID_POS ] );
+ setText( splitted[ SdfEntity.TEXT_POS ] );
+ setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] );
+ setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
+ setTitle( splitted[ SdfEntity.TITLE_POS ] );
+ setDate( splitted[ SdfEntity.DATE_POS ] );
+ }
+
+ public String getFileId(){
+ return project+"\\"+source_file;
+ }
+ public String getResourcePath(){
+ return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
+ }
+ public String toString(){
+ return project+"\t"+source_file+"\t"+dummy1+"\t"+resource_type+"\t"+gid+"\t"
+ +lid+"\t"+helpid+"\t"+platform+"\t"+dummy2+"\t"+langid+"\t"
+ +text+"\t"+helptext+"\t"+quickhelptext+"\t"+title+"\t"+date;
+ }
+ public String getId(){
+ return project+gid+lid+source_file+resource_type+platform+helpid;
+ }
+
+ public String getDummy1() {
+ return dummy1;
+ }
+
+ public void setDummy1(String dummy1) {
+ this.dummy1 = dummy1;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getDummy2() {
+ return dummy2;
+ }
+
+ public void setDummy2(String dummy2) {
+ this.dummy2 = dummy2;
+ }
+
+ public String getGid() {
+ return gid;
+ }
+
+ public void setGid(String gid) {
+ this.gid = gid;
+ }
+
+ public String getHelpid() {
+ return helpid;
+ }
+
+ public void setHelpid(String helpid) {
+ this.helpid = helpid;
+ }
+
+ public String getHelptext() {
+ return helptext;
+ }
+
+ public void setHelptext(String helptext) {
+ this.helptext = helptext;
+ }
+
+ public String getLangid() {
+ return langid;
+ }
+
+ public void setLangid(String langid) {
+ this.langid = langid;
+ }
+
+ public String getLid() {
+ return lid;
+ }
+
+ public void setLid(String lid) {
+ this.lid = lid;
+ }
+
+ public String getProject() {
+ return project;
+ }
+
+ public void setProject(String project) {
+ this.project = project;
+ }
+
+ public String getQuickhelptext() {
+ return quickhelptext;
+ }
+
+ public void setQuickhelptext(String quickhelptext) {
+ this.quickhelptext = quickhelptext;
+ }
+
+ public String getResource_type() {
+ return resource_type;
+ }
+
+ public void setResource_type(String resource_type) {
+ this.resource_type = resource_type;
+ }
+
+ public String getSource_file() {
+ return source_file;
+ }
+
+ public void setSource_file(String source_file) {
+ this.source_file = source_file;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getDate() {
+ return date;
+ }
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+
+}
diff --git a/l10ntools/java/receditor/java/transex3/model/SdfString.java b/l10ntools/java/receditor/java/transex3/model/SdfString.java
new file mode 100644
index 000000000000..7eec2151b7c3
--- /dev/null
+++ b/l10ntools/java/receditor/java/transex3/model/SdfString.java
@@ -0,0 +1,167 @@
+package transex3.model;
+import java.util.*;
+import java.io.*;
+public class SdfString {
+ private SdfEntity sourceString = null;
+ //private java.util.HashMap languageStrings = new HashMap();
+ private Vector languageList = new Vector();
+ private String id = null;
+ private String fileid = null;
+ private String filename = null;
+ private String modulename = null;
+ private String filepath = null;
+
+ /*public HashMap getLanguageStrings() {
+ return languageStrings;
+ }*/
+ public Vector getLanguageStrings() {
+ return languageList;
+ }
+
+ public void setLanguageStrings(Vector languageStrings) {
+ this.languageList = languageStrings;
+ }
+
+ public void addSourceString( SdfEntity aSdfEntity )
+ {
+ if( id == null )
+ id = aSdfEntity.getId();
+ if ( fileid == null )
+ fileid = aSdfEntity.getFileId();
+ if( modulename == null )
+ modulename = aSdfEntity.getProject();
+ if( filename == null )
+ filename = aSdfEntity.getSource_file();
+ if( filepath == null )
+ filepath = aSdfEntity.getResourcePath();
+ setSourceString( aSdfEntity );
+ }
+ public void addLanguageString( SdfEntity aSdfEntity ){
+ if( !aSdfEntity.getLangid().equals( "en-US" ) )
+ {
+ if( id == null )
+ id = aSdfEntity.getId();
+ if ( fileid == null )
+ fileid = aSdfEntity.getFileId();
+ if( modulename == null )
+ modulename = aSdfEntity.getProject();
+ if( filename == null )
+ filename = aSdfEntity.getSource_file();
+ if( filepath == null )
+ filepath = aSdfEntity.getResourcePath();
+
+ //if( aSdfEntity.getLangid().equals( "en-US" ) )
+ //{
+ // setSourceString( aSdfEntity );
+ //}
+ //else
+ //{
+ //languageStrings.put( aSdfEntity.getLangid() , aSdfEntity );
+ languageList.add( aSdfEntity );
+ //}
+ id = aSdfEntity.getId();
+ }
+ }
+
+ public SdfEntity getSourceString() {
+ return sourceString;
+ }
+
+ public void setSourceString(SdfEntity sourceString) {
+ this.sourceString = sourceString;
+ id = sourceString.getId();
+ }
+ public String getFilePath(){
+ return filepath;
+ }
+ public String getId(){
+ //return id;
+ return sourceString.getId();
+ }
+ public String getFileId(){
+ return fileid;
+ }
+
+ public String getFileName() {
+ return filename;
+ }
+
+ public void setFileName(String filename) {
+ this.filename = filename;
+ }
+
+ public String getModuleName() {
+ return modulename;
+ }
+
+ public void setModuleName(String modulename) {
+ this.modulename = modulename;
+ }
+
+ public String getRealFileName(){
+ String filepart = sourceString.getFileId();
+ filepart = filepart.replaceAll( "\\\\" , "_" );
+ String filename = "/so/ws/merge/In/" + java.lang.System.getProperty( "WORK_STAMP" ) + "/" + filepart + ".sdf";
+ return filename;
+ }
+ public void removeFile(){
+ String filename = getRealFileName();
+ File aFile = new File( filename );
+ if( aFile.exists() ){
+ if( ! aFile.delete() )
+ {
+ System.out.println("Can't delete File "+filename+"\nWrong access rights?\n");
+ }
+ }
+ }
+ public void writeString(){
+ String filename = getRealFileName();
+ try {
+ if( languageList.size() > 0 )
+ {
+ System.out.print("\nWrite to "+filename );
+ BufferedWriter aBW = new BufferedWriter( new FileWriter( filename , true) );
+ aBW.write( sourceString + "\n" );
+ Iterator aIter = languageList.iterator();
+ while( aIter.hasNext() ){
+ SdfEntity aEntity = (SdfEntity)aIter.next();
+ aBW.write( sourceString.getProject()+"\t" );
+ aBW.write( sourceString.getSource_file()+"\t" );
+ aBW.write( sourceString.getDummy1()+"\t" );
+ aBW.write( sourceString.getResource_type()+"\t" );
+ aBW.write( sourceString.getGid()+"\t" );
+ aBW.write( sourceString.getLid()+"\t" );
+ aBW.write( sourceString.getHelpid()+"\t" );
+ aBW.write( sourceString.getPlatform()+"\t" );
+ aBW.write( sourceString.getDummy2()+"\t" );
+ if( aEntity.getLangid() == null )
+ aBW.write( "\t" );
+ else
+ aBW.write( aEntity.getLangid()+"\t" );
+ if( aEntity.getText() == null )
+ aBW.write( "\t" );
+ else
+ aBW.write( aEntity.getText()+"\t" );
+ if( aEntity.getHelptext() == null )
+ aBW.write( "\t" );
+ else
+ aBW.write( aEntity.getHelptext()+"\t" );
+ if( aEntity.getQuickhelptext() == null )
+ aBW.write( "\t" );
+ else
+ aBW.write( aEntity.getQuickhelptext()+"\t" );
+ if( aEntity.getTitle() == null )
+ aBW.write( "\t" );
+ else
+ aBW.write( aEntity.getTitle()+"\t" );
+ aBW.write( "2002-02-02 02:02:02\n" );
+ }
+ aBW.close();
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ System.out.println("\nERROR: Can't write to file '"+filename+"'\nPlease contact RE/Tooling!");
+ }
+ }
+}
diff --git a/l10ntools/java/receditor/java/transex3/view/Editor.java b/l10ntools/java/receditor/java/transex3/view/Editor.java
new file mode 100644
index 000000000000..f46a82a11a2b
--- /dev/null
+++ b/l10ntools/java/receditor/java/transex3/view/Editor.java
@@ -0,0 +1,97 @@
+package transex3.view;
+import javax.swing.*;
+import java.awt.*;
+
+public class Editor extends JFrame{
+ Object[] columnnames = { "File" , "GID" , "LID" , "String" };
+ Object[] stringcolnames = { "Language", "Text", "Helptext" , "Quickhelptext","Title"};
+ //Object[][] data = new Object[4][1];//{ { "a " }, { "v " }, { "v " } , { "a " } };
+ JTable table = null;
+ JTable rectable = null;
+ JComboBox cBox = null;
+ JMenuBar menubar = null;
+ JMenu filemenu = null;
+ JMenuItem miNew = null;
+ JMenuItem miSave = null;
+ JMenuItem miExit = null;
+ //JButton button = null;
+
+ public Editor( Object[][] tabledata , Object[][] firstdata ){
+ table = new JTable( tabledata , columnnames );
+ rectable = new SdfTable( firstdata , stringcolnames );
+ menubar = new JMenuBar();
+ filemenu = new JMenu("File");
+ //miNew = new JMenuItem("New");
+ miSave = new JMenuItem("Save");
+ miExit = new JMenuItem("Exit");
+ //button = new JButton("Edit");
+ //filemenu.add( miNew );
+ filemenu.add( miSave );
+ filemenu.add( miExit );
+ menubar.add( filemenu );
+
+ Container contentPane = getContentPane();
+ //contentPane.add( new ControlPanel() , BorderLayout.NORTH );
+ contentPane.add( menubar , BorderLayout.NORTH );
+ //JPanel aPanel = new JPanel( new FlowLayout( FlowLayout.CENTER) );
+ JPanel aPanel = new JPanel( new GridLayout( 2,1 ) );
+ aPanel.add( new JScrollPane( table ) );
+ aPanel.add( new JScrollPane( rectable ) );
+ contentPane.add( aPanel , BorderLayout.CENTER );
+ //contentPane.add( button , BorderLayout.SOUTH );
+ //contentPane.add( new JScrollPane( table ), BorderLayout.CENTER );
+ //contentPane.add( new JScrollPane( table ), BorderLayout.SOUTH );
+ //contentPane.add( new JScrollPane( rectable ), BorderLayout.SOUTH );
+ //contentPane.add( new JScrollPane( rectable ), BorderLayout.SOUTH );
+ this.repaint();
+
+ }
+
+ public JTable getRectable() {
+ return rectable;
+ }
+
+ public void setRectable(JTable rectable) {
+ this.rectable = rectable;
+ }
+
+ public JTable getTable() {
+ return table;
+ }
+
+ public void setTable(JTable table) {
+ this.table = table;
+ }
+
+ /*public JButton getButton() {
+ return button;
+ }
+
+ public void setButton(JButton button) {
+ this.button = button;
+ }*/
+
+ public JMenuItem getMiExit() {
+ return miExit;
+ }
+
+ public void setMiExit(JMenuItem miExit) {
+ this.miExit = miExit;
+ }
+
+ public JMenuItem getMiSave() {
+ return miSave;
+ }
+
+ public void setMiSave(JMenuItem miSave) {
+ this.miSave = miSave;
+ }
+
+ /*public void setTableData(){
+
+ }*/
+
+}
+
+//class ControlPanel extends JPanel{}
+
diff --git a/l10ntools/java/receditor/java/transex3/view/SdfTable.java b/l10ntools/java/receditor/java/transex3/view/SdfTable.java
new file mode 100644
index 000000000000..f0cc7bd84a34
--- /dev/null
+++ b/l10ntools/java/receditor/java/transex3/view/SdfTable.java
@@ -0,0 +1,24 @@
+package transex3.view;
+
+import javax.swing.JTable;
+
+class SdfTable extends JTable{
+ //private String tableId;
+ public SdfTable( Object[][] obj1 , Object[] obj2){
+ super(obj1,obj2);
+ }
+ //@Override
+ public boolean isCellEditable(int row, int col) {
+ if( row == 0 && col == 0 || row == 0 && col == 1 || row == 0 && col == 2 || row == 0 && col == 3 || row == 0 && col == 4 )
+ return false;
+ else
+ return true;
+ }
+ /*public String getTableId() {
+ return tableId;
+ }
+ public void setTableId(String tableId) {
+ this.tableId = tableId;
+ }*/
+
+} \ No newline at end of file
diff --git a/l10ntools/java/receditor/makefile.mk b/l10ntools/java/receditor/makefile.mk
new file mode 100755
index 000000000000..63587a557ec6
--- /dev/null
+++ b/l10ntools/java/receditor/makefile.mk
@@ -0,0 +1,35 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../..
+PRJNAME=l10ntools
+TARGET=receditor
+
+.INCLUDE : ant.mk
+
+ALLTAR : ANTBUILD
+
diff --git a/l10ntools/java/receditor/receditor.MF b/l10ntools/java/receditor/receditor.MF
new file mode 100755
index 000000000000..dced97882df9
--- /dev/null
+++ b/l10ntools/java/receditor/receditor.MF
@@ -0,0 +1 @@
+Main-Class: transex3.controller.Main