Could not create content describer for com.example.cstfile. Content type has been disabled - eclipse

I'm trying to add a content type for my XML files with a custom file extension(CST) and I get the following error -
Could not create content describer for com.example.cstfile. Content type has been disabled.
Here's my plugin.xml file -
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.xml"
file-extensions="cst,xml"
id="cstfile"
name="CST File"
priority="normal">
<describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2"
plugin="org.eclipse.core.runtime">
<parameter name="elementNames" value="CSTFile"/>
</describer>
</content-type>
<file-association
content-type="org.eclipse.core.runtime.xml"
file-extensions="cst">
</file-association>
</extension>
I'm trying to figure out the reason by debugging org.eclipse.core.internal.content.ContentTypeCatalog but have not found any reasons so far, any help is appreciated.

It looks like it comes from calls to ContentTypes.invalidateDescriber - the content describer has thrown an exception.
Looking at XMLRootElementContentDescriber2 it will throw an exception if it gets a javax.xml.parsers.ParserConfigurationException exception when try to parse the XML.
There should be more information in the .log file in the .metadata directory of the workspace.

Related

Talend - how to configure tFileInputDelimited do not throw error when file not found

Good day,
I am using tFileInputDelimited in Talend Data Studio to read a txt file and get some value inside.
The input file name is something like follow, it contain day in the file name:
checksum_150123.txt
This file will create in last few steps before the job end and the file not found.
Thus, every day the job first run, there is no file exist, and then tFileInputDelimited will throw error on file not found.
C:\LandingZone\jx\checksum_180123.txt (The system cannot find the file specified)
[ERROR] 14:13:35 my_track.my_precheck_registration_0_1.DL_PRECHECK_REGISTRATION- CollectCheckSum_1_tFileInputDelimited_1 - C:\LandingZone\jx\checksum_180123.txt (The system cannot find the file specified)
I have a requirement to not showing this, may I know how can I configure this?
for that I recommend you to use the tFileExist component and then use the tFileExist variable Exist (((Boolean)globalMap.get("tFileExist_1_EXISTS")) for example) in a run if trigger
Hope this answers your question

ERROR in There is a placeholder name mismatch with the translation provided

We use #angular/localize (Version 9.1.12) and have a problem with the placeholders in localized text.
E. g. we have:
$localize`:##form.hint:Some text ${name} in service.`;
or
$localize`:##form.hint:Some text ${name}:name: in service.`;
Because the localize text strings in typescript files aren't extracted we put these into a component template.
E. g.:
<p i18n="##form.hint">Some text {{ name }} in service.</p>
After execution of xi18n we get the messages.xlf (and messages.de.xlf) files which contain the following:
<trans-unit id="form.hint" datatype="html">
<source>Some text <x id="INTERPOLATION" equiv-text="{{ name }}"/> in service.</source>
<target state="new">Some text <x id="INTERPOLATION" equiv-text="{{ name }}"/> in service.</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/translation/translation.component.html</context>
<context context-type="linenumber">207</context>
</context-group>
</trans-unit>
When we start the application with ng serve we get the following error:
ERROR in There is a placeholder name mismatch with the translation provided for the message "form.hint" ("Some text {$PH} in service.").
The translation contains a placeholder with name INTERPOLATION, which does not exist in the message.
The application does not work. After a restart the error does not occur and the application works. Nothing was changed before the restart.
We can work with a local restart but after each change of the messages.xlf files the error occurs again and we need two ci-builds on our build server to get a working installation on our test machine.
Any ideas what can be the cause of the placeholder mismatch?
For the current angular version (10.1.3) you need to opt in to extraction of translation tokens via ivy:
ng xi18n --ivy
The result will include texts from $localize.

Automatically create i18n directory for VSCode extension

I am trying to understand the workflow presented in https://github.com/microsoft/vscode-extension-samples/tree/master/i18n-sample for localizing Visual Studio Code extensions.
I cannot figure out how the i18n directory gets created to begin with, as well as how the set of string keys in that directory get maintained over time.
There is one line in the README.md which says "You could have created this folder by hand, or you could have used the vscode-nls-dev tool to extract it."...how would one use vscode-nls-dev tool to extract it?
What I Understand
I understand that you can use vscode-nls, and wrap strings like this: localize("some.key", "My String") to pick up the localized version of that string at runtime.
I am pretty sure I understand that vscode-nls-dev is used at build time to substitute the content of files in the i18n directory into the transpiled JavaScript code, as well as creating files like out/extension.nls.ja.json
What is missing
Surely it is not expected that: for every file.ts file in your project you create an i18n/lang/out/file.i18n.json for every lang you support...and then keep the set of keys in that file up to date manually with every string change.
I am assuming that there is some process which automatically goes "are there any localize("key", "String") calls in file.ts for new keys not yet in file.i18n.json? If so, add those keys with some untranslated values". What is that process?
I have figured this out, referencing https://github.com/Microsoft/vscode-extension-samples/issues/74
This is built to work if you use Transifex for your translator. At the bare minimum you need to use .xlf files as your translation file format.
I think that this is best illustrated with an example, so lets say you wanted to get the sample project working after you had deleted the i18n folder
Step 1: Clone that project, and delete the i18n directory
Step 2: Modify the gulp file so that the compile function also generates nls metadata files in the out directory. Something like:
function compile(buildNls) {
var r = tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject()).js
.pipe(buildNls ? nls.rewriteLocalizeCalls() : es.through())
.pipe(buildNls ? nls.createAdditionalLanguageFiles(languages, 'i18n', 'out') : es.through())
.pipe(buildNls ? nls.bundleMetaDataFiles('ms-vscode.node-debug2', 'out') : es.through())
.pipe(buildNls ? nls.bundleLanguageFiles() : es.through())
Step 3: Run the gulp build command. This will generate several necessary metadata files in the out/ directory
Step 4: Create and run a new gulp function to export the necessarry translations to the xlf file. Something like:
gulp.task('export-i18n', function() {
return gulp.src(['package.nls.json', 'out/nls.metadata.header.json', 'out/nls.metadata.json'])
.pipe(nls.createXlfFiles("vscode-extensions", "node-js-debug2"))
.pipe(gulp.dest(path.join('vscode-translations-export')));
}
Step 5: Get the resulting xlf file translated. Or, add some dummy values. I cant find if/where there is documentation for the file format needed, but this worked for me (for the extension):
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="package" source-language="en" target-language="ja" datatype="plaintext"><body>
<trans-unit id="extension.sayHello.title">
<source xml:lang="en">Hello</source>
<target>JA_Hello</target>
</trans-unit>
<trans-unit id="extension.sayBye.title">
<source xml:lang="en">Bye</source>
<target>JA_Bye</target>
</trans-unit>
</body></file>
<file original="out/extension" source-language="en" target-language="ja" datatype="plaintext"><body>
<trans-unit id="sayHello.text">
<source xml:lang="en">Hello</source>
<target>JA_Hello</target>
</trans-unit>
</body></file>
<file original="out/command/sayBye" source-language="en" target-language="ja" datatype="plaintext"><body>
<trans-unit id="sayBye.text">
<source xml:lang="en">Bye</source>
<target>JA_Bye</target>
</trans-unit>>
</body></file>
</xliff>
Step 6: Stick that file in some known location, let's say /path/to/translation.xlf. Then add/run another new gulp task to import the translation. Something like:
gulp.task('i18n-import', () => {
return es.merge(languages.map(language => {
console.log(language.folderName)
return gulp.src(["/path/to/translation.xlf"])
.pipe(nls.prepareJsonFiles())
.pipe(gulp.dest(path.join('./i18n', language.folderName)));
}));
});
Step 7: Run the gulp build again.
The i18n/ directory should now be recreated correctly! Running the same build/export/translate/import/build steps will pick up any new changes to the localize() calls in your TypeScript code
Obviously this is not perfect, there are a lot of hardcoded paths and such, but hopefully it helps out anyone else who hits this issue.

How to Add more than one object contribution for Eclipse Plugin?

Heloo,
I have a plugin with the plugin.xml file below,
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.xxx.xxx.a"
objectClass="org.eclipse.xxx.xxx.b" (ERROR !!)
id="xxx">
<menu
label="NewMenu"
path="additions"
id="xxx">
<separator
name="group1">
</separator>
</menu>..... blah blah blah
My intention is to enable this "newmenu" for only two types of classes -
org.eclipse.xxx.xxx.a & org.eclipse.xxx.xxx.b
When I tried to declare a new object class I get an error
ERROR: Description Resource Path Location Type Attribute "objectClass" was
already specified for element "objectContribution".
How do I chieve my intention ??

Unity Container not Resolving my Type

I am working in a project that is using unity. The first element was already in the web.config and is resolving correctly. The second one (IEventRepository) was added by me. It will not resolve the type and throws an error ("Resolution of the dependency failed..")
I have 2 questions on this:
1) What is the issue?
2) Why does the first one have commas in it?
Thanks
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<container>
<register type="Demo.IPerson, Demo.Shared.Facilities" mapTo="Person, Demo.Shared.Facilities" />
<register type="Web.Repositories.IEventRepository" mapTo="Web.Repositories.MockEventRepository" />
</container>
</unity>
The purpose of the commas is to separate the Type and Assembly. For example, in the first line Demo.IPerson is the Type and this type is in the Demo.Shared.Facilities assembly. In the second line you haven't specified both the Type and Assembly which could be the reason for the error.
The way you have configured the registration in line 2 could work if you have defined a type alias. Have a look at The Unity Configuration Schema