use of org.moe.editors.InfoPlistManager in project moe-ide-integration by multi-os-engine.
the class XcodeEditor method initManagers.
private void initManagers(VirtualFile virtualFile) {
this.fileDocumentManager = FileDocumentManager.getInstance();
this.xcodeProjectDocument = fileDocumentManager.getDocument(virtualFile);
xcodeProjectDocument.addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void beforeDocumentChange(com.intellij.openapi.editor.event.DocumentEvent documentEvent) {
}
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent documentEvent) {
reloadXcodeProjectFile();
}
});
try {
this.xcodeEditorManager = new XcodeEditorManager(null, xcodeProjectDocument.getText());
} catch (ProjectException e) {
e.printStackTrace();
}
xcodeEditorManager.setListener(new DocumentChangeListener() {
@Override
public void documentChanged() {
saveXcodeDocument();
}
});
this.projectName = EditorUtil.getXcodeProjectName(new File(virtualFile.getPath()));
xcodeEditorManager.setProjectName(projectName);
String root = virtualFile.getParent().getParent().getPath();
File mainInfoPlist = getFileFromXcodeConfiguration(root, xcodeEditorManager.getInfoMainPlist());
VirtualFile mainInfoVirtualFile = project.getBaseDir().getFileSystem().findFileByPath(mainInfoPlist.getAbsolutePath());
this.mainInfoPlistDocument = fileDocumentManager.getDocument(mainInfoVirtualFile);
try {
this.mainInfoPlistManager = new InfoPlistManager(mainInfoPlistDocument.getText());
} catch (Exception e) {
LOG.error("Unable read main Info.plist", e);
}
mainInfoPlistManager.setListener(new DocumentChangeListener() {
@Override
public void documentChanged() {
saveMainInfoPlistDocument();
}
});
mainInfoPlistDocument.addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void beforeDocumentChange(com.intellij.openapi.editor.event.DocumentEvent documentEvent) {
}
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent documentEvent) {
reloadMainInfoPlist();
}
});
File testInfoPlist = getFileFromXcodeConfiguration(root, xcodeEditorManager.getInfoTestPlist());
VirtualFile testInfoVirtualFile = project.getBaseDir().getFileSystem().findFileByPath(testInfoPlist.getAbsolutePath());
this.testInfoPlistDocument = fileDocumentManager.getDocument(testInfoVirtualFile);
try {
this.testInfoPlistManager = new InfoPlistManager(testInfoPlistDocument.getText());
} catch (Exception e) {
LOG.error("Unable read test Info.plist", e);
}
testInfoPlistManager.setListener(new DocumentChangeListener() {
@Override
public void documentChanged() {
saveTestInfoPlistDocument();
}
});
testInfoPlistDocument.addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void beforeDocumentChange(com.intellij.openapi.editor.event.DocumentEvent documentEvent) {
}
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent documentEvent) {
reloadTestInfoPlist();
}
});
}
Aggregations