/** * Adds the entry if new. Inserted at the beginning of the history entries list. * @param entry The new entry */ private void addHistoryEntry(IJavaElement entry) { if (fInputHistory.contains(entry)) { fInputHistory.remove(entry); } fInputHistory.add(0, entry); fHistoryDropDownAction.setEnabled(true); }
public HistoryDropDownAction(TypeHierarchyViewPart view) { fHierarchyView= view; fMenu= null; setToolTipText(TypeHierarchyMessages.HistoryDropDownAction_tooltip); JavaPluginImages.setLocalImageDescriptors(this, "history_list.png"); //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.TYPEHIERARCHY_HISTORY_ACTION); setMenuCreator(this); }
public Menu getMenu(Control parent) { if (fMenu != null) { fMenu.dispose(); } fMenu= new Menu(parent); IJavaElement[] elements= fHierarchyView.getHistoryEntries(); addEntries(fMenu, elements); new MenuItem(fMenu, SWT.SEPARATOR); addActionToMenu(fMenu, new HistoryListAction(fHierarchyView)); addActionToMenu(fMenu, new ClearHistoryAction(fHierarchyView)); return fMenu; }
fHistoryDropDownAction= new HistoryDropDownAction(this); fHistoryDropDownAction.setEnabled(false);
private boolean addEntries(Menu menu, List<IJavaElement[]> elements) { boolean checked= false; int count= 0; int min= Math.min(elements.size(), RESULTS_IN_DROP_DOWN); for (Iterator<IJavaElement[]> iterator= elements.iterator(); count < min; count++) { IJavaElement[] entries= iterator.next(); if (entries == null || entries.length == 0) continue; HistoryAction action= new HistoryAction(fHierarchyView, entries); action.setChecked(entries.equals(fHierarchyView.getInputElements())); checked= checked || action.isChecked(); addActionToMenu(menu, action); } return checked; }
public HistoryDropDownAction(TypeHierarchyViewPart view) { fHierarchyView= view; fMenu= null; setToolTipText(TypeHierarchyMessages.HistoryDropDownAction_tooltip); JavaPluginImages.setLocalImageDescriptors(this, "history_list.gif"); //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.TYPEHIERARCHY_HISTORY_ACTION); setMenuCreator(this); }
@Override public Menu getMenu(Control parent) { if (fMenu != null) { fMenu.dispose(); } fMenu= new Menu(parent); List<IJavaElement[]> elements= fHierarchyView.getHistoryEntries(); addEntries(fMenu, elements); new MenuItem(fMenu, SWT.SEPARATOR); addActionToMenu(fMenu, new HistoryListAction(fHierarchyView)); addActionToMenu(fMenu, new ClearHistoryAction(fHierarchyView)); return fMenu; }
fHistoryDropDownAction= new HistoryDropDownAction(this); fHistoryDropDownAction.setEnabled(false);
private boolean addEntries(Menu menu, List<IJavaElement[]> elements) { boolean checked= false; int count= 0; int min= Math.min(elements.size(), RESULTS_IN_DROP_DOWN); for (Iterator<IJavaElement[]> iterator= elements.iterator(); count < min; count++) { IJavaElement[] entries= iterator.next(); if (entries == null || entries.length == 0) continue; HistoryAction action= new HistoryAction(fHierarchyView, entries); action.setChecked(entries.equals(fHierarchyView.getInputElements())); checked= checked || action.isChecked(); addActionToMenu(menu, action); } return checked; }
public HistoryDropDownAction(TypeHierarchyViewPart view) { fHierarchyView= view; fMenu= null; setToolTipText(TypeHierarchyMessages.HistoryDropDownAction_tooltip); JavaPluginImages.setLocalImageDescriptors(this, "history_list.png"); //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.TYPEHIERARCHY_HISTORY_ACTION); setMenuCreator(this); }
@Override public Menu getMenu(Control parent) { if (fMenu != null) { fMenu.dispose(); } fMenu= new Menu(parent); List<IJavaElement[]> elements= fHierarchyView.getHistoryEntries(); addEntries(fMenu, elements); new MenuItem(fMenu, SWT.SEPARATOR); addActionToMenu(fMenu, new HistoryListAction(fHierarchyView)); addActionToMenu(fMenu, new ClearHistoryAction(fHierarchyView)); return fMenu; }
fHistoryDropDownAction= new HistoryDropDownAction(this); fHistoryDropDownAction.setEnabled(false);
/** * Adds the entry if new. Inserted at the beginning of the history entries list. * @param entry The new entry */ private void addHistoryEntry(IJavaElement[] entry) { for (Iterator<IJavaElement[]> iter= fInputHistory.iterator(); iter.hasNext();) { IJavaElement[] elem= iter.next(); if (Arrays.equals(elem, entry)) { fInputHistory.remove(elem); break; } } fInputHistory.add(0, entry); fHistoryDropDownAction.setEnabled(true); }
private boolean addEntries(Menu menu, IJavaElement[] elements) { boolean checked= false; int min= Math.min(elements.length, RESULTS_IN_DROP_DOWN); for (int i= 0; i < min; i++) { HistoryAction action= new HistoryAction(fHierarchyView, elements[i]); action.setChecked(elements[i].equals(fHierarchyView.getInputElement())); checked= checked || action.isChecked(); addActionToMenu(menu, action); } return checked; }
private void updateHistoryEntries() { for (int i= fInputHistory.size() - 1; i >= 0; i--) { IJavaElement type= (IJavaElement) fInputHistory.get(i); if (!type.exists()) { fInputHistory.remove(i); } } fHistoryDropDownAction.setEnabled(!fInputHistory.isEmpty()); }
/** * Adds the entry if new. Inserted at the beginning of the history entries list. * @param entry The new entry */ private void addHistoryEntry(IJavaElement[] entry) { for (Iterator<IJavaElement[]> iter= fInputHistory.iterator(); iter.hasNext();) { IJavaElement[] elem= iter.next(); if (Arrays.equals(elem, entry)) { fInputHistory.remove(elem); break; } } fInputHistory.add(0, entry); fHistoryDropDownAction.setEnabled(true); }
private void updateHistoryEntries() { for (int i= fInputHistory.size() - 1; i >= 0; i--) { IJavaElement[] entries= fInputHistory.get(i); for (int j= 0; j < entries.length; j++) { IJavaElement elem= entries[j]; if (elem != null && !elem.exists()) { fInputHistory.remove(i); break; } } } fHistoryDropDownAction.setEnabled(!fInputHistory.isEmpty()); }
private void updateHistoryEntries() { for (int i= fInputHistory.size() - 1; i >= 0; i--) { IJavaElement[] entries= fInputHistory.get(i); for (int j= 0; j < entries.length; j++) { IJavaElement elem= entries[j]; if (elem != null && !elem.exists()) { fInputHistory.remove(i); break; } } } fHistoryDropDownAction.setEnabled(!fInputHistory.isEmpty()); }