Why Doesn't FDT Take Into Account My Selected 'Default' SDK When I Create A Project - fdt

Check out the screenshots. I have Flex 4.6 selected as default but the project template uses Apache Flex 4.8.
Why?

The project template is set to look for the highest, acceptable SDK.
To change this, go to your FDT preference folder in your home folder and change the value of the template (description.xml) from "_highest" to "_selected".
The the description.xml change:
<variable name="selectedSDK" label="Default SDK" default="_highest" type="sdk(3.6,4.9,1.5,4)" />
to:
<variable name="selectedSDK" label="Default SDK" default="_selected" type="sdk(3.6,4.9,1.5,4)" />
The FDT wiki has more info on using project templates.

Related

VS 15.3 Standard Library not connecting xaml and xaml.cs

Yesterday I did the update to VS (15.3), .NET Standard 2.0, .NET Core SDK 2.0 and so on. After that my current Xamarin Forms project broke. Most packages lost compatibility (although I did not change the standard1.4 version of the library). So I created a new standard1.4 library through VS (as stated here: https://xamarinhelp.com/visual-studio-2017-net-standard-xamarin/). I copied the code from the old Xamarin library to the new one and added all packages.
The problem now is that all xaml and xaml.cs are splitted and I get compile errors. I cant connect the files as I was used to (How can I connect xaml and xaml.cs files), because the csproj has completely changed through the evolution of netstandard. Whats even more astonishing is that even when I add a new xaml page to the project, the xaml and xaml.cs files are splitted. How can I fix this behavior?
Found the solution, through my post on the Microsoft Developer Network (https://developercommunity.visualstudio.com/content/problem/96027/vs-153-netstandard-xaml-and-xamlcs-seperated-and-c.html)
Credit to Long Nguyen (see source):
Fixed it by following this article:
https://oren.codes/2017/04/23/using-xamarin-forms-with-net-standard-vs-2017-edition/
In the .csproj file, you can see he declare the .xaml pages:
<ItemGroup>
<!-- https://bugzilla.xamarin.com/show_bug.cgi?id=55591 -->
<None Remove="***.xaml" />
<Compile Update="***.xaml.cs" DependentUpon="%(Filename)" />
<EmbeddedResource Include="***.xaml" SubType="Designer" Generator="MSBuild:UpdateDesignTimeXaml" />
</ItemGroup>
After doing the changes to the csproj, it should pick up the xaml and xaml.cs files again.

What settings should be used to get custom ItemTemplates working with .NET Core projects?

I have a Visual Studio 2017 item template extension that is currently working with ASP.NET projects. It has the following .vstemplate:
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate-sdkextension/2010">
<TemplateData>
<Name>Angular Component</Name>
<Description>Files for an Angular component</Description>
<RequiredFrameworkVersion>4.5</RequiredFrameworkVersion>
<Icon>AngularComponentTemplate.ico</Icon>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>Web</ProjectSubType>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.component.html">base.component.html</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.component.ts">base.component.ts</ProjectItem>
</TemplateContent>
</VSTemplate>
Additionally the VSIX file referencing it has
ItemTemplates\CSharp\Web
set for the "VSIX Sub Path" property of the project.
I cannot, however, get this template to appear in ASP.NET Core projects. I tried using this in the vstemplate:
<ProjectType>DNX</ProjectType>
<TemplateGroupID>SharedDotNetAndDotNetWeb</TemplateGroupID>
(from https://stackoverflow.com/a/38543920/1783619) but it didn't work. In the released version of Visual Stuido 2017, how do I get item templates to appear in .NET core projects?
I had this same issue while creating an item template for pug files.
Here is what I did:
Firstly, I found out how the stock templates are written in:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ItemTemplates\AspNetCore
This is how my template looks:
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>page.pug</DefaultName>
<Name>Pug File</Name>
<Description>This is a basic pug file template (previously Jade)</Description>
<ProjectType>CSharp</ProjectType>
<TemplateGroupID>AspNetCore</TemplateGroupID>
<TemplateID>AspNetCore.Pug</TemplateID>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<Icon>__TemplateIcon.ico</Icon>
<PreviewImage>__PreviewImage.ico</PreviewImage>
<SortOrder>10</SortOrder>
<ShowByDefault>false</ShowByDefault>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem ReplaceParameters="true">page.pug</ProjectItem>
</TemplateContent>
</VSTemplate>
Areas to pay attention to:
ProjectType, TemplateGroupId, TemplateId(make up your own) and NumberOfParentCategoriesToRollUp
I wanted my template to show up mainly in the "Content" category, where the HTML and CSS type templates were so I placed my zip file in
Visual Studio 2017\Templates\ItemTemplates\Visual C#\AspNetCore\Web\Content
I had to create a few directories (AspNetCore\Web\Content) to get this structure.
Then the setting "NumberOfParentCategoriesToRollUp" set to 2 allows the template to display in the "Content" category, but also "roll up" and show in Web and AspNetCore categories.
More info on organization of templates here:
https://learn.microsoft.com/en-us/visualstudio/ide/how-to-locate-and-organize-project-and-item-templates
Then when you are all done, open a visual studio 2017 developer command prompt and type:
devenv /updateconfiguration
The most important thing is
<TemplateGroupID>AspNetCore</TemplateGroupID>
Otherwise you will not see your item template from ASP.NET core project.
Strange thing is that you will see your item template with other project (desktop for example).
Hoping that Microsoft will document or make things easier one day

Modify the icon of an eclipse template plugin

Followed the steps here and created an eclipse plugin based on the Hello World, Command template - exported it, dropped in the plugins folder of my eclipse install and I saw the menu and toolbar entries alright.
Then I had the idea to modify the icon it showed in the toolbar item. Modified the plugin.xml as in (git diff):
<menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar id="gr.uoa.di.regas.eclipse.poc.toolbars.sampleToolbar">
<command
commandId="gr.uoa.di.regas.eclipse.poc.commands.sampleCommand"
- icon="icons/sample.gif"
+ icon="icons/my_icon.gif"
tooltip="Say hello world"
id="gr.uoa.di.regas.eclipse.poc.toolbars.sampleCommand">
</command>
</toolbar>
</menuContribution>
</extension>
and of course added my_icon.gif into the icons directory. Initially eclipse just kept loading the old icon till I deleted it and reexported just to see the little square that means 'icon not found'
So how do I change the icon ? Also where are the specifications for the icon - can't find any ?
EDIT: renamed the icon to icon.gif thinking the underscores might be the issue - nothing changed - of note that eclipse went ahead and renamed the icon in the plugin.xml (I renamed through the package explorer) - so the setup seems correct - eclipse knows about icon.gif.
EDIT2: the repo for the plugin: https://github.com/Utumno/eclipse_poc

popup:org.eclipse.jdt.ui.PackageExplorer not visible for Java projects

I'm writing a plugin for Eclipse to help me with some custom errors and warnings. Started by creating a new plugin project using the wizard, chose the option with the nature and markers in it.
This automatically added a menu item in the project's context menu (popup:org.eclipse.jdt.ui.PackageExplorer?after=additions)
This seemed to work for most projects. Except the projects i needed it for. The menu item simply does not show up for Java projects in the Package Explorer.
I only changed the default ?after to be ?before, so the menu-item is in a location that suited me better (for the projects that it does work on).
Screenshot if what i've got now
That shows it's working on a non-java project in the Package Explorer.
I also added the same menu-item to the Project Explorer, all works fine there.
Here is a link to the plugin.xml i currently have.
The project it DOES NOT work on, is a simple java project freshly generated from the Eclipse "New -> Java Project" wizard. Any other java project doesn't work either.
The project it DOES work on, is freshly generated from the "Plug-in Development -> Update Site Project" wizard.
Stuff i tried:
I know it is not the same as popup:org.eclipse.jdt.ui.PackageExplorer not visible, i'm adding the menu-item to the context menu of a project, not files or directories.
However, i did try using:
<adapt type="org.eclipse.core.resources.IResource">
<test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.jdt.core.IJavaProject" />
</adapt>
instead of the <instanceof> tags, which also did not work. in fact, removing the whole <instanceof> tag does not even work.
I know it is not the same as Eclipse plugin menu item is not visible, the generated plugin.xml used selection, which i later changed to activeMenuSelection because that matched the documentation, and what the Plug-in Selection Spy says it actually is. Again, no change.
I think it is not the same as How create popup menu item in PackageExplorer only for directories, but i did try to use the suggested code and toyed around with it, no luck.
So, to summarize:
This is my first Eclipse plugin, most of the GUI stuff is generated from the Plug-in Developent wizard. Now i hope a real wizard can lead me to the answers i seek.
The <adapt> tag gave me an idea to adapt the project to an IResource. Then check for natures from inside the <adapt> tag. And that seemed to work!
The Platform Expression Framework page at eclipse.org also helped me understand what each of the tags exactly do.
So, i think my problem was actually similar to the one i linked first (popup:org.eclipse.jdt.ui.PackageExplorer not visible). Feel pretty dumb about that now...
Relevant part of my current plugin.xml:
<visibleWhen checkEnabled="false">
<with variable="activeMenuSelection">
<count value="1" />
<iterate operator="and">
<adapt type="org.eclipse.core.resources.IResource">
<and>
<not>
<test property="org.eclipse.core.resources.projectNature" value="com.mycompany.converterhelper.javaFileNature" />
</not>
<test property="org.eclipse.core.resources.projectNature" value="org.eclipse.jdt.core.javanature" />
</and>
</adapt>
</iterate>
</with>
</visibleWhen>
And a link to the entire plugin.xml
I want to thank Calon for his time and effort :-)

How to enable autoscroll to/from source permanently for all new project imports?

I like the "Autoscroll to/from source" features. Every time I import a new project, I will always enable them. However, it gets annoying when you have to do that every time for a new import. I googled, but couldn't find out how. How can I enable them permanently?
There is now a free IntelliJ plugin to remember Autoscroll to/from Source settings:
Jetbrains repository: Autoscroll Save Plugin
Instructions to use:
Download Autoscroll Save plugin and restart IntelliJ
Open an IntelliJ project and set desired autoscroll to and from settings
Use Ctrl-Alt-Shift END
All IntelliJ projects opened or created in future will now inherit your desired Autoscroll to/from Source settings.
If you have any feedback on the plugin, please click on the author (vikingsteve) on the plugin page and use "Send email" function.
Edit: I was just at a java conference and spoke to some of the Jetbrains devs from St Petersbourg. After thanking them for developing IntelliJ, I asked them about this, and I understand that since they are really busy with other things they don't have time right now to make this default functionality in IntelliJ.
So, in the meantime, please try out the Autoscroll Save plugin - from everyone I spoke to at the conference, it works for them without problem.
This is currently not possible.
The auto-scroll settings are Project specific and are stored in the .idea/workspace.xml file :
Accessing Default Project Settings and Structure documents how to change the default settings used by new projects. Unfortunately, the autoscroll settings are not amongst the ones that can be set there.
A bit more digging shows that the default project is represented by .IntelliJIdea12\config\options\project.default.xml and it does not have settings for autoScroll specified. (Out of curiosity, I tried copying in the following in that file :
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource ProjectPane="true" />
<autoscrollFromSource ProjectPane="true" />
<sortByType />
</navigator>
</component>
But that was not picked up by new projects.
)