CoastalHacking / semiotics-main

Semiotics models and stand-alone product / UI
Apache License 2.0
0 stars 0 forks source link

Context menu: text editors #21

Closed jpasski closed 8 years ago

jpasski commented 8 years ago

From @jonpasski on June 28, 2016 2:2

In a text editor context menu:

Copied from original issue: OpenSemanticsIO/semiotics-main#36

jpasski commented 8 years ago

Successful Travis CI build closes #21

Learned

Popups

https://jaxenter.com/eclipse-migration-tutorial-124527.html:

If the URL location defines a generic view in a popup (popup:org.eclipse.ui.popup.any), it must be translated in a menuContribution in the application model using ‘popup’ as ‘Parent-ID’ and ‘after=additions’ as position.

I was using popup: not popup before. Lol...

3.x Part Service

Figured out how to access the 3.x stuff, yay!

Eclipse FAQ:

Eclipse 3.x Compatibility Layer ... Services

  • org.eclipse.ui.IPartService

JUnit Test

Learned how to make run configurations headless, which was helpful when creating resources.

Other Tasks

Target Definition

Features

Dead Ends

Dynamic Dynamic Menus

I tried to get dynamic menus within a dynamic menu working. No love. Dunno if this is supported or not.

Generics in OSGi DS?

API:

interface Foo<A,B> {
  void bar(A source);
}

Impl:

class FooImpl<A extends SomeA, B extends SomeB> implements Foo<A,B> {
  void bar(A source) {}
}

Results in the following SCR XML:

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="FooImpl">
   <service>
      <provide interface="Foo"/>
   </service>
   <implementation class="FooImpl"/>
</scr:component>

This SO post seems to confirm what I thought:

In short, there is no such thing as Foo at runtime due to the type Type Erasure. The type information is lost. Instead, you can expose Bar as raw Foo with service property typeArg=java.lang.String and use filter when injecting it to the consumer.

So the idea is to specify a custom service property (e.g. typeArg or whatever) in the service descriptor for the component. Then a consumer could filter on that. Yay?

I could have a general service API with a producer that declares a property and a consumer that filters on such a property. Then each consumer, which will be an extension (Burp, Eclipse, ZAP, etc.), could be more specific on the provider interfaces. That does create a strong coupling between the API, producer, and consumer.