Java Code Examples for org.eclipse.jface.viewers.ISelectionChangedListener

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project ccw, under directory /ccw.core/src/java/ccw/repl/.

Source file: NamespaceBrowser.java

  22 
vote

/** 
 * Fires a selection changed event.
 * @param selection the new selection
 */
protected void fireSelectionChanged(ISelection selection){
  final SelectionChangedEvent event=new SelectionChangedEvent(this,selection);
  Object[] listeners=selectionChangedListeners.getListeners();
  for (int i=0; i < listeners.length; ++i) {
    final ISelectionChangedListener l=(ISelectionChangedListener)listeners[i];
    SafeRunner.run(new SafeRunnable(){
      public void run(){
        l.selectionChanged(event);
      }
    }
);
  }
}
 

Example 2

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/views/.

Source file: GallerySelectionProvider.java

  22 
vote

public void setSelection(ISelection selection){
  theSelection=selection;
  final SelectionChangedEvent e=new SelectionChangedEvent(this,selection);
  Object[] listenersArray=listeners.toArray();
  for (int i=0; i < listenersArray.length; i++) {
    final ISelectionChangedListener l=(ISelectionChangedListener)listenersArray[i];
    Platform.run(new SafeRunnable(){
      public void run(){
        l.selectionChanged(e);
      }
    }
);
  }
}
 

Example 3

From project dawn-ui, under directory /org.dawb.workbench.plotting/src/org/dawb/workbench/plotting/views/.

Source file: ToolPageView.java

  22 
vote

/** 
 * @param event the event
 */
public void selectionChanged(final SelectionChangedEvent event){
  Object[] listeners=getListeners();
  for (int i=0; i < listeners.length; ++i) {
    final ISelectionChangedListener l=(ISelectionChangedListener)listeners[i];
    Platform.run(new SafeRunnable(){
      public void run(){
        l.selectionChanged(event);
      }
    }
);
  }
}
 

Example 4

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/preferences/.

Source file: DroolsRuntimesBlock.java

  22 
vote

private void fireSelectionChanged(){
  SelectionChangedEvent event=new SelectionChangedEvent(this,getSelection());
  Object[] listeners=fSelectionListeners.getListeners();
  for (int i=0; i < listeners.length; i++) {
    ISelectionChangedListener listener=(ISelectionChangedListener)listeners[i];
    listener.selectionChanged(event);
  }
}
 

Example 5

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/hsimpls/.

Source file: ImplementationsBlock.java

  22 
vote

private void fireSelectionChanged(){
  SelectionChangedEvent evt=new SelectionChangedEvent(this,getSelection());
  Object[] lis=selectionListeners.getListeners();
  for (int i=0; i < lis.length; i++) {
    ISelectionChangedListener li=(ISelectionChangedListener)lis[i];
    li.selectionChanged(evt);
  }
}
 

Example 6

From project grails-ide, under directory /org.grails.ide.eclipse.ui/src/org/grails/ide/eclipse/ui/internal/properties/.

Source file: InstalledGrailsInstallBlock.java

  22 
vote

/** 
 * Fire current selection
 */
private void fireSelectionChanged(){
  SelectionChangedEvent event=new SelectionChangedEvent(this,getSelection());
  Object[] listeners=fSelectionListeners.getListeners();
  for (int i=0; i < listeners.length; i++) {
    ISelectionChangedListener listener=(ISelectionChangedListener)listeners[i];
    listener.selectionChanged(event);
  }
}
 

Example 7

From project netifera, under directory /platform/com.netifera.platform.ui/com.netifera.platform.ui/src/com/netifera/platform/ui/util/.

Source file: SelectionProviderProxy.java

  22 
vote

private void fireSelectionChanged(ListenerList list,ISelection selection){
  if (selection == null) {
    return;
  }
  SelectionChangedEvent event=new SelectionChangedEvent(provider,selection);
  Object[] listeners=list.getListeners();
  for (int i=0; i < listeners.length; i++) {
    ISelectionChangedListener listener=(ISelectionChangedListener)listeners[i];
    listener.selectionChanged(event);
  }
}
 

Example 8

From project Newsreader, under directory /bundles/org.eclipse.ecf.salvo.ui/src/org/eclipse/ecf/salvo/ui/internal/views/.

Source file: MessageView.java

  22 
vote

public void setSelection(ISelection selection){
  theSelection=selection;
  final SelectionChangedEvent e=new SelectionChangedEvent(this,selection);
  Object[] listenersArray=listeners.toArray();
  for (int i=0; i < listenersArray.length; i++) {
    final ISelectionChangedListener l=(ISelectionChangedListener)listenersArray[i];
    SafeRunner.run(new SafeRunnable(){
      public void run(){
        l.selectionChanged(e);
      }
    }
);
  }
}
 

Example 9

From project radrails, under directory /plugins/org.radrails.rails.ui/src/org/radrails/rails/internal/ui/railsplugins/.

Source file: RailsPluginsView.java

  22 
vote

/** 
 * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
 */
public void setSelection(ISelection selection){
  this.selection=selection;
  for (Iterator iter=listeners.iterator(); iter.hasNext(); ) {
    ISelectionChangedListener listener=(ISelectionChangedListener)iter.next();
    listener.selectionChanged(new SelectionChangedEvent(this,selection));
  }
}
 

Example 10

From project substeps-eclipse-plugin, under directory /com.technophobia.substeps.testlauncher/src/main/java/com/technophobia/substeps/junit/ui/component/.

Source file: SelectionProviderMediator.java

  22 
vote

private void fireSelectionChanged(){
  if (selectionChangedListeners != null) {
    final SelectionChangedEvent event=new SelectionChangedEvent(this,getSelection());
    final Object[] listeners=selectionChangedListeners.getListeners();
    for (int i=0; i < listeners.length; i++) {
      final ISelectionChangedListener listener=(ISelectionChangedListener)listeners[i];
      listener.selectionChanged(event);
    }
  }
}
 

Example 11

From project TadpoleForDBTools, under directory /com.hangum.db.rap.commons/src/com/hangum/tadpole/viewsupport/.

Source file: SelectionProviderMediator.java

  22 
vote

private void fireSelectionChanged(){
  if (fSelectionChangedListeners != null) {
    SelectionChangedEvent event=new SelectionChangedEvent(this,getSelection());
    Object[] listeners=fSelectionChangedListeners.getListeners();
    for (int i=0; i < listeners.length; i++) {
      ISelectionChangedListener listener=(ISelectionChangedListener)listeners[i];
      listener.selectionChanged(event);
    }
  }
}
 

Example 12

From project CIShell, under directory /clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/.

Source file: AbstractDataManagerView.java

  21 
vote

public void setSelection(ISelection selection){
  if (selection != this.selection) {
    this.selection=selection;
    AbstractDataManagerView.this.viewer.refresh(true);
    if ((selection != null) && (selection instanceof IStructuredSelection)) {
      IStructuredSelection selections=(IStructuredSelection)selection;
      Iterator<?> iterator=selections.iterator();
      TreeItem[] newTreeSelection=new TreeItem[selections.size()];
      int i=0;
      while (iterator.hasNext()) {
        Object next=iterator.next();
        if (next instanceof Data) {
          TreeItem result=getTreeItem((Data)next,AbstractDataManagerView.this.tree.getItems());
          newTreeSelection[i]=result;
          AbstractDataManagerView.this.viewer.expandToLevel(AbstractDataManagerView.this.dataToDataGUIItem.get(next),0);
        }
        i++;
      }
      AbstractDataManagerView.this.tree.setSelection(newTreeSelection);
    }
    Iterator<ISelectionChangedListener> listenerIterator=listeners.iterator();
    while (listenerIterator.hasNext()) {
      ISelectionChangedListener listener=listenerIterator.next();
      SelectionChangedEvent event=new SelectionChangedEvent(this,selection);
      listener.selectionChanged(event);
    }
  }
}
 

Example 13

From project mylyn.docs.intent.main, under directory /plugins/org.eclipse.mylyn.docs.intent.client.ui/src/org/eclipse/mylyn/docs/intent/client/ui/editor/.

Source file: IntentEditor.java

  21 
vote

/** 
 * Creates a listener which is notified when the outline's selection changes.
 * @return the listener which is notified when the outline's selection changes
 */
protected ISelectionChangedListener createSelectionChangeListener(){
  return new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      selectionChangedDetected(event);
    }
  }
;
}
 

Example 14

From project phing-eclipse, under directory /org.ganoro.phing.ui/src/org/ganoro/phing/ui/internal/preferences/.

Source file: AddCustomDialog.java

  21 
vote

private void createFileSelectionGroup(Composite parent){
  FileSystemElement dummyRoot=new FileSystemElement("Dummy",null,true);
  this.selectionGroup=new TreeAndListGroup(parent,dummyRoot,getFolderProvider(),new WorkbenchLabelProvider(),getFileProvider(),new WorkbenchLabelProvider(),SWT.NONE,400,150,false);
  ISelectionChangedListener listener=new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      updateStatus();
    }
  }
;
  WorkbenchViewerComparator comparator=new WorkbenchViewerComparator();
  this.selectionGroup.setTreeComparator(comparator);
  this.selectionGroup.setListSorter(comparator);
  this.selectionGroup.addSelectionChangedListener(listener);
  selectionGroup.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      if (getButton(IDialogConstants.OK_ID).isEnabled()) {
        buttonPressed(IDialogConstants.OK_ID);
      }
    }
  }
);
}
 

Example 15

From project Vega, under directory /platform/com.subgraph.vega.ui.http/src/com/subgraph/vega/ui/http/builder/.

Source file: HeaderEditor.java

  21 
vote

private ISelectionChangedListener createSelectionChangedListener(){
  return new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      boolean sel=event.getSelection().isEmpty();
      buttonRemove.setGrayed(sel);
      buttonMoveUp.setGrayed(sel);
      buttonMoveDown.setGrayed(sel);
    }
  }
;
}
 

Example 16

From project zest, under directory /org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/.

Source file: GraphViewer.java

  21 
vote

protected void hookControl(Control control){
  super.hookControl(control);
  selectionChangedListeners=new ArrayList();
  getGraphControl().addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      Iterator iterator=selectionChangedListeners.iterator();
      ISelection structuredSelection=getSelection();
      SelectionChangedEvent event=new SelectionChangedEvent(GraphViewer.this,structuredSelection);
      while (iterator.hasNext()) {
        ISelectionChangedListener listener=(ISelectionChangedListener)iterator.next();
        listener.selectionChanged(event);
      }
      firePostSelectionChanged(event);
    }
  }
);
  control.addMouseListener(new MouseListener(){
    public void mouseDoubleClick(    MouseEvent e){
      DoubleClickEvent doubleClickEvent=new DoubleClickEvent(GraphViewer.this,getSelection());
      fireDoubleClick(doubleClickEvent);
    }
    public void mouseDown(    MouseEvent e){
    }
    public void mouseUp(    MouseEvent e){
    }
  }
);
}
 

Example 17

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.editor/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/presentation/.

Source file: ScalaEditor.java

  20 
vote

/** 
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the current one. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer){
  if (currentViewer != viewer) {
    if (selectionChangedListener == null) {
      selectionChangedListener=new ISelectionChangedListener(){
        public void selectionChanged(        SelectionChangedEvent selectionChangedEvent){
          setSelection(selectionChangedEvent.getSelection());
        }
      }
;
    }
    if (currentViewer != null) {
      currentViewer.removeSelectionChangedListener(selectionChangedListener);
    }
    if (viewer != null) {
      viewer.addSelectionChangedListener(selectionChangedListener);
    }
    currentViewer=viewer;
    setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
  }
}
 

Example 18

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.editor/src-gen/org/eclipse/acceleo/tutorial/webapp/presentation/.

Source file: WebappEditor.java

  20 
vote

/** 
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the current one. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer){
  if (currentViewer != viewer) {
    if (selectionChangedListener == null) {
      selectionChangedListener=new ISelectionChangedListener(){
        public void selectionChanged(        SelectionChangedEvent selectionChangedEvent){
          setSelection(selectionChangedEvent.getSelection());
        }
      }
;
    }
    if (currentViewer != null) {
      currentViewer.removeSelectionChangedListener(selectionChangedListener);
    }
    if (viewer != null) {
      viewer.addSelectionChangedListener(selectionChangedListener);
    }
    currentViewer=viewer;
    setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
  }
}
 

Example 19

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.ec2/src/com/amazonaws/eclipse/ec2/ui/keypair/.

Source file: KeyPairSelectionTable.java

  20 
vote

/** 
 * Create a key pair table for the specified account Id
 */
public KeyPairSelectionTable(Composite parent,String accountId){
  super(parent);
  this.accountId=accountId;
  KeyPairTableProvider keyPairTableProvider=new KeyPairTableProvider();
  viewer.setContentProvider(keyPairTableProvider);
  viewer.setLabelProvider(keyPairTableProvider);
  viewer.setComparator(new KeyPairComparator());
  refreshKeyPairs();
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      updateActionsForSelection();
    }
  }
);
}
 

Example 20

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/filter/.

Source file: FilterDialog.java

  20 
vote

private void addUnionIntersection(){
  Composite unionIntersectionComponent=new Composite(container,SWT.NONE);
  unionIntersectionComponent.setLayout(new GridLayout(NR_OF_COLUMNS,false));
  Label lblBeiErfllen=new Label(unionIntersectionComponent,SWT.NONE);
  lblBeiErfllen.setText("If");
  groupFilterComboViewer=new ComboViewer(unionIntersectionComponent,SWT.READ_ONLY);
  groupFilterComboViewer.setContentProvider(ArrayContentProvider.getInstance());
  groupFilterComboViewer.setLabelProvider(new LabelProvider(){
    @Override public String getText(    Object element){
      return ((FilterGroupType)element).value();
    }
  }
);
  groupFilterComboViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      filterGroupType=SelectionHelper.handleStructuredSelectionEvent(event,FilterGroupType.class);
    }
  }
);
  groupFilterComboViewer.setInput(FilterGroupType.values());
  groupFilterComboViewer.setSelection(new StructuredSelection(FilterGroupType.UNION));
  Label lblDerFolgendenBedingungen=new Label(unionIntersectionComponent,SWT.NONE);
  lblDerFolgendenBedingungen.setText("of the following conditions are met:");
}
 

Example 21

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.specmol/src/net/bioclipse/specmol/wizards/.

Source file: ChooseBibtexWizardPage.java

  20 
vote

public void createControl(Composite parent){
  Composite container=new Composite(parent,SWT.NULL);
  GridLayout layout=new GridLayout();
  container.setLayout(layout);
  layout.numColumns=2;
  layout.verticalSpacing=9;
  final TreeViewer treeViewer=new TreeViewer(container);
  treeViewer.setContentProvider(new BibtexContentProvider());
  treeViewer.setLabelProvider(new DecoratingLabelProvider(new FolderLabelProvider(),PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
  treeViewer.setUseHashlookup(true);
  GridData layoutData=new GridData();
  layoutData.grabExcessHorizontalSpace=true;
  layoutData.grabExcessVerticalSpace=true;
  layoutData.horizontalAlignment=GridData.FILL;
  layoutData.verticalAlignment=GridData.FILL;
  layoutData.horizontalSpan=3;
  treeViewer.getControl().setLayoutData(layoutData);
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().findMember("."));
  treeViewer.expandToLevel(2);
  treeViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      ISelection sel=event.getSelection();
      if (sel instanceof IStructuredSelection && ((IStructuredSelection)sel).getFirstElement() instanceof IFile) {
        selectedRes=(IFile)((IStructuredSelection)sel).getFirstElement();
        getWizard().getContainer().updateButtons();
      }
    }
  }
);
  treeViewer.setSelection(new StructuredSelection(ResourcesPlugin.getWorkspace().getRoot().findMember(".")));
  setControl(container);
}
 

Example 22

From project bndtools, under directory /bndtools.core/src/bndtools/editor/workspace/.

Source file: PluginPathPart.java

  20 
vote

/** 
 * Fill the section.
 */
private void createClient(Section section,FormToolkit toolkit){
  section.setText("Plugin Path");
  createToolBar(section);
  Table table=new Table(section,SWT.BORDER | SWT.FULL_SELECTION);
  toolkit.adapt(table);
  toolkit.paintBordersFor(table);
  section.setClient(table);
  viewer=new TableViewer(table);
  viewer.setContentProvider(ArrayContentProvider.getInstance());
  viewer.setLabelProvider(new PluginPathLabelProvider());
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      boolean enable=!viewer.getSelection().isEmpty();
      removeItem.setEnabled(enable);
    }
  }
);
  table.addKeyListener(new KeyAdapter(){
    @Override public void keyReleased(    KeyEvent e){
      if (e.character == SWT.DEL) {
        doRemove();
      }
 else       if (e.character == '+') {
        doAdd();
      }
    }
  }
);
}
 

Example 23

From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/dialog/field/.

Source file: ListField.java

  20 
vote

@Override protected void createControl(Composite parent){
  fViewer=new TableViewer(parent);
  GridData gd=new GridData(SWT.FILL,SWT.BEGINNING,true,false);
  gd.widthHint=200;
  gd.horizontalSpan=2;
  fViewer.getTable().setLayoutData(gd);
  fViewer.setContentProvider(new ListContentProvider());
  fViewer.setLabelProvider(fLabelProvider);
  fViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      String selection=extractSelection();
      if (selection != null) {
        fSelection=selection;
        getDialog().validateFields();
      }
    }
  }
);
  fViewer.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      String selection=extractSelection();
      if (selection != null) {
        fSelection=selection;
        getDialog().validateFields();
        getDialog().doPressOK();
      }
    }
  }
);
  fViewer.setInput(fValues);
}
 

Example 24

From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/handler/.

Source file: SelectArtifactParentDialog.java

  20 
vote

/** 
 * {@inheritDoc}
 */
@Override protected Control createDialogArea(Composite parent){
  setTitle(MSG_TITLE);
  setMessage(MSG_MESSAGE);
  _treeViewer=ArtifactTreeViewerFactory.createDefaultArtifactTreeViewer(parent,SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER);
  _treeViewer.setInput(_rootArtifact);
  _treeViewer.expandToLevel(2);
  _treeViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      validateInput();
    }
  }
);
  Dialog.applyDialogFont(parent);
  return parent;
}
 

Example 25

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/editor/.

Source file: RestorePreviousSelectionAction.java

  20 
vote

public void setEditor(ITextEditor editor){
  if (editor instanceof CeylonEditor) {
    fEditor=(CeylonEditor)editor;
    fEditor.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener(){
      @Override public void selectionChanged(      SelectionChangedEvent event){
        if (!restoring) {
          IRegion r=fEditor.getSelection();
          if (r.getLength() == 0) {
            previous.clear();
          }
          previous.add(r);
          if (previous.size() > 20) {
            previous.remove(0);
          }
          setEnabled(previous.size() > 1);
        }
      }
    }
);
  }
 else {
    fEditor=null;
  }
  setEnabled(false);
}
 

Example 26

From project Database-Designer, under directory /plugins/org.obeonetwork.dsl.database.editor/src/org/obeonetwork/dsl/database/presentation/.

Source file: DatabaseEditor.java

  20 
vote

/** 
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the current one. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer){
  if (currentViewer != viewer) {
    if (selectionChangedListener == null) {
      selectionChangedListener=new ISelectionChangedListener(){
        public void selectionChanged(        SelectionChangedEvent selectionChangedEvent){
          setSelection(selectionChangedEvent.getSelection());
        }
      }
;
    }
    if (currentViewer != null) {
      currentViewer.removeSelectionChangedListener(selectionChangedListener);
    }
    if (viewer != null) {
      viewer.addSelectionChangedListener(selectionChangedListener);
    }
    currentViewer=viewer;
    setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
  }
}
 

Example 27

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/views/.

Source file: ActorPalettePage.java

  20 
vote

/** 
 * Creates the SWT control for this page under the given parent control.
 * @param parent the parent control
 */
public void createControl(Composite parent){
  treeViewer=createTreeViewer(parent);
  getTreeViewer().addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      treeSelect(event);
    }
  }
);
  treeViewer.getTree().addListener(SWT.PaintItem,new Listener(){
    public void handleEvent(    Event event){
      TreeItem item=(TreeItem)event.item;
      if (item == null)       return;
    }
  }
);
  configTreeViewer();
  hookTreeViewer();
  initPage();
}
 

Example 28

From project Diver, under directory /ca.uvic.chisel.javasketch/src/ca/uvic/chisel/javasketch/launching/internal/.

Source file: FolderSelectionDialog.java

  20 
vote

@Override protected Control createDialogArea(Composite parent){
  Composite page=new Composite(parent,SWT.NONE);
  page.setLayout(new GridLayout());
  Control treeHolder=super.createDialogArea(page);
  treeHolder.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  Composite newFolderComposite=new Composite(page,SWT.NONE);
  newFolderComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  newFolderComposite.setLayout(new GridLayout(2,false));
  folderNameText=new Text(newFolderComposite,SWT.SINGLE | SWT.BORDER);
  folderNameText.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  folderNameButton=new Button(newFolderComposite,SWT.PUSH);
  folderNameButton.setText("New Folder");
  folderNameButton.setLayoutData(new GridData(SWT.END,SWT.FILL,false,false));
  folderNameButton.addSelectionListener(new CreateFolderAction());
  treeListener=new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      ISelection selection=event.getSelection();
      if (selection instanceof IStructuredSelection) {
        if (((IStructuredSelection)selection).size() == 1) {
          folderNameButton.setEnabled(true);
          folderNameText.setEnabled(true);
          return;
        }
      }
      folderNameButton.setEnabled(false);
      folderNameText.setEnabled(false);
    }
  }
;
  treeListener.selectionChanged(new SelectionChangedEvent(getTreeViewer(),getTreeViewer().getSelection()));
  getTreeViewer().addSelectionChangedListener(treeListener);
  return page;
}
 

Example 29

From project e4-rendering, under directory /com.toedter.e4.demo.contacts.swt/src/com/toedter/e4/demo/contacts/swt/views/.

Source file: ListView.java

  20 
vote

@Inject public ListView(Composite parent){
  final Composite tableComposite=new Composite(parent,SWT.NONE);
  tableComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  final TableColumnLayout tableColumnLayout=new TableColumnLayout();
  tableComposite.setLayout(tableColumnLayout);
  contactsViewer=new TableViewer(tableComposite,SWT.FULL_SELECTION);
  contactsViewer.getTable().setHeaderVisible(true);
  contactsViewer.setComparator(new ContactViewerComparator());
  contactsViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      selectionService.setSelection(selection.getFirstElement());
    }
  }
);
  final TableViewerColumn firstNameColumn=new TableViewerColumn(contactsViewer,SWT.NONE);
  firstNameColumn.getColumn().setText("First Name");
  tableColumnLayout.setColumnData(firstNameColumn.getColumn(),new ColumnWeightData(40));
  final TableViewerColumn lastNameColumn=new TableViewerColumn(contactsViewer,SWT.NONE);
  lastNameColumn.getColumn().setText("Last Name");
  tableColumnLayout.setColumnData(lastNameColumn.getColumn(),new ColumnWeightData(60));
  ObservableListContentProvider contentProvider=new ObservableListContentProvider();
  contactsViewer.setContentProvider(contentProvider);
  IObservableMap[] attributes=BeansObservables.observeMaps(contentProvider.getKnownElements(),Contact.class,new String[]{"firstName","lastName"});
  contactsViewer.setLabelProvider(new ObservableMapLabelProvider(attributes));
  contactsViewer.setInput(ContactsRepositoryFactory.getContactsRepository().getAllContacts());
  GridLayoutFactory.fillDefaults().generateLayout(parent);
}
 

Example 30

From project Eclipse, under directory /com.mobilesorcery.sdk.testing/src/com/mobilesorcery/sdk/testing/internal/ui/.

Source file: TestRunComposite.java

  20 
vote

private void init(){
  setLayout(new GridLayout(1,false));
  counter=new CounterPanel(this);
  counter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  progress=new JUnitProgressBar(this);
  progress.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  testLog=new TreeViewer(this,SWT.BORDER | SWT.SINGLE);
  testLog.setContentProvider(new TestSessionContentProvider());
  testSessionsLabelProvider=new TestSessionLabelProvider();
  testLog.setLabelProvider(testSessionsLabelProvider);
  testLog.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
  failureDetails=new TableViewer(this,SWT.BORDER | SWT.SINGLE);
  failureDetailsContentProvider=new FailureDetailsContentProvider();
  failureDetails.setContentProvider(failureDetailsContentProvider);
  failureDetails.setLabelProvider(new FailureDetailsLabelProvider());
  failureDetails.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
  testLog.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      Object selectedTest=selection.getFirstElement();
      failureDetails.setInput(selectedTest == null ? FailureDetailsContentProvider.EMPTY : selectedTest);
    }
  }
);
}
 

Example 31

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/.

Source file: CloudSpacesSelectionPart.java

  20 
vote

public Composite createComposite(Composite parent){
  Composite tableArea=new Composite(parent,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).applyTo(tableArea);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(tableArea);
  Composite orgTableComposite=new Composite(tableArea,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).applyTo(orgTableComposite);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(orgTableComposite);
  Label orgLabel=new Label(orgTableComposite,SWT.NONE);
  GridDataFactory.fillDefaults().grab(false,false).applyTo(orgLabel);
  orgLabel.setText("Organizations and Spaces:");
  Tree orgTable=new Tree(orgTableComposite,SWT.BORDER | SWT.SINGLE);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(orgTable);
  orgsSpacesViewer=new TreeViewer(orgTable);
  orgsSpacesViewer.setContentProvider(new TableContentProvider());
  orgsSpacesViewer.setLabelProvider(new SpacesLabelProvider());
  orgsSpacesViewer.setSorter(new SpacesSorter());
  orgsSpacesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      refresh();
    }
  }
);
  setInput();
  return tableArea;
}
 

Example 32

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.ui/src/org/springsource/ide/eclipse/commons/frameworks/ui/internal/plugins/.

Source file: PluginManagerDialog.java

  20 
vote

/** 
 * Creates the main tree viewer area that contains the tree viewer that displays the list of plugins as well as the button selection controls
 * @param parent
 */
protected void createPluginViewerArea(Composite parent){
  createSearchArea(parent);
  Composite viewerArea=new Composite(parent,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(viewerArea);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(viewerArea);
  Composite treeArea=new Composite(viewerArea,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).applyTo(treeArea);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(treeArea);
  pluginViewer=new GrailsBrowserViewer(getColumns());
  pluginViewer.createControls(treeArea);
  TreeViewer viewer=pluginViewer.getTreeViewer();
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      refreshDescriptionArea();
      validateOperationButtons();
    }
  }
);
  viewer.addFilter(new PluginStatusFilter());
  viewer.setContentProvider(new GrailsViewerContentProvider());
  viewer.setLabelProvider(new GrailsViewerLabelProvider());
  viewer.setSorter(new GrailsViewerColumnSorter());
  createDescriptionArea(treeArea);
  createFilterOptionsArea(treeArea);
  createOperationButtonArea(viewerArea);
  searchPart.connectViewer(pluginViewer.getTreeViewer());
  initIconManager();
}
 

Example 33

From project egit-github, under directory /org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/.

Source file: GistConnectorSelectionDialog.java

  20 
vote

protected Control createDialogArea(Composite parent){
  Composite c=(Composite)super.createDialogArea(parent);
  createMessageArea(c);
  TableViewer viewer=new TableViewer(c,SWT.SINGLE | SWT.FULL_SELECTION | SWT.V_SCROLL| SWT.H_SCROLL);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(viewer.getControl());
  viewer.setContentProvider(ArrayContentProvider.getInstance());
  viewer.setLabelProvider(new DecoratingLabelProvider(new TaskRepositoryLabelProvider(),PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
  viewer.setSorter(new ViewerSorter());
  viewer.setInput(repos);
  viewer.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      Object selected=((IStructuredSelection)event.getSelection()).getFirstElement();
      setResult(Collections.singletonList(selected));
      okPressed();
    }
  }
);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      Object selected=((IStructuredSelection)event.getSelection()).getFirstElement();
      setResult(Collections.singletonList(selected));
    }
  }
);
  return c;
}
 

Example 34

From project EMF-IncQuery, under directory /tests/org.eclipse.viatra2.emf.incquery.snapshot.editor/src/org/eclipse/viatra2/emf/incquery/snapshot/EIQSnapshot/presentation/.

Source file: EIQSnapshotEditor.java

  20 
vote

/** 
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the current one. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer){
  if (currentViewer != viewer) {
    if (selectionChangedListener == null) {
      selectionChangedListener=new ISelectionChangedListener(){
        public void selectionChanged(        SelectionChangedEvent selectionChangedEvent){
          setSelection(selectionChangedEvent.getSelection());
        }
      }
;
    }
    if (currentViewer != null) {
      currentViewer.removeSelectionChangedListener(selectionChangedListener);
    }
    if (viewer != null) {
      viewer.addSelectionChangedListener(selectionChangedListener);
    }
    currentViewer=viewer;
    setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
  }
}
 

Example 35

From project fr.obeo.performance, under directory /fr.obeo.performance.editor/src-gen/fr/obeo/performance/presentation/.

Source file: PerformanceEditor.java

  20 
vote

/** 
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the current one. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer){
  if (currentViewer != viewer) {
    if (selectionChangedListener == null) {
      selectionChangedListener=new ISelectionChangedListener(){
        public void selectionChanged(        SelectionChangedEvent selectionChangedEvent){
          setSelection(selectionChangedEvent.getSelection());
        }
      }
;
    }
    if (currentViewer != null) {
      currentViewer.removeSelectionChangedListener(selectionChangedListener);
    }
    if (viewer != null) {
      viewer.addSelectionChangedListener(selectionChangedListener);
    }
    currentViewer=viewer;
    setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
  }
}
 

Example 36

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/.

Source file: CreateVolumePage1.java

  20 
vote

private void createTypeCombo(Composite container){
  typeComboViewer=new ComboViewer(container,SWT.READ_ONLY);
  Combo typeCombo=typeComboViewer.getCombo();
  GridData typeComboData=new GridData(SWT.LEFT,SWT.CENTER,true,false,1,1);
  typeCombo.setLayoutData(typeComboData);
  typeComboViewer.setContentProvider(new ArrayContentProvider());
  VOLUME_TYPE[] volumeTypes=new VOLUME_TYPE[3];
  volumeTypes[0]=VOLUME_TYPE.DISTRIBUTE;
  volumeTypes[1]=VOLUME_TYPE.REPLICATE;
  volumeTypes[2]=VOLUME_TYPE.STRIPE;
  typeComboViewer.setInput(volumeTypes);
  typeCombo.select(0);
  typeComboViewer.setLabelProvider(new LabelProvider(){
    @Override public String getText(    Object element){
      return Volume.getVolumeTypeStr((VOLUME_TYPE)element);
    }
  }
);
  typeComboViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      validateForm();
    }
  }
);
}
 

Example 37

From project gted, under directory /net.sf.gted.editor/src/net/sf/gted/editor/entry/master/.

Source file: POMasterDetailsBlock.java

  20 
vote

/** 
 * @param managedForm
 * @param spart
 */
private void createViewer(final IManagedForm managedForm,final SectionPart spart){
  viewer=new TableViewer(table);
  viewer.setUseHashlookup(true);
  viewer.setColumnProperties(this.columnNames);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      for (final Iterator<?> iter=selection.iterator(); iter.hasNext(); ) {
        final Object object=iter.next();
        if (object instanceof POEntry) {
          selectedEntry=(POEntry)object;
        }
      }
      managedForm.fireSelectionChanged(spart,event.getSelection());
    }
  }
);
  viewer.setContentProvider(new EntryTableContentProvider());
  viewer.setLabelProvider(new EntryTableLabelProvider());
  viewer.setInput(page.getEditor().getFile());
}
 

Example 38

From project incubator, under directory /net.karlmartens.ui/test/net/karlmartens/ui/viewer/.

Source file: GridChooserViewerTest.java

  20 
vote

public static void main(String[] args) throws Exception {
  final Shell shell=new Shell();
  final Display display=shell.getDisplay();
  shell.setLayout(new FillLayout());
  final GridChooserViewer viewer=new GridChooserViewer(shell);
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setLabelProvider(new TestColumnLabelProvider(0));
  viewer.setComparator(new ViewerComparator(new NumberStringComparator()));
  viewer.getControl().setHeaderVisible(true);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      System.out.println("Selection changed event");
    }
  }
);
  final ColumnViewerEditorActivationStrategy activationStrategy=new ColumnViewerEditorActivationStrategy(viewer){
    @Override protected boolean isEditorActivationEvent(    ColumnViewerEditorActivationEvent event){
      return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR) || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
    }
  }
;
  GridChooserViewerEditor.create(viewer,activationStrategy,ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL| ColumnViewerEditor.KEYBOARD_ACTIVATION);
  final GridChooserViewerColumn c1=new GridChooserViewerColumn(viewer,SWT.NONE);
  c1.setLabelProvider(new TestColumnLabelProvider(0));
  c1.getColumn().setText("Test");
  c1.getColumn().setMoveable(true);
  final GridChooserViewerColumn c2=new GridChooserViewerColumn(viewer,SWT.NONE);
  c2.setLabelProvider(new TestColumnLabelProvider(1));
  c2.setEditingSupport(new TextEditingSupport(viewer,1));
  c2.getColumn().setText("Test 2");
  c2.getColumn().setMoveable(true);
  new GridChooserColumnWeightedResize(viewer.getControl(),new int[]{1,1});
  viewer.setInput(new String[][]{{"Andrew","2","3"},{"Bill","2","3"},{"C","2","3"},{"bob","2","3"},{"1","2","3"},{"11","2","3"},{"2","2","3"},{"1.1","2","3"}});
  shell.open();
  while (!shell.isDisposed()) {
    if (!display.readAndDispatch())     display.sleep();
  }
}
 

Example 39

From project JGit, under directory /org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/.

Source file: GitHistoryPage.java

  20 
vote

private void attachCommitSelectionChanged(){
  graph.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    final SelectionChangedEvent event){
      final ISelection s=event.getSelection();
      if (s.isEmpty() || !(s instanceof IStructuredSelection)) {
        commentViewer.setInput(null);
        fileViewer.setInput(null);
        return;
      }
      final IStructuredSelection sel;
      final PlotCommit<?> c;
      sel=((IStructuredSelection)s);
      c=(PlotCommit<?>)sel.getFirstElement();
      commentViewer.setInput(c);
      fileViewer.setInput(c);
      revObjectSelectionProvider.setSelection(s);
    }
  }
);
  commentViewer.addCommitNavigationListener(new CommitNavigationListener(){
    public void showCommit(    final RevCommit c){
      graph.selectCommit(c);
    }
  }
);
  findToolbar.addSelectionListener(new Listener(){
    public void handleEvent(    Event event){
      graph.selectCommit((RevCommit)event.data);
    }
  }
);
}
 

Example 40

From project koneki.ldt, under directory /plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/interpreters/.

Source file: LuaInterpreterPreferencePage.java

  20 
vote

/** 
 * Copy of the super method without the initialization of the default interpreter and customizing interpreter list validation
 */
@Override protected Control createContents(final Composite ancestor){
  initializeDialogUnits(ancestor);
  noDefaultAndApplyButton();
  GridLayout layout=new GridLayout();
  layout.numColumns=1;
  layout.marginHeight=0;
  layout.marginWidth=0;
  ancestor.setLayout(layout);
  fInterpretersBlock=(LuaInterpretersBlock)createInterpretersBlock();
  fInterpretersBlock.createControl(ancestor);
  Control control=fInterpretersBlock.getControl();
  GridData data=new GridData(GridData.FILL_BOTH);
  data.horizontalSpan=1;
  control.setLayoutData(data);
  fInterpretersBlock.restoreColumnSettings(getDialogSettings(false),IScriptDebugHelpContextIds.INTERPRETER_PREFERENCE_PAGE);
  PlatformUI.getWorkbench().getHelpSystem().setHelp(ancestor,IScriptDebugHelpContextIds.INTERPRETER_PREFERENCE_PAGE);
  checkDefaultInterpreter();
  fInterpretersBlock.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      validateInterpreterList();
    }
  }
);
  applyDialogFont(ancestor);
  validateInterpreterList();
  return ancestor;
}
 

Example 41

From project logsaw-app, under directory /net.sf.logsaw.ui/src/net/sf/logsaw/ui/dialogs/.

Source file: FilterClauseComposite.java

  20 
vote

/** 
 * Constructor.
 * @param parent the parent composite
 * @param style the style flags
 * @param log the log resource
 */
public FilterClauseComposite(Composite parent,int style,ILogResource log){
  super(parent,style);
  this.log=log;
  GridLayout layout=new GridLayout(4,false);
  layout.horizontalSpacing=10;
  setLayout(layout);
  setLayoutData(new GridData(SWT.FILL,SWT.NONE,true,false));
  fieldComboViewer=new ComboViewer(this,SWT.BORDER | SWT.READ_ONLY);
  WritableList model=new WritableList(log.getDialect().getFieldProvider().getAllFields(),ALogEntryField.class);
  ViewerSupport.bind(fieldComboViewer,model,PojoProperties.values(new String[]{"label"}));
  fieldComboViewer.setComparator(new ViewerComparator());
  fieldComboViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent e){
      IStructuredSelection sel=(IStructuredSelection)e.getSelection();
      ALogEntryField<?,?> fld=(ALogEntryField<?,?>)sel.getFirstElement();
      updateOperatorCombo(fld);
      recreateRenderer(fld);
      renderer.validateInput();
    }
  }
);
  operatorComboViewer=new ComboViewer(this,SWT.BORDER | SWT.READ_ONLY);
  operatorModel=WritableList.withElementType(Operator.class);
  ViewerSupport.bind(operatorComboViewer,operatorModel,PojoProperties.values(new String[]{"label"}));
  operatorComboViewer.setComparator(new ViewerComparator());
  removeButton=new Button(this,SWT.NONE);
  removeButton.setText(Messages.FilterClauseComposite_label_remove);
  removeButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      fireRemoveButtonPressed();
    }
  }
);
  fieldComboViewer.setSelection(new StructuredSelection(fieldComboViewer.getElementAt(0)));
}
 

Example 42

From project makegood, under directory /com.piece_framework.makegood.ui/src/com/piece_framework/makegood/ui/.

Source file: ActivePart.java

  20 
vote

public void update(IWorkbenchPart part){
  String id=part.getSite().getId();
  if (ResultView.VIEW_ID.equals(id))   return;
  if (VIEW_ID_PHPDEBUGOUTPUT.equals(id))   return;
  if (VIEW_ID_PHPBROWSEROUTPUT.equals(id))   return;
  if (IConsoleConstants.ID_CONSOLE_VIEW.equals(id))   return;
  if (shouldUpdateLink(part)) {
    updateLink(part);
  }
  if (!(part instanceof IEditorPart)) {
    ISelectionProvider provider=part.getSite().getSelectionProvider();
    if (provider != null) {
      provider.addSelectionChangedListener(new ISelectionChangedListener(){
        @Override public void selectionChanged(        SelectionChangedEvent event){
          if (shouldUpdateLink(event.getSelection())) {
            updateLink(event.getSelection());
          }
        }
      }
);
    }
  }
}
 

Example 43

From project mousefeed, under directory /com.mousefeed/src/com/mousefeed/eclipse/preferences/.

Source file: ActionInvocationModeControl.java

  20 
vote

/** 
 * Constructor.
 * @param parent the container where to create the UI.Not <code>null</code>.
 */
public ActionInvocationModeControl(final Composite parent){
  super(parent,SWT.NONE);
  this.setLayout(new FormLayout());
  table=createTable(null);
  tableViewer=createTableViewer();
  resizeTableColumns();
  table.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    final KeyEvent e){
      if (e.character == SWT.DEL && e.stateMask == 0) {
        removeSelected();
        e.doit=false;
      }
    }
  }
);
  tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    final SelectionChangedEvent event){
      onTableSelectionChanged();
    }
  }
);
  removeButton=createRemoveButton();
  layoutTable(removeButton);
  createAddReminder(removeButton);
  onTableSelectionChanged();
}
 

Example 44

From project mwe, under directory /plugins/org.eclipse.emf.mwe.ewm.editor/src/org/eclipse/emf/mwe/ewm/orchestration/presentation/.

Source file: OrchestrationEditor.java

  20 
vote

/** 
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the current one. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer){
  if (currentViewer != viewer) {
    if (selectionChangedListener == null) {
      selectionChangedListener=new ISelectionChangedListener(){
        public void selectionChanged(        SelectionChangedEvent selectionChangedEvent){
          setSelection(selectionChangedEvent.getSelection());
        }
      }
;
    }
    if (currentViewer != null) {
      currentViewer.removeSelectionChangedListener(selectionChangedListener);
    }
    if (viewer != null) {
      viewer.addSelectionChangedListener(selectionChangedListener);
    }
    currentViewer=viewer;
    setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
  }
}
 

Example 45

From project mylyn-mantis, under directory /com.itsolut.mantis.ui/src/com/itsolut/mantis/ui/wizard/.

Source file: MantisCustomQueryPage.java

  20 
vote

private void createProjectTree(Composite control){
  tree=newEnhancedFilteredTree(control);
  TreeViewer projectTreeViewer=tree.getViewer();
  projectTreeViewer.setLabelProvider(new MantisProjectLabelProvider());
  projectTreeViewer.setContentProvider(new MantisProjectITreeContentProvider());
  projectTreeViewer.addPostSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      if (getSelectedProject() == null) {
        setErrorMessage("Please select a project.");
      }
 else {
        setErrorMessage(null);
      }
      refreshFilterCombo();
    }
  }
);
}
 

Example 46

From project org.openscada.dakara, under directory /org.openscada.vi.model.editor/src/org/openscada/vi/model/VisualInterface/presentation/.

Source file: VisualInterfaceEditor.java

  20 
vote

/** 
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the current one. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer){
  if (currentViewer != viewer) {
    if (selectionChangedListener == null) {
      selectionChangedListener=new ISelectionChangedListener(){
        public void selectionChanged(        SelectionChangedEvent selectionChangedEvent){
          setSelection(selectionChangedEvent.getSelection());
        }
      }
;
    }
    if (currentViewer != null) {
      currentViewer.removeSelectionChangedListener(selectionChangedListener);
    }
    if (viewer != null) {
      viewer.addSelectionChangedListener(selectionChangedListener);
    }
    currentViewer=viewer;
    setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
  }
}
 

Example 47

From project Pdf4Eclipse, under directory /de.vonloesch.pdf4eclipse/src/de/vonloesch/pdf4eclipse/outline/.

Source file: PDFFileOutline.java

  20 
vote

public void createControl(Composite parent){
  super.createControl(parent);
  TreeViewer viewer=getTreeViewer();
  viewer.setContentProvider(new PDFFileContentProvider());
  viewer.setLabelProvider(new PDFFileLabelProvider());
  if (input != null)   viewer.setInput(input);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      if (event.getSelection().isEmpty()) {
        return;
      }
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      for (Iterator<IOutlineNode> iterator=selection.iterator(); iterator.hasNext(); ) {
        IOutlineNode domain=iterator.next();
        IPDFDestination dest=domain.getDestination();
        if (dest != null) {
          editor.gotoAction(dest);
          return;
        }
      }
    }
  }
);
}
 

Example 48

From project PSP-NetParty, under directory /src/pspnetparty/client/swt/.

Source file: LobbyServerSelectDialog.java

  20 
vote

@Override protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  composite.setLayout(new GridLayout(1,false));
  TableViewer viewer=new TableViewer(composite,SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
  Table table=viewer.getTable();
  table.setHeaderVisible(true);
  table.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  TableColumn titleColumn=new TableColumn(table,SWT.LEFT);
  titleColumn.setText("??????");
  TableColumn userCountColumn=new TableColumn(table,SWT.RIGHT);
  userCountColumn.setText("???????");
  TableColumn addressColumn=new TableColumn(table,SWT.LEFT);
  addressColumn.setText("??????");
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setLabelProvider(LobbyServerInfo.LABEL_PROVIDER);
  viewer.setInput(serverList);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent e){
      IStructuredSelection selection=(IStructuredSelection)e.getSelection();
      selectedServer=(LobbyServerInfo)selection.getFirstElement();
      getButton(OK).setEnabled(selectedServer != null);
    }
  }
);
  viewer.addDoubleClickListener(new IDoubleClickListener(){
    @Override public void doubleClick(    DoubleClickEvent e){
      IStructuredSelection selection=(IStructuredSelection)e.getSelection();
      selectedServer=(LobbyServerInfo)selection.getFirstElement();
      setReturnCode(OK);
      close();
    }
  }
);
  addressColumn.pack();
  userCountColumn.pack();
  titleColumn.pack();
  table.select(0);
  return composite;
}
 

Example 49

From project recommenders, under directory /plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/.

Source file: ExtdocView.java

  20 
vote

private void createProviderOverview(){
  viewer=new TableViewer(sash);
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setLabelProvider(new LabelProvider(){
    @Override public String getText(    Object element){
      return ((ExtdocProvider)element).getDescription().getName();
    }
    @Override public Image getImage(    Object element){
      return ((ExtdocProvider)element).getDescription().getImage();
    }
  }
);
  viewer.setInput(providers);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      ExtdocProvider newProvider=RCPUtils.<ExtdocProvider>first(event.getSelection()).orNull();
      if (newProvider == activeProvider) {
        return;
      }
      activeProvider=newProvider;
      Job job=new Job("Update Extdoc"){
        @Override protected IStatus run(        IProgressMonitor monitor){
          onJavaSelection(activeSelection);
          return Status.OK_STATUS;
        }
      }
;
      job.setSystem(true);
      job.schedule();
    }
  }
);
  viewer.setSelection(new StructuredSelection(Iterables.getFirst(providers,null)));
}
 

Example 50

From project scisoft-ui, under directory /uk.ac.diamond.scisoft.analysis.rcp/src/uk/ac/diamond/scisoft/analysis/rcp/explorers/.

Source file: ImageExplorer.java

  20 
vote

public ImageExplorer(Composite parent,IWorkbenchPartSite partSite,ISelectionChangedListener valueSelect){
  super(parent,partSite,valueSelect);
  display=parent.getDisplay();
  setLayout(new FillLayout());
  viewer=new TableViewer(this,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
  viewer.getTable().setHeaderVisible(true);
  TableColumn tc=new TableColumn(viewer.getTable(),SWT.LEFT);
  tc.setText("Name");
  tc.setWidth(200);
  tc=new TableColumn(viewer.getTable(),SWT.LEFT);
  tc.setText("min");
  tc.setWidth(100);
  tc=new TableColumn(viewer.getTable(),SWT.LEFT);
  tc.setText("max");
  tc.setWidth(100);
  tc=new TableColumn(viewer.getTable(),SWT.LEFT);
  tc.setText("Class");
  tc.setWidth(100);
  viewer.setContentProvider(new ViewContentProvider());
  viewer.setLabelProvider(new ViewLabelProvider());
  listener=new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent arg0){
      selectItemSelection();
    }
  }
;
  viewer.addSelectionChangedListener(listener);
  if (metaValueListener != null) {
    final ImageExplorer provider=this;
    contextListener=new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        int i=viewer.getTable().getMenu().indexOf((MenuItem)e.widget);
        SelectionChangedEvent ce=new SelectionChangedEvent(provider,new MetadataSelection(metaNames.get(i)));
        metaValueListener.selectionChanged(ce);
      }
    }
;
  }
}
 

Example 51

From project sketch, under directory /org.eclipse.sketch.examples.shapes.diagram/src/org/eclipse/sketch/examples/shapes/diagram/part/.

Source file: ModelElementSelectionPage.java

  20 
vote

/** 
 * @generated
 */
public void createControl(Composite parent){
  initializeDialogUnits(parent);
  Composite plate=new Composite(parent,SWT.NONE);
  plate.setLayoutData(new GridData(GridData.FILL_BOTH));
  GridLayout layout=new GridLayout();
  layout.marginWidth=0;
  plate.setLayout(layout);
  setControl(plate);
  Label label=new Label(plate,SWT.NONE);
  label.setText(getSelectionTitle());
  label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
  modelViewer=new TreeViewer(plate,SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER);
  GridData layoutData=new GridData(GridData.FILL_BOTH);
  layoutData.heightHint=300;
  layoutData.widthHint=300;
  modelViewer.getTree().setLayoutData(layoutData);
  modelViewer.setContentProvider(new AdapterFactoryContentProvider(ShapesDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
  modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(ShapesDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
  if (selectedModelElement != null) {
    modelViewer.setInput(selectedModelElement.eResource());
    modelViewer.setSelection(new StructuredSelection(selectedModelElement));
  }
  modelViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      ModelElementSelectionPage.this.updateSelection((IStructuredSelection)event.getSelection());
    }
  }
);
  setPageComplete(validatePage());
}
 

Example 52

From project sveditor, under directory /sveditor/plugins/net.sf.sveditor.ui/src/net/sf/sveditor/ui/prop_pages/.

Source file: ProjectDirectoryDialog.java

  20 
vote

@Override protected Control createDialogArea(Composite p){
  Composite parent=new Composite(p,SWT.NONE);
  parent.setLayout(new GridLayout(1,true));
  fTreeViewer=new TreeViewer(parent);
  GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true);
  gd.widthHint=300;
  gd.heightHint=300;
  fTreeViewer.getControl().setLayoutData(gd);
  fTreeViewer.setAutoExpandLevel(2);
  fTreeViewer.setContentProvider(new WorkbenchContentProvider());
  fTreeViewer.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      return (element instanceof IContainer && ((IResource)element).getProject().equals(fProject));
    }
  }
);
  fTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
  fTreeViewer.setInput(ResourcesPlugin.getWorkspace());
  fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection sel=(IStructuredSelection)fTreeViewer.getSelection();
      if (sel.getFirstElement() != null) {
        fPathStr=((IContainer)sel.getFirstElement()).getFullPath().toOSString();
      }
    }
  }
);
  fTreeViewer.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      buttonPressed(IDialogConstants.OK_ID);
    }
  }
);
  return fTreeViewer.getControl();
}
 

Example 53

From project tabris-demos, under directory /com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/enron/.

Source file: EnronExample.java

  20 
vote

private void createTreeArea(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=ExampleUtil.createGridLayout();
  composite.setLayout(layout);
  viewer=new TreeViewer(composite,SWT.SINGLE | SWT.VIRTUAL);
  viewer.setUseHashlookup(true);
  TreeColumn treeColumn=new TreeColumn(viewer.getTree(),SWT.NONE);
  treeColumn.setWidth(200);
  TreeColumn treeColumn2=new TreeColumn(viewer.getTree(),SWT.NONE);
  treeColumn2.setWidth(200);
  viewer.getTree().setToolTipText("Enron Mailbox");
  viewer.getControl().setLayoutData(ExampleUtil.createFillData());
  viewer.setLabelProvider(new EnronLabelProvider(parent.getDisplay()));
  viewer.setContentProvider(new EnronLazyContentProvider(viewer));
  viewer.setInput(getDataSet());
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      Object firstElement=selection.getFirstElement();
      if (firstElement instanceof Node) {
        nodeSelected((Node)firstElement);
      }
    }
  }
);
}
 

Example 54

From project texlipse, under directory /net.sourceforge.texlipse/source/net/sourceforge/texlipse/editor/.

Source file: TexEditor.java

  20 
vote

/** 
 * Create the part control.
 * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 */
public void createPartControl(Composite parent){
  super.createPartControl(parent);
  ProjectionViewer projectionViewer=(ProjectionViewer)getSourceViewer();
  fProjectionSupport=new ProjectionSupport(projectionViewer,getAnnotationAccess(),getSharedColors());
  fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
  fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
  fProjectionSupport.install();
  if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.CODE_FOLDING)) {
    projectionViewer.doOperation(ProjectionViewer.TOGGLE);
  }
  fAnnotationUpdater=new TexlipseAnnotationUpdater(this);
  ((IPostSelectionProvider)getSelectionProvider()).addPostSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      documentModel.removeStatusLineErrorMessage();
    }
  }
);
  this.getDocumentProvider().getDocument(getEditorInput()).addDocumentListener(this.documentModel);
  this.documentModel.initializeModel();
  this.documentModel.updateNow();
  ISourceViewer sourceViewer=getSourceViewer();
  if (sourceViewer instanceof ITextViewerExtension) {
    if (fBracketInserter == null)     fBracketInserter=new BracketInserter(getSourceViewer(),this);
    ((ITextViewerExtension)sourceViewer).prependVerifyKeyListener(fBracketInserter);
  }
}
 

Example 55

From project Utah-Tools-Decision-Support, under directory /core/edu.utah.cdmcc.decisionsupport.application.core/src/edu/utah/cdmcc/views/.

Source file: DecisionTableViewTemplate.java

  20 
vote

@Override public void createPartControl(final Composite parent){
  decisionTableViewer.setContentProvider(new DecisionContentProvider());
  decisionTableViewer.setInput(ApplicationControllers.getDecisionController().getDecisionsForPatient());
  checkInvalidDecisions(ApplicationControllers.getDecisionController().getDecisionsForPatient());
  decisionTableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      if (event.getSelection() instanceof IStructuredSelection) {
        IStructuredSelection ss=(IStructuredSelection)event.getSelection();
        ClinicalDecision decision=(ClinicalDecision)ss.getFirstElement();
        ApplicationControllers.getDecisionController().fireDecisionChanged(decision);
      }
    }
  }
);
  decisionTableViewer.addCheckStateListener(new ICheckStateListener(){
    public void checkStateChanged(    CheckStateChangedEvent event){
      ClinicalDecision decision=(ClinicalDecision)event.getElement();
      if (event.getChecked() == true) {
        decision.setValid(false);
      }
 else {
        decision.setValid(true);
      }
      IPatientDAO patientDAO=DAOFactory.instance(DAOFactory.HIBERNATE).getPatientDAO();
      try {
        patientDAO.getSession().beginTransaction();
        patientDAO.updatePatientValues(decision.getPatient());
        patientDAO.getSession().getTransaction().commit();
      }
 catch (      HibernateException e) {
        throw new UtahToolboxException(ErrorCode.HIBERNATE_ERROR,e);
      }
      ApplicationControllers.getDecisionController().fireDecisionStored(decision);
    }
  }
);
  addListenerHookups();
  ApplicationControllers.getDecisionController().setInvalidRecordsShown(false);
  decisionTableViewer.addFilter(getInvalidFilter);
}
 

Example 56

From project warlock2, under directory /stormfront/cc.warlock.rcp.stormfront/src/cc/warlock/rcp/stormfront/ui/prefs/.

Source file: PresetsPreferencePage.java

  20 
vote

protected void createPresetsTable(Composite main){
  Group presetsGroup=new Group(main,SWT.NONE);
  presetsGroup.setLayout(new GridLayout(6,false));
  GridData data=new GridData(GridData.FILL,GridData.FILL,true,true);
  data.horizontalSpan=3;
  presetsGroup.setLayoutData(data);
  presetsGroup.setText("Presets");
  bgSelector=colorSelectorWithLabel(presetsGroup,"Background color:");
  fgSelector=colorSelectorWithLabel(presetsGroup,"Foreground color:");
  stylesTable=new TableViewer(presetsGroup,SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL| SWT.FULL_SELECTION);
  TableColumn column=new TableColumn(stylesTable.getTable(),SWT.NONE,0);
  column.setWidth(400);
  stylesTable.setUseHashlookup(true);
  stylesTable.setColumnProperties(new String[]{"preset"});
  stylesTable.setContentProvider(new ArrayContentProvider());
  stylesTable.setLabelProvider(new PresetsLabelProvider());
  data=new GridData(GridData.FILL,GridData.FILL,true,true);
  data.horizontalSpan=6;
  stylesTable.getTable().setLayoutData(data);
  stylesTable.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      presetSelected((IStructuredSelection)stylesTable.getSelection());
    }
  }
);
}
 

Example 57

From project xrepl, under directory /org.xrepl.repl.ui/src/org/xrepl/ui/embedded/.

Source file: EmbeddedXtextEditor.java

  20 
vote

private void createSourceViewer(Composite parent){
  fVerticalRuler=createVerticalRuler();
  fSourceViewer=fSourceViewerFactory.createSourceViewer(parent,fVerticalRuler,getOverviewRuler(),true,fStyle);
  fViewerConfiguration=fSourceViewerConfigurationProvider.get();
  fSourceViewer.configure(fViewerConfiguration);
  installProjectionSupport(fSourceViewer);
  getSourceViewerDecorationSupport(fSourceViewer);
  fSourceViewer.getTextWidget().addFocusListener(new SourceViewerFocusListener());
  fSourceViewerDecorationSupport.install(fPreferenceStoreAccess.getPreferenceStore());
  parent.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      fSourceViewerDecorationSupport.dispose();
    }
  }
);
  fDocument=fDocumentProvider.get();
  if (fDocument != null) {
    IDocumentPartitioner partitioner=documentPartitioner.get();
    partitioner.connect(fDocument);
    fDocument.setDocumentPartitioner(partitioner);
  }
  ValidationJob job=new ValidationJob(fResourceValidator,fDocument,new IValidationIssueProcessor(){
    private AnnotationIssueProcessor annotationIssueProcessor;
    public void processIssues(    List<Issue> issues,    IProgressMonitor monitor){
      if (annotationIssueProcessor == null) {
        annotationIssueProcessor=new AnnotationIssueProcessor(fDocument,fSourceViewer.getAnnotationModel(),new IssueResolutionProvider.NullImpl());
      }
      if (annotationIssueProcessor != null)       annotationIssueProcessor.processIssues(issues,monitor);
    }
  }
,CheckMode.FAST_ONLY);
  fDocument.setValidationJob(job);
  fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      updateSelectionDependentActions();
    }
  }
);
}
 

Example 58

From project libra, under directory /plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/.

Source file: ConfigurationOSGiModuleEditorPart.java

  19 
vote

/** 
 */
protected void selectOsgiBundle(){
  if (readOnly)   return;
  try {
    selection=osgiBundlesTable.getSelectionIndex();
    remove.setEnabled(true);
    for (    ISelectionChangedListener changedListener : selectionChangedListeners)     changedListener.selectionChanged(new SelectionChangedEvent(this,getSelection()));
  }
 catch (  Exception e) {
    selection=-1;
    remove.setEnabled(false);
  }
}