How can I get rid of "No XCLASS inclusion code found in file 'pi1/class.tx_xxxxx_pi1.php''"? - typo3

Typo3 - Question:
In the extensionmanager when you click on "Information" there often is a (red) error which reads like this: "No XCLASS inclusion code found in file xxxxx".
Especially when developing an extension I am looking for a way to fix this this.
Any ideas?

You need to add the neccessary code in the bottom of your extension code. The extension kickstarter produces one for you, or you could snatch and adapt one from another extension, just make sure you don't change anything but the name of the class/path etc, as there doesn't seem to be much of a fuzzy logic to recognize the XCLASS statements.

Yes, norwebian's answer is right. I just want to add that XCLASS is a concept for extension to extend other extension's (or core) classes.
t3lib_div::makeInstance() takes care of this and looks, whether another class added itself as an XCLASS for this particular class, which should be instantiated.

Thanks for the answers! Here is the code that I found, that has to go in the class files:
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/extkey/pi1/class.tx_extkey_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/extcey/pi1/class.tx_extkey_pi1.php']);
}

Related

VS Code: Is there a way to refactor class and file name at once?

I use Typescript and refactor classnames a lot.
Right now I have to rename file and class names separately.
Is there any extension / shortcut for this?
I'm not aware of any shortcut allowing this. Nothing is linking the typescript filename and the class name for now.
Some people are looking for the same behavior over there and created a feature request: https://github.com/Microsoft/TypeScript/issues/10218. Check it out :)

what makes a variable be visible (intellij idea)

With intellij idea, how do I find out what makes a variable be visible?
An example of when it is hard:
Suppose you look at class A, and you see a variable something. If you jump to source you see that it's defined in trait X. But you don't extend trait X directly. What do you extend, then, that makes this variable visible? If you have a deeply nested hierarchy, tracking can be hard.
Any recommendations or solutions?
EDIT: Please vote for the feature if you're interested: http://youtrack.jetbrains.com/issue/IDEA-124369
I don't think that IntelliJ IDEA has any shortcut for "finding what makes a variable visible".
However you can determine it using the "Find Usages" option (Alt + F7). For example:
import java.nio._
object TempObj extends App {
def func = 2
val p = file.Paths.get("some-path")
func
}
So Find Usages on "file", tells you that its from the Package "file" (in heading of the new Tab it also shows the complete package name, ex: Find Usages of java.nio.file in Project Files).
Whereas Find Usages on func will tell you that its a Method (And the Tab heading now says: Find Usages of func() in Project and Libraries)
So now in way you can determine, what exactly makes the variable visible. This also works for imports since it shows the package from which it is imported and you can then look for import of that packages.
I know of two almost-solutions to this problem.
Go-to-declaration, as you mentioned, solves this problem in the case of local variables.
More generally, the "find usages" feature gives you a neat little breakdown by type and file of different uses of the variable. From this you can see if it's involved in a static import.
It's not perfect, but with a moment's thought these two are generally sufficient to figure out what you want.
Use ctrl+b or F4 to jump to source code. Alternatively you can use ctrl+shift+a to get option/action. You can find shortcuts at http://gaerfield.github.io/ide-shortcuts/ as well. Hope it will help.
From what I understood you want to see the code that creates an Object you use, for instance Mystery someMystery;.
That gives you two options to populate someMystery:
someMystery = ... where ... is your code to populate
someMystery and if that is the case you should follow
that code (with ctrl+B as far as you need to) to the point where it
actually creates the Mystery object.
Use CDI to populate that object instance for you, in which case you should look into the CDI mechanism in order to see in what way the object instance is populated.
In either way IMO there is no way to know for sure if the someMystery instance is of some more concrete class than Mystery, because it is decided in runtime, not in compile time, so your next bet would be to run the program in debug and see what object goes into someMystery, although you are not guaranteed to get the same type of object every time.
PS. My answer is based entirely on my java understanding of the topic, can't say if it is valid for scala also.
This might not be exactly the answer you were hoping to get.
However, quoting yourself,
If you have a deeply nested hierarchy, tracking can be hard.
Have you considered using composition over inheritance? Perhaps this would remove the need for the feature you are looking for.
Deeply nested hierarchy doesn't sound good. I understand your pain about that.
When you override vals or defs there is a little circle next to the line number that shows where it is from even when it is from nested hierarchy. Hovering over vals with the command key down also shows you a little tooltip where it is from.
Does this help?
https://youtu.be/r3D9axSlBo8
if you want class, field or method to be visible, you need to implement them as public. If it was your question.

Is there any way of expanding Visual studio Intellisense for .cs files?

I was wondering if it is possible to expand Visual Studio Intellisense for displaying custom statement completition in .cs files. I.e. I have found some examples of using xsd schemas to expand intellisense but they are for custom xml files if I'm not mistaken. What I would like to do is add some additional "options" to intellisense by adding just a string that will appear. Something like "MyCustomIntellisenseOption" and when I start writing I will get it in intellisense. I have found a similar solution here, but although it works exactly like I want it with a slight modification where I changed:
[Export(typeof(IVsTextViewCreationListener))]
[Name("token completion handler")]
[ContentType("plaintext")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal class TestCompletionHandlerProvider : IVsTextViewCreationListener
to:
[Export(typeof(IVsTextViewCreationListener))]
[Name("token completion handler")]
[ContentType("CSharp")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal class TestCompletionHandlerProvider : IVsTextViewCreationListener
But that gives me another problem.
If I have two strings "AddSomething.SomethingElse.Something1" and "AddSomething.SomethingElse.Something2" whenever I try to type the second string I come to the .(dot) and autocomplete kicks in and selects first option. Is it possible to override the dot? I figured that it has something to do with Token triggers but it seems I'm not able to find a solution for this.
The main idea is that those custom strings work like intellisense for classes but with predefined fixed strings.
Is there any other possible solution for adding custom intellisense and autocomplete option? Or a solution for my .(dot) problem?
Thank you in advance.

refactoring a whole class name in whole xcode project

I just changed my class name from Group.h to CVGroup.h and therefore everything is affected in my code. Is it possible to refactor the whole project so that Group is refactored into CVGroup?
In short, there is functionality that is supposed to do just that, but it doesn't always catch all of the instances. You can select the class name in the header file and then do Edit > Refactor > Rename and that will try and catch all of the instances (this is in Xcode 4). The nice thing is that it will let you see the diff's of where it was changed.
I will say from experience that this method usually missed several instances of the name, so a manual follow-up is almost always required.
Have you tried the Refactor command? In your Group.h file highlight the class name and choose Refactor->Rename from the Context Menu. This will rename the class everywhere it is used in your application.
The same as described above will work in Xcode 6.2: Select the class name in the header file and then Edit > Refactor > Rename.

Read remote properties

First of all, Hello everyone(/world) !
I am making an Eclipse RCP app' who needs to inspect some .properties located in some plugins who's Id I know at runtime.
I'd like to know if there is an easy way to read them, for example I know that in my plugin *org.anyname.myplugins.mypluginthatrocks I have a file named myawsomeproperties.properties*, how can I open it and read it easyly with a sort of getter/setter system like String getInProperties(String fileNameOrPath,String myPropertieId)
void setInProperties(String fileNameOrPath,String myPropertieId,String myPropertieValue)orString getInProperties(File file,String myPropertieId)
void setInProperties(File file,String myPropertieId,String myPropertieValue)or any other mean in that type if you get what I mean ...
Thanks in advance ^^
Well, if these are juste plain old properties, there is the good old ResourceBundle that will do the trick.
But, if you would like to do it, IMHO, a little bit cleaner, and in a more Eclipse oriented mind, I would suggest that you create a class that you use the NLS class, as explained here.