Find in Eclipse all classes that are under specific package - eclipse

I have project in which I have a package "com.mysite.Entities". Under this package I have several entities: "Class1.java","Class2.java","Class3.java". Currently in the names we don't have the string "Entity". And now I want to find what entities I have in this package. I want to write somewhere the package and as a result to have the 3 classes defined above.
Is this possible in Eclipse?
I don't want to find them with java code. What I need is just in some way to search in Eclipse IDE and to see in the UI that there are 3 classes, which were written under this package and to be able to select one of them and to open it into the Editor Window.

In Search > Java..., enter the search string com.mysite.Entities.*, search for Type and limit to Declarations.

Related

Create a package in Modelica

I am using Modelica in my work, where I have modeled a system that contains many models. I want to make it simple to use by creating a package using " within" so this package contains all the models. What I want is to open the package instead of opening many models, which takes time.
Instead of doing everything by hand, I suggest to create your packages with a Modelica tool (OpenModelica, Dymola, SimulationX, ...).
The tool will automatically create the folder structure and the within lines in the .mo files for you. Doing it manually is not much fun.
You could e.g. use OMEdit (part of OpenModelica) to create your package structure as follow:
create your top-level package via File > New Modelica Class
insert sub-models and sub-packages in existing packages via right-click > New Modelica Class
According to this website http://omwebbook.openmodelica.org/
A package is simply a container or namespace for names of classes, functions, constants, and other allowed definitions. The package name is prefixed to all definitions in the package using standard dot notation. An import language construct is provided for Modelica packages.
the package can help us to gather components that build the main model together in same place inside it , just by clicking on the package you open all your components inside it.
to open a package in Modelica we follow the follwing instructions:
After creationg the package you will get a folder with the package name in the place that you chosed to saved it in it , when you open the folder you click on package in order to open your package .
hope this can be helpfull

Generate code from Use Case Diagram creates lots of empty classes

In a Papyrus Model, I clicked the Use Case Diagram (which is quite simple - contains about 5 use-cases), and selected "Designer -> Generate Java Code".
In response, I got hundreds of new packages, each of which contains hundreds of empty classes, with strange names such as "Aaixixnrpr", "Aclywqwwlr", etc...
What is happening?!
Papyrus SW designer does not have a particular code generation support for "use case" elements, i.e. it will treat an Actor or a Use Case just as a UML class. This means that it will create an empty Java class, unless you add operations/opaque behaviors.
But the Java code generator should not create classes for elements that are not in the model. Can you please double check via the model explorer that elements such as "Aaixixnrpr" do not exist in the model?
Which version are you using? (I recommend to use version 1.0.5 from this update site on an Eclipse oxygen). Btw, I also recommend to use the Papyrus forum for questions like this.

Incorporate library when building a static library with Eclipse

I am creating a static library A which utilizes a 3rd party static library B. I want to provide a single static library which includes my code as well as the required code from library B.
I could extract all the object files from library B, but that does not heop with the problem:
Since my project is a static library project, the C/C++-Build > Settings > Tool Settings contains no linker section but an archiver section, thus there is no Miscellaneous > Other objects field as it is with executable projects. Do I miss some obvious way or do the Eclipse developers disallow such a field? Can I somehow declare to incorporate the B code?
The only alternative I currently see is to convert the project into a Makefile project.
You can add extra command line options by editing the Expert Settings: to set the Command Line pattern: to what you want. For example I can add an arbitrary extra .o file by adding it to the end of the line, as shown here:

Rename references at the same time in Eclipse

I have the following situation:
Consider that I have a class nested in a folder structure like for example /fol/der/exam/ple.java . Of course, the class ple.java contains package or import instuctions referencing to some sources. Now, when I choose Use as a source folder for /fol/der/exam/ple.java then, of course, the references used in package, import or function parameters are not the same anymore. I need to adjust them. Is there an elegant how to do that automatically in eclipse?
So, let´s assume that I have the following line in ple.java:
package fol.der.exam;
and that I have this line also in other files like a.java, b.java, etc. and I want to change the line, let´s say to package der.exam;
How can I do that automatically for all java files in eclipse?
best regards,

Eclipse can not find JUnit test case folder - how to configure it?

I want to test methods of Java classes using JUnit. Therefore, I use Eclipse and create a source folder "TestCases" which contains a package with the name "test" that should be the place where I want to put the JUnit test cases.
The whole directory set up is shown in the following pic:
My problem is, when I right-click on "test" and go to "JUnit Test Case", and write for example "ASTAnyExprTest"(see (1) in the following pic), and go to "Browse" (see (2)) and type "ASTAnyExpr" (see (3) ) to set the name of the class under test, then I see only a blank space (no class to choose).
So, I must have a path-problem, I thought. My first idea was to copy all classes to the package "test". But then I need to modify and adjust all dependencies in the classes.
So is there a better solution for that ?
best regards,