mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-29 09:47:50 +08:00
project.md: cleanup
This commit is contained in:
parent
6d9e6d2b90
commit
6468b06adc
@ -6,9 +6,9 @@ In the *IntelliJ Platform*, a project encapsulates all your source code, librari
|
||||
|
||||
## Working with projects
|
||||
|
||||
The *IntelliJ Platform* stores the project configuration data in XML files. The list of those files depends on the plugin [project](https://www.jetbrains.com/help/idea/about-projects.html) format.
|
||||
The *IntelliJ Platform* stores the project configuration data in XML files. The list of those files depends on the chosen [project](https://www.jetbrains.com/help/idea/about-projects.html) format.
|
||||
|
||||
For file-based format projects, the information core to the project itself (e.g. location of the component modules, compiler settings, etc.) is stored in the `%project_name%.ipr` file. The information about modules the project includes is stored in `%module_name%.iml` files. Module files are created for each module.
|
||||
For file-based format projects (legacy), the information core to the project itself (e.g. location of the component modules, compiler settings, etc.) is stored in the `%project_name%.ipr` file. The information about modules the project includes is stored in `%module_name%.iml` files. Module files are created for each module.
|
||||
|
||||
For directory-based format projects, the project and workspace settings are stored in a number of XML files under the `%project_home_directory%/.idea` directory. Each XML file is responsible for its own set of settings and can be recognized by its name: `projectCodeStyle.xml`, `encodings.xml`, `vcs.xml` etc. As for the file-based format projects, `.iml` files describe modules.
|
||||
|
||||
@ -16,10 +16,10 @@ Note that you don't need to access project files directly to load or save settin
|
||||
|
||||
To work with projects and project files, you can use the following classes and interfaces:
|
||||
|
||||
* [`Project`](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java) interface.
|
||||
* [`ProjectRootManager`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectRootManager.java) abstract class.
|
||||
* [`ProjectManager`](upsource:///platform/projectModel-api/src/com/intellij/openapi/project/ProjectManager.java) abstract class.
|
||||
* [`ProjectFileIndex`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java) interface.
|
||||
* [`Project`](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java)
|
||||
* [`ProjectRootManager`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectRootManager.java)
|
||||
* [`ProjectManager`](upsource:///platform/projectModel-api/src/com/intellij/openapi/project/ProjectManager.java)
|
||||
* [`ProjectFileIndex`](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java)
|
||||
|
||||
Other classes for working with the project model are located in the [projectModel-api.openapi](upsource:///platform/projectModel-api/src/com/intellij/openapi) package. Basic API classes and interfaces for the concepts of [project](upsource:///platform/core-api/src/com/intellij/openapi/project/Project.java), [module](upsource:///platform/core-api/src/com/intellij/openapi/module/Module.java), [application](upsource:///platform/core-api/src/com/intellij/openapi/application/Application.java) and [component](upsource:///platform/core-api/src/com/intellij/openapi/components/ProjectComponent.java) are placed in the [core-api.openapi](upsource:///platform/core-api/src/com/intellij/openapi) package.
|
||||
|
||||
@ -37,7 +37,7 @@ Messages.showInfoMessage("Source roots for the " + projectName + " plugin:\n" +
|
||||
|
||||
### Checking if a file belongs to a project
|
||||
|
||||
Use [ProjectFileIndex.java](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java) to get this information:
|
||||
Use [ProjectFileIndex](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java) to get this information:
|
||||
```java
|
||||
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
```
|
||||
@ -73,11 +73,11 @@ You can use the following methods:
|
||||
* To set the project-level SDK: `ProjectRootManager.getInstance(project).setProjectSdk(Sdk jdk);`
|
||||
* To set the project-level SDK name: `ProjectRootManager.getInstance(project).setProjectSdkName(String name);`
|
||||
|
||||
Note that by default, the project modules use the project SDK. Optionally, you can configure an individual SDK for each module.
|
||||
Note that by default, the project modules use the project SDK. Optionally, you can configure an individual SDK for each module. See [SDK](sdk.md) for more details.
|
||||
|
||||
## Changing the project structure
|
||||
|
||||
Utility classes which can be used for modifying a project structure can be found in the package [projectModel-impl.openapi](upsource:///platform/projectModel-impl/src/com/intellij/openapi). Its [roots](upsource:///platform/projectModel-impl/src/com/intellij/openapi/roots/) subpackage contains instances and utilities intended for work with project and module source roots, including [ModuleRootModificationUtil.java](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) and [ProjectRootUtil.java](upsource:///platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootUtil.java). Project structure
|
||||
Utility classes used for modifying the project structure can be found in the package [projectModel-impl.openapi](upsource:///platform/projectModel-impl/src/com/intellij/openapi). Its [roots](upsource:///platform/projectModel-impl/src/com/intellij/openapi/roots/) subpackage contains instances and utilities intended for work with project and module source roots, including [ModuleRootModificationUtil](upsource:///platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) and [ProjectRootUtil](upsource:///platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootUtil.java). Project structure
|
||||
changes need to be performed in a [write action](/basics/architectural_overview/general_threading_rules.md#readwrite-lock).
|
||||
|
||||
Refer to the [basic example](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/project_model/src/com/intellij/tutorials/project/model/ModificationAction.java) of on-the-fly project structure modification to learn how it can be implemented.
|
||||
|
Loading…
x
Reference in New Issue
Block a user