Kaydet (Commit) 40893569 authored tarafından neilm's avatar neilm

Adding package declarations

üst 4701a503
package installer;
import java.awt.*;
public class Banner extends Canvas
......
package installer;
import java.io.*;
public class FileUpdater {
......@@ -157,7 +159,14 @@ public class FileUpdater {
//<library:library library:name="Depot" xlink:href="file:///scriptdev/neil/openoffice1.0.1ScriptFrame/share/basic/Depot/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
//<library:library library:name="Standard" xlink:href="file:///scriptdev/neil/openoffice1.0.1ScriptFrame/user/basic/Standard/script.xlb/" xlink:type="simple" library:link="false"/>
//System.out.println(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/user/basic/ScriptBindingLibrary/script.xlb/\" xlink:type=\"simple\" library:link=\"false\"/>\n" );
out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/user/basic/ScriptBindingLibrary/script.xlb/\" xlink:type=\"simple\" library:link=\"false\"/>\n" );
String opSys = System.getProperty("os.name");
if (opSys.indexOf("Windows") != -1) {
out.write(" <library:library library:name=\"ScriptBindingLibrary\" library:link=\"false\"/>\n" );
}
else {
out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/user/basic/ScriptBindingLibrary/script.xlb/\" xlink:type=\"simple\" library:link=\"false\"/>\n" );
}
}
}
}
......@@ -244,7 +253,13 @@ public class FileUpdater {
//<library:library library:name="Depot" xlink:href="file:///scriptdev/neil/openoffice1.0.1ScriptFrame/share/basic/Depot/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
//<library:library library:name="Standard" xlink:href="file:///scriptdev/neil/openoffice1.0.1ScriptFrame/user/basic/Standard/script.xlb/" xlink:type="simple" library:link="false"/>
//System.out.println( " <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/user/basic/ScriptBindingLibrary/dialog.xlb/\" xlink:type=\"simple\" library:link=\"false\"/>\n" );
out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/user/basic/ScriptBindingLibrary/dialog.xlb/\" xlink:type=\"simple\" library:link=\"false\"/>\n" );
String opSys = System.getProperty("os.name");
if (opSys.indexOf("Windows") != -1) {
out.write(" <library:library library:name=\"ScriptBindingLibrary\" library:link=\"false\"/>\n" );
}
else {
out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/user/basic/ScriptBindingLibrary/dialog.xlb/\" xlink:type=\"simple\" library:link=\"false\"/>\n" );
}
}
}
}
......@@ -265,4 +280,4 @@ public class FileUpdater {
}// updateScriptXLC
}
\ No newline at end of file
}
package installer;
/*
* Welcome.java
*
......@@ -58,6 +60,7 @@ public class Final extends javax.swing.JPanel implements ActionListener, Install
}
public void actionPerformed(ActionEvent e) {
// navNext is "Install"
if (e.getSource() == nav.navNext)
{
JProgressBar progressBar=new JProgressBar();
......@@ -85,30 +88,42 @@ public class Final extends javax.swing.JPanel implements ActionListener, Install
xud.start();
}
}
if (e.getSource() == nav.navCancel)
// set to "Exit" at end of installation process
if (e.getSource() == nav.navCancel) {
int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
if (answer == JOptionPane.YES_OPTION)
{
//xud.setSuspend();
int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
if (answer == JOptionPane.YES_OPTION)
{
wizard.exitForm(null);
}
else
{
return;
}
wizard.exitForm(null);
}
else
{
return;
}
}
}// actionPerformed
public void installationComplete(InstallationEvent ev) {
//System.out.println("Detected installation complete");
if( InstUtil.hasNetbeansInstallation() || InstUtil.hasJeditInstallation() ) {
//System.out.println("Detected installation complete (IDE(s) detected)");
nav.removeCancelListener(this);
nav.setCancelListener(nav);
nav.navCancel.setText("Finish");
nav.enableIDE(true);
nav.enableCancel(true);
xud = null;
}
else {
//System.out.println("Detected installation complete (No IDE(s) detected)");
nav.removeCancelListener(this);
nav.setCancelListener(nav);
nav.navCancel.setText("Exit");
nav.navCancel.setText("Finish");
nav.enableCancel(true);
xud = null;
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel statusPanel;
......@@ -117,5 +132,5 @@ public class Final extends javax.swing.JPanel implements ActionListener, Install
private NavPanel nav;
private XmlUpdater xud;
// End of variables declaration//GEN-END:variables
}
package installer;
import java.io.*;
import java.util.*;
import java.util.zip.*;
......@@ -114,6 +116,35 @@ public class InstUtil {
public static boolean hasNetbeansInstallation() {
File theFile = null;
StringBuffer str = new StringBuffer();
String sep = System.getProperty("file.separator");
str.append(System.getProperty("user.home"));
str.append(sep);
StringBuffer thePath = new StringBuffer(str.toString());
thePath.append(".netbeans");
theFile = new File(thePath.toString());
return theFile.isDirectory();
}
public static boolean hasJeditInstallation() {
File theFile = null;
StringBuffer str = new StringBuffer();
String sep = System.getProperty("file.separator");
str.append(System.getProperty("user.home"));
str.append(sep);
StringBuffer thePath = new StringBuffer(str.toString());
thePath.append(".jedit");
theFile = new File(thePath.toString());
return theFile.isDirectory();
}
public static Properties getNetbeansLocation() throws IOException {
File theFile = null;
Properties results = new Properties();
......@@ -127,51 +158,17 @@ public class InstUtil {
String os = System.getProperty("os.name");
if (os.indexOf("Windows") != -1) {
/*String appData = winGetAppData;
if (os.equals("Windows 2000")) {
thePath.append("Application Data");
thePath.append(sep);
theFile = new File(thePath.toString());
} else if (os.indexOf("Windows") != -1) {
thePath.append(sep);
thePath.append("sversion.ini");
theFile = new File(thePath.toString());
if (!theFile.exists())
{
thePath.delete(0, thePath.length());
thePath.append(str);
thePath.append("Application Data");
thePath.append(sep);
thePath.append("sversion.ini");
theFile = new File(thePath.toString());
}
}*/
//theFile = findVersionFile(new File(str.toString()));
//theFile = findVersionFile(new File(str.toString()));
thePath.append(".netbeans");
//theFile = new File(thePath.toString());
//theFile = new File(thePath.toString());
} else if (os.indexOf("SunOS") != -1) {
thePath.append(".netbeans");
//theFile = new File(thePath.toString());
thePath.append(".netbeans");
//theFile = new File(thePath.toString());
} else if (os.indexOf("Linux") != -1) {
thePath.append(".netbeans");
//theFile = new File(thePath.toString());
thePath.append(".netbeans");
//theFile = new File(thePath.toString());
}
/*
if (theFile == null)
{
throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?");
}
if (!theFile.exists())
{
throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?");
}
*/
//return location;
if ( thePath.toString().indexOf( ".netbeans" ) == -1 )
return null;
else if ( new File( thePath.append( sep+"3.4"+sep ).toString() ).isDirectory() ) {
......@@ -180,23 +177,8 @@ public class InstUtil {
if( netbeansLogFile.exists() ) {
String installPath = getNetbeansInstallation( netbeansLogFile );
File f = new File(installPath);
results.put("NetBeans 3.4", f.getPath());
/*
try {
URI uri = new URI(installPath);
File f = new File(uri);
//.sversion: OpenOffice.org 643=file:///scriptdev/neil/ScriptFrameOpenoffice1.0.1
// parts = Installation name. f.getPath = Installation path
results.put("NetBeans 3.4", f.getPath());
//System.out.println("Putting " + parts[0] + " : " + f.getPath());
}
catch (URISyntaxException eSyntax) {
throw new IOException("Error while reading NetBeans version information");
//results.put(parts[0].trim(), parts[1].trim());
//System.out.println(parts[0].trim() + " : " + parts[1].trim());
}
*/
results.put("NetBeans 3.4", f.getPath()+"/");
System.out.println( "f.getPath() " + f.getPath()+"/" );
}
else {
System.out.println( "Prompt user for NetBeans installation path" );
......@@ -207,9 +189,63 @@ public class InstUtil {
return results;
}
public static Properties getJeditLocation() throws IOException {
if( !hasJeditInstallation() ) {
System.out.println( "No Jedit found (line195 InstUtil");
return null;
}
File theFile = null;
Properties results = new Properties();
StringBuffer str = new StringBuffer();
String sep = System.getProperty("file.separator");
str.append(System.getProperty("user.home"));
str.append(sep);
StringBuffer thePath = new StringBuffer(str.toString());
String os = System.getProperty("os.name");
thePath.append(".jedit");
//System.out.println( ".jedit path " + thePath );
/*
if (os.indexOf("Windows") != -1) {
//theFile = findVersionFile(new File(str.toString()));
thePath.append(".jedit");
//theFile = new File(thePath.toString());
} else if (os.indexOf("SunOS") != -1) {
thePath.append(".jedit");
//theFile = new File(thePath.toString());
} else if (os.indexOf("Linux") != -1) {
thePath.append(".jedit");
//theFile = new File(thePath.toString());
}
*/
File jeditLogFile = new File( thePath.toString() + sep + "activity.log" );
if( jeditLogFile.exists() ) {
String[] jeditDetails = getJeditInstallation( jeditLogFile );
System.out.println( "installPath (line 229) " + jeditDetails[0] );
File f = new File(jeditDetails[0]);
results.put("jEdit "+jeditDetails[1], jeditDetails[0]);
System.out.println( "jeditDetails[0] is " + jeditDetails[0]);
}
else {
System.out.println( "Prompt user for Jedit installation path" );
}
return results;
}
public static String getNetbeansInstallation( File logFile ) {
private static String getNetbeansInstallation( File logFile ) {
String installPath = "";
try {
BufferedReader reader = new BufferedReader(new FileReader(logFile));
......@@ -217,7 +253,7 @@ public class InstUtil {
for (String s = reader.readLine(); s != null; s = reader.readLine()) {
s.trim();
if( s.indexOf( "IDE Install" ) != -1 ) {
int pathStart = s.indexOf( "=" );
int pathStart = s.indexOf( "=" ) + 2;
//System.out.println( "pathStart " + pathStart );
installPath = s.substring( pathStart, s.length() );
//System.out.println( "installPath 1" + installPath );
......@@ -230,7 +266,7 @@ public class InstUtil {
//System.out.println( "s is " + s + " and " + s.length() + " long" );
//installPath = s.substring( pathStart, pathEnd - 1 );
installPath.trim();
//System.out.println( "installPath 2 " + installPath );
System.out.println( "Netbeans installPath (line267 InstUtil " + installPath );
break;
}
}
......@@ -244,7 +280,55 @@ public class InstUtil {
return installPath;
}
private static String[] getJeditInstallation( File logFile ) {
String[] jeditDetails = new String[2];
try {
BufferedReader reader = new BufferedReader(new FileReader(logFile));
String installPath = "";
String version = "";
for (String s = reader.readLine(); s != null; s = reader.readLine()) {
s.trim();
if( s.indexOf( "jEdit home directory is" ) != -1 ) {
int pathStart = s.indexOf( "is /" ) + 3;
//System.out.println( "pathStart " + pathStart );
installPath = s.substring( pathStart, s.length() ) +File.separator;
System.out.println( "installPath 1" + installPath );
//int pathEnd = installPath.indexOf( ";");
//System.out.println( "pathEnd " + pathEnd );
//installPath = installPath.substring( 0, pathEnd ) +File.separator;
//System.out.println( "pathStart " + pathStart );
//int pathEnd = s.indexOf( ";");
//System.out.println( "pathEnd " + pathEnd );
//System.out.println( "s is " + s + " and " + s.length() + " long" );
//installPath = s.substring( pathStart, pathEnd - 1 );
installPath.trim();
//System.out.println( "installPath 2 " + installPath );
//break;
jeditDetails[0] = installPath;
}
if( s.indexOf( "jEdit: jEdit version" ) != -1 ) {
int versionStart = s.indexOf( "version" ) + 8;
System.out.println( "versionStart is: " + versionStart );
version = s.substring( versionStart, s.length() );
version.trim();
System.out.println( "jEdit version is: " + version );
jeditDetails[1] = version;
}
}
}
catch( IOException ioe ) {
System.out.println( "Error reading Jedit location information" );
}
//catch( FileNotFoundException fnfe ) {
//System.out.println( "Jedit activity.log FileNotFoundException" );
//}
return jeditDetails;
}
public static File findVersionFile(File start)
......
package installer;
public interface InstallListener
{
public void installationComplete(InstallationEvent e);
......
package installer;
/*
* InstallWizard.java
*
......@@ -65,7 +67,7 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
setBackground(new Color(0,0,0));
locations = new ArrayList();
//Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
Point center = new Point( 300, 300 );
Point center = new Point( 400, 400 );
int windowWidth=200;
int windowHeight=300;
setSize(windowWidth,windowHeight);
......@@ -113,23 +115,25 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
getContentPane().add(navigation, java.awt.BorderLayout.SOUTH);
screens.setLayout(new java.awt.CardLayout());
screens.add(WELCOME, new Welcome(this));
//screens.add("EULA", new EULA());
// ----------------
netbeansVersion = new NetbeansVersion(this);
screens.add(NETBEANSVERSIONS, netbeansVersion);
// ----------------
version = new Version(this);
screens.add(VERSIONS, version);
_final = new Final(this);
screens.add(FINAL, _final);
idewelcome = new IdeWelcome(this);
screens.add(IDEWELCOME, idewelcome);
ideversion = new IdeVersion(this);
screens.add(IDEVERSIONS, ideversion);
idefinal = new IdeFinal(this);
screens.add(IDEFINAL, idefinal);
getContentPane().add(screens, java.awt.BorderLayout.CENTER);
navNext.addActionListener(this);
navNext.addActionListener(netbeansVersion);
navNext.addActionListener(version);
navNext.addActionListener(netbeansVersion);
navNext.addActionListener(_final);
navNext.addActionListener(ideversion);
navNext.addActionListener(idefinal);
navCancel.addActionListener(this);
navBack.addActionListener(this);
......@@ -258,14 +262,18 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
private javax.swing.JPanel screens;
private Version version;
private NetbeansVersion netbeansVersion;
private Final _final;
private IdeVersion ideversion;
private IdeFinal idefinal;
private IdeWelcome idewelcome;
private static ArrayList locations;
public static String VERSIONS = "VERSIONS";
public static String WELCOME = "WELCOME";
public static String FINAL = "FINAL";
public static String NETBEANSVERSIONS = "NETBEANSVERSIONS";
public static String IDEVERSIONS = "IDEVERSIONS";
public static String IDEWELCOME = "IDEWELCOME";
public static String IDEFINAL = "IDEFINAL";
public static int DEFWIDTH = 480;
public static int DEFHEIGHT = 240;
......
package installer;
public class InstallationEvent
{
private Object source;
......
package installer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
......@@ -49,6 +51,10 @@ public class NavPanel extends JPanel implements ActionListener {
navCancel.setEnabled(bEnable);
}
public void enableIDE(boolean bEnable) {
ideDetected = bEnable;
}
public void actionPerformed(ActionEvent ev) {
if ((ev.getSource() == navNext) && (next.length() != 0)) {
wizard.show(next);
......@@ -57,8 +63,14 @@ public class NavPanel extends JPanel implements ActionListener {
wizard.show(prev);
}
if (ev.getSource() == navCancel) {
if( ideDetected ) {
wizard.show(InstallWizard.IDEWELCOME);
}
else {
wizard.exitForm(null);
}
enableIDE(false);
}
}
public void setNextListener(ActionListener listener) {
......@@ -97,4 +109,5 @@ public class NavPanel extends JPanel implements ActionListener {
private InstallWizard wizard;
private String next;
private String prev;
private boolean ideDetected = false;
}
package installer;
import java.lang.String;
import java.io.*;
import javax.swing.*;
......@@ -79,7 +81,7 @@ public class Register{
System.out.println( "Windows" );
//path = "C:\\Progra~1\\OpenOffice.org643";
//progpath = path + "\\program\\";
//System.out.println("\""+progpath+"regsingleton.exe\" \""+path+File.separator+"user"+File.separator+"uno_packages"+File.separator+"cache"+File.separator+"services.rdb\" \"drafts.com.sun.star.script.framework.theScriptRuntimeForJava=drafts.com.sun.star.script.framework.ScriptRuntimeForJava\"");
System.out.println("\""+progpath+"regsingleton.exe\" \""+path+File.separator+"user"+File.separator+"uno_packages"+File.separator+"cache"+File.separator+"services.rdb\" \"drafts.com.sun.star.script.framework.theScriptRuntimeForJava=drafts.com.sun.star.script.framework.ScriptRuntimeForJava\"");
p=rt.exec("\""+progpath+"regsingleton.exe\" \""+path+File.separator+"user"+File.separator+"uno_packages"+File.separator+"cache"+File.separator+"services.rdb\" \"drafts.com.sun.star.script.framework.theScriptRuntimeForJava=drafts.com.sun.star.script.framework.ScriptRuntimeForJava\"");
}
exitcode=p.waitFor();
......@@ -102,7 +104,7 @@ public class Register{
}
else {
//System.out.println( "Windows" );
//System.out.println("\""+progpath+"regsingleton.exe\" \""+path+File.separator+"user"+File.separator+"uno_packages"+File.separator+"cache"+File.separator+"services.rdb\" \"drafts.com.sun.star.script.framework.storage.theScriptStorageManager=drafts.com.sun.star.script.framework.storage.ScriptStorageManager\"");
System.out.println("\""+progpath+"regsingleton.exe\" \""+path+File.separator+"user"+File.separator+"uno_packages"+File.separator+"cache"+File.separator+"services.rdb\" \"drafts.com.sun.star.script.framework.storage.theScriptStorageManager=drafts.com.sun.star.script.framework.storage.ScriptStorageManager\"");
p=rt.exec("\""+progpath+"regsingleton.exe\" \""+path+File.separator+"user"+File.separator+"uno_packages"+File.separator+"cache"+File.separator+"services.rdb\" \"drafts.com.sun.star.script.framework.storage.theScriptStorageManager=drafts.com.sun.star.script.framework.storage.ScriptStorageManager\"");
}
exitcode=p.waitFor();
......
package installer;
/*
* Welcome.java
*
......@@ -76,12 +78,13 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
//JScrollPane scroll = new JScrollPane(tableVersions);
//versionPanel.add(scroll);
versionPanel.add(tableVersions);
JTextArea area = new JTextArea("\n Please select the Office version you wish to Update \n ");
JTextArea area = new JTextArea("Please select the Office version you wish to Update");
area.setLineWrap(true);
area.setEditable(false);
add(area, BorderLayout.NORTH);
add(versionPanel, BorderLayout.CENTER);
nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME, InstallWizard.FINAL);
//nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME, InstallWizard.FINAL);
nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME, InstallWizard.FINAL);
nav.setNextListener(this);
add(nav, BorderLayout.SOUTH);
......
package installer;
import java.io.*;
import java.util.*;
import java.util.jar.*;
......@@ -174,6 +176,8 @@ public class XmlUpdater extends Thread {
else
System.out.println( "soffice.cfg exists" );
// Robert Kinsella test 1
//Adding <Office>/user/Scripts/java/
File scriptsDir = new File( scriptsPath );
File highlightDir = new File( scriptsPath+File.separator+"Highlight"+File.separator );
......@@ -204,7 +208,12 @@ public class XmlUpdater extends Thread {
onInstallComplete();
return;
}
if (opSys.indexOf("Windows")!=-1){
if (!zd.extractEntry("sframework/scripting64401.res",progpath+"resource"+File.separator, statusLabel))
{
onInstallComplete();
return;
}
if (opSys.indexOf("Windows")!=-1){
if (!zd.extractEntry("windows/regsingleton.exe",progpath, statusLabel))
{
onInstallComplete();
......@@ -227,6 +236,7 @@ public class XmlUpdater extends Thread {
}
//--------------------------------
// Robert Kinsella test 2
// adding (JAVA) script examples
File highlightScript = new File( scriptsPath+File.separator+"Highlight"+File.separator+"HighlightUtil.java" );
......@@ -276,6 +286,7 @@ public class XmlUpdater extends Thread {
else {
System.out.println( "Spell script already deployed" );
}
//--------------------------------
// Adding binding dialog
......
package installer;
import java.io.*;
import java.util.*;
import java.util.zip.*;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment