|
From: <jom...@us...> - 2009-04-25 18:40:57
|
Revision: 1490
http://jason.svn.sourceforge.net/jason/?rev=1490&view=rev
Author: jomifred
Date: 2009-04-25 18:40:52 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
fix bug in eclipse plugin for mac os
Modified Paths:
--------------
trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/PluginTemplates.java
trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/ProjectCreation.java
trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewAgentWizard.java
trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewEnvironmentWizard.java
trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewInternalActionWizard.java
trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewLogConfigurationWizard.java
trunk/doc/faq/Makefile
Modified: trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/PluginTemplates.java
===================================================================
--- trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/PluginTemplates.java 2009-04-20 18:39:20 UTC (rev 1489)
+++ trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/PluginTemplates.java 2009-04-25 18:40:52 UTC (rev 1490)
@@ -1,24 +1,24 @@
package net.sourceforge.jasonide.core;
-import java.io.File;
+
/**
- * Plugin Templates and constants to access the Jason templates in your instalation directory.
+ * Plugin Templates and constants to access the Jason templates in your installation directory.
* @author Germano
*/
public class PluginTemplates {
- public static final String TEMPLATE_DIR = "src" + File.separator + "templates";
+ //public static final String TEMPLATE_DIR = "src" + File.separator + "templates";
- public static final String ENVIRONMENT = "environment";
+ //public static final String ENVIRONMENT = "environment";
- public static final String INTERNAL_ACTION = "ia";
+ //public static final String INTERNAL_ACTION = "ia";
- public static final String AGENT = "agent.asl";
+ //public static final String AGENT = "agent.asl";
public static final String MAS2J = "project.mas2j";
- public static final String BUILD = "build-template.xml";
+ //public static final String BUILD = "build-template.xml";
public static final String LOGGING_CONFIGURATION = "logging.properties";
Modified: trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/ProjectCreation.java
===================================================================
--- trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/ProjectCreation.java 2009-04-20 18:39:20 UTC (rev 1489)
+++ trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/core/ProjectCreation.java 2009-04-25 18:40:52 UTC (rev 1490)
@@ -15,7 +15,6 @@
import java.util.Enumeration;
import java.util.Formatter;
import java.util.Hashtable;
-import java.util.Scanner;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
@@ -181,21 +180,8 @@
File f = new File(actualPackage + File.separator + className + ".java");
f.createNewFile();
- String jasonHome = JasonPluginConstants.JASON_HOME;
- String envTempl = jasonHome +
- File.separator +
- PluginTemplates.TEMPLATE_DIR +
- File.separator +
- PluginTemplates.ENVIRONMENT;
+ String templateContent = Config.get().getTemplate("environment");
- StringBuffer buffer = new StringBuffer();
- Scanner s = new Scanner(new File(envTempl));
- while (s.hasNextLine()) {
- buffer.append(s.nextLine().concat("\r\n"));
- }
-
- String templateContent = buffer.toString();
-
// contains package(s)
if (packages.length() != 0) {
templateContent = "package ".concat(packages).concat(";\r\n\r\n").concat(templateContent);
@@ -209,6 +195,7 @@
fw.flush();
fw.close();
} catch (IOException e) {
+ e.printStackTrace();
MessageDialog.openError(getShell(), "Error", e.getMessage());
}
}
@@ -221,22 +208,8 @@
try {
File f = new File(projectRootDir + File.separator + JasonPluginConstants.AGENT_DEFAULT_REPOS + File.separator + "sample.asl");
f.createNewFile();
-
- String jasonHome = JasonPluginConstants.JASON_HOME;
- String envTempl = jasonHome +
- File.separator +
- PluginTemplates.TEMPLATE_DIR +
- File.separator +
- PluginTemplates.AGENT;
+ String templateContent = Config.get().getTemplate("agent.asl");
- StringBuffer buffer = new StringBuffer();
- Scanner s = new Scanner(new File(envTempl));
- while (s.hasNextLine()) {
- buffer.append(s.nextLine().concat("\r\n"));
- }
-
- String templateContent = buffer.toString();
-
templateContent = templateContent.replace("<AG_NAME>", "sample");
templateContent = templateContent.replace("<PROJECT_NAME>", projectName);
@@ -245,6 +218,7 @@
fw.flush();
fw.close();
} catch (IOException e) {
+ e.printStackTrace();
MessageDialog.openError(getShell(), "Error", e.getMessage());
}
}
Modified: trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewAgentWizard.java
===================================================================
--- trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewAgentWizard.java 2009-04-20 18:39:20 UTC (rev 1489)
+++ trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewAgentWizard.java 2009-04-25 18:40:52 UTC (rev 1490)
@@ -1,21 +1,18 @@
package net.sourceforge.jasonide.wizards;
+import jason.jeditplugin.Config;
import jason.mas2j.AgentParameters;
import jason.mas2j.MAS2JProject;
import jason.mas2j.parser.ParseException;
import java.io.ByteArrayInputStream;
-import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Scanner;
import net.sourceforge.jasonide.Activator;
-import net.sourceforge.jasonide.core.JasonPluginConstants;
import net.sourceforge.jasonide.core.JasonPluginException;
import net.sourceforge.jasonide.core.MAS2JHandler;
-import net.sourceforge.jasonide.core.PluginTemplates;
import net.sourceforge.jasonide.editors.MAS2JEditor;
import org.eclipse.core.resources.IContainer;
@@ -206,21 +203,8 @@
*/
private InputStream openContentStream(String containerName, String fileName) {
try {
- String jasonHome = JasonPluginConstants.JASON_HOME;
- String envTempl = jasonHome +
- File.separator +
- PluginTemplates.TEMPLATE_DIR +
- File.separator +
- PluginTemplates.AGENT;
-
- StringBuffer buffer = new StringBuffer();
- Scanner s = new Scanner(new File(envTempl));
- while (s.hasNextLine()) {
- buffer.append(s.nextLine().concat("\r\n"));
- }
-
- String agentFileContents = buffer.toString();
-
+ String agentFileContents = Config.get().getTemplate("agent.asl");
+
fileName = fileName.replace(".", ">");
String agentName = fileName.split(">")[0];
String projectName = containerName.split("/")[1];
@@ -229,7 +213,8 @@
agentFileContents = agentFileContents.replace("<PROJECT_NAME>", projectName);
return new ByteArrayInputStream(agentFileContents.getBytes());
- } catch (IOException e) {
+ } catch (Exception e) {
+ e.printStackTrace();
MessageDialog.openError(getShell(), "Error", e.getMessage());
return null;
}
Modified: trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewEnvironmentWizard.java
===================================================================
--- trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewEnvironmentWizard.java 2009-04-20 18:39:20 UTC (rev 1489)
+++ trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewEnvironmentWizard.java 2009-04-25 18:40:52 UTC (rev 1490)
@@ -1,5 +1,6 @@
package net.sourceforge.jasonide.wizards;
+import jason.jeditplugin.Config;
import jason.mas2j.ClassParameters;
import jason.mas2j.MAS2JProject;
import jason.mas2j.parser.ParseException;
@@ -9,13 +10,10 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Scanner;
import net.sourceforge.jasonide.Activator;
-import net.sourceforge.jasonide.core.JasonPluginConstants;
import net.sourceforge.jasonide.core.JasonPluginException;
import net.sourceforge.jasonide.core.MAS2JHandler;
-import net.sourceforge.jasonide.core.PluginTemplates;
import net.sourceforge.jasonide.editors.MAS2JEditor;
import org.eclipse.core.resources.IContainer;
@@ -223,21 +221,8 @@
private InputStream openContentStream(String containerName, String packageName, String fileName) {
try {
- String jasonHome = JasonPluginConstants.JASON_HOME;
- String iaTempl = jasonHome +
- File.separator +
- PluginTemplates.TEMPLATE_DIR +
- File.separator +
- PluginTemplates.ENVIRONMENT;
+ String environmentContents = Config.get().getTemplate("environment"); //buffer.toString();
- StringBuffer buffer = new StringBuffer();
- Scanner s = new Scanner(new File(iaTempl));
- while (s.hasNextLine()) {
- buffer.append(s.nextLine().concat("\r\n"));
- }
-
- String environmentContents = buffer.toString();
-
String iaName = fileName;
String projectName = containerName.split("/")[1];
@@ -249,7 +234,8 @@
}
return new ByteArrayInputStream(environmentContents.getBytes());
- } catch (IOException e) {
+ } catch (Exception e) {
+ e.printStackTrace();
MessageDialog.openError(getShell(), "Error", e.getMessage());
return null;
}
Modified: trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewInternalActionWizard.java
===================================================================
--- trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewInternalActionWizard.java 2009-04-20 18:39:20 UTC (rev 1489)
+++ trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewInternalActionWizard.java 2009-04-25 18:40:52 UTC (rev 1490)
@@ -1,15 +1,14 @@
package net.sourceforge.jasonide.wizards;
+import jason.jeditplugin.Config;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
-import java.util.Scanner;
import net.sourceforge.jasonide.Activator;
-import net.sourceforge.jasonide.core.JasonPluginConstants;
-import net.sourceforge.jasonide.core.PluginTemplates;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -164,33 +163,21 @@
private InputStream openContentStream(String containerName, String packageName, String fileName) throws CoreException {
try {
- String jasonHome = JasonPluginConstants.JASON_HOME;
- String iaTempl = jasonHome +
- File.separator +
- PluginTemplates.TEMPLATE_DIR +
- File.separator +
- PluginTemplates.INTERNAL_ACTION;
+ String iaCode = Config.get().getTemplate("ia");
- StringBuffer buffer = new StringBuffer();
- Scanner s = new Scanner(new File(iaTempl));
- while (s.hasNextLine()) {
- buffer.append(s.nextLine().concat("\r\n"));
- }
-
- String agentFileContents = buffer.toString();
-
String iaName = fileName;
String projectName = containerName.split("/")[1];
- agentFileContents = agentFileContents.replace("<IA_NAME>", iaName);
- agentFileContents = agentFileContents.replace("<PROJECT_NAME>", projectName);
+ iaCode = iaCode.replace("<IA_NAME>", iaName);
+ iaCode = iaCode.replace("<PROJECT_NAME>", projectName);
if (packageName != null) {
- agentFileContents = agentFileContents.replace("<PCK>", packageName);
+ iaCode = iaCode.replace("<PCK>", packageName);
}
- return new ByteArrayInputStream(agentFileContents.getBytes());
- } catch (IOException e) {
+ return new ByteArrayInputStream(iaCode.getBytes());
+ } catch (Exception e) {
+ e.printStackTrace();
throwCoreException(e.getMessage());
return null;
}
Modified: trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewLogConfigurationWizard.java
===================================================================
--- trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewLogConfigurationWizard.java 2009-04-20 18:39:20 UTC (rev 1489)
+++ trunk/applications/jason-eclipse-plugin/src/net/sourceforge/jasonide/wizards/NewLogConfigurationWizard.java 2009-04-25 18:40:52 UTC (rev 1490)
@@ -1,14 +1,13 @@
package net.sourceforge.jasonide.wizards;
+import jason.jeditplugin.Config;
+
import java.io.ByteArrayInputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
-import java.util.Scanner;
import net.sourceforge.jasonide.Activator;
-import net.sourceforge.jasonide.core.JasonPluginConstants;
import net.sourceforge.jasonide.core.PluginTemplates;
import org.eclipse.core.resources.IContainer;
@@ -139,23 +138,9 @@
*/
private InputStream openContentStream(String containerName) {
try {
- String jasonHome = JasonPluginConstants.JASON_HOME;
- String iaTempl = jasonHome +
- File.separator +
- PluginTemplates.TEMPLATE_DIR +
- File.separator +
- PluginTemplates.LOGGING_CONFIGURATION;
-
- StringBuffer buffer = new StringBuffer();
- Scanner s = new Scanner(new File(iaTempl));
- while (s.hasNextLine()) {
- buffer.append(s.nextLine().concat("\r\n"));
- }
-
- String logginConfigContents = buffer.toString();
-
+ String logginConfigContents = Config.get().getTemplate(PluginTemplates.LOGGING_CONFIGURATION); //buffer.toString();
return new ByteArrayInputStream(logginConfigContents.getBytes());
- } catch (IOException e) {
+ } catch (Exception e) {
e.printStackTrace();
return null;
}
Modified: trunk/doc/faq/Makefile
===================================================================
--- trunk/doc/faq/Makefile 2009-04-20 18:39:20 UTC (rev 1489)
+++ trunk/doc/faq/Makefile 2009-04-25 18:40:52 UTC (rev 1490)
@@ -4,7 +4,7 @@
latex2html -split 0 -style faq.css \
-white -image_type=gif -transparent \
-dir html -mkdir -ascii_mode \
- -show_section_numbers -noinfo -html_version 3.2,math -no_math \
+ -address "" -show_section_numbers -noinfo -html_version 3.2,math -no_math \
-math -no_navigation $(TARGET).tex
cp faq.css html
cp html/faq.html ..
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|