protected void addDropTest(MdiEntry entry) { if (!Constants.isCVSVersion()) { return; } entry.addListener( new MdiEntryDropListener() { public boolean mdiEntryDrop(MdiEntry entry, Object droppedObject) { String s = "You just dropped " + droppedObject.getClass() + "\n" + droppedObject + "\n\n"; if (droppedObject.getClass().isArray()) { Object[] o = (Object[]) droppedObject; for (int i = 0; i < o.length; i++) { s += "" + i + ": "; Object object = o[i]; if (object == null) { s += "null"; } else { s += object.getClass() + ";" + object; } s += "\n"; } } new MessageBoxShell(SWT.OK, "test", s).open(null); return true; } }); }
private void setupHeader(final MdiEntry entry) { titleInfo = new ViewTitleInfo() { public Object getTitleInfoProperty(int propertyID) { if (propertyID == ViewTitleInfo.TITLE_INDICATOR_TEXT) { if (entry.isExpanded()) { return null; } StringBuilder sb = new StringBuilder(); MdiEntry[] entries = entry.getMDI().getEntries(); for (MdiEntry subEntry : entries) { if (entry.getId().equals(subEntry.getParentID())) { ViewTitleInfo titleInfo = subEntry.getViewTitleInfo(); if (titleInfo != null) { Object text = titleInfo.getTitleInfoProperty(TITLE_INDICATOR_TEXT); if (text instanceof String) { if (sb.length() > 0) { sb.append(" | "); } sb.append(text); } } } } if (sb.length() > 0) { return sb.toString(); } } else if (propertyID == ViewTitleInfo.TITLE_INDICATOR_TEXT_TOOLTIP) { if (entry.isExpanded()) { return null; } StringBuilder sb = new StringBuilder(); MdiEntry[] entries = entry.getMDI().getEntries(); for (MdiEntry subEntry : entries) { if (entry.getId().equals(subEntry.getParentID())) { ViewTitleInfo titleInfo = subEntry.getViewTitleInfo(); if (titleInfo != null) { Object text = titleInfo.getTitleInfoProperty(TITLE_INDICATOR_TEXT); if (text instanceof String) { if (sb.length() > 0) { sb.append("\n"); } sb.append(subEntry.getTitle() + ": " + text); } } } } if (sb.length() > 0) { return sb.toString(); } } return null; } }; entry.setViewTitleInfo(titleInfo); }