|
From: <jom...@us...> - 2008-12-05 14:36:52
|
Revision: 1419
http://jason.svn.sourceforge.net/jason/?rev=1419&view=rev
Author: jomifred
Date: 2008-12-05 14:36:48 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
fix bug in 'automatic agent creation' when using jEdit
Modified Paths:
--------------
trunk/doc/faq/faq.tex
trunk/src/jason/jeditplugin/JasonID.java
Modified: trunk/doc/faq/faq.tex
===================================================================
--- trunk/doc/faq/faq.tex 2008-12-04 14:25:22 UTC (rev 1418)
+++ trunk/doc/faq/faq.tex 2008-12-05 14:36:48 UTC (rev 1419)
@@ -116,7 +116,7 @@
Most of the internal actions (IAs) are developed from an agent
perspective, since they are conceived to be called by agents. Thus the
\code{execute} method needs an agent's
-\code{TransitionSystem} (TS) to be executed (e.g. \code{.myName} only makes
+\code{TransitionSystem} (TS) to be executed (e.g. \code{.my_name} only makes
sense when called by an agent).
%However, some internal actions can be executed without a reference for
Modified: trunk/src/jason/jeditplugin/JasonID.java
===================================================================
--- trunk/src/jason/jeditplugin/JasonID.java 2008-12-04 14:25:22 UTC (rev 1418)
+++ trunk/src/jason/jeditplugin/JasonID.java 2008-12-05 14:36:48 UTC (rev 1419)
@@ -269,24 +269,35 @@
void openAgentBuffer(AgentParameters ap) {
try {
- boolean newFile = !(new File(ap.asSource.getAbsolutePath()).exists());
- Buffer nb = org.gjt.sp.jedit.jEdit.openFile(view, ap.asSource.getAbsolutePath());
+ if (ap == null || ap.asSource == null)
+ return;
+
+ // fix file name
+ Buffer projectb = getProjectBuffer();
+ String file = ap.asSource.toString();
+ if (file.indexOf('/') < 0)
+ file = projectb.getDirectory() + "/" + file;
+ file = new File(file).getAbsolutePath();
+
+ boolean newFile = !(new File(file).exists());
+ Buffer nb = org.gjt.sp.jedit.jEdit.openFile(view, file);
// textArea.append(lstAgs.getSelectedValue()+"");
if (newFile) {
try {
- Buffer projectb = getProjectBuffer();
ap.asSource = new File(projectb.getDirectory() + ap.name + "." + MAS2JProject.AS_EXT);
String agcode = Config.get().getTemplate("agent.asl");
agcode = agcode.replace("<AG_NAME>", ap.getAgName());
agcode = agcode.replace("<PROJECT_NAME>", projectb.getName());
nb.writeLock();
nb.insert(0, agcode);
- nb.save(view, ap.asSource.getAbsolutePath());
+ nb.save(view, file);
} finally {
nb.writeUnlock();
}
}
- } catch (Exception ex) {}
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
}
public void handleMessage(EBMessage message) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|