How do I use "org.eclipse.debug.ui.launchShortcuts"? - eclipse-plugin

I have written a custom launcher in Eclipse which I can access via the "Run As" and "Debug As" menu options on the toolbar. I also want to be able to launch via the package explorer and via right clicking on the editor of a file to be launched. I followed the tutorial here to add the shortcut but nothing happens, it does not enter my handling code, nor does it complain regarding the configuration of the extension point.
Here is a snippet from my plugin.xml
<extension point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
id = "org.mylauncher.launchCalcShortcut"
class = "org.mylauncher.LaunchCalcShortcut"
description="Execute calculations"
icon="icons/launch_16_16.png"
label="Calculate"
modes="run, debug" >
<configurationType id="org.mylauncher.launchCalc"/>
</shortcut>
I have also played with removing the (optional) icon attribute, and have separately validated the path of the icon.
I've been modifying this configuration for hours now with no good result and it is impossible to debug as it is not running in my own code at all.
Thanks.

It seems that the correct answer to this problem is to specify a contextual launch shortcut. Here is my working configuration:
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="com.xxxx.CalcLaunchShortcut"
icon="calc.png"
id="com.xxxx.CalcLaunchShortcut"
label="Calc"
modes="run, debug">
<contextualLaunch>
<contextLabel mode="run" label="Run Calculator" />
<contextLabel mode="debug" label="Debug Calculator" />
<enablement >
<with variable="selection">
<count value="1"/>
<iterate>
<adapt type="org.eclipse.core.resources.IResource">
<and>
<test property="org.eclipse.core.resources.name" value="*.calc"/>
</and>
</adapt>
</iterate>
</with>
</enablement>
</contextualLaunch>
</shortcut>

Related

Sitecore 8.2 ItemService api working in main website but not in microsites

I have a website that has a primary home node as well as several microsites (each of which is a different language), configured like so:
<sites>
<site name="website-swedish" itemwebapi.mode="StandardSecurity" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="true" patch:source="x.Sites.config" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/Swedish" hostName="se.mysite.com" language="sv" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB"/>
<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" language="en" patch:source="x.Sites.config" formsRoot="{F1F7AAB6-C8CE-422F-A214-F610C109FA63}" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" itemwebapi.mode="StandardSecurity" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="true" database="web"/>
</sites>
InSitecore.Services.Client.config I changed SecurityPolicy to ServicesOnPolicy:
<setting name="Sitecore.Services.SecurityPolicy" value="Sitecore.Services.Infrastructure.Web.Http.Security.ServicesOnPolicy, Sitecore.Services.Infrastructure" />
When I make a call to the ItemService on my main website, such as mysite.com/sitecore/api/ssc/item/0CF2CD64-2A60-47AE-A2F2-7FD1B599EE04, it works as expected. However, when I make a call on the microsite, e.g. se.mysite.com/sitecore/api/ssc/item/0CF2CD64-2A60-47AE-A2F2-7FD1B599EE04, I get a 403 error.
In addition to the SecurityPolicy setting I also had to change the AllowAnonymousUser setting to true:
<setting name="Sitecore.Services.AllowAnonymousUser" value="true" />

Eclipse plug-in: nameFilter of propertyPages takes a strange effect

I use Eclipse SDK Mars.1(4.5.1). I create a propertyPages plug-in.
In plugin.xml:
If I change value of “nameFilter” to “.txt”, then only when I select .txt file, the propertyPage item can appear in left of the properties dialog;
If I change value of “nameFilter” to “.java” or “.xml” or even “.*”, then still only when I select .txt file, the propertyPage item can appear.
Here is my plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.propertyPages">
<page
id="com.def.btp_property_3.properties.BTPPropertyPage"
name="BTP Page"
class="com.def.btp_property_3.properties.BTPPropertyPage"
nameFilter="*.java">
<enabledWhen>
<instanceof
value="org.eclipse.core.resources.IFile">
</instanceof>
</enabledWhen>
</page>
</extension>
</plugin>
Can anyone tell me the reason and give me a solution.
For the enableWhen use:
<enabledWhen>
<or>
<instanceof
value="org.eclipse.core.resources.IFile">
</instanceof>
<adapt
type="org.eclipse.core.resources.IFile">
</adapt>
</or>
</enabledWhen>
User interface elements in views are often not instances of IFile, instead they are some other object which can be 'adapted' to IFile. This enabledWhen deals with this case.

Enable plugin only on certain folder (Eclipse RCP)

I created a simple Eclipse plugin, to launch a wizard and create some files, everything is working, I also added an option lo launch the wizard from the New > Mi Wizard menu, but now I want to display this option only when I right click an specific folder in a project, this is what I have so far:
This is my wizard:
<extension point="org.eclipse.ui.newWizards">
<category
name="My Category"
id="com.test.myCategory">
</category>
<wizard
name="My Wizard"
icon="icons/wizard1.gif"
category="com.test.myCategory"
class="com.test.myWizard"
id="com.test.myWizard">
</wizard>
</extension>
And this is how I'm adding the wizard to the New menu:
<extension point="org.eclipse.ui.navigator.navigatorContent">
<commonWizard
type="new"
wizardId="com.test.myWizard"
menuGroupId="testGroup">
<enablement>
<adapt type="org.eclipse.core.resources.IFolder">
<test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="myFacet:1.3" forcePluginActivation="true"/>
</adapt>
</enablement>
</commonWizard>
</extension>
The option in the New menu is displayed correctly, but it is displayed when I right click all folders, is there a way to display the option only when I right click a certain folder, specifically the WebContent folder?
You can use the org.eclipse.core.resources.name property tester to test the resource name:
<adapt type="org.eclipse.core.resources.IFolder">
<and>
<test property="org.eclipse.core.resources.name" value="WebContent"/>
<test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="myFacet:1.3" forcePluginActivation="true"/>
</and>
</adapt>

Eclipse conflicting handlers

On developing an eclipse plugin i created a command in the Manifest extensions with id crtc_v4.session with a default handler crtc_v4.handlers.StartSession , I added a handler in the manifest for this command this handler enables the command according to the variable crtc_v4.sessionvar.
The problem which appears on the console is :
!MESSAGE Conflicting handlers for crtc_v4.session: {crtc_v4.handlers.StartSession#98bc5c} vs {crtc_v4.handlers.StartSession#1265d09}
But it doesn't block running the plugin. I'm asking about the solution for this problem, and whether it affects the performance of my plugin in general ?
Edit :
The snippet that define the command :
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="crtc_v5.crtctoolbar">
<command
commandId="crtc_v5.session"
icon="icons/neutral.png"
label="Start Session"
style="push">
</command>
</toolbar>
</menuContribution>
The snippet that define the handler :
</extension>
<command
defaultHandler="crtc_v5.handlers.StartSession"
id="crtc_v5.session"
name="session">
</command>
</extension>
And here is the enablement against sessionvar :
<extension
point="org.eclipse.ui.handlers">
<handler
class="crtc_v5.handlers.StartSession"
commandId="crtc_v5.session">
<enabledWhen>
<with
variable="crtc_v5.sessionvar">
<equals
value="LOGGEDIN">
</equals>
</with>
</enabledWhen>
</handler>
You've defined a default handler in the command and another one in the org.eclipse.ui.handlers extension. If you want to use enabledWhen, simply remove the defaultHandler attribute (since both instances provide the same handler, crtc_v5.handlers.StartSession).
When you want to have different handlers provide the behaviour for your command depending on the application state, you would use activeWhen in the org.eclipse.ui.handlers definition, but that doesn't seem to be the case here.

Is setting "ASP.NET Impersonation" possible using WiX 3.x with IISExtension?

I have this component in my .wxs file:
<Component Id="Component.IisConfiguration" Guid="[COMPONENT_GUID_IISSITE]">
<iis:WebAppPool Id="IIS.AppPool" Name="[WEB_APP_POOL_NAME]" Identity="networkService" ManagedRuntimeVersion="v4.0" />
<iis:WebSite Id="IIS.WebSite" Description="[WEB_APP_NAME]" SiteId="[WEB_APP_SITEID]" Directory="TARGETDIR" >
<iis:WebApplication Id="IIS.WebSite.Application" Name="[WEB_APP_POOL_NAME]" WebAppPool="IIS.AppPool" />
<iis:WebAddress Id="IIS.WebSite.WebAddress.Port" Port="[WEB_APP_ADDRESS_PORT]" />
<iis:WebDirProperties Id="IIS.WebSite.Authentication" WindowsAuthentication="yes" />
</iis:WebSite>
</Component>
Is it possible to set "ASP.NET Impersonation" anywhere ?
It seems there's no out-of-the-box switch for this. You can have a custom action which calls:
appcmd set config /commit:WEBROOT/section:identity /impersonate:true
See this article for more information.
On the other hand, you can always set this setting on the application level, and use the standard XmlConfig element to modify the web.config file for this.