1 11 package org.eclipse.help.ui.internal.views; 12 13 import java.io.IOException ; 14 import java.io.InputStream ; 15 import java.util.ArrayList ; 16 import java.util.Observable ; 17 import java.util.Observer ; 18 19 import org.eclipse.core.runtime.IStatus; 20 import org.eclipse.core.runtime.jobs.IJobChangeEvent; 21 import org.eclipse.core.runtime.jobs.IJobChangeListener; 22 import org.eclipse.core.runtime.jobs.Job; 23 import org.eclipse.help.HelpSystem; 24 import org.eclipse.help.internal.base.BaseHelpSystem; 25 import org.eclipse.help.internal.search.federated.FederatedSearchEntry; 26 import org.eclipse.help.internal.search.federated.FederatedSearchJob; 27 import org.eclipse.help.search.ISearchEngineResult; 28 import org.eclipse.help.search.ISearchEngineResultCollector; 29 import org.eclipse.help.search.ISearchScope; 30 import org.eclipse.help.ui.internal.HelpUIResources; 31 import org.eclipse.help.ui.internal.IHelpUIConstants; 32 import org.eclipse.help.ui.internal.Messages; 33 import org.eclipse.jface.action.IAction; 34 import org.eclipse.jface.action.IMenuManager; 35 import org.eclipse.jface.preference.PreferenceDialog; 36 import org.eclipse.jface.preference.PreferenceManager; 37 import org.eclipse.osgi.util.NLS; 38 import org.eclipse.swt.SWT; 39 import org.eclipse.swt.events.KeyAdapter; 40 import org.eclipse.swt.events.KeyEvent; 41 import org.eclipse.swt.events.ModifyEvent; 42 import org.eclipse.swt.events.ModifyListener; 43 import org.eclipse.swt.events.SelectionAdapter; 44 import org.eclipse.swt.events.SelectionEvent; 45 import org.eclipse.swt.widgets.Button; 46 import org.eclipse.swt.widgets.Composite; 47 import org.eclipse.swt.widgets.Control; 48 import org.eclipse.swt.widgets.Event; 49 import org.eclipse.swt.widgets.Label; 50 import org.eclipse.swt.widgets.Listener; 51 import org.eclipse.swt.widgets.Shell; 52 import org.eclipse.ui.IMemento; 53 import org.eclipse.ui.actions.ActionFactory; 54 import org.eclipse.ui.forms.AbstractFormPart; 55 import org.eclipse.ui.forms.IFormColors; 56 import org.eclipse.ui.forms.events.HyperlinkAdapter; 57 import org.eclipse.ui.forms.events.HyperlinkEvent; 58 import org.eclipse.ui.forms.widgets.FormText; 59 import org.eclipse.ui.forms.widgets.FormToolkit; 60 import org.eclipse.ui.forms.widgets.Hyperlink; 61 import org.eclipse.ui.forms.widgets.Section; 62 import org.eclipse.ui.forms.widgets.TableWrapData; 63 import org.eclipse.ui.forms.widgets.TableWrapLayout; 64 65 public class SearchPart extends AbstractFormPart implements IHelpPart, IHelpUIConstants { 66 67 private ReusableHelpPart parent; 68 69 protected static java.util.List previousSearchQueryData = new java.util.ArrayList (20); 70 71 private static final String HREF_TOGGLE = "__toggle__"; 73 private static final String HREF_SEARCH_HELP = "/org.eclipse.platform.doc.user/tasks/tsearch.htm"; 75 private static boolean SEARCH_HELP_AVAILABLE = false; 76 77 static { 78 InputStream is = HelpSystem.getHelpContent(HREF_SEARCH_HELP); 79 if (is != null) { 80 try { 82 is.close(); 83 SEARCH_HELP_AVAILABLE = true; 84 } catch (IOException e) { 85 } 87 } 88 } 89 90 private String id; 91 92 private Composite container; 93 94 private Composite filteringGroup; 95 private FormText searchWordText; 96 97 private Chevron searchWordChevron; 98 99 private ComboPart searchWordCombo; 100 101 private Section scopeSection; 102 103 private Button goButton; 104 105 private Button shellDefaultButton; 106 107 private Hyperlink scopeSetLink; 108 109 private Hyperlink advancedLink; 110 111 private Observer engineObserver; 112 113 private ScopeSetManager scopeSetManager; 114 115 private static final int COMBO_HISTORY_SIZE = 10; 116 117 private JobListener jobListener; 118 119 private boolean searchPending; 120 121 private class JobListener implements IJobChangeListener, Runnable { 122 123 private boolean searchInProgress = false; 124 125 public void aboutToRun(IJobChangeEvent event) { 126 } 127 128 public void awake(IJobChangeEvent event) { 129 } 130 131 public void done(IJobChangeEvent event) { 132 if (event.getJob().belongsTo(FederatedSearchJob.FAMILY)) { 133 Job[] searchJobs = Job.getJobManager().find(FederatedSearchJob.FAMILY); 134 if (searchJobs.length == 0) { 135 searchInProgress = false; 137 if (container.isDisposed()) 138 return; 139 container.getDisplay().asyncExec(this); 140 SearchResultsPart results = (SearchResultsPart) parent 141 .findPart(IHelpUIConstants.HV_FSEARCH_RESULT); 142 results.completed(); 143 } 144 } 145 } 146 147 public void running(IJobChangeEvent event) { 148 } 149 150 public void scheduled(IJobChangeEvent event) { 151 if (!searchInProgress && event.getJob().belongsTo(FederatedSearchJob.FAMILY)) { 152 searchInProgress = true; 153 container.getDisplay().asyncExec(this); 154 } 155 } 156 157 public void sleeping(IJobChangeEvent event) { 158 } 159 160 public void run() { 161 searchWordCombo.getControl().setEnabled(!searchInProgress); 162 if (!searchInProgress) 163 goButton.setEnabled(true); 164 if (searchInProgress) 165 goButton.setText(Messages.SearchPart_stop); 166 else 167 goButton.setText(Messages.SearchPart_go); 168 parent.getForm().getForm().setBusy(searchInProgress); 169 goButton.getParent().layout(); 170 } 171 } 172 173 178 public SearchPart(final Composite parent, FormToolkit toolkit) { 179 container = toolkit.createComposite(parent); 180 scopeSetManager = new ScopeSetManager(); 181 TableWrapLayout layout = new TableWrapLayout(); 182 layout.numColumns = 2; 183 container.setLayout(layout); 184 searchWordText = toolkit.createFormText(container, false); 186 searchWordChevron = new Chevron(searchWordText, SWT.NULL); 187 toolkit.adapt(searchWordChevron, true, true); 188 searchWordChevron.setHoverDecorationColor(toolkit.getHyperlinkGroup().getActiveForeground()); 189 searchWordChevron.setDecorationColor(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); 190 searchWordText.setControl(HREF_TOGGLE, searchWordChevron); 191 searchWordText.addHyperlinkListener(new HyperlinkAdapter() { 192 193 public void linkActivated(HyperlinkEvent e) { 194 SearchPart.this.parent.showURL(HREF_SEARCH_HELP, true); 195 } 196 }); 197 searchWordChevron.addHyperlinkListener(new HyperlinkAdapter() { 198 199 public void linkActivated(HyperlinkEvent e) { 200 parent.getDisplay().asyncExec(new Runnable () { 201 202 public void run() { 203 toggleSearchWordText(); 204 } 205 }); 206 } 207 }); 208 searchWordText.setImage(IHelpUIConstants.IMAGE_HELP, HelpUIResources 209 .getImage(IHelpUIConstants.IMAGE_HELP)); 210 updateSearchWordText(); 211 TableWrapData td = new TableWrapData(); 212 td.colspan = 2; 213 searchWordText.setLayoutData(td); 214 searchWordCombo = new ComboPart(container, toolkit, toolkit.getBorderStyle()); 216 updateSearchCombo(null); 217 td = new TableWrapData(TableWrapData.FILL_GRAB); 218 td.maxWidth = 100; 219 td.valign = TableWrapData.MIDDLE; 220 searchWordCombo.getControl().setLayoutData(td); 221 searchWordCombo.addSelectionListener(new SelectionAdapter() { 222 223 public void widgetSelected(SelectionEvent e) { 224 if (searchWordCombo.getSelectionIndex() < 0) 225 return; 226 searchFromHistory(searchWordCombo.getSelectionIndex()); 227 } 228 }); 229 goButton = toolkit.createButton(container, Messages.SearchPart_go, SWT.PUSH); 230 goButton.addSelectionListener(new SelectionAdapter() { 231 232 public void widgetSelected(SelectionEvent e) { 233 handleButtonPressed(); 234 } 235 }); 236 goButton.setEnabled(false); 237 searchWordCombo.addModifyListener(new ModifyListener() { 238 239 public void modifyText(ModifyEvent e) { 240 goButton.setEnabled(searchWordCombo.getText().length() > 0); 241 } 242 }); 243 searchWordCombo.addKeyListener(new KeyAdapter() { 244 public void keyPressed(KeyEvent e) { 245 if (e.character == '\r') { 246 if (goButton.isEnabled()) 247 doSearch(searchWordCombo.getText()); 248 } 249 } 250 }); 251 searchWordCombo.getControl().addListener(SWT.FocusIn, new Listener() { 252 public void handleEvent(Event event) { 253 shellDefaultButton = null; 254 Shell shell = searchWordCombo.getControl().getShell(); 255 Button button = shell.getDefaultButton(); 256 if (button != null) { 257 shellDefaultButton = button; 258 shell.setDefaultButton(goButton); 259 } 260 } 261 }); 262 searchWordCombo.getControl().addListener(SWT.FocusOut, new Listener() { 263 public void handleEvent(Event event) { 264 if (shellDefaultButton != null) { 265 Shell shell = searchWordCombo.getControl().getShell(); 266 shell.setDefaultButton(shellDefaultButton); 267 shellDefaultButton = null; 268 } 269 } 270 }); 271 272 scopeSection = toolkit.createSection(container, Section.TWISTIE | Section.COMPACT 273 | Section.LEFT_TEXT_CLIENT_ALIGNMENT); 274 scopeSection.setText(Messages.limit_to); 275 td = new TableWrapData(); 276 td.colspan = 2; 277 td.align = TableWrapData.FILL; 278 scopeSection.setLayoutData(td); 279 filteringGroup = toolkit.createComposite(scopeSection); 280 scopeSection.setClient(filteringGroup); 281 TableWrapLayout flayout = new TableWrapLayout(); 282 flayout.numColumns = 2; 283 filteringGroup.setLayout(flayout); 284 createScopeSet(scopeSection, toolkit); 285 toolkit.paintBordersFor(filteringGroup); 286 toolkit.paintBordersFor(container); 287 jobListener = new JobListener(); 288 Job.getJobManager().addJobChangeListener(jobListener); 289 } 290 291 private void createAdvancedLink(Composite parent, FormToolkit toolkit) { 292 advancedLink = toolkit.createHyperlink(parent, Messages.FederatedSearchPart_advanced, SWT.NULL); 293 advancedLink.addHyperlinkListener(new HyperlinkAdapter() { 294 295 public void linkActivated(HyperlinkEvent e) { 296 doAdvanced(); 297 } 298 }); 299 TableWrapData td = new TableWrapData(); 300 td.colspan = 2; 301 advancedLink.setLayoutData(td); 302 } 303 304 private void createScopeSet(Section section, FormToolkit toolkit) { 305 scopeSetLink = toolkit.createHyperlink(section, null, SWT.NULL); 306 scopeSetLink.addHyperlinkListener(new HyperlinkAdapter() { 307 308 public void linkActivated(HyperlinkEvent e) { 309 doChangeScopeSet(); 310 } 311 }); 312 scopeSetLink.setToolTipText(Messages.FederatedSearchPart_changeScopeSet); 313 section.setTextClient(scopeSetLink); 314 ScopeSet active = scopeSetManager.getActiveSet(); 315 setActiveScopeSet(active); 316 } 317 318 private void toggleSearchWordText() { 319 updateSearchWordText(); 320 SearchPart.this.parent.reflow(); 321 } 322 323 private void updateSearchWordText() { 324 StringBuffer buff = new StringBuffer (); 325 buff.append("<form>"); buff.append("<p>"); buff.append(Messages.expression); 328 if (searchWordChevron.isExpanded()) { 329 searchWordChevron.setToolTipText(Messages.SearchPart_collapse); 330 buff.append("<control HREF=\""); buff.append(HREF_TOGGLE); 332 buff.append("\"/>"); buff.append("</p><p>"); buff.append(Messages.expression_label); 335 if (SEARCH_HELP_AVAILABLE) { 337 buff.append("</p><p>"); buff.append("<img HREF=\""); buff.append(IHelpUIConstants.IMAGE_HELP); 340 buff.append("\"/> "); buff.append("<a HREF=\""); buff.append(HREF_SEARCH_HELP); 343 buff.append("\">"); buff.append(Messages.SearchPart_learnMore); 345 buff.append("</a>"); } 347 } else { 348 searchWordChevron.setToolTipText(Messages.SearchPart_expand); 349 buff.append("<control HREF=\""); buff.append(HREF_TOGGLE); 351 buff.append("\"/>"); } 353 buff.append("</p>"); buff.append("</form>"); searchWordText.setText(buff.toString(), true, false); 356 } 357 358 private void setActiveScopeSet(ScopeSet set) { 359 scopeSetLink.setText(set.getName()); 360 scopeSetManager.setActiveSet(set); 361 updateMasters(set); 362 scopeSection.layout(); 363 if (parent != null) 364 parent.reflow(); 365 } 366 367 private void updateMasters(ScopeSet set) { 368 Control[] children = ((Composite) scopeSection.getClient()).getChildren(); 369 for (int i = 0; i < children.length; i++) { 370 Control child = children[i]; 371 if (child instanceof Button) { 372 Button master = (Button) child; 373 Object data = master.getData(); 374 if (data != null && data instanceof EngineDescriptor) { 375 EngineDescriptor ed = (EngineDescriptor) data; 376 master.setSelection(set.getEngineEnabled(ed)); 377 } 378 } 379 } 380 } 381 382 private void loadEngines(final Composite container, final FormToolkit toolkit) { 383 EngineDescriptorManager descManager = parent.getEngineManager(); 384 EngineDescriptor[] descriptors = descManager.getDescriptors(); 385 for (int i = 0; i < descriptors.length; i++) { 386 EngineDescriptor desc = descriptors[i]; 387 loadEngine(desc, container, toolkit); 388 } 389 engineObserver = new Observer () { 390 391 public void update(Observable o, Object arg) { 392 EngineDescriptorManager.DescriptorEvent event = (EngineDescriptorManager.DescriptorEvent) arg; 393 int kind = event.getKind(); 394 EngineDescriptor desc = event.getDescriptor(); 395 if (kind == IHelpUIConstants.ADD) { 396 advancedLink.dispose(); 397 loadEngine(desc, container, toolkit); 398 createAdvancedLink(container, toolkit); 399 parent.reflow(); 400 } else if (kind == IHelpUIConstants.REMOVE) { 401 removeEngine(desc); 402 } else { 403 updateEngine(desc); 404 } 405 } 406 }; 407 408 descManager.addObserver(engineObserver); 409 updateMasters(scopeSetManager.getActiveSet()); 410 } 411 412 private EngineDescriptor loadEngine(final EngineDescriptor edesc, Composite container, FormToolkit toolkit) { 413 Label ilabel = toolkit.createLabel(container, null); 414 ilabel.setImage(edesc.getIconImage()); 415 ilabel.setData(edesc); 416 final Button master = toolkit.createButton(container, edesc.getLabel(), SWT.CHECK); 417 master.setData(edesc); 418 master.addSelectionListener(new SelectionAdapter() { 419 420 public void widgetSelected(SelectionEvent e) { 421 scopeSetManager.getActiveSet().setEngineEnabled(edesc, master.getSelection()); 422 } 423 }); 424 String desc = edesc.getDescription(); 425 if (desc != null) { 426 Label spacer = toolkit.createLabel(container, null); 427 spacer.setData(edesc); 428 Label dlabel = toolkit.createLabel(container, desc, SWT.WRAP); 429 dlabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); 430 dlabel.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); 431 dlabel.setMenu(container.getMenu()); 432 dlabel.setData(edesc); 433 } 434 return edesc; 435 } 436 437 private void removeEngine(EngineDescriptor desc) { 438 boolean reflowNeeded = false; 439 Control[] children = ((Composite) scopeSection.getClient()).getChildren(); 440 for (int i = 0; i < children.length; i++) { 441 Control child = children[i]; 442 EngineDescriptor ed = (EngineDescriptor) child.getData(); 443 if (ed == desc) { 444 child.setMenu(null); 445 child.dispose(); 446 reflowNeeded = true; 447 } 448 } 449 if (reflowNeeded) 450 parent.reflow(); 451 } 452 453 private void updateEngine(EngineDescriptor desc) { 454 Control[] children = ((Composite) scopeSection.getClient()).getChildren(); 455 boolean reflowNeeded = false; 456 for (int i = 0; i < children.length; i++) { 457 Control child = children[i]; 458 EngineDescriptor ed = (EngineDescriptor) child.getData(); 459 if (ed == desc) { 460 Button b = (Button) children[i + 1]; 461 b.setText(desc.getLabel()); 462 Label d = (Label) children[i + 3]; 463 d.setText(desc.getDescription()); 464 d.getParent().layout(); 465 reflowNeeded = true; 466 break; 467 } 468 } 469 if (reflowNeeded) 470 parent.reflow(); 471 } 472 473 public void startSearch(String text) { 474 searchWordCombo.setText(text); 475 doSearch(text); 476 } 477 478 private void storeSearchHistory(String expression) { 479 HistoryScopeSet sset = scopeSetManager.findSearchSet(expression); 481 if (sset == null) { 482 sset = new HistoryScopeSet(expression); 483 scopeSetManager.add(sset); 484 } 485 ScopeSet activeSet = scopeSetManager.getActiveSet(); 486 sset.copyFrom(activeSet); 487 sset.save(); 488 updateSearchCombo(sset); 489 searchWordCombo.setText(expression); 490 } 491 492 private void updateSearchCombo(HistoryScopeSet current) { 493 ScopeSet[] sets = scopeSetManager.getScopeSets(true); 495 ArrayList items = new ArrayList (); 496 ArrayList toDelete = new ArrayList (); 497 for (int i = sets.length - 1; i >= 0; i--) { 500 HistoryScopeSet sset = (HistoryScopeSet) sets[i]; 501 if (current != null && sset == current) 502 continue; 503 if (sets.length - i > COMBO_HISTORY_SIZE) 504 toDelete.add(sset); 505 items.add(sset.getExpression()); 506 } 507 for (int i = 0; i < toDelete.size(); i++) { 508 HistoryScopeSet sset = (HistoryScopeSet) toDelete.get(i); 509 scopeSetManager.remove(sset); 510 } 511 if (items.size() > 0) 512 searchWordCombo.setItems((String []) items.toArray(new String [items.size()])); 513 } 514 515 private void searchFromHistory(int index) { 516 String expression = searchWordCombo.getSelection(); 517 ScopeSet set = scopeSetManager.findSearchSet(expression); 518 if (set == null) 519 return; 520 setActiveScopeSet(set); 521 doSearch(expression, true); 522 } 523 524 private void handleButtonPressed() { 525 if (searchWordCombo.getControl().isEnabled()) 526 doSearch(searchWordCombo.getText()); 527 else { 528 goButton.setEnabled(false); 529 stop(); 530 } 531 } 532 533 private void doSearch(String text) { 534 doSearch(text, false); 535 } 536 537 private void doSearch(String text, boolean fromHistory) { 538 ScopeSet set = scopeSetManager.getActiveSet(); 539 if (!fromHistory && set instanceof HistoryScopeSet) { 540 String setExpression = ((HistoryScopeSet) set).getExpression(); 541 if (setExpression.equals(text)) 542 fromHistory = true; 543 } 544 if (!fromHistory) { 545 storeSearchHistory(text); 546 boolean switchedSet = scopeSetManager.restoreLastExplicitSet(); 547 set = scopeSetManager.getActiveSet(); 548 if (switchedSet) 549 setActiveScopeSet(set); 550 } 551 ArrayList entries = new ArrayList (); 552 final SearchResultsPart results = (SearchResultsPart) parent 553 .findPart(IHelpUIConstants.HV_FSEARCH_RESULT); 554 ArrayList eds = new ArrayList (); 555 EngineDescriptor[] engineDescriptors = parent.getEngineManager().getDescriptors(); 556 for (int i = 0; i < engineDescriptors.length; i++) { 557 final EngineDescriptor ed = engineDescriptors[i]; 558 if (set.getEngineEnabled(ed) && ed.getEngine() != null) { 559 ISearchScope scope = ed.createSearchScope(set.getPreferenceStore()); 560 FederatedSearchEntry entry = new FederatedSearchEntry(ed.getId(), ed.getLabel(), scope, ed 561 .getEngine(), new ISearchEngineResultCollector() { 562 563 public void accept(ISearchEngineResult searchResult) { 564 results.add(ed, searchResult); 565 } 566 567 public void accept(ISearchEngineResult[] searchResults) { 568 results.add(ed, searchResults); 569 } 570 571 public void error(IStatus status) { 572 results.error(ed, status); 573 } 574 }); 575 entries.add(entry); 576 eds.add(ed); 577 } 578 } 579 if (entries.size() == 0) 580 return; 581 FederatedSearchEntry[] array = (FederatedSearchEntry[]) entries 582 .toArray(new FederatedSearchEntry[entries.size()]); 583 if (scopeSection.isExpanded()) { 584 scopeSection.setExpanded(false); 585 parent.reflow(); 586 } 587 results.clearResults(); 588 results.startNewSearch(text, eds); 589 BaseHelpSystem.getSearchManager().search(text, array); 590 } 591 592 private void doAdvanced() { 593 ScopeSet set = scopeSetManager.getActiveSet(); 594 PreferenceManager manager = new ScopePreferenceManager(parent.getEngineManager(), set); 595 PreferenceDialog dialog = new ScopePreferenceDialog(container.getShell(), manager, parent 596 .getEngineManager(), set.isEditable()); 597 dialog.setPreferenceStore(set.getPreferenceStore()); 598 dialog.create(); 599 dialog.getShell().setText(NLS.bind(Messages.ScopePreferenceDialog_wtitle, set.getName())); 600 dialog.open(); 601 updateMasters(set); 602 } 603 604 private void doChangeScopeSet() { 605 ScopeSetDialog dialog = new ScopeSetDialog(container.getShell(), scopeSetManager, parent 606 .getEngineManager()); 607 dialog.setInput(scopeSetManager); 608 dialog.create(); 609 dialog.getShell().setText(Messages.ScopeSetDialog_wtitle); 610 if (dialog.open() == ScopeSetDialog.OK) { 611 ScopeSet set = dialog.getActiveSet(); 612 if (set != null) 613 setActiveScopeSet(set); 614 } 615 } 616 617 public void dispose() { 618 ScopeSet activeSet = scopeSetManager.getActiveSet(); 619 if (activeSet != null) 620 activeSet.save(); 621 if (engineObserver != null) { 622 parent.getEngineManager().deleteObserver(engineObserver); 623 engineObserver = null; 624 } 625 Job.getJobManager().removeJobChangeListener(jobListener); 626 stop(); 627 super.dispose(); 628 } 629 630 635 public Control getControl() { 636 return container; 637 } 638 639 644 public void init(ReusableHelpPart parent, String id, IMemento memento) { 645 this.parent = parent; 646 this.id = id; 647 loadEngines(filteringGroup, parent.getForm().getToolkit()); 648 createAdvancedLink(filteringGroup, parent.getForm().getToolkit()); 649 parent.hookFormText(searchWordText); 650 if (memento != null) 651 restorePart(memento); 652 } 653 654 private void restorePart(IMemento memento) { 655 String setName = memento.getString("activeSet"); if (setName != null) { 657 ScopeSet sset = scopeSetManager.findSet(setName); 658 if (sset != null) 659 scopeSetManager.setActiveSet(sset); 660 } 661 String expression = memento.getString("expression"); if (expression != null && expression.length() > 0) { 663 searchWordCombo.setText(expression); 664 searchPending = true; 665 markStale(); 666 } 667 } 668 669 public void refresh() { 670 super.refresh(); 671 if (searchPending) { 672 searchPending = false; 673 doSearch(searchWordCombo.getText()); 674 } 675 } 676 677 public String getId() { 678 return id; 679 } 680 681 686 public void setVisible(boolean visible) { 687 getControl().setVisible(visible); 688 } 689 690 695 public boolean fillContextMenu(IMenuManager manager) { 696 return parent.fillFormContextMenu(searchWordText, manager); 697 } 698 699 704 public boolean hasFocusControl(Control control) { 705 return control == searchWordText || control == searchWordCombo.getControl() 706 || scopeSection.getClient() == control; 707 } 708 709 public void setFocus() { 710 searchWordCombo.getControl().setFocus(); 711 } 712 713 public IAction getGlobalAction(String id) { 714 if (id.equals(ActionFactory.COPY.getId())) 715 return parent.getCopyAction(); 716 return null; 717 } 718 719 public void stop() { 720 SearchResultsPart results = (SearchResultsPart) parent.findPart(IHelpUIConstants.HV_FSEARCH_RESULT); 721 results.canceling(); 722 Job.getJobManager().cancel(FederatedSearchJob.FAMILY); 723 } 724 725 public void toggleRoleFilter() { 726 } 727 728 public void refilter() { 729 } 730 731 public void saveState(IMemento memento) { 732 ScopeSet sset = scopeSetManager.getActiveSet(); 733 if (sset != null) 734 memento.putString("activeSet", sset.getName()); memento.putString("expression", searchWordCombo.getText()); } 737 } 738 | Popular Tags |