return null;
}
public void save() {
String tempBaseType = this.getBaseType();
PatternBaseStore patternParser = new PatternBaseStoreImplementation();
FileOutputStream fileOutputStream;
this.setNonProject();
try {
File file;
if (getClass().getResource("DefaultPattern/patternBase") == null) {
File defDirec = new File(getClass().getResource("").getPath()
+ "/DefaultPattern");
defDirec.mkdir();
file = new File(defDirec.getPath() + "/patternBase");
file.createNewFile();
} else {
file = new File(getClass().getResource(
"DefaultPattern/patternBase").toURI());
}
fileOutputStream = new FileOutputStream(file);
patternParser.savePl(fileOutputStream, this);
fileOutputStream.close();
Map<String, Templete> templetes = this.getAllTempletes();
Iterator templeteIterator = templetes.values().iterator();
while (templeteIterator.hasNext()) {
Templete templete = (Templete) templeteIterator.next();
File temDirec;
if (getClass().getResource(
"DefaultPattern/" + templete.getName()) == null) {
temDirec = new File(getClass()
.getResource("DefaultPattern").getPath()
+ "/" + templete.getName());
temDirec.mkdir();
} else {
temDirec = new File(getClass().getResource(
"DefaultPattern/" + templete.getName()).getPath());
}
// ���ģ��ĸ�Ϊģʽ������Ҫд������ģ�ͺ�Լ��ģ������
if (templete.getParentType().equals("pattern")) {
File fmFile;
if (getClass().getResource(
"DefaultPattern/" + templete.getName() + "/"
+ templete.getName() + ".fm") == null) {
fmFile = new File(getClass().getResource(
"DefaultPattern/" + templete.getName())
.getPath()
+ "/" + templete.getName() + ".fm");
fmFile.createNewFile();
} else {
fmFile = new File(getClass().getResource(
"DefaultPattern" + "/" + templete.getName()
+ "/" + templete.getName() + ".fm")
.toURI());
}
fileOutputStream = new FileOutputStream(fmFile);
patternParser.saveFm(fileOutputStream, templete);
fileOutputStream.close();
File cmFile;
if (getClass().getResource(
"DefaultPattern" + "/" + templete.getName() + "/"
+ templete.getName() + ".cm") == null) {
cmFile = new File(getClass().getResource(
"DefaultPattern/" + templete.getName())
.getPath()
+ "/" + templete.getName() + ".cm");
cmFile.createNewFile();
} else {
cmFile = new File(getClass().getResource(
"DefaultPattern" + "/" + templete.getName()
+ "/" + templete.getName() + ".cm")
.toURI());
}
fileOutputStream = new FileOutputStream(cmFile);
patternParser.saveCm(fileOutputStream, templete);
fileOutputStream.close();
}
File paFile;
if (getClass().getResource(
"DefaultPattern" + "/" + templete.getName() + "/"
+ templete.getName() + ".pa") == null) {
paFile = new File(getClass().getResource(
"DefaultPattern/" + templete.getName()).getPath()
+ "/" + templete.getName() + ".pa");
paFile.createNewFile();
} else {
paFile = new File(getClass().getResource(
"DefaultPattern" + "/" + templete.getName() + "/"
+ templete.getName() + ".pa").toURI());
}
fileOutputStream = new FileOutputStream(paFile);
patternParser.savePa(fileOutputStream, templete);
fileOutputStream.close();
}
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {