<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Nathan,<br>
<br>
There might be an workaround for you... Using the plugin API you
can get access to the "Open/Find Resource" view and from there on
you can locate the JList used to present the results and take a
look inside it's model. I don't think you can contribute an action
to the contextual menu (maybe you could remove the mouse listener
we use to show the menu and install your own instead). Instead, it
would be easier to add a new toolbar and put an action in it. The
code below can be put on the applicationStarted() method of an
Workspace Access plugin. Hopefully the information you can get
from the model of the list is enough for what your action need to
do. Since the method used to get to that information is not API I
also can't guarantee that the information structure wont change in
a future Oxygen release.<br>
<br>
If you need more information about plugins you can find it
starting at:
<a class="moz-txt-link-freetext" href="http://oxygenxml.com/oxygen_sdk.html#Developer_Plugins">http://oxygenxml.com/oxygen_sdk.html#Developer_Plugins</a><br>
<br>
/**<br>
* @see
ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension#applicationStarted(ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace)<br>
*/<br>
@Override<br>
public void applicationStarted(final StandalonePluginWorkspace
pluginWorkspaceAccess) {<br>
pluginWorkspaceAccess.addViewComponentCustomizer(new
ViewComponentCustomizer() {<br>
@Override<br>
public void customizeView(ViewInfo viewInfo) {<br>
if
(MainFrameComponentProvider.OPEN_FIND_RESOURCE.equals(viewInfo.getViewID()))
{<br>
JPanel component = (JPanel) viewInfo.getComponent();<br>
<br>
// Search for the list.<br>
final JList list = searchForList(component);<br>
<br>
JPanel newPanel = new JPanel(new BorderLayout());<br>
newPanel.add(component, BorderLayout.CENTER);<br>
JPanel northPanel = new JPanel();<br>
JButton button = new JButton("Process Selection");<br>
button.addActionListener(new ActionListener() {<br>
@Override<br>
public void actionPerformed(ActionEvent e) {<br>
int[] selectedIndices = list.getSelectedIndices();<br>
for (int i = 0; i < selectedIndices.length; i++)
{<br>
int index = selectedIndices[i];<br>
org.apache.lucene.document.Document selValue =
(org.apache.lucene.document.Document)
list.getModel().getElementAt(index);<br>
// All the information is located in these
fields<br>
List<org.apache.lucene.index.IndexableField>
fields = selValue.getFields();<br>
for
(Iterator<org.apache.lucene.index.IndexableField> iterator =
fields.iterator(); iterator.hasNext();) {<br>
org.apache.lucene.index.IndexableField
indexableField = iterator.next();<br>
String text =
selValue.get(indexableField.name());<br>
<br>
System.out.println(indexableField.name() + " - "
+ text);<br>
}<br>
}<br>
}<br>
});<br>
<br>
northPanel.add(button);<br>
newPanel.add(northPanel, BorderLayout.NORTH);<br>
<br>
viewInfo.setComponent(newPanel);<br>
}<br>
}<br>
<br>
private JList searchForList(JComponent component) {<br>
JList list = null;<br>
if (component instanceof JList) {<br>
list = (JList) component;<br>
} else {<br>
int componentCount = component.getComponentCount();<br>
for (int i = 0; i < componentCount; i++) {<br>
Component childComponent = component.getComponent(i);<br>
if (childComponent instanceof JComponent) {<br>
list = searchForList((JComponent) childComponent);<br>
if (list != null) {<br>
break;<br>
}<br>
}<br>
}<br>
}<br>
<br>
return list;<br>
}<br>
});<br>
}<br>
<pre class="moz-signature" cols="72">Best regards,
Alex
--
Alex Jitianu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
<a class="moz-txt-link-freetext" href="http://www.oxygenxml.com">http://www.oxygenxml.com</a> </pre>
On 20-Jan-14 11:11 PM, Nathan wrote:<br>
</div>
<blockquote
cite="mid:CAAA7NDiKJfc_JWsJVx1VJsxvv30QcA_gHUL+F4CCot+QnimMjQ@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Alex,
<div> I am looking to perform this action on the results of
the "Open/Find Resource" view. So, if a particular "Open/Find
Resource" operation retrieved 5 results in the "Open/Find
Resource" results and I am interested in 3 out of the 5
results, I would like to select 3 out of the 5 and provide a
custom action on right click.</div>
<div> It looked like there was no way to access to the
"Open/Find Resource" search results from the API so I wanted
to check.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Nathan</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
oXygen-sdk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:oXygen-sdk@oxygenxml.com">oXygen-sdk@oxygenxml.com</a>
<a class="moz-txt-link-freetext" href="http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk">http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk</a>
</pre>
</blockquote>
<br>
</body>
</html>