@Override protected void open(ISelection sel, boolean activate) { handleOpen(sel, OpenStrategy.activateOnOpen()); } @Override
@Override protected void activate(ISelection selection) { final int currentMode= OpenStrategy.getOpenMethod(); try { OpenStrategy.setOpenMethod(OpenStrategy.DOUBLE_CLICK); handleOpen(); } finally { OpenStrategy.setOpenMethod(currentMode); } }
@Override protected void hookControl(Control control) { super.hookControl(control); OpenStrategy handler = new OpenStrategy(control); handler.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { // On Windows, selection events may happen during a refresh. // Ignore these events if we are currently in preservingSelection(). // See bug 184441. if (!inChange) { handleSelect(e); } } @Override public void widgetDefaultSelected(SelectionEvent e) { handleDoubleSelect(e); } }); handler.addPostSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handlePostSelect(e); } }); handler.addOpenListener(StructuredViewer.this::handleOpen); }
/** * @param control the control the strategy is applied to */ public OpenStrategy(Control control) { initializeHandler(control.getDisplay()); addListener(control); }
/** * @return true if editors should be activated when opened. */ public static boolean activateOnOpen() { return getOpenMethod() == DOUBLE_CLICK; }
OpenStrategy handler = new OpenStrategy(fTable); handler.addOpenListener(new IOpenEventListener() { public void handleOpen(SelectionEvent e) {
void initializeSingleClickOption() { IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); boolean openOnSingleClick = store.getBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); boolean selectOnHover = store.getBoolean(IPreferenceConstants.SELECT_ON_HOVER); boolean openAfterDelay = store.getBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK : OpenStrategy.DOUBLE_CLICK; if (openOnSingleClick) { if (selectOnHover) { singleClickMethod |= OpenStrategy.SELECT_ON_HOVER; } if (openAfterDelay) { singleClickMethod |= OpenStrategy.ARROW_KEYS_OPEN; } } OpenStrategy.setOpenMethod(singleClickMethod); }
/** * @return true if editors should be activated when opened. */ public static boolean activateOnOpen() { return getOpenMethod() == DOUBLE_CLICK; }
OpenStrategy handler = new OpenStrategy(treeViewer.getTree()); handler.addOpenListener(new IOpenEventListener() { public void handleOpen(SelectionEvent e) { if (getSite() != null) {
/** * @param control the control the strategy is applied to */ public OpenStrategy(Control control) { initializeHandler(control.getDisplay()); addListener(control); }
private static void initializeSingleClickOption() { IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); boolean openOnSingleClick = store.getBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); boolean selectOnHover = store.getBoolean(IPreferenceConstants.SELECT_ON_HOVER); boolean openAfterDelay = store.getBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK : OpenStrategy.DOUBLE_CLICK; if (openOnSingleClick) { if (selectOnHover) { singleClickMethod |= OpenStrategy.SELECT_ON_HOVER; } if (openAfterDelay) { singleClickMethod |= OpenStrategy.ARROW_KEYS_OPEN; } } OpenStrategy.setOpenMethod(singleClickMethod); }
@Override protected void open(ISelection selection, boolean activate) { handleOpen(selection, OpenStrategy.activateOnOpen()); } @Override
@Override protected void activate(ISelection selection) { final int currentMode = OpenStrategy.getOpenMethod(); try { OpenStrategy.setOpenMethod(OpenStrategy.DOUBLE_CLICK); openSelectedMarkers(); } finally { OpenStrategy.setOpenMethod(currentMode); } }
/** * @return true if editors should be activated when opened. */ public static boolean activateOnOpen() { return getOpenMethod() == DOUBLE_CLICK; }
protected void hookControl(Control control) { super.hookControl(control); OpenStrategy handler = new OpenStrategy(control); handler.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { // On Windows, selection events may happen during a refresh. // Ignore these events if we are currently in preservingSelection(). // See bug 184441. if (!inChange) { handleSelect(e); } } public void widgetDefaultSelected(SelectionEvent e) { handleDoubleSelect(e); } }); handler.addPostSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handlePostSelect(e); } }); handler.addOpenListener(new IOpenEventListener() { public void handleOpen(SelectionEvent e) { StructuredViewer.this.handleOpen(e); } }); }
/** * @param control the control the strategy is applied to */ public OpenStrategy(Control control) { initializeHandler(control.getDisplay()); addListener(control); }
OpenStrategy.setOpenMethod(singleClickMethod);
@Override protected void open(ISelection selection, boolean activate) { handleOpen(selection, OpenStrategy.activateOnOpen()); } @Override
@Override protected void activate(ISelection selection) { int currentMode= OpenStrategy.getOpenMethod(); try { OpenStrategy.setOpenMethod(OpenStrategy.DOUBLE_CLICK); open(selection, true); } finally { OpenStrategy.setOpenMethod(currentMode); } }
@Override public void mouseUp(MouseEvent e) { if (JavaPlugin.DEBUG_BREADCRUMB_ITEM_DROP_DOWN) System.out.println("BreadcrumbItemDropDown.showMenu()$treeViewer>mouseUp"); //$NON-NLS-1$ if (e.button != 1) return; if ((OpenStrategy.getOpenMethod() & OpenStrategy.SINGLE_CLICK) != 0) return; Item item= tree.getItem(new Point(e.x, e.y)); if (item == null) return; openElement(item.getData()); }