AppCode add PsiDir issue
I create dir with files via PsiDirectory.createSubdirectory(..), it works fine in Idea. But same code in AppCode works wrong: Folder not visible in ProjectView "project" mode. AFAIK AppCode doesn't open source, so i have no idea how to debug\fix this.
Please sign in to leave a comment.
'Project' view in AppCode represents logical Groups, not real folders. Depending on your needs, you might want to use one of the subclasses of OCNewFileActionBase
I can't find in idea community repository anything related to AppCode.
Also i'm discovered that the created files can be added to logical groups via context menu:
I dont found any api for adding to logical group. Seems like this functionality exists in ApppCode implementation only. Am i right?
Could you please describe what are you trying to achieve?
https://github.com/CeH9/PackageTemplates/issues/3
I see, so yes, this is AppCode-specific.
The easiest way is to inherit from OCNewFileActionBase. You can also inherit from XcodeCreateFileDialog and then use com.jetbrains.cidr.actions.newFile.XcodeNewFileHelper.doCreateFiles extension to add the file to the project model
Can't find these classes(using community 163.xx), should i add some dependencies?
Update: found these modules, dont sure that i'm need both
com.intellij.modules.appcode
com.intellij.modules.cidr.lang
Should i make two version of plugin? Maybe exists some way to make dependency optional?
Update: oh, i found answer on http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
You can have one version with optional dependencies. In order to access mentioned classes and compile the plugin you'll need to have AppCode SDK setup (you can use the current EAP version).
Can i setup AppCode SDK on OS windows?
You can set it up, since IntelliJ SDK only requires standard jar files, but most likely you won't be able to run it easily.
You'll also need a way to extract macOS DMG installers on Windows: http://www.wikihow.com/Open-DMG-Files
Thx a lot.
How to understand what does these args mean?
You must not implement/override the extension, instead call it using the following snippet:
OCNewFileHelperProvider[] providers = Extensions.getExtensions(OCNewFileHelperProvider.EP_NAME);
myHelper = providers.length == 1 ? providers[0].createHelper() : null;
@NotNull PsiDirectory directory // where files should be created
@NotNull String[] fileNames // file names
@NotNull PsiFile[] resultElements // empty array of size of fileNames.
@Nullable DialogWrapper dialog // reference to XcodeCreateFileDialog
@Nullable PsiFile sampleFile // leave it empty
Got null in PsiFile[] resultElements, when trying to put null instead of "@Nullable DialogWrapper dialog".
1) Is dialog required? Can i create Dir\Group silently?
2) I have no PBXProjectFile and PBXGroup to instantiate dialog. Can i find them in Event?
3) My Action common for all platform, what is the right way to detect availability of opptional dependency?
e.g:
>1) Is dialog required? Can i create Dir\Group silently?
>2) I have no PBXProjectFile and PBXGroup to instantiate dialog. Can i find them in Event?
Try something like this:
But I must admit that there is no good API to do what you need.
> 3) My Action common for all platform, what is the right way to detect availability of opptional dependency?
You can register a custom extension in your plugin and implement it depending on the availability of the optional dependency ( http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html).
We'll get to it when you are able to achieve what you need with dialogs.