Java Code Examples for org.eclipse.swt.widgets.Listener

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 libra, under directory /plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/.

Source file: BundleInformationMasterDetailsBlock.java

  22 
vote

private void hookResizeListener(){
  Listener listener=((MDSashForm)sashForm).listener;
  Control[] children=sashForm.getChildren();
  for (  Control element : children) {
    if (element instanceof Sash) {
      continue;
    }
    element.addListener(SWT.Resize,listener);
  }
}
 

Example 2

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

Source file: NagPopUp.java

  22 
vote

/** 
 * Adds listeners to close the dialog on any user action.
 * @see #closeOnActionListener
 * @see #CLOSE_LISTENER_TIMEOUT
 */
private void addCloseOnActionListeners(){
  getDisplay().timerExec(CLOSE_LISTENER_TIMEOUT,new Runnable(){
    public void run(){
      if (!open) {
        return;
      }
      final Listener l=closeOnActionListener;
      getDisplay().addFilter(SWT.MouseDown,l);
      getDisplay().addFilter(SWT.Selection,l);
      getDisplay().addFilter(SWT.KeyDown,l);
    }
  }
);
}
 

Example 3

From project mylyn.builds, under directory /org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/view/.

Source file: BuildsView.java

  22 
vote

/** 
 * Initializes automatic resize of the tree control columns. The size of these will be adjusted when a node is expanded or collapsed and when the tree changes size.
 * @param tree the tree to resize
 */
private void installAutomaticResize(final Tree tree){
  Listener listener=new Listener(){
    public void handleEvent(    Event e){
      packColumnsAsync(tree);
    }
  }
;
  tree.addListener(SWT.Collapse,listener);
  tree.addListener(SWT.Expand,listener);
  tree.getParent().addListener(SWT.Resize,listener);
}
 

Example 4

From project org.openscada.external, under directory /org.eclipse.albireo/src/org/eclipse/albireo/internal/.

Source file: GlobalFocusHandler.java

  22 
vote

protected void fireEvent(final Event event){
  for (final Iterator iterator=this.listeners.iterator(); iterator.hasNext(); ) {
    final Listener listener=(Listener)iterator.next();
    listener.handleEvent(event);
  }
}
 

Example 5

From project swtbot, under directory /org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/.

Source file: Tab.java

  22 
vote

/** 
 * Hooks all listeners to the specified widget.
 */
void hookListeners(Widget widget){
  if (logging) {
    Listener listener=new Listener(){
      public void handleEvent(      Event event){
        log(event);
      }
    }
;
    for (int i=0; i < Tab.EVENT_NAMES.length; i++)     if (eventsFilter[i])     widget.addListener(((Integer)Tab.EVENT_NAMES[i][1]).intValue(),listener);
  }
}
 

Example 6

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

Source file: Toolkit.java

  21 
vote

/** 
 * Creates and returns a new Link, which when selected, will run the specified action.
 * @param parent The parent composite in which to create the new link.
 * @param text The text to display in the link.
 * @param action The action to execute when the Link is selected.
 * @return The new link.
 */
public Link newActionLink(Composite parent,String text,final IAction action){
  Link link=new Link(parent,SWT.NONE);
  link.setText(createAnchor(text,text));
  link.setBackground(parent.getBackground());
  link.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      action.run();
    }
  }
);
  return link;
}
 

Example 7

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

Source file: BinaryBundleExporterConfigurationDialog.java

  21 
vote

/** 
 * @param settingsGroup
 */
private void createSettings(Group settingsGroup){
  _includeSourcesCheckBox=new Button(settingsGroup,SWT.CHECK);
  _includeSourcesCheckBox.setText("Include sources in OSGI-OPT");
  _includeSourcesCheckBox.setSelection(_includeSources);
  _includeSourcesCheckBox.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event event){
      _includeSources=_includeSourcesCheckBox.getSelection();
    }
  }
);
}
 

Example 8

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

Source file: ModuleSearchViewPart.java

  21 
vote

private void initSearchInfo(){
  searchInfo=new Link(parent,0);
  searchInfo.setLayoutData(GridDataFactory.swtDefaults().span(4,1).create());
  searchInfo.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event e){
      updateBeforeSearch(false);
      moduleSearchManager.fetchNextModules();
    }
  }
);
  updateInfoLabel();
}
 

Example 9

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

Source file: PasserelleModelEditor.java

  21 
vote

protected void configureGraphicalViewer(){
  super.configureGraphicalViewer();
  ScrollingGraphicalViewer viewer=(ScrollingGraphicalViewer)getGraphicalViewer();
  PasserellRootEditPart root=new PasserellRootEditPart();
  List<String> zoomLevels=new ArrayList<String>(3);
  zoomLevels.add(ZoomManager.FIT_ALL);
  zoomLevels.add(ZoomManager.FIT_WIDTH);
  zoomLevels.add(ZoomManager.FIT_HEIGHT);
  root.getZoomManager().setZoomLevelContributions(zoomLevels);
  IAction zoomIn=new ZoomInAction(root.getZoomManager());
  IAction zoomOut=new ZoomOutAction(root.getZoomManager());
  getActionRegistry().registerAction(zoomIn);
  getActionRegistry().registerAction(zoomOut);
  getSite().getKeyBindingService().registerAction(zoomIn);
  getSite().getKeyBindingService().registerAction(zoomOut);
  viewer.setRootEditPart(root);
  viewer.setEditPartFactory(createEditPartFactory());
  ContextMenuProvider provider=new PasserelleContextMenuProvider(viewer,getActionRegistry());
  viewer.setContextMenu(provider);
  getSite().registerContextMenu("com.isencia.passerelle.workbench.model.editor.ui.editor.contextmenu",provider,viewer);
  GraphicalViewerKeyHandler graphicalViewerKeyHandler=new GraphicalViewerKeyHandler(viewer);
  graphicalViewerKeyHandler.setParent(getCommonKeyHandler());
  graphicalViewerKeyHandler.put(KeyStroke.getPressed('X',SWT.CTRL,0),getActionRegistry().getAction(ActionFactory.CUT.getId()));
  viewer.setKeyHandler(graphicalViewerKeyHandler);
  viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL),MouseWheelZoomHandler.SINGLETON);
  IAction showRulers=new ToggleRulerVisibilityAction(getGraphicalViewer());
  getActionRegistry().registerAction(showRulers);
  IAction snapAction=new ToggleSnapToGeometryAction(getGraphicalViewer());
  getActionRegistry().registerAction(snapAction);
  IAction showGrid=new ToggleGridAction(getGraphicalViewer());
  getActionRegistry().registerAction(showGrid);
  Listener listener=new Listener(){
    public void handleEvent(    Event event){
      handleActivationChanged(event);
    }
  }
;
  getGraphicalControl().addListener(SWT.Activate,listener);
  getGraphicalControl().addListener(SWT.Deactivate,listener);
}
 

Example 10

From project Diver, under directory /ca.uvic.chisel.widgets/src/ca/uvic/chisel/widgets/.

Source file: RangeSliderHelper.java

  21 
vote

RangeSliderHelper(RangeSlider slider){
  this.slider=slider;
  armedLocation=-1;
  Canvas canvas=slider.getCanvas();
  canvas.addMouseListener(this);
  canvas.addMouseMoveListener(this);
  Listener listener=new EventForwarder();
  canvas.addListener(SWT.MouseMove,listener);
  canvas.addListener(SWT.MouseDown,listener);
  canvas.addListener(SWT.MouseEnter,listener);
  canvas.addListener(SWT.MouseUp,listener);
  canvas.addListener(SWT.MouseExit,listener);
  canvas.addListener(SWT.MouseHover,listener);
  canvas.addListener(SWT.MouseMove,listener);
  canvas.addListener(SWT.MouseWheel,listener);
  canvas.addListener(SWT.MouseDoubleClick,listener);
  canvas.addListener(SWT.KeyDown,listener);
  canvas.addListener(SWT.KeyUp,listener);
  canvas.addListener(SWT.MenuDetect,listener);
}
 

Example 11

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

Source file: ConvertToBPMN2ProcessDialog.java

  21 
vote

protected Control createDialogArea(Composite parent){
  Composite parentComposite=(Composite)super.createDialogArea(parent);
  Composite composite=new Composite(parentComposite,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.marginHeight=convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
  layout.marginWidth=convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
  layout.verticalSpacing=convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
  layout.horizontalSpacing=convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
  composite.setLayout(layout);
  composite.setLayoutData(new GridData(GridData.FILL_BOTH));
  composite.setFont(parentComposite.getFont());
  Listener listener=new Listener(){
    public void handleEvent(    Event event){
      setDialogComplete(validatePage());
    }
  }
;
  resourceGroup=new ResourceAndContainerGroup(composite,listener,IDEWorkbenchMessages.SaveAsDialog_fileLabel,IDEWorkbenchMessages.SaveAsDialog_file);
  resourceGroup.setAllowExistingResources(true);
  return parentComposite;
}
 

Example 12

From project Eclipse, under directory /com.mobilesorcery.sdk.builder.s60/src/com/mobilesorcery/sdk/builder/s60/ui/properties/.

Source file: SymbianPropertyPage.java

  21 
vote

protected Control createContents(Composite parent){
  noDefaultAndApplyButton();
  Composite main=new Composite(parent,SWT.NONE);
  main.setLayout(new GridLayout(1,false));
  Group symbianUIDs=new Group(main,SWT.NONE);
  symbianUIDs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  symbianUIDs.setText(Messages.SymbianPropertyPage_S60_UIDs);
  symbianUIDs.setLayout(new GridLayout(3,false));
  s60v2=new Label(symbianUIDs,SWT.NONE);
  s60v2.setText(Messages.SymbianPropertyPage_S60V2_UID);
  s60v2UID=new Text(symbianUIDs,SWT.SINGLE | SWT.BORDER);
  s60v2UID.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  s60v2UID.setText(getUID(S60V2_UID));
  Button generateRandom=new Button(symbianUIDs,SWT.PUSH);
  generateRandom.setText(Messages.SymbianPropertyPage_GenerateTestUIDs);
  generateRandom.addListener(SWT.Selection,new GenerateRandomUIDListener());
  generateRandom.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,true,false,1,2));
  s60v3=new Label(symbianUIDs,SWT.NONE);
  s60v3.setText(Messages.SymbianPropertyPage_S60V3_UID);
  s60v3UID=new Text(symbianUIDs,SWT.SINGLE | SWT.BORDER);
  s60v3UID.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  s60v3UID.setText(getUID(S60V3_UID));
  Listener validateListener=new ValidateListener();
  s60v2UID.addListener(SWT.Modify,validateListener);
  s60v3UID.addListener(SWT.Modify,validateListener);
  return main;
}
 

Example 13

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

Source file: ContentProposalAdapter.java

  21 
vote

protected final Control createDialogArea(final Composite parent){
  if (USE_VIRTUAL) {
    proposalTable=new Table(parent,SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL);
    Listener listener=new Listener(){
      public void handleEvent(      Event event){
        handleSetData(event);
      }
    }
;
    proposalTable.addListener(SWT.SetData,listener);
  }
 else {
    proposalTable=new Table(parent,SWT.H_SCROLL | SWT.V_SCROLL);
  }
  setProposals(filterProposals(proposals,filterText));
  proposalTable.setHeaderVisible(false);
  proposalTable.addSelectionListener(new SelectionListener(){
    public void widgetSelected(    SelectionEvent e){
      if (e.item == null) {
        if (infoPopup != null) {
          infoPopup.close();
        }
      }
 else {
        showProposalDescription();
      }
    }
    public void widgetDefaultSelected(    SelectionEvent e){
      acceptCurrentProposal();
    }
  }
);
  return proposalTable;
}
 

Example 14

From project EMF-IncQuery, under directory /plugins/org.eclipse.viatra2.emf.incquery.tooling.gui/src/org/eclipse/viatra2/emf/incquery/gui/wizards/internal/.

Source file: ElementSelectionDialog.java

  21 
vote

protected Text createFilterText(Composite parent){
  Text text=new Text(parent,SWT.BORDER);
  GridData data=new GridData();
  data.grabExcessVerticalSpace=false;
  data.grabExcessHorizontalSpace=true;
  data.horizontalAlignment=GridData.FILL;
  data.verticalAlignment=GridData.BEGINNING;
  text.setLayoutData(data);
  text.setFont(parent.getFont());
  text.setText((filter == null ? "" : filter));
  Listener listener=new Listener(){
    public void handleEvent(    Event e){
      importFilter.filterString=filterText.getText();
      tableViewer.refresh();
    }
  }
;
  text.addListener(SWT.Modify,listener);
  text.addKeyListener(new KeyListener(){
    public void keyPressed(    KeyEvent e){
      if (e.keyCode == SWT.ARROW_DOWN) {
        tableViewer.getTable().setFocus();
      }
    }
    public void keyReleased(    KeyEvent e){
    }
  }
);
  filterText=text;
  return text;
}
 

Example 15

From project ereviewboard, under directory /org.review_board.ereviewboard.ui/src/org/review_board/ereviewboard/ui/wizard/.

Source file: ReviewboardQueryPage.java

  21 
vote

private void createAllButton(Composite radioComposite){
  Button button=UiUtils.createRadioButton(radioComposite,"All");
  button.setSelection(true);
  final Composite allComposite=createRadioComposite(radioComposite);
  allComposite.setEnabled(false);
  new Label(allComposite,SWT.NONE);
  button.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      reviewRequestQuery=new AllReviewRequestQuery(status);
      getContainer().updateButtons();
    }
  }
);
}
 

Example 16

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

Source file: CommitGraphTable.java

  21 
vote

private void createPaintListener(final Table rawTable){
  rawTable.addListener(SWT.EraseItem,new Listener(){
    public void handleEvent(    final Event event){
      if (0 <= event.index && event.index <= 2)       event.detail&=~SWT.FOREGROUND;
    }
  }
);
  rawTable.addListener(SWT.PaintItem,new Listener(){
    public void handleEvent(    final Event event){
      doPaint(event);
    }
  }
);
}
 

Example 17

From project mylyn.context, under directory /org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/context/ui/.

Source file: AbstractFocusViewAction.java

  21 
vote

/** 
 * Public for testing
 */
public void updateInterestFilter(final boolean on,StructuredViewer viewer){
  if (viewer != null) {
    if (on) {
      if (showEmptyViewMessage && viewer instanceof TreeViewer) {
        Tree tree=((TreeViewer)viewer).getTree();
        Listener drawingListener=viewerToDrawerMap.get(viewer);
        if (drawingListener == null) {
          EmptyContextDrawer drawer=new EmptyContextDrawer(tree);
          viewerToDrawerMap.put(viewer,drawer);
          tree.addListener(SWT.Paint,drawer);
        }
      }
      installInterestFilter(viewer);
      ContextUiPlugin.getViewerManager().addFilteredViewer(viewer,this);
    }
 else {
      if (showEmptyViewMessage && viewer instanceof TreeViewer) {
        Tree tree=((TreeViewer)viewer).getTree();
        EmptyContextDrawer drawer=viewerToDrawerMap.remove(viewer);
        if (drawer != null) {
          tree.removeListener(SWT.Paint,drawer);
        }
      }
      ContextUiPlugin.getViewerManager().removeFilteredViewer(viewer);
      uninstallInterestFilter(viewer);
    }
  }
}
 

Example 18

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

Source file: ControlUpdater.java

  21 
vote

private static void put(final ControlUpdater controlUpdater){
  final Control control=controlUpdater.getControl();
  controlUpdater.addDisposeListener(new Listener(){
    public void handleEvent(    Event event){
      controlUpdater.dispose();
    }
  }
);
synchronized (controlToUpdater) {
    controlToUpdater.put(control,controlUpdater);
  }
}
 

Example 19

From project radrails, under directory /plugins/com.aptana.radrails.rcp/src/com/aptana/radrails/rcp/.

Source file: IDEWorkbenchAdvisor.java

  21 
vote

/** 
 * Initialize the listener for settings changes.
 */
private void initializeSettingsChangeListener(){
  settingsChangeListener=new Listener(){
    boolean currentHighContrast=Display.getCurrent().getHighContrast();
    public void handleEvent(    org.eclipse.swt.widgets.Event event){
      if (Display.getCurrent().getHighContrast() == currentHighContrast)       return;
      currentHighContrast=!currentHighContrast;
      if (new MessageDialog(null,IDEWorkbenchMessages.SystemSettingsChange_title,null,IDEWorkbenchMessages.SystemSettingsChange_message,MessageDialog.QUESTION,new String[]{IDEWorkbenchMessages.SystemSettingsChange_yes,IDEWorkbenchMessages.SystemSettingsChange_no},1).open() == Window.OK) {
        PlatformUI.getWorkbench().restart();
      }
    }
  }
;
}
 

Example 20

From project samolisov-demo, under directory /Eclipse/RCP/Hyperbola/org.rcpbook.hyperbola.ui/src/org/rcpbook/hyperbola/ui/.

Source file: ApplicationWorkbenchWindowAdvisor.java

  21 
vote

private void hookPopupMenu(final IWorkbenchWindow window){
  trayItem.addListener(SWT.MenuDetect,new Listener(){
    public void handleEvent(    Event event){
      MenuManager trayMenu=new MenuManager();
      actionBarAdvisor.fillTrayItem(trayMenu);
      Menu menu=trayMenu.createContextMenu(window.getShell());
      menu.setVisible(true);
    }
  }
);
}
 

Example 21

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

Source file: HDF5TreeExplorer.java

  21 
vote

public HDF5TreeExplorer(Composite parent,IWorkbenchPartSite partSite,ISelectionChangedListener valueSelect){
  super(parent,partSite,valueSelect);
  display=parent.getDisplay();
  setLayout(new FillLayout());
  if (metaValueListener != null) {
    contextListener=new Listener(){
      @Override public void handleEvent(      Event event){
        handleContextClick();
      }
    }
;
  }
  Listener singleListener=new Listener(){
    @Override public void handleEvent(    Event event){
      if (event.button == 1)       handleSingleClick();
    }
  }
;
  tableTree=new HDF5TableTree(this,singleListener,new Listener(){
    @Override public void handleEvent(    Event event){
      if (event.button == 1)       handleDoubleClick();
    }
  }
,contextListener);
  initDragDrop(tableTree.getViewer());
  cListeners=new HashSet<ISelectionChangedListener>();
}
 

Example 22

From project studio2-rcp, under directory /plugins/com.aptana.ide.rcp/src/com/aptana/ide/rcp/.

Source file: IDEWorkbenchAdvisor.java

  21 
vote

/** 
 * Initialize the listener for settings changes.
 */
private void initializeSettingsChangeListener(){
  settingsChangeListener=new Listener(){
    boolean currentHighContrast=Display.getCurrent().getHighContrast();
    public void handleEvent(    org.eclipse.swt.widgets.Event event){
      if (Display.getCurrent().getHighContrast() == currentHighContrast)       return;
      currentHighContrast=!currentHighContrast;
      if (new MessageDialog(null,IDEWorkbenchMessages.SystemSettingsChange_title,null,IDEWorkbenchMessages.SystemSettingsChange_message,MessageDialog.QUESTION,new String[]{IDEWorkbenchMessages.SystemSettingsChange_yes,IDEWorkbenchMessages.SystemSettingsChange_no},1).open() == Window.OK) {
        PlatformUI.getWorkbench().restart();
      }
    }
  }
;
}
 

Example 23

From project trademaker, under directory /src/org/lifeform/application/.

Source file: FontManager.java

  21 
vote

/** 
 * Create a new FontManager.
 */
public FontManager(final Display display,final boolean autoDispose){
  this.fonts=new HashMap<String,ManagedFont>();
  this.reverse=new HashMap<Font,ManagedFont>();
  this.display=display;
  this.autoDispose=autoDispose;
  display.addListener(SWT.Dispose,new Listener(){
    public void handleEvent(    final Event event){
      disposeAll();
    }
  }
);
}
 

Example 24

From project bndtools, under directory /bndtools.core/src/bndtools/wizards/bndfile/.

Source file: NewWrappingBndFileWizardPage.java

  20 
vote

@Override protected void createAdvancedControls(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  new Label(composite,SWT.NONE).setText(Messages.NewWrappingBndFileWizardPage_labelBSN);
  txtBSN=new Text(composite,SWT.BORDER);
  new Label(composite,SWT.NONE).setText(Messages.NewWrappingBndFileWizardPage_labelVersion);
  txtVersion=new Text(composite,SWT.BORDER);
  txtBSN.setText(bsn);
  txtVersion.setText(version.toString());
  txtBSN.addListener(SWT.Modify,new Listener(){
    public void handleEvent(    Event event){
      bsn=txtBSN.getText();
      getContainer().updateButtons();
      getContainer().updateMessage();
    }
  }
);
  txtVersion.addListener(SWT.Modify,new Listener(){
    public void handleEvent(    Event event){
      try {
        version=Version.parseVersion(txtVersion.getText());
        error=null;
      }
 catch (      IllegalArgumentException e) {
        version=null;
        error=Messages.NewWrappingBndFileWizardPage_errorInvalidVersion;
      }
      getContainer().updateButtons();
      getContainer().updateMessage();
    }
  }
);
  composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  GridLayout layout=new GridLayout(2,false);
  layout.marginWidth=0;
  layout.marginHeight=0;
  composite.setLayout(layout);
  txtBSN.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  txtVersion.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  super.createAdvancedControls(parent);
}
 

Example 25

From project bpelunit, under directory /tycho/net.bpelunit.toolsupport/editors/wizards/fields/.

Source file: MessageEditor.java

  20 
vote

private void addButtons(final TreeItem item,final Composite composite){
  this.addLabel(composite,"   ");
  Label label=new Label(composite,SWT.NULL);
  label.setImage(ToolSupportActivator.getImage(ToolSupportActivator.IMAGE_ADD));
  label.setCursor(new Cursor(MessageEditor.this.getDisplay(),SWT.CURSOR_HAND));
  label.setToolTipText("Add another tag of this kind.");
  label.addListener(SWT.MouseUp,new Listener(){
    @Override public void handleEvent(    Event arg0){
      MessageEditor.this.copyItem(item);
    }
  }
);
  label=this.addLabel(composite," ");
  Font oldFont=label.getFont();
  FontData fontData=oldFont.getFontData()[0];
  fontData.height*=.75;
  label.setFont(new Font(oldFont.getDevice(),fontData));
  label=new Label(composite,SWT.NULL);
  label.setImage(ToolSupportActivator.getImage(ToolSupportActivator.IMAGE_DELETE));
  label.setCursor(new Cursor(MessageEditor.this.getDisplay(),SWT.CURSOR_HAND));
  label.setToolTipText("Remove this tag.");
  label.addListener(SWT.MouseUp,new Listener(){
    @Override public void handleEvent(    Event arg0){
      MessageEditor.this.removeItem(item);
      XMLTreeSelectionListener.this.disposeEditor();
    }
  }
);
}
 

Example 26

From project CIShell, under directory /core/org.cishell.utility.swt/src/org/cishell/utility/swt/.

Source file: GUIBuilderUtilities.java

  20 
vote

public static void setCancelable(final Shell shell,final ObjectContainer<GUICanceledException> exceptionThrown){
  shell.addListener(SWT.Traverse,new Listener(){
    public void handleEvent(    Event event){
switch (event.detail) {
case SWT.TRAVERSE_ESCAPE:
        shell.close();
      event.detail=SWT.TRAVERSE_NONE;
    event.doit=false;
  break;
}
}
}
);
shell.addShellListener(new ShellListener(){
public void shellActivated(ShellEvent event){
}
public void shellClosed(ShellEvent event){
if (exceptionThrown != null) {
String exceptionMessage="Canceled by user.";
exceptionThrown.object=new GUICanceledException(exceptionMessage);
}
}
public void shellDeactivated(ShellEvent event){
}
public void shellDeiconified(ShellEvent event){
}
public void shellIconified(ShellEvent event){
}
}
);
}
 

Example 27

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

Source file: DawbResourcePage.java

  20 
vote

protected final void createDestinationGroup(Composite containerGroup){
  Label resourcesLabel=new Label(containerGroup,SWT.NONE);
  resourcesLabel.setText("Parent Folder ");
  this.containerNameField=new Text(containerGroup,SWT.SINGLE | SWT.BORDER);
  containerNameField.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
  final String containerPath=getContainerPath(selection);
  if (containerPath != null)   containerNameField.setText(containerPath);
  containerNameField.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      dialogChanged();
    }
  }
);
  Button containerBrowseButton=new Button(containerGroup,SWT.PUSH);
  containerBrowseButton.setText("Browse...");
  containerBrowseButton.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false));
  containerBrowseButton.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event event){
      final IPath path=queryForContainer(getSpecifiedContainer(),"Choose folder to import to","Choose Folder");
      containerNameField.setText(path.toString());
      dialogChanged();
    }
  }
);
  setButtonLayoutData(containerBrowseButton);
}
 

Example 28

From project dawn-third, under directory /org.dawb.org.csstudio.swt.xygraph/src/org/csstudio/swt/xygraph/util/.

Source file: XYGraphMediaFactory.java

  20 
vote

/** 
 * Private constructor to avoid instantiation.
 */
private XYGraphMediaFactory(){
  _colorRegistry=new ColorRegistry();
  _imageRegistry=new ImageRegistry();
  _fontRegistry=new FontRegistry();
  _imageCache=new HashMap<ImageDescriptor,Image>();
  Display.getDefault().addListener(SWT.Dispose,new Listener(){
    public void handleEvent(    final Event event){
      for (      Image img : _imageCache.values()) {
        img.dispose();
      }
      disposeResources();
    }
  }
);
}
 

Example 29

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

Source file: ImageHistoryTool.java

  20 
vote

@Override protected void createColumns(TableViewer viewer){
  viewer.getTable().addListener(SWT.MeasureItem,new Listener(){
    public void handleEvent(    Event event){
      event.height=40;
    }
  }
);
  ColumnViewerToolTipSupport.enableFor(viewer,ToolTip.NO_RECREATE);
  viewer.setColumnProperties(new String[]{"Selected","Name","Original Plot","Operator"});
  TableViewerColumn var=new TableViewerColumn(viewer,SWT.LEFT,0);
  var.getColumn().setText("Plot");
  var.getColumn().setWidth(50);
  var.setLabelProvider(new ImageCompareLabelProvider());
  var=new TableViewerColumn(viewer,SWT.CENTER,1);
  var.getColumn().setText("Name");
  var.getColumn().setWidth(200);
  var.setLabelProvider(new ImageCompareLabelProvider());
  var.setEditingSupport(new ImageNameEditingSupport(viewer));
  var=new TableViewerColumn(viewer,SWT.CENTER,2);
  var.getColumn().setText("Original File");
  var.getColumn().setWidth(0);
  var.getColumn().setMoveable(false);
  var.getColumn().setResizable(false);
  var.setLabelProvider(new ImageCompareLabelProvider());
  var=new TableViewerColumn(viewer,SWT.CENTER,3);
  var.getColumn().setText("Operator");
  var.getColumn().setWidth(100);
  var.setLabelProvider(new ImageCompareLabelProvider());
  var.setEditingSupport(new ImageOperatorEditingSupport(viewer));
  var=new TableViewerColumn(viewer,SWT.CENTER,4);
  var.getColumn().setText("Shape");
  var.getColumn().setWidth(150);
  var.setLabelProvider(new ImageCompareLabelProvider());
  var=new TableViewerColumn(viewer,SWT.CENTER,5);
  var.getColumn().setText("Weight");
  var.getColumn().setWidth(150);
  var.setLabelProvider(new ImageCompareLabelProvider());
  var.setEditingSupport(new ImageWeightingEditingSupport(viewer));
}
 

Example 30

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swt/src/com/toedter/e4/ui/workbench/renderers/swt/.

Source file: ItemRenderer.java

  20 
vote

protected Listener createParametrizedCommandEventHandler(final MHandledItem item){
  return new Listener(){
    @Override public void handleEvent(    Event event){
      final IEclipseContext eclipseContext=getContext(item);
      EHandlerService service=(EHandlerService)eclipseContext.get(EHandlerService.class.getName());
      ParameterizedCommand command=item.getWbCommand();
      if (command == null) {
        command=generateParameterizedCommand(item,eclipseContext);
      }
      if (command == null) {
        System.err.println("Failed to execute: " + item.getCommand());
        return;
      }
      eclipseContext.set(MItem.class.getName(),item);
      service.executeHandler(command);
      eclipseContext.remove(MItem.class.getName());
    }
  }
;
}
 

Example 31

From project eclim, under directory /org.eclim.vimplugin/java/org/vimplugin/views/.

Source file: CommandView.java

  20 
vote

@Override public void createPartControl(Composite parent){
  input=new Text(parent,SWT.MULTI);
  input.addListener(SWT.KeyDown,new Listener(){
    public void handleEvent(    Event e){
      if (e.character == 0x0D) {
        String line1=input.getText().substring(3);
        if (input.getText().startsWith("vr:")) {
          String[] args={"vim","--servername","GVIM","--remote-send",line1};
          try {
            logger.debug("running: " + Arrays.toString(args));
            Process process=new ProcessBuilder(args).start();
            InputStream is=process.getInputStream();
            InputStreamReader isr=new InputStreamReader(is);
            BufferedReader br=new BufferedReader(isr);
            String line;
            while ((line=br.readLine()) != null) {
              logger.debug(line);
            }
            process.waitFor();
            logger.debug("result: " + process.exitValue());
          }
 catch (          IOException ioe) {
            logger.error("Error sending command.",ioe);
          }
catch (          InterruptedException ie) {
            logger.error("Error sending command.",ie);
          }
        }
 else         if (input.getText().startsWith("nb:")) {
          VimPlugin.getDefault().getVimserver(0).getVc().plain(line1);
        }
        input.setText("");
      }
    }
  }
);
}
 

Example 32

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

Source file: ImplementationsBlock.java

  20 
vote

private void createButtons(final Composite buttonsComp){
  String sAdd=UITexts.implementationsBlock_btnAdd;
  btnAdd=SWTUtil.createPushButton(buttonsComp,sAdd);
  btnAdd.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    final Event evt){
      addHsImplementation();
    }
  }
);
  String sEdit=UITexts.implementationsBlock_btnEdit;
  btnEdit=SWTUtil.createPushButton(buttonsComp,sEdit);
  btnEdit.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    final Event evt){
      editHsImplementation();
    }
  }
);
  String sRemove=UITexts.implementationsBlock_btnRemove;
  btnRemove=SWTUtil.createPushButton(buttonsComp,sRemove);
  btnRemove.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    final Event evt){
      removeSelectedInstallations();
    }
  }
);
}
 

Example 33

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

Source file: IssueAttributePart.java

  20 
vote

@Override protected Control createContent(FormToolkit toolkit,Composite parent){
  attributesComposite=toolkit.createComposite(parent);
  attributesComposite.addListener(SWT.MouseDown,new Listener(){
    public void handleEvent(    Event event){
      Control focus=event.display.getFocusControl();
      if (focus instanceof Text && ((Text)focus).getEditable() == false)       getManagedForm().getForm().setFocus();
    }
  }
);
  GridLayout attributesLayout=EditorUtil.createSectionClientLayout();
  attributesLayout.numColumns=2;
  attributesLayout.horizontalSpacing=7;
  attributesLayout.verticalSpacing=6;
  attributesComposite.setLayout(attributesLayout);
  GridData attributesData=new GridData(GridData.FILL_BOTH);
  attributesData.horizontalSpan=1;
  attributesData.grabExcessVerticalSpace=false;
  attributesComposite.setLayoutData(attributesData);
  createAttributeControls(attributesComposite,toolkit,attributesLayout.numColumns);
  toolkit.paintBordersFor(attributesComposite);
  return attributesComposite;
}
 

Example 34

From project eik, under directory /plugins/info.evanchik.eclipse.karaf.ui/src/main/java/info/evanchik/eclipse/karaf/ui/.

Source file: KarafConfigurationTab.java

  20 
vote

/** 
 * Creates the necessary UI controls to manipulate the features system.
 * @param parent
 */
private void createFeaturesBlock(final Composite parent){
  final Font font=parent.getFont();
  final GridLayout layout=new GridLayout(2,false);
  final Group group=new Group(parent,SWT.NONE);
  group.setFont(font);
  group.setLayout(layout);
  group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  group.setText("Features");
  enableFeaturesManagement=new Button(group,SWT.CHECK);
  enableFeaturesManagement.setText("Enable Karaf Features management");
  enableFeaturesManagement.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    final Event event){
      if (event.widget == enableFeaturesManagement) {
        final boolean enabledState=availableFeaturesViewer.getControl().getEnabled();
        availableFeaturesViewer.getControl().setEnabled(!enabledState);
        bootFeaturesViewer.getControl().setEnabled(!enabledState);
        bootFeatureOrderDecreaseButton.setEnabled(!enabledState);
        bootFeatureOrderIncreaseButton.setEnabled(!enabledState);
        bootFeatureRemoveButton.setEnabled(!enabledState);
        KarafConfigurationTab.this.updateLaunchConfigurationDialog();
      }
    }
  }
);
  enableFeaturesManagement.setLayoutData(new GridData(SWT.BEGINNING));
  final Label bootFeatureRankLabel=new Label(group,SWT.NONE);
  bootFeatureRankLabel.setText("Boot Feature Rank");
  bootFeatureRankLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  createAvailableFeaturesControls(group);
  createBootFeatureManagementControls(group);
}
 

Example 35

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/uk/ac/gda/richbeans/components/selector/.

Source file: GridListEditor.java

  20 
vote

/** 
 * @param par
 * @param switches
 * @param columns
 * @param rows
 */
public GridListEditor(final Composite par,final int switches,final int columns,final int rows){
  super(par,switches,GridListEditor.class.getName());
  this.eventDelegate=new EventManagerDelegate(this);
  this.columns=columns;
  this.rows=rows;
  setLayout(new GridLayout(1,false));
  if ((rows * columns) > 1) {
    this.gridTable=new TableViewer(this,SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION| SWT.NO_SCROLL);
    gridTable.getTable().setLinesVisible(true);
    createContentProvider();
    createLabelProvider();
    createEditor();
    this.tableListener=new Listener(){
      @Override public void handleEvent(      Event event){
        gridTable.setSelection(null);
      }
    }
;
    gridTable.getTable().addListener(SWT.Selection,tableListener);
    gridTable.getControl().setLayoutData(new GridData(SWT.CENTER,SWT.CENTER,false,false));
    setGridHeight(100);
    gridTable.setInput(new Object());
  }
 else {
    selectedIndex=0;
  }
  editorUI=null;
}
 

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 createDisksCustomizeLink(Composite container){
  linkCustomize=new Link(container,SWT.UNDERLINE_LINK);
  linkCustomize.setText("All Brick(s) (<a>customize</a>)");
  linkCustomize.setEnabled(false);
  linkCustomize.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      Display.getDefault().asyncExec(new Runnable(){
        @Override public void run(){
          SelectDisksDialog dialog=new SelectDisksDialog(getShell(),allDevices,selectedDevices,txtName.getText().trim());
          dialog.create();
          if (dialog.open() == Window.OK) {
            selectedDevices=dialog.getSelectedDevices();
            linkCustomize.setText("" + selectedDevices.size() + " Brick(s) (<a>customize</a>)");
            validateForm();
          }
        }
      }
);
    }
  }
);
}
 

Example 37

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

Source file: TableViewerDeleteCellSelectionManager.java

  20 
vote

private void activateHandler(final IHandlerService service){
  final IHandlerActivation activation=service.activateHandler(IWorkbenchCommandConstants.EDIT_DELETE,new AbstractHandler(){
    @Override public Object execute(    ExecutionEvent event) throws ExecutionException {
      delete();
      return null;
    }
    @Override public void setEnabled(    Object evaluationContext){
      setBaseEnabled(UiUtil.hasFocus(_viewer.getControl(),true));
    }
  }
);
  final Table table=_viewer.getControl();
  new Listener(){
{
      table.addListener(SWT.Dispose,this);
      table.addListener(SWT.FocusIn,this);
      table.addListener(SWT.FocusOut,this);
    }
    @Override public void handleEvent(    Event event){
      if (event.type == SWT.Dispose) {
        handleDispose(event);
      }
 else       if (event.type == SWT.FocusIn || event.type == SWT.FocusOut) {
        ((IHandler2)activation.getHandler()).setEnabled(null);
      }
    }
    private void handleDispose(    Event event){
      table.removeListener(SWT.Dispose,this);
      table.removeListener(SWT.FocusIn,this);
      table.removeListener(SWT.FocusOut,this);
      service.deactivateHandler(activation);
    }
  }
;
}
 

Example 38

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

Source file: LogViewEditor.java

  20 
vote

private void updateColumns(List<ALogEntryField<?,?>> newFields,int[] newWidths){
  viewer.getTable().setRedraw(false);
  labelProvider.setFields(newFields.toArray(new ALogEntryField[newFields.size()]));
  TableColumn[] oldColumns=viewer.getTable().getColumns();
  for (int i=0; i < oldColumns.length; i++) {
    oldColumns[i].dispose();
  }
  TableColumn col=new TableColumn(viewer.getTable(),SWT.NONE);
  col.setWidth(20);
  col.setResizable(false);
  int i=0;
  for (  ALogEntryField<?,?> newField : newFields) {
    col=new TableColumn(viewer.getTable(),SWT.NONE);
    col.setText(newField.getLabel());
    if (newField.equals(getLogResource().getDialect().getFieldProvider().getTimestampField())) {
      viewer.getTable().setSortColumn(col);
      viewer.getTable().setSortDirection(SWT.UP);
    }
    int newWidth=newWidths[i++];
    if (newWidth > 0) {
      col.setWidth(newWidth);
    }
 else {
      col.setWidth(100);
    }
    col.addListener(SWT.Resize,new Listener(){
      @Override public void handleEvent(      Event event){
        saveColumnConfig();
      }
    }
);
  }
  viewer.refresh(true);
  viewer.getTable().setRedraw(true);
}
 

Example 39

From project mylyn.incubator, under directory /org.eclipse.mylyn.trac.wiki/src/org/eclipse/mylyn/internal/trac/wiki/editor/.

Source file: TracWikiPageEditor.java

  20 
vote

private void addActionButtons(Composite buttonComposite){
  previewButton=toolkit.createButton(buttonComposite,LABEL_BUTTON_PREVIEW,SWT.NONE);
  GridData previewButtonData=new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
  previewButtonData.widthHint=100;
  previewButton.setLayoutData(previewButtonData);
  previewButton.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event e){
      previewSection.setExpanded(true);
      setText(previewBrowser,"loading preview...");
      previewWiki(previewBrowser,sourceEditor.getTextWidget().getText());
    }
  }
);
  submitButton=toolkit.createButton(buttonComposite,LABEL_BUTTON_SUBMIT,SWT.NONE);
  GridData submitButtonData=new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
  submitButtonData.widthHint=100;
  submitButton.setImage(CommonImages.getImage(TasksUiImages.REPOSITORY_SUBMIT));
  submitButton.setLayoutData(submitButtonData);
  submitButton.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event e){
      InputDialog commentDialog=new InputDialog(null,"Page Comment","Enter a Comment for the page (or cancel the submit):",null,null);
      if (commentDialog.open() == Window.OK) {
        page.getPageInfo().setComment(commentDialog.getValue());
        boolean isAnonymouse=repository.getCredentials(AuthenticationType.REPOSITORY) == null;
        page.getPageInfo().setAuthor(isAnonymouse ? "anonymous" : repository.getUserName());
        page.setContent(sourceEditor.getTextWidget().getText());
        submitToRepository();
      }
    }
  }
);
  setSubmitEnabled(false);
}
 

Example 40

From project org.openscada.orilla, under directory /org.openscada.ae.ui.views/src/org/openscada/ae/ui/views/dialog/.

Source file: FilterAdvancedComposite.java

  20 
vote

public OrCondition(final FilterAdvancedComposite filterAdvancedComposite,final CTabFolder tabFolder){
  this.filterAdvancedComposite=filterAdvancedComposite;
  this.tabItem=new CTabItem(tabFolder,SWT.NULL);
  this.tabItem.setText(Messages.a_condition);
  this.tabContent=new Composite(tabFolder,SWT.NONE);
  this.tabItem.setControl(this.tabContent);
  this.addAssertionComposite=new AddAssertionComposite(this,this.tabContent);
  this.assertionScrolledComposite=new ScrolledComposite(this.tabContent,SWT.V_SCROLL | SWT.NONE);
  this.assertionComposite=new Composite(this.assertionScrolledComposite,SWT.NONE);
  this.assertionScrolledComposite.setContent(this.assertionComposite);
  final GridLayout layout=new GridLayout();
  layout.marginLeft=6;
  layout.marginRight=6;
  layout.marginTop=6;
  layout.marginBottom=6;
  layout.verticalSpacing=12;
  this.tabContent.setLayout(layout);
  final GridData addAssertionCompositeLayoutData=new GridData();
  addAssertionCompositeLayoutData.grabExcessHorizontalSpace=true;
  addAssertionCompositeLayoutData.horizontalAlignment=GridData.FILL;
  this.addAssertionComposite.setLayoutData(addAssertionCompositeLayoutData);
  final GridData assertionCompositeLayoutData=new GridData();
  assertionCompositeLayoutData.grabExcessHorizontalSpace=true;
  assertionCompositeLayoutData.horizontalAlignment=GridData.FILL;
  assertionCompositeLayoutData.grabExcessVerticalSpace=true;
  assertionCompositeLayoutData.verticalAlignment=GridData.FILL;
  this.assertionScrolledComposite.setLayoutData(assertionCompositeLayoutData);
  this.assertionScrolledComposite.setExpandHorizontal(true);
  final RowLayout innerlayout=new RowLayout(SWT.VERTICAL);
  innerlayout.wrap=false;
  this.assertionComposite.setLayout(innerlayout);
  this.assertionComposite.addListener(SWT.Resize,new Listener(){
    public void handleEvent(    final org.eclipse.swt.widgets.Event event){
      final Point s=OrCondition.this.assertionComposite.computeSize(SWT.DEFAULT,SWT.DEFAULT);
      OrCondition.this.assertionComposite.setSize(s.x,s.y);
      refreshGUI();
    }
  }
);
}
 

Example 41

From project phresco-eclipse, under directory /com.photon.phresco.ui/src/com/photon/phresco/ui/dialog/.

Source file: ManageEnvironmentsDialog.java

  20 
vote

protected Button createOkButton(Composite parent,int id,String label,boolean defaultButton){
  ((GridLayout)parent.getLayout()).numColumns++;
  Button button=new Button(parent,SWT.PUSH);
  button.setText(label);
  button.setFont(JFaceResources.getDialogFont());
  button.setData(new Integer(id));
  button.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event event){
      createEnvironment(environmentList,projectCode);
      deleteEnvironment(deletableEnvs,projectCode);
      okPressed();
    }
  }
);
  if (defaultButton) {
    Shell shell=parent.getShell();
    if (shell != null) {
      shell.setDefaultButton(button);
    }
  }
  setButtonLayoutData(button);
  return button;
}
 

Example 42

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

Source file: ComboHistoryManager.java

  20 
vote

public ComboHistoryManager(Combo combo,String[] history,int maxHistory,boolean initialSelect){
  this.combo=combo;
  this.maxHistory=maxHistory;
  if (combo.getItemCount() > 0) {
    combo.add("----------???----------");
    combo.addListener(SWT.Selection,new Listener(){
      @Override public void handleEvent(      Event event){
        if (ComboHistoryManager.this.combo.getSelectionIndex() == historyStartIndex - 1) {
          ComboHistoryManager.this.combo.select(lastSelectedIndex);
        }
 else {
          lastSelectedIndex=ComboHistoryManager.this.combo.getSelectionIndex();
        }
      }
    }
);
  }
  this.historyStartIndex=combo.getItemCount();
  if (history != null)   for (  String s : history) {
    if (Utility.isEmpty(s))     continue;
    combo.add(s);
    this.history.add(s);
    if (this.history.size() == maxHistory)     break;
  }
  if (initialSelect && combo.getItemCount() > 0)   combo.select(0);
 else   combo.setText("");
}
 

Example 43

From project sandbox, under directory /xeclipse/org.xwiki.eclipse.ui/src/main/java/org/xwiki/eclipse/ui/dialogs/.

Source file: SelectionDialog.java

  20 
vote

@Override protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayoutFactory.fillDefaults().applyTo(composite);
  viewer=new TreeViewer(composite,SWT.BORDER | SWT.CHECK);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(viewer.getControl());
  viewer.setLabelProvider(new WorkbenchLabelProvider());
  viewer.setContentProvider(new SelectionDialogContentProvider(objects));
  viewer.setLabelProvider(new WorkbenchLabelProvider());
  viewer.setSorter(new ViewerSorter());
  viewer.setInput(this);
  viewer.getTree().addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      if (event.detail == SWT.CHECK) {
        TreeItem item=(TreeItem)event.item;
        if (item.getChecked()) {
          selectedObjects.add(item.getData());
        }
 else {
          selectedObjects.remove(item.getData());
        }
      }
    }
  }
);
  selectAll(viewer);
  return composite;
}
 

Example 44

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

Source file: TemplateParametersTableViewer.java

  20 
vote

public ValueEditingSupport(Composite parent,ColumnViewer viewer){
  super(viewer);
  fRestrictedIdEditor=new ComboBoxCellEditor(parent,new String[]{},SWT.READ_ONLY);
  fIdEditor=new TextCellEditor(parent,SWT.NONE);
  fClassEditor=new TextCellEditor(parent,SWT.SEARCH + SWT.ICON_SEARCH + SWT.CANCEL+ SWT.ICON_CANCEL);
  final Text t=(Text)fClassEditor.getControl();
  t.addListener(SWT.DefaultSelection,new Listener(){
    public void handleEvent(    Event event){
      ClassBrowseDialog d=new ClassBrowseDialog(t.getShell(),fSourceFolderStr,fActiveParameter.getExtFrom());
      if (d.open() == Dialog.OK) {
        t.setText(d.getSelectedClass());
      }
    }
  }
);
}
 

Example 45

From project TableAllocationProj, under directory /TableAllocationProj/src/com/hexapixel/widgets/ribbon/.

Source file: RibbonGroup.java

  20 
vote

private boolean didMouseExit(int x,int y){
  if (isInside(x,y,getBounds())) {
    if (deHoverListener == null) {
      deHoverListener=new Listener(){
        public void handleEvent(        Event event){
          if (!isInside(event.x,event.y,getBounds())) {
            mIsHoverGroup=false;
            deHover();
            redraw();
          }
        }
      }
;
      Display.getDefault().addFilter(SWT.MouseMove,deHoverListener);
      Display.getDefault().addFilter(SWT.MouseDown,deHoverListener);
    }
    return false;
  }
  return true;
}
 

Example 46

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

Source file: SimpleTreeDemo.java

  20 
vote

private void createContent(Display display,Shell shell){
  final Tree tree=new Tree(shell,SWT.BORDER);
  tree.setToolTipText("Winchester Evangelium");
  for (int i=0; i < 4; i++) {
    TreeItem iItem=new TreeItem(tree,0);
    iItem.setText(getMainCharacterName(i));
    for (int j=0; j < 8; j++) {
      TreeItem jItem=new TreeItem(iItem,0);
      jItem.setText(getSideCharacterName(j));
      for (int k=0; k < 30; k++) {
        TreeItem kItem=new TreeItem(jItem,0);
        kItem.setText("Season 5, Episode " + k);
      }
    }
  }
  tree.addListener(SWT.Expand,new Listener(){
    public void handleEvent(    Event event){
      TreeItem item=(TreeItem)event.item;
      System.out.println("Item selected: " + item.getText());
    }
  }
);
}
 

Example 47

From project Vega, under directory /platform/com.subgraph.vega.application/src/com/subgraph/vega/application/workspaces/.

Source file: SwitchWorkspaceDialog.java

  20 
vote

protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  Label label=new Label(composite,SWT.NONE);
  label.setText("Choose a workspace to open:");
  GridData gd=new GridData(SWT.FILL,SWT.CENTER,true,true);
  label.setLayoutData(gd);
  list=new List(composite,SWT.SINGLE);
  gd=new GridData(SWT.FILL,SWT.FILL,true,true);
  list.setLayoutData(gd);
  for (  WorkspaceRecord rec : records) {
    list.add(rec.getName());
  }
  list.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      setIndex(list.getSelectionIndex());
    }
  }
);
  list.addListener(SWT.MouseDoubleClick,new Listener(){
    public void handleEvent(    Event event){
      setIndex(list.getSelectionIndex());
      okPressed();
    }
  }
);
  list.setSelection(0);
  setIndex(0);
  composite.setLayout(new GridLayout());
  return composite;
}
 

Example 48

From project xwiki-eclipse, under directory /plugins/org.xwiki.eclipse.ui/src/main/java/org/xwiki/eclipse/ui/dialogs/.

Source file: SelectionDialog.java

  20 
vote

@Override protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayoutFactory.fillDefaults().applyTo(composite);
  viewer=new TreeViewer(composite,SWT.BORDER | SWT.CHECK);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(viewer.getControl());
  viewer.setContentProvider(new SelectionDialogContentProvider(objects));
  viewer.setLabelProvider(new WorkbenchLabelProvider());
  viewer.setSorter(new ViewerSorter());
  viewer.setInput(this);
  viewer.getTree().addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      if (event.detail == SWT.CHECK) {
        TreeItem item=(TreeItem)event.item;
        if (item.getChecked()) {
          selectedObjects.add(item.getData());
        }
 else {
          selectedObjects.remove(item.getData());
        }
      }
    }
  }
);
  selectAll(viewer);
  return composite;
}
 

Example 49

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/views/.

Source file: LoadData.java

  19 
vote

/** 
 * Load the date for the selected  {@link Resource resource} in a separatethread. {@inheritDoc}
 */
@Override public void run(){
  Listener[] listeners=table.getListeners(SWT.SetData);
  if (hasItems(listeners)) {
    for (    final Listener l : listeners) {
      if (l instanceof DataListener) {
        table.removeListener(SWT.SetData,l);
      }
    }
  }
  table.clearAll();
  table.removeAll();
  table.setItemCount(0);
  final String pluginResources=getPluginLocation().append("resources").makeAbsolute().toString();
  createDirectory(pluginResources);
  final File file=new File(pluginResources);
  try {
    final Records records=new Records(file,getDefault().getResourceIndex());
    final String rloc=resource.getResourceLocation();
    table.setItemCount((int)records.count(rloc));
    table.addListener(SWT.SetData,new DataListener(records,rloc));
  }
 catch (  IOException ex) {
    logError(ex);
  }
}
 

Example 50

From project ccw, under directory /ccw.core/src/java/ccw/editors/clojure/.

Source file: ClojureSourceViewer.java

  19 
vote

private void addKeyListenerFirst(Control control,KeyListener listener){
  Listener[] keyDownListeners=control.getListeners(SWT.KeyDown);
  Listener[] keyUpListeners=control.getListeners(SWT.KeyUp);
  removeAll(control,SWT.KeyDown,keyDownListeners);
  removeAll(control,SWT.KeyUp,keyUpListeners);
  control.addKeyListener(listener);
  addAll(control,SWT.KeyDown,keyDownListeners);
  addAll(control,SWT.KeyUp,keyUpListeners);
}