How to quickly copy the current editing file name or full file path in Eclipse (Luna)? - eclipse

This 'solution' doesn't look to work any longer in the Luna version:
Copy path/file name in Eclipse to clipboard
This is actually a must have feature for a rich IDE!

You can use start explorer (alternate link) or Copy path plugin.
Short cut key to copy path to clipboard in star explorer is : Ctrl+Alt+
C
Standard eclipse eclipse doest have such key. You can select resource in Package/Project/Navigator view and press Alt+Enter to open property dialog and then copy path from here.

I am using Eclipse Java EE IDE for Web Developers.Version: Luna Release (4.4.0)
Build id: 20140612-0600
You can right mouse click on the file and select "Copy Qualified Name".
For this particular example, the path in clipboard is
/TestingProject/src/com/website/testing/App1.java

Use the EasyShell plugin
If using Eclipse 4.14 or later, from Dec 2019 or later, neither StartExplorer nor Path Tools nor Copy as Path works.
Instead, use EasyShell, which works great!
Instructions:
Unsure no text or code is selected.
Right-click anywhere in your open Eclipse file editor, including on empty space near your code, or in the Project Explorer pane.
Go to "EasyShell" --> "Copy Full Path to Clipboard", or "Copy Qualified Name to Clipboard" (see screenshot below).
You now have the file path copied. Paste it wherever you want.
Totally unrelated aside
Additional note: as far as good Ecliplse plugins go in general, I also highly recommend the DevStyle plugin, set to "Dark Gray (Darkest Dark)" Workbench theme, with the DevStyle "Editor theme" (syntax highlighting) set to Sublime Text 3 (Monokai), by Jeremy Shepherd <-- Update Feb 2020: dead links. Instead, I've copied and pasted the contents of Jeremy Shepherd's .xml file at the bottom of this answer.
Sublime Text 3 (Monokai) - by Jeremy Shepherd--theme-25808.xml:
<?xml version="1.0" encoding="utf-8"?>
<colorTheme id="25808" name="Sublime Text 3 (Monokai)" modified="2014-04-11 19:52:55" author="Jeremy Shepherd">
<searchResultIndication color="#757575" />
<filteredSearchResultIndication color="#757575" />
<occurrenceIndication color="#000000" />
<writeOccurrenceIndication color="#000000" />
<findScope color="#111111" />
<deletionIndication color="#D25252" />
<sourceHoverBackground color="#000000" />
<singleLineComment color="#75715E" italic="false" />
<multiLineComment color="#75715E" italic="false" />
<commentTaskTag color="#CCDF32" italic="false" underline="true" strikethrough="false" />
<javadoc color="#76725E" italic="false" />
<javadocLink color="#76725E" italic="false" underline="true" strikethrough="false" />
<javadocTag color="#FD2971" italic="false" />
<javadocKeyword color="#C2BFA6" italic="false" />
<class color="#56D8F0" bold="false" underline="false" strikethrough="false" />
<interface color="#D197D9" />
<method color="#FFFFFF" />
<methodDeclaration color="#7BE12A" />
<bracket color="#D8D8D8" />
<number color="#7FB347" />
<string color="#E7DD6C" />
<operator color="#D8D8D8" />
<keyword color="#F12971" bold="false" />
<annotation color="#FFFFFF" />
<staticMethod color="#BED6FF" />
<localVariable color="#E7F8F2" />
<localVariableDeclaration color="#F12971" />
<field color="#7BE12A" />
<staticField color="#EFC090" />
<staticFinalField color="#EFC090" />
<deprecatedMember color="#D25252" underline="false" strikethrough="true" />
<enum color="#7BE12A" />
<inheritedMethod color="#BED6FF" />
<abstractMethod color="#BED6FF" />
<parameterVariable color="#79ABFF" />
<typeArgument color="#BFA4A4" />
<typeParameter color="#BFA4A4" />
<constant color="#EFB571" />
<background color="#272822" />
<currentLine color="#3E3D32" />
<foreground color="#F8F8F2" />
<lineNumber color="#72736A" />
<selectionBackground color="#757575" />
<selectionForeground color="#D0D0D0" />
</colorTheme>
Sublime Text 3 (Monokai) - by Jeremy Shepherd--theme-25808.epf:
Too long to post here. See my dotfiles project to download it instead.

Related

Add VS icon pack to VS plugin, visual studio plug-ins development

I'm creating an add-in for VS, how to add icon getting from VS icon pack for the menu command button?
Getting icon from resource code example
<GuidSymbol name="testIcon" value="{00000000-0000-0000-0000-0000}">
<IDSymbol name="testIcon1" value="1" />
</GuidSymbol>
<Bitmap guid="testIcon" href="Resources\Icon.png" usedList="testIcon1"/>
<Button guid="guidAddIconCmdSet" id="cmdidMyCommand" priority="0x0100" type="Button">
<Parent guid="guidAddIconCmdSet" id="MyMenuGroup" />
<Icon guid="testIcon" id="testIcon1" />
<Strings>
<ButtonText>My Command name</ButtonText>
</Strings>
</Button>
Known Monikers - The set of image monikers contained in the Visual Studio Image Catalog and publicly consumable by any Visual Studio component or extension. This one is a good choice, let's try.
Firstly, include this library KnownImageIds.vsct in you .vsct file
Modify the code to add what icon you need around <Icon> tag
Add flag <CommandFlag>IconIsMoniker</CommandFlag>
For example, add VS "open folder" icon to your menu command
<Include href="KnownImageIds.vsct"/>
<Extern href="stdidcmd.h"/>
<Extern href="vsshlids.h"/>
<GuidSymbol name="testIcon" value="{00000000-0000-0000-0000-0000}">
<IDSymbol name="testIcon1" value="1" />
</GuidSymbol>
<Bitmap guid="testIcon" href="Resources\Icon.png" usedList="testIcon1"/>
<Button guid="guidAddIconCmdSet" id="cmdidMyCommand" priority="0x0100" type="Button">
<Parent guid="guidAddIconCmdSet" id="MyMenuGroup" />
<Icon guid="ImageCatalogGuid" id="OpenFolder" /> // icon id
<CommandFlag>IconIsMoniker</CommandFlag> // enable moniker
<Strings>
<ButtonText>My Command name</ButtonText>
</Strings>
</Button>
Browse Monkier icon id from here KnownMoniker id text
For more visualization, just install this VS add-in Moniker Browser

sun_checks.xml location in checkstyle-idea.xml

My checkstyle-idea.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="active-configuration" value="CLASSPATH:/sun_checks.xml:The default CheckStyle rules" />
<entry key="check-nonjava-files" value="false" />
<entry key="check-test-classes" value="false" />
<entry key="location-0" value="CLASSPATH:/sun_checks.xml:The default CheckStyle rules" />
<entry key="suppress-errors" value="false" />
<entry key="thirdparty-classpath" value="" />
</map>
</option>
</component>
</project>
And i can't seem to find this file in my Ubuntu 14.04. Searched everywhere. The only solution i see is to download it and replace that location.
But is there a way to understand where it is located now?
My /etc/environment doesn't contain it also. So where is it? Because CheckStyle works and checks the code in Idea.
The Checkstyle-IDEA plugin contains a copy of the Sun Checks (sun_checks.xml). It is contained in the root of the plugin's JAR file. The plugin JAR is usually located at:
Linux: ~/.<PRODUCT><VERSION>/config/plugins/CheckStyle-IDEA/lib/checkstyle-idea-4.5.2.jar
Windows: C:\Users\<YourUserName>\.<PRODUCT><VERSION>\config\plugins\CheckStyle-IDEA\lib\checkstyle-idea-4.5.2.jar
Version numbers may differ in your case. The part .<PRODUCT><VERSION> should appear as something like .IdeaIC13 (for IntelliJ IDEA version 13).
Note that you should not need to find this file. You should never change it or touch it in any way. If you need to change the rules configuration, create your own rule set and use that. You may of course create your own rule set based on a copy of sun_checks.xml.
For mac I located it by typing:
sudo find / -iname Checkstyle-IDEA
Which lead me to
~/Library/Application Support/IntelliJIdea15/CheckStyle-IDEA/lib
I was then able to open the jar with an archive program and make a copy of the sun_checks.xml for my own customization.

Authentication issue when debugging in VS2013 - iis express

I'm trying to pick up the windows username when debugging in Visual Studio 2013. I am simply using:
httpcontext.current.user.identity.name
If I run this on my Dev Server it works fine, if I run it in debug mode on any previous version of Visual Studio it also works fine.
My problems is - If i run this on visual studio 2013 I get an empty string.
My web config is as follows.
<system.web>
<authentication mode="Windows"/>
<identity impersonate="false"/>
<authorization>
<allow users="*"/>
</authorization>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
<customErrors mode="Off"/>
</system.web>
I had just upgraded to VS 2013 from VS 2012 and the current user identity (HttpContext.User.Identity) was coming through as anonymous.
I tried changing the IIS express applicationhost.config, no difference.
The solution was to look at the properties of the web project, hit F4 to get the project properties when you have the top level of the project selected. Do not right click on the project and select properties, this is something entirely different.
Change Anonymous Authentication to be Disabled and Windows Authentication to be Enabled.
Works like gravy :)
As I was researching this I found my answer, but can't find the answer on the internet, so I thought I'd share this:
I fixed my issue by modifying my applicationhost.config file. My file was saved in the "\My Documents\IISExpress\config" folder.
It seems that VS2013 was ignoring my web.config file and applying different authentication methods.
I had to modify this portion of the file to look like the below. In truth, I only modified the anonymousAuthentication to be false and the windowsAuthentication mode to true.
<authentication>
<anonymousAuthentication enabled="false" userName="" />
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="false" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="false">
</iisClientCertificateMappingAuthentication>
<windowsAuthentication enabled="true">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
In Visual Studio 2013 AND VS15 (but i guess if the same for all other version) just press F4 and change this two properties:
-Anonymous Authentication: Disable
-Windows Authentication: Enable
In VS2013 F4 on your project to view properties window and disable Anonymous access and enable "Windows authentication"
Then it will work. No need to change anything else
VS 2015 changes this. It added a .vs folder to my web project and the applicationhost.config was in there. I made the changes suggested (window authentication = true, anon=false) and it started delivering a username instead of a blank.
Open up the applicationHost.config file located in the C:\Users[userid]\Documents\IISExpress\config folder. Inside this file change the overrideModeDefault of anonymousAthentication and windowsAuthentication to "Allow"
<sectionGroup name="security">
<section name="access" overrideModeDefault="Deny" />
<section name="applicationDependencies" overrideModeDefault="Deny" />
<sectionGroup name="authentication">
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<section name="basicAuthentication" overrideModeDefault="Deny" />
<section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" />
<section name="digestAuthentication" overrideModeDefault="Deny" />
<section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" />
<section name="windowsAuthentication" overrideModeDefault="Allow" />
</sectionGroup>
Next change lockItem to be "false" for AnonymousAuthenticationModule and WindowsAuthenticationModule
<system.webServer>
<modules>
<!--
<add name="HttpCacheModule" lockItem="true" />
-->
<add name="DynamicCompressionModule" lockItem="true" />
<add name="StaticCompressionModule" lockItem="true" />
<add name="DefaultDocumentModule" lockItem="true" />
<add name="DirectoryListingModule" lockItem="true" />
<add name="IsapiFilterModule" lockItem="true" />
<add name="ProtocolSupportModule" lockItem="true" />
<add name="HttpRedirectionModule" lockItem="true" />
<add name="ServerSideIncludeModule" lockItem="true" />
<add name="StaticFileModule" lockItem="true" />
<add name="AnonymousAuthenticationModule" lockItem="false" />
<add name="CertificateMappingAuthenticationModule" lockItem="true" />
<add name="UrlAuthorizationModule" lockItem="true" />
<add name="BasicAuthenticationModule" lockItem="true" />
<add name="WindowsAuthenticationModule" lockItem="false" />
Making these changes will allow the existing web config settings to override what is in the applicationHost file for IIS Express.
You could also modify the project properties for your web project, choose "Web" from left tabs, then change the Servers drop down to "Local IIS". Create a new virtual directory and use IIS manager to setup your site/app pool as desired.
I prefer this method, as you would typically have a local IIS v-directory (or site) to test locally. You won't affect any other sites this way either.
It appears that the right answer is provided by user3149240 above. However, As Neil Watson pointed out, the applicationhost.config file is at play here.
The changes can actually be made in the VS Property pane or in the file albeit in a different spot. Near the bottom of the applicationhost.config file is a set of location elements. Each app for IIS Express seems to have one of these. Changing the settings in the UI updates this section of the file. So, you can either change the settings through the UI or modify this file.
Here is an example with anonymous auth off and Windows auth on:
<location path="MyApp">
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
This is equivalent in the VS UI to:
Anonymous Authentication: Disabled
Windows Authentication: Enabled
F4 doesn't always bring me to this panel. Besides, it is often said that a picture is worth a thousand words.

Is it possible to use run-jetty-run's eclipse plugin to debug this app?

Theres about 20 diff ant files, that make up the build. Im not sure how to configure run-jetty-runs eclipse plugin to use this information. Can anyone point me towards a tutorial or some documentation:
<target name="run-jetty" depends="build" description="Runs application in included Jetty container">
<property file="credentials.properties" />
<property name="jetty.port" value="8080" />
<java jar="${jetty.dir}/start.jar" fork="true" dir="${basedir}" maxmemory="512M">
<arg value="${jetty.conf.dir}/jetty.xml" />
<arg value="${jetty.conf.dir}/jetty-jndi.xml" />
<sysproperty key="jetty.port" value="${jetty.port}" />
<jvmarg value="-XX:MaxPermSize=128m" />
<jvmarg value="-Dfile.encoding=UTF-8" />
<jvmarg value="-Djetty.home=${jetty.dir}" />
<jvmarg value="-Djetty.datasource.lanter.username=${jetty.datasource.lanter.username}" />
<jvmarg value="-Djetty.datasource.lanter.password=${jetty.datasource.lanter.password}" />
<jvmarg value="-Djetty.datasource.vs.username=${jetty.datasource.us.username}" />
<jvmarg value="-Djetty.datasource.vs.password=${jetty.datasource.us.password}" />
<jvmarg value="-DSTOP.PORT=${jetty.stop.port}" />
<jvmarg value="-DSTOP.KEY=${jetty.stop.key}" />
</java>
</target>
You have two options:
Start the app using the run-jetty-run plugin; this will give you an entry in the debug menu which means that Jetty (and the app) will be launched in the debugger if you select it.
Use the information in the code block above to create your own run configuration. The classpath should already be correct; you just need to select the correct main class (open META-INF/MANIFEST.MF in start.jar to find that out). Replace all the properties with their values and put each into a new line into the argument text fields of the run configuration.
On the tab "Common", you can set a file name and save the launch config as a file in your project, so everyone working on it will get it.

WiX plugin installer needs to reference primary installation

I have created a second plugin for my primary program which allows it to open additional file extensions. Now when creating the "Verb" element to associate the new file extension with the executable of the primary executable (installed from a different installer which I also created) I do not know how to reference said executable.
<!-- Associate file type -->
<ProgId Id='myfile' Description='My file'>
<Extension Id='ext' ContentType='application/ext'>
<Verb Id='open' Command='Open' TargetFile="INSERT MAGIC HERE" Argument='"%1"' />
</Extension>
</ProgId>
thanks
brian
If you know the GUID of the Component that installed the file that is the target of the shortcut a ComponentSearch is the easiest way to get what you want. Something like:
<Property Id="TARGET_FILE">
<ComponentSearch Id="FindTargetFile" Guid="{GUID-OF-TARGET-FILE-COMPONENT}" Type="file">
<FileSearch Id="FoundTargetFile" Name="file.exe" />
</ComponentSearch>
</Property>
<Component>
<ProgId Id='myfile' Description='My file'>
<Extension Id='ext' ContentType='application/ext'>
<Verb Id='open' Command='Open' TargetProperty="[TARGET_FILE]" Argument='"%1"' />
</Extension>
</ProgId>
</Component>