find usages of a symbol only in a specific module in Intellj - intellij-idea

I have an IntelliJ project with several modules. Is there a way to use find usages (for symbols - Alt+F7 in Linux) only inside a specific module?
For example I have two modules one is framework and one app and there's a class defined in framework module FrameworkClass.
If I see the symbol FrameworkClass in a class inside app module and click ALT+F7 I want to get all usages/references of FrameworkClass only inside 'app' module
Is there such a way?
Thanks

'Find Usages' options dialog can be invoked with Ctrl+Alt+Shift+F7 where you can define a custom search scope, e.g. a certain module.

Related

How to find derived types in a referenced assembly?

In JetBrains Rider, there is an action to find derived symbols of a symbol. I would like to use it to explore a new library. For example, when I use a new class from the library, I want to see its derived classes.
Unfortunately, none of these find the derived types in an external assembly:
Navigate > Implementation(s)
Navigate > Derived Symbols
Navigate > Type Hierarchy
But View > Quick Definition shows all of the types when cycling through the definitions. It does not show the hierarchy, so you do not see immediately, which type is derived from which.
How am I supposed to navigate library types and public APIs to get around a new library?
The easiest way to navigate through an external library is to use Rider's assembly explorer. Use double-click on a type to open it in the editor, and call Navigate -> Derived symbols action, which will show the list of derived symbols for a type under caret in the editor.

IntelliJ call hierarchy with dependencies

In IntelliJ, it is possible to decompile single class from a dependency jar and see that there is a function call to our prod class. But this is not useful for finding all calls to the method.
There is an option to include dependencies in call hierarchy feature (Ctrl+Alt+H), but seems like it doesn't work for a specific case.
To use this functionality of searching dependencies, should source code of dependency be available?
Does this mean that IntelliJ can index only dependencies with source code?
Thanks
Seems that I met the same puzzle like you did, I click the notice upper under the tag "download the source" and it makes!
I can use "open call hierarchy" function to see the function hierarchy in source code.

Reusing the eclipse plug in to create the customized plug in

Problem: I am using the eclipse editor plugin to create the customized plug in. So in that plug in i will be using only some classes to get the customized view of the editor. But I will not be using all classes now for example there are classes Class A,Class B, and Class C in the editor plug in and Class A will be initiating Class C.Now in my customized plugin I will be extending the Class C and customize the Class as per my requirement and I don't want to modify the Class A.
Actual problem is if open the eclipse editor i want Class A to initiate the extended Class C present in my plug in and not present in the eclipse editor plug in.
I.e During compile time binding i want Class A of the eclipse plug in to bind with the extended Class C present in my plugin.
Thanks
You can't change the behavior of an existing editor by trying to extend its classes in a new plugin.
If the existing editor provides 'extension points' to add new functionality to can extend it using those.
You can write a new editor using the classes from an existing plugin provided the existing plugin exports the packages you need to use.
You can sometimes use the org.eclipse.ui.activities extension point to suppress existing menus items, but this will require research to identify menu ids.
You can also sometimes add to menus by using the org.eclipse.ui.menus extension point. Again this requires research to identify menu ids. The 'plug-in Spy' may help with this.

Yii - Using alternate view file in Yii User module

Is it possible to use a custom view file in a module (eg. user) in order to keep the module (3rd party) intact?
Somehow extend the module, with a views folder that holds my custom views.
The path to the module theme views should be
/{{your_app_name}}/themes/{{theme_name}}/views/user/
Copy all of the module views from the folder
/{{your_app_name}}/protected/modules/user/views
to the mentioned above folder and that will do the job. After that you could customize the views as you like.
Copy user module view files to <app>/themes/<current_theme>/views/user/. More general, customize module views using the folowing "formula": <app>/themes/<current_tehem>/views/<modules_name>/<controller_name>/<view_file_to_customize>.php
Use a theme. For a module named "user" and a view path of "profile/edit", create "/themes/flashy/user/views/profile/edit.php". You can also define a new layout in "/themes/flashy/layouts/column2.php". Then add to your configuration file in "protected/config":
return array(
// many settings...
'theme' => 'flashy',
For the module "user" you pointed out, unfortunately its controllers use absolute paths for their layouts (e.g. "//layouts/columns2") so AFAIK you can't define distinct layouts for the application and this module.
See also the official guide chapter on theming with Yii.
I disagree that in many help forums of the Internet, when someone asks abot theming a module, everyone suggests a path alias to the themes folder. I think this is wrong, because it implies modules to be splitted, and modules are supposed to be a black-box that can be used across projects. The advice given in such forums would only be valid if a theme is shared among several modules. If someone wants to "package" a theme inside a module, she can:
-add an init function to the controller of the module
-inside that init, use the class attribute layout and a path alias, like this, supose a module whose id is "Sample":
then you add, to SampleCOntroller.php:
public function init() {
//BELOW: it will use the layouts/main.php inside the module.
$this->layouts = "sample.views.layouts.main";
}

How to get a module instance in PRISM

I have a PRISM desktop app which loads modules from a directory with the help of the DirectoryModuleCatalog.
Everything is fine, except that I cannot find a way to get the instance of a loaded module.
IModuleManager and IModuleCatalog don't have a method like getInstance(ModuleInfo) or similar.
See
moduleManager.LoadModule(moduleInfo.ModuleName);
This line loads the module properly(moduleManager is of type IModuleManager), but what do I have to do next to get the actual instance of this module?
The modules are loaded on demand of the user, so I cannot register all modules at startup within the bootstrapper.
If by Module instance you mean the class that implement IModule, then you must explicitly register the instance into the container to be able to get it.
Although the aforementioned will work, you should not take that approach at all. The idea is that the module classes are specific to a particular module and should only be used for module initialization purposes.
I would place each module's Start method in a separate component (IStartable), register each component in the container with a different Id and resolve/import an IEnumerable to get all instances that have the start method.
Hope this helps