private static final boolean DEBUG_ADAPTERS = false;
- private ResourceManager resourceManager;
+ protected ResourceManager resourceManager;
private String editorId = null;
public OpenWithMenuContribution() {
}
}
+ public String getEditorId() {
+ return editorId;
+ }
+
public void setEditorId(String editorId) {
this.editorId = editorId;
}
if (editorAdapters.length > 0) {
// Sort the open with actions in descending priority order.
- Adapter[] adapters = new Adapter[editorAdapters.length];
- for (int i = 0; i < editorAdapters.length; i++)
- adapters[i] = new Adapter(editorAdapters[i], r, true);
- Arrays.sort(adapters, new Comparator<Adapter>() {
- @Override
- public int compare(Adapter o1, Adapter o2) {
- int delta = o2.getPriority() - o1.getPriority();
- if (delta != 0)
- return delta;
- return AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(o1.getText(), o2.getText());
- }
- });
+ Adapter[] adapters = toAdapters(editorAdapters, r);
for (Adapter a : adapters)
addMenuItem(subMenu, a, r);
};
}
+ protected Adapter[] toAdapters(EditorAdapter[] editorAdapters, Object r) {
+ Adapter[] adapters = new Adapter[editorAdapters.length];
+ for (int i = 0; i < editorAdapters.length; i++)
+ adapters[i] = new Adapter(editorAdapters[i], r, true);
+ Arrays.sort(adapters, new Comparator<Adapter>() {
+ @Override
+ public int compare(Adapter o1, Adapter o2) {
+ int delta = o2.getPriority() - o1.getPriority();
+ if (delta != 0)
+ return delta;
+ return AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(o1.getText(), o2.getText());
+ }
+ });
+ return adapters;
+ }
+
protected EditorAdapter[] filter(EditorAdapter[] adapters, String id) {
if (id == null)
return adapters;
item.addSelectionListener(adapter);
}
- static class Adapter extends ResourceEditorAdapterAction implements SelectionListener {
+ protected static class Adapter extends ResourceEditorAdapterAction implements SelectionListener {
boolean remember;
public Adapter(EditorAdapter adapter, Object r, boolean remember) {