Eclipse 4 plugin - key bindings - java

I want to migrate my eclipse plugin to use Eclipse 4. That basically means to get rid of the dependency on the compatibility layer?
My plugin has an Activator class, a command with an attached handler and a key binding to trigger this command. What I did so far is install the e4 tools, and add fragment.e4xmi to my plugin-project and org.eclipse.e4.workbench.model to the extensions in plugin.xml. Following these instructions http://www.vogella.com/tutorials/EclipsePlugin/article.html, I was able to add a menu contribution to the main menu of eclipse and attach an e4 handler to this menu (That uses the cool dependency injection stuff!).
My problem is the key binding. In my plugin.xml, it looked this way
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.florian.regexfindandreplace.commands.FindAndReplaceCommand"
contextId="org.eclipse.ui.textEditorScope"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+F5">
</key>
<scheme
name="Default"
description="Default shortcuts for Eclipse"
id="default.id" />
</extension>
In fragment.e4xmi, I added a model fragment with Extended Element id: org.eclipse.e4.legacy.ide.application and with Feature name keyBindings.
Under that node I created a BindingContext with Id org.eclipse.ui.contexts.window (I imported that binding context) and a BindingTable using this context and a key binding on M1 + F5.
But when I press Ctrl + F5 when the plugin is running (the menu is visible and the command can be triggered from there), the command isn't triggered.
Here is my frament.e4xmi file
<?xml version="1.0" encoding="ASCII"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_GxS4UF4xEea8x7AIe1PlrQ">
<imports xsi:type="commands:BindingContext" xmi:id="_vgCiAF8lEea2fbkyfFHzhA" elementId="org.eclipse.ui.contexts.dialogAndWindow"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_OX6rcF4xEea8x7AIe1PlrQ" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Command" xmi:id="_XcrQgF4xEea8x7AIe1PlrQ" elementId="com.florian.regexfindandreplace.command.openfindreplacedialog" commandName="Open find/replace dialog" description="Opens the find/replace dialog"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_dc1cIF4xEea8x7AIe1PlrQ" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Handler" xmi:id="_ioC8wF4xEea8x7AIe1PlrQ" elementId="com.florian.regexfindandreplace.handler.openfindreplacedialog" contributionURI="bundleclass://com.florian.regexfindandreplace/com.florian.regexfindandreplace.handlers.OpenFindReplaceDialogE4Handler" command="_XcrQgF4xEea8x7AIe1PlrQ"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_ok-OMF4xEea8x7AIe1PlrQ" featurename="menuContributions" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="menu:MenuContribution" xmi:id="_1fot0F4xEea8x7AIe1PlrQ" elementId="com.florian.regexfindandreplace.menucontribution.firstmenu" positionInParent="after=additions" parentId="org.eclipse.ui.main.menu">
<children xsi:type="menu:HandledMenuItem" xmi:id="_FTLfEF4yEea8x7AIe1PlrQ" elementId="id.openfindreplacedialog" label="Open find/replace dialog" command="_XcrQgF4xEea8x7AIe1PlrQ"/>
</elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="__aNm8F45Eea8x7AIe1PlrQ" featurename="keyBindings" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:BindingTable" xmi:id="_2seTgF8lEea2fbkyfFHzhA" elementId="com.florian.regexfindandreplace.bindingtable.0" bindingContext="_vgCiAF8lEea2fbkyfFHzhA">
<bindings xmi:id="_3ySFAF8lEea2fbkyfFHzhA" elementId="com.florian.regexfindandreplace.keybinding.0" keySequence="CTRL+F5" command="_XcrQgF4xEea8x7AIe1PlrQ"/>
</elements>
</fragments>
</fragment:ModelFragments>
What did I do wrong? Any help is appreciated!

I got my problem solved. The model fragment for my key bindings had to have the featurename = "bindingTables". So you can't have an arbitrary name here as I thought when I gabe it the name "keyBindings".

Related

What makes wsdl file with portType but without binding correct?

In the wsdl manual, in the second section of example 2, There is a wsdl file that has portType, but no binding blocks
<?xml version="1.0"?>
<definitions
targetNamespace="http://example.com/stockquote/definitions"
xmlns:tns="http://example.com/stockquote/definitions"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<import namespace="some.xsd"
location="some.xsd"/>
<message name="GetLastTradePriceInput">
<part name="body"/>
</message>
<message name="GetLastTradePriceOutput">
<part name="body"/>
</message>
<portType name="StockQuotePortType">
<operation name="GetLastTradePrice">
<input message="tns:GetLastTradePriceInput"/>
<output message="tns:GetLastTradePriceOutput"/>
</operation>
</portType>
</definitions>
some.xsd is section 1 of the same example, and contains no bindings, either.
When I try to pass that file through the wsdltojava of cxf, it gives me a warning
WARNING: WSDL document file:/C:/IdeaProjects/sss/webservices/src/main/schema/BundleAdmin/Atry.wsdl does not define any services
and an error:
WSI-BP-1.0 R2718 violation: A wsdl:binding in a DESCRIPTION MUST have the same set of wsdl:operations as the wsdl:portType to which it refers. GetLastTradePrice not found in wsdl:binding.
These are used arguments for wsdltojava:
List<String> prepareArgs = ['-fe', 'jaxws',
'-autoNameResolution',
'-db', 'jaxb',
'-xjc-extension',
'-impl', '-server', '-client', '-validate',
'-d', ext.genDirName,
/* change package name for types already generated with XmlBeans */
'-p', 'http://messaging.ei.tmobile.net/datatypes=net.tmobile.ei.messaging.jaxb'
Please, what makes the translation program to demand the binding section? -validate can make the SW to notice the problem, but it is not the arg that creates the problem.
... the correct way to reference an external XSD is to use XSD schema with import/include within a wsdl:types element.
For details, please refer to
Importing xsd into wsdl
In your case, you are using
*<import namespace="some.xsd"
location="some.xsd"/>*
Following the cited link, why don't you include the <import namespace=... element in a <types> element, as also shown here:
https://stackoverflow.com/a/12125913/1925356
Oh, it was totally mine error. The second section of example 2 of wsdl manual really has only portType without binding. And the xsd file it is importing has no bindings, too (naturally). But the second section is not a service! The service is the third section, that has bindings and imports section 2. So, the service has both portType and binding. They are not arguments that demand the binding section, it is always demanded for.
I should pay attention to the warning - the file mentioned is not a service yet, there should exist another file for it, that will be a service and will contain include for that file and binding section in it. Or, of course, it could contain both portType and binding in one file.

Eclipse plugin. Resolve variable + dynamic variables - doesn't work

I tried to make an eclipse plugin and I had some difficulties.
First of all I created two extension points:
<extension point="org.eclipse.ui.propertyPages">
<page
id="com.coffee.projectPage"
name="Coffee Java Properties"
class="com.coffee.cona.properties.CoffeePropertyPage">
<enabledWhen>
<resolve variable="MYCOFFEE" args="">
<equals value="cona"/>
</resolve>
</enabledWhen>
</page>
</extension>
<extension point="org.eclipse.core.variables.dynamicVariables">
<variable
name="MYCOFFEE"
resolver="com.coffee.properties.CoffeeTimeResolver"
description="Coffee time"
supportsArgument="true">
</variable>
</extension>
In my com.coffee.properties.CoffeeTimeResolver I wrote:
...
public class CoffeeTimeResolver implements IDynamicVariableResolver {
public String resolveValue(IDynamicVariable variable, String argument){
return "cona";
...
...
But it doesn't work! En Eclipse console I see this message:
!MESSAGE The variable MYCOFFEE is not defined
Where I was wrong?
All I need to do es show Property Page only in *.java files that have classes that extend Applet, I mean:
class Xxx extends Applet
but I really don't know how to reach it using test element
Many thanks in advance!
Eclipse has a number of things referred to as variables. org.eclipse.core.variables.dynamicVariables defines a dynamic string substitution variable, this is not the type of variable that the resolve element requires.
As far as I can see there is currently no way to define the IVariableResolver that resolve requires (but the Eclipse code is very large so I may have missed something).
You can probably use the test element instead and use the org.eclipse.core.expressions.propertyTesters extension point which definitely works properly.

Shortcut key is not working in eclipse RCP java project

I have eclipse RCP java project, in which i have enabled shortcut keys Ctrl+H and ctrl+S for save and other activities. it was working fine until i have imported my project in 64 bit Eclipse indigo. Most of the keys are working but these two not. I have checked Ctrl+S is associated with defaultHandler.
Now it is throwing following Exception:
ENTRY org.eclipse.ui.workbench 2 0 2015-01-21 15:07:08.646
!MESSAGE A handler conflict occurred. This may disable some commands.
!SUBENTRY 1 org.eclipse.ui.workbench 2 0 2015-01-21 15:07:08.646
!MESSAGE Conflict for 'org.eclipse.ui.file.save':
HandlerActivation(commandId=org.eclipse.ui.file.save,
handler=org.eclipse.ui.internal.handlers.SaveHandler#4e65ad52,
expression=,sourcePriority=0)
Update:
public class KBShortcutsHandler extends AbstractHandler {
#Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (event.getCommand().getId().equals("org.eclipse.ui.file.save")) {
new XyzHandler(XConstants.SAVE_EDITOR_ID)
.run();
}
}
}
in plugin.xml
<command
defaultHandler="KBShortcutsHandler"
id="org.eclipse.ui.file.save"
name="save">
</command>
and simply write code to "Add Action" it was working fine but not now.
Eclipse already has a definition of the org.eclipse.ui.file.save command so you should not be trying to define it yourself. Instead use the org.eclipse.ui.handlers extension point to define a handler to be used when your code is active.
The following is an example of how the Debug plugin handles the 'delete' command:
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.debug.internal.ui.views.launch.TerminateAndRemoveHandler"
commandId="org.eclipse.ui.edit.delete">
<activeWhen>
<iterate
ifEmpty="false"
operator="and">
<adapt
type="org.eclipse.debug.core.model.ITerminate">
</adapt>
</iterate>
</activeWhen>
</handler>
</extension>
I notice your constants XConstants.SAVE_EDITOR_ID - if you are trying to save in an editor there should not be any need to do anything if it is based on EditorPart.
This "org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar" workBench
jar must contain the SaveHandler class which is present inside
org.eclipse.ui.internal.handlers package.
Below line must removed from plugin.xml
This works for me.

Flex blank/white screen after deploy

Just uploaded a .war file to the server.. everthing is ok there.. but by no reason the login page is not loading anything..
i earned this flex+java projects on my new job.. its kind strange to me..
i can't even use firebug on it.. it dysplay nothing on eclipse console.
plz someone give me a hand !
The login page mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%" initialize="Spinner.init(this)" >
<mx:Style source="../flexdesign/css/Login.css"/>
<mx:Style source="../flexdesign/css/principal.css"/>
<mx:Style source="../flexdesign/css/conteudo.css"/>
<mx:Script>
<![CDATA[
import automacao.ui.Spinner;
import flash.net.navigateToURL;
import mx.controls.Alert;
public function abreMenu(url:String):void{
try {
navigateToURL(new URLRequest(url),"_parent");
} catch (e:Error) {
trace("Error occurred!");
}
}
]]>
</mx:Script>
<mx:Move id="cimabaixo" duration="1100" yFrom="0" yTo="0" xFrom="300" xTo="0"/>
<mx:Iris id="zoom" duration="300" xFrom="0" xTo="1" yFrom="0" yTo="1"/>
<mx:Zoom id="zoomhide" duration="500" zoomWidthFrom="1" zoomWidthTo="0" zoomHeightFrom="1" zoomHeightTo="0"/>
<mx:Glow id="brilho" duration="300" alphaFrom="0" alphaTo=".4" blurXFrom="0" blurXTo="20" blurYFrom="0" blurYTo="20" color="0xBBBBBB" strength="3"/>
<mx:Glow id="sembrilho" duration="500" alphaFrom=".6" alphaTo="0" blurXFrom="20" blurXTo="0" blurYFrom="20" blurYTo="0" color="0xBBBBBB" strength="3"/>
<mx:Glow id="brilhoradio" duration="200" alphaFrom="0" alphaTo=".4" blurXFrom="0" blurXTo="15" blurYFrom="0" blurYTo="15" color="0xBBBBBB" strength="2"/>
<mx:Glow id="sembrilhoradio" duration="200" alphaFrom=".3" alphaTo="0" blurXFrom="15" blurXTo="0" blurYFrom="15" blurYTo="0" color="0xBBBBBB" strength="2"/>
<mx:Fade id="fadeOut" duration="300" alphaFrom="1.0" alphaTo="0.0"/>
<mx:Fade id="fadeIn" duration="300" alphaFrom="0.0" alphaTo="1.0"/>
<mx:ModuleLoader id="workspace" x="0" y="0" width="100%" height="100%" url="LoginView.swf"/>
</mx:Application>
it was working like a piece of cake.. i just make some java business change and deploy the project..
Haven't worked with Flex either, but just see if any of these ideas help.
1) Restore the backup and confirm it does still work, and it's your changes. (Just get that out of the way)
2) Ensure you can find those imports on the classpath (i.e. automacao.ui.Spinner etc.) Your WAR might not have included them for some reason.
3) Add into that abreMenu function some sort of generic output to a file to see if it's getting there. I'll suspect its not.
4) Turn on trace-level debugging in log4j/slf4j or whatever you're using.
When you find the answer, post back. :)
Is LoginView.swf still on the same directory?
Also download the Flash debug version so that you will see the "silenced" errors.
If you were using Flex Builder, Go to Project --> Properties --> FlexModules.
Make sure you have added your module LoginView to that. This might be a reason for module not loading.

(oracle.jbo.NoXMLFileException) JBO-26001: XML File not found for the Container Error

I'm trying to develop simple swing ADF application with Jdeveloper but I faced this error when I tried to create Master/Detail form. I checked my bc4j file but I think it is fine. Here it is:
<?xml version = '1.0' encoding = 'UTF-8'?>
<BC4JConfig version="11.1" xmlns="http://xmlns.oracle.com/bc4j/configuration">
<AppModuleConfigBag ApplicationName="maintenance.model.AppModule">
<AppModuleConfig name="AppModuleLocal" ApplicationName="maintenance.model.AppModule" DeployPlatform="LOCAL" JDBCName="Connection1" jbo.project="maintenance.model.AppModel">
<Database jbo.sql92.JdbcDriverClass="com.mysql.jdbc.Driver" jbo.TypeMapEntries="Java" jbo.SQLBuilder="SQL92"/>
<Security AppModuleJndiName="maintenance.model.AppModule"/>
</AppModuleConfig>
<AppModuleConfig name="AppModuleShared" ApplicationName="maintenance.model.AppModule" DeployPlatform="LOCAL" JDBCName="Connection1" jbo.project="maintenance.model.AppModel">
<AM-Pooling jbo.ampool.maxpoolsize="1" jbo.ampool.isuseexclusive="false"/>
<Database jbo.sql92.JdbcDriverClass="com.mysql.jdbc.Driver" jbo.TypeMapEntries="Java" jbo.SQLBuilder="SQL92"/>
<Security AppModuleJndiName="maintenance.model.AppModule"/>
</AppModuleConfig>
</AppModuleConfigBag>
</BC4JConfig
and here is the picture of my Application in the IDE:
Can anybody Help my I'm new to Jdeveloper and I'm using 11.1.1.5.0
go here
JBO-25058 and JBO-26001 exceptions
http://andrejusb.blogspot.com/2008/08/jbo-25058-and-jbo-26001-exceptions.html
JBO-26001: NoXMLFileException
http://jneelmani.blogspot.com/2009/03/11g-adf-error-list-jbo.html

Categories

Resources