Example #1
0
 @Override
 public void createPartControl(final Composite parent) {
   setPartName(Messages.FaelleView_partName); // $NON-NLS-1$
   parent.setLayout(new GridLayout());
   tv = new TableViewer(parent);
   tv.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
   tv.setContentProvider(new FaelleContentProvider());
   tv.setLabelProvider(new FaelleLabelProvider());
   tv.addSelectionChangedListener(GlobalEventDispatcher.getInstance().getDefaultListener());
   menus = new ViewMenus(getViewSite());
   menus.createToolbar(neuerFallAction, konsFilterAction);
   menus.createViewerContextMenu(
       tv, delFallAction, openFallaction, reopenFallAction, makeBillAction);
   GlobalEventDispatcher.addActivationListener(this, this);
   tv.setInput(getViewSite());
   tv.addDoubleClickListener(
       new IDoubleClickListener() {
         @Override
         public void doubleClick(DoubleClickEvent event) {
           try {
             FallDetailView pdv = (FallDetailView) getSite().getPage().showView(FallDetailView.ID);
           } catch (PartInitException e) {
             ExHandler.handle(e);
           }
         }
       });
 }
Example #2
0
 NotesList(Composite parent) {
   super(parent, SWT.NONE);
   setLayout(new GridLayout());
   this.parent = parent;
   Composite cFilter = new Composite(this, SWT.NONE);
   cFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
   cFilter.setLayout(new GridLayout(3, false));
   ImageHyperlink clearSearchFieldHyperlink = new ImageHyperlink(cFilter, SWT.NONE);
   clearSearchFieldHyperlink.setImage(Images.IMG_CLEAR.getImage());
   clearSearchFieldHyperlink.addHyperlinkListener(
       new HyperlinkAdapter() {
         @Override
         public void linkActivated(HyperlinkEvent e) {
           tFilter.setText(""); // $NON-NLS-1$
           filterExpr = ""; // $NON-NLS-1$
           matches.clear();
           tv.collapseAll();
           tv.removeFilter(notesFilter);
         }
       });
   new Label(cFilter, SWT.NONE).setText(Messages.NotesList_searchLabel);
   tFilter = new Text(cFilter, SWT.SINGLE);
   tFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
   tFilter.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetDefaultSelected(SelectionEvent e) {
           filterExpr = tFilter.getText().toLowerCase();
           matches.clear();
           if (filterExpr.length() == 0) {
             tv.removeFilter(notesFilter);
             tv.collapseAll();
           } else {
             tv.addFilter(notesFilter);
             tv.expandAll();
           }
         }
       });
   tv = new TreeViewer(this, SWT.NONE);
   tv.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
   tv.setContentProvider(new NotesContentProvider());
   tv.setLabelProvider(new DefaultLabelProvider());
   tv.setUseHashlookup(true);
   tv.setInput(parent);
   tv.addSelectionChangedListener(GlobalEventDispatcher.getInstance().getDefaultListener());
 }
Example #3
0
 public void dispose() {
   tv.removeSelectionChangedListener(GlobalEventDispatcher.getInstance().getDefaultListener());
 }