Changeset 18257

Show
Ignore:
Timestamp:
18.12.2008 16:32:29 (11 years ago)
Author:
cc108
Message:

add a method to insert gsdl home path to Mat extension

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/admin/gui/ExtensionInstallation.java

    r18253 r18257  
    5959import javax.swing.text.StyledDocument; 
    6060import java.io.DataInputStream; 
     61import java.io.*; 
     62import java.awt.Insets; 
    6163 
    6264class ExtensionInstallation extends Thread { 
     
    115117        ExtPane.message_textarea.append(timestamp); 
    116118        proc.waitFor(); 
    117         JTextPaneStyle msgpane  = new JTextPaneStyle(adaptee.extension_path); 
     119        JTextPaneStyle msgpane  = new JTextPaneStyle(adaptee.extension_path,adaptee.web_xml_path); 
    118120        msgpane.display(); 
    119121 
     
    137139    JFrame frame = new JFrame("The extension (Mat) has been installed!!!"); 
    138140    private String filePath; 
    139      
    140     public JTextPaneStyle (String path){ 
     141    private String webPath; 
     142    public JTextPaneStyle (String path, String web_xml_path){ 
    141143        filePath = path + "README.txt"; 
     144        webPath = web_xml_path; 
    142145        loadReadMe(); 
    143146    } 
     
    154157 
    155158            while ((strLine = br.readLine()) != null)   { 
     159                if(strLine.indexOf("web@xml@path")!=-1){ 
     160                webPath = webPath.replaceAll("\\\\","/"); 
     161                strLine = strLine.replaceAll("web@xml@path",webPath); 
     162                strLine = strLine.replaceAll("/","\\\\"); 
     163                } 
    156164                message = message+ "\n "+ strLine; 
    157165            } 
     
    170178        JTextArea textPane = new JTextArea(message); 
    171179        textPane.setEditable(false); 
     180        textPane.setLineWrap(true); 
     181        textPane.setWrapStyleWord(true); 
     182        textPane.setMargin(new Insets(0,ExtPane.left_padding,0,0)); 
    172183        JScrollPane scrollPane = new JScrollPane(textPane); 
    173184        mainPane.add(scrollPane,BorderLayout.CENTER); 
     
    188199 
    189200    public void actionPerformed(ActionEvent e) { 
     201        writeReadMe(); 
    190202        frame.dispose(); 
    191203    } 
     204     
     205     
     206     
     207    public void writeReadMe(){ 
     208        try{ 
     209            FileWriter fstream = new FileWriter(filePath); 
     210            BufferedWriter br = new BufferedWriter(fstream); 
     211            br.write(message); 
     212            br.close(); 
     213        }catch (Exception e){ 
     214            System.err.println("Error: " + e.getMessage()); 
     215        } 
     216    } 
    192217} 
    193218