Eclipse Contextual Help - eclipse-gef

Now can I register contextual help in an Eclipse WizardDialog/Editor.
1) I created a help_contexts.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.contexts"?>
<contexts>
<context id="my.plugin.help.general" >
<description>test</description>
<topic label="test" href="http://domain.com/help.html"/>
</context>
</contexts>
2) I referenced this file in my plugin.xml
<extension
point="org.eclipse.help.contexts">
<contexts file="help_contexts.xml" plugin="my.plugin.MainEditor">
</contexts>
</extension>
3) I added a line in my build.properties to include this file in the bin directory (bin.includes = help_contexts.xml, ... )
4) When running my GEF-based plugin, I see "No match found for "my.plugin.MainEditor"" under dynamic help.
I know I need to create something like this somewhere, but I don't know where to set this up for my WizardDialog or at least for my whole editor:
public void createPartControl(Composite parent) {
...
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
"my.plugin.help.general");
}
Note: This question originally contained two questions. I have removed the first (unanswered part) to be posted elsewhere.

Here is how you do it:
1) I created a help_contexts.xml file. Don't have periods in the context id. Don't include your plugin name in there.
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.contexts"?>
<contexts>
<context id="help_general" >
<description>test</description>
<topic label="test" href="http://domain.com/help.html"/>
</context>
</contexts>
2) I referenced this file in my plugin.xml Don't include the plugin-id if you are referencing your own plugin.
<extension
point="org.eclipse.help.contexts">
<contexts file="help_contexts.xml">
</contexts>
</extension>
3) I added a line in my build.properties to include this file in the bin directory (bin.includes = help_contexts.xml, ... ). Note your Bundle-SymbolicName in your Manifest.MF (also visible in your plugin.xml editor). Example: my.plugin
4) Set the context id in the WizardPage (credit goes to #VonC)
public class MyWizardPage extends WizardPage
public void createControl(Composite parent) {
PlatformUI.getWorkbench.getHelpSystem.setHelp(parent, "my.plugin.help_general");
}
}

For the main question, I am not sure about your setHelp second parameter. See this thread:
In the method call
PlatformUI.getWorkbench().getHelpSystem().setHelp()
second parameter is the contextID.
It should be prefixed with the pluginID like : "pluginID.contextID".
Now I was not sure where to find the plug-in ID for my plug-in.
So I used the value of this property : Bundle-Name Bundle-Symbolic-Name from MANIFEST.MF as the plug-in ID.
Now it works.
For the sidenote (help for WizardDialog), this thread might help (from David Kyle
and his blog "Eclipse RCP"):
We set the context id in our wizard page.
public class MyWizardPage extends WizardPage
public void createControl(Composite parent) {
PlatformUI.getWorkbench.getHelpSystem.setHelp(parent,
MyPluginActivator.ID + ".mycontexthelpid");
}
}
and we set help for the wizard dialog.
WizardDialog dialog = new WizardDialog(.....);
PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
"mycontexthelp.id");
We don't override performHelp().
As for the help context id. Define a context xml file in your plugin.
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.contexts"?>
<contexts>
<context id="mycontexthelpid" >
<description>My wizard help.</description>
<topic label="Wizard help" href="reference/wizard/help.xhtml"/>
</context>
</contexts>
in your plugin
<plugin>
<extension point="org.eclipse.help.contexts">
<contexts file="mywizard.xml" plugin="com.mypluginid"/>
</extension>
</plugin>
A common problem is messing up the plugin and context help ids. You can set
a couple of break points to see which context id is being requested.

Related

How to edit vsixmanifest using groovy without loosing content?

My question may sound stupid but I am struggling to achieve my result. I would like to edit and save version tage of vsixmanifest file without loosing any content. This article almost solved my purpose but it removes some of the tags.
<?xml version="1.0" encoding="utf-8"?>
<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
<Identifier Id="Visual Test">
<Name>Visual Gallery Test</Name>
<Author>Visual Studio Demo</Author>
<Version>XXXXX</Version>
<Description xml:space="preserve">Visual Studio Gallery Demo</Description>
<Locale>1033</Locale>
<AllUsers>true</AllUsers>
<InstalledByMsi>false</InstalledByMsi>
<Icon>Resources/Icon.png</Icon>
<PreviewImage>Resources/Preview.png</PreviewImage>
<SupportedProducts>
<IsolatedShell Version="7.0">Visual Studio</IsolatedShell>
</SupportedProducts>
<SupportedFrameworkRuntimeEdition MinVersion="4.6" MaxVersion="4.9" />
</Identifier>
<Content>
<VsPackage>XX.pkgdef</VsPackage>
</Content>
</Vsix>
Here is my gradle script
task updateExtensionManifest{
def vsixmanifestFile = "build/source.extension.vsixmanifest"
def vsixmanifest = new XmlParser().parse(vsixmanifestFile)
vsixmanifest.Identifier[0].Version[0].value="YYYYY"
def nodePrinter = new XmlNodePrinter(new PrintWriter(new FileWriter(vsixmanifestFile)))
nodePrinter.preserveWhitespace = true
nodePrinter.expandEmptyElements = true
nodePrinter.print(vsixmanifest)
}
When I execute the script it removes some of the tags defines manifest file, this is how it looks after task is getting executed:
<Vsix xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010" Version="1.0.0">
<Identifier Id="Visual Test">
<Name>Visual Gallery Test</Name>
<Author>Visual Studio Demo</Author>
<Version>YYYYY</Version>
<Description xml:space="preserve" xmlns:xml="http://www.w3.org/XML/1998/namespace">Visual Studio Gallery Demo</Description>
<Locale>1033</Locale>
<AllUsers>true</AllUsers>
<InstalledByMsi>false</InstalledByMsi>
<Icon>Resources/Icon.png</Icon>
<PreviewImage>Resources/Preview.png</PreviewImage>
<SupportedProducts>
<IsolatedShell Version="7.0">Visual Studio</IsolatedShell>
</SupportedProducts>
<SupportedFrameworkRuntimeEdition MinVersion="4.6" MaxVersion="4.9"></SupportedFrameworkRuntimeEdition>
</Identifier>
<Content>
<VsPackage>XX.pkgdef</VsPackage>
</Content>
</Vsix>
Some unwanted edits:
Line1 removed: <?xml version="1.0" encoding="utf-8"?>
Line2 modified to <Vsix xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010" Version="1.0.0">
Tag "Description" got edited too..
How could I avoid this edits? I just expected the version to get modified from XXXXX to YYYYY without changing any other content through my gradle build script.
That is because XmlNodePrinter.
If xml markup declaration is needed, use XmlUtil.serialize().
def vsixmanifest = new XmlSlurper().parse(vsixmanifestFile)
vsixmanifest.Identifier[0].Version.replaceBody ( "YYYYY" )
println groovy.xml.XmlUtil.serialize(vsixmanifest)
You can quickly try the demo

Using nokogiri xpath to access nested elements within an xmlns

I'm new to nokogiri and am having trouble using xpath to access nested elements of an xml document with a specific xmlns.
Given the following code
#!/opt/chef/embedded/bin/ruby
require 'nokogiri'
doc = Nokogiri::XML.parse <<-XML
<?xml version="1.0" encoding="UTF-8" ?>
<domain xmlns="urn:jboss:domain:1.8">
<profiles>
<profile name="full">
<subsystem xmlns="urn:jboss:domain:datasources:1.2">
<datasources>
<datasource jndi-name="java:/Paulstestjndi" pool-name="pauls_ds" enabled="false">
<connection-url>jdbc:oracle:thin:#testhost1:80001paulstestinstance|jdbc:oracle:thin:#testhost2:80001paulstestinstance</connection-url>
</datasource>
</datasources>
</subsystem>
</profile>
</profiles>
</domain>
XML
datasources = doc.xpath('//datasources:datasource', 'datasources' => "urn:jboss:domain:datasources:1.2")
datasources.each do |datasource|
conn_url = datasource.xpath("connection-url")
puts "CLASS = #{conn_url.class}"
puts "No of Entries = #{conn_url.length}"
end
I am able to retrieve datasources using xpath but am unable to use xpath to access 'connection-url' for each datasource.
I have tried several xpath calls to achieve this the following are examples
conn_url = datasource.xpath("connection-url")
conn_url = datasource.xpath("//connection-url")
conn_url = datasource.xpath("//datasources:datasource/connection-url", 'datasources'=>"urn:jboss:domain:datasources:1.2")
But each seems to return an empty set of results.
What am I missing?
It’s a namespacing issue:
datasource.xpath(
'subsystem:connection-url',
'subsystem' => 'urn:jboss:domain:datasources:1.2')
#⇒ [#<... name="connection-url" namespace=...

How to replace my custom template for product detail page in Magento2?

I need to replace my custom template for product detail page in magento2.
I have followed this link and updated my code but it is not working.
In my module, I have added catalog_product_view.xml and below code.
Mynamespace\Catalog\view\frontend\layout\catalog_product_view.xml
<referenceContainer name="content">
<block class="Mynamepace\Catalog\Block\Product\View\Article" name="product.view.art" template="Mynamespace_Catalog::product\view\article.phtml">
</block>
</referenceContainer>
This is not working. Can anyone suggest what I am missing here?
My Block Code:
Mynamepace\Catalog\Block\Product\View\Article.php
<?php
namespace Mynamespace\Catalog\Block\Product\View;
use Magento\Catalog\Block\Product\AbstractProduct;
class Article extends AbstractProduct
{
public function showPages()
{
return 'Article';
}
}
My phtml - Mynamespace\Catalog\view\frontend\templates\product\view\article.phtml
I am in Article
<?php
My Module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Mynamespace_Catalog" setup_version="1.0.0" schema_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Please tell me if I have missed something Or at least tell me how to debug this code.
I see a wrong syntax on your layout file Mynamespace\Catalog\view\frontend\layout\catalog_product_view.xml
template="Mynamespace_Catalog::product\view\article.phtml"
Change it to:
template="Mynamespace_Catalog::product/view/article.phtml"

Joomla 3.x onContentAfterSave not triggering

my over all goal is to grab the articles content after they have saved it and send it though my API. It's stated that onContentAfterSave is fired after they save to the database, my database is getting updated, but nothing coming though api.
Im using Joomla! 3.2.3 Stable
Owtest is my api call, it currently has hard coded data in it.
I feel im either extending the wrong class or missing an import. code below.
<?php
// no direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class plgContentHelloworld extends JPlugin
{
public function onContentAfterSave( $context, &$article, $isNew )
{
owTest();
}
}
?>
Xml Code:
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content" method="upgrade">
<name>plg_content_helloworld</name>
<author>Keith</author>
<creationDate>March 18th, 2014</creationDate>
<copyright></copyright>
<license>GNU General Public License</license>
<authorEmail></authorEmail>
<version>1.0</version>
<files>
<filename plugin="helloworld">helloworld.php</filename>
<filename>index.html</filename>
</files>
</extension>
file names are helloworld.php and helloworld.xml respectfully.
what solved my problem was passing article by value and not reference

Issues with Adobe AIR File access when file name has a semi-colon

I have a piece of code in AIR that accesses a file on the hard drive. This fails to work on a mac if the file name contains a semi-colon. It throws an exception that it can't find the file. If I rename the file and remove the semi-colon and point to it it works fine so the code is ok. The only problem is when the filename contains a semi-colon. The exception occurs on the line where I request file.size.
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="windowedapplication1_creationCompleteHandler(event)">
<fx:Script> <![CDATA[
import mx.events.FlexEvent;
protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
var f:File = new File("file:///Users/foo/pix/test;1.JPG");
trace (" here" + f.size );
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:WindowedApplication>
Don't use semi colons in filenames.
See this article from 2007
http://www.portfoliofaq.com/pfaq/FAQ00352.htm
Deprecated filename characters (; and ,). (All OSs).

Resources