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

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 bpelunit, under directory /tycho/net.bpelunit.toolsupport/editors/wizards/fields/.

Source file: MessageEditor.java

  22 
vote

private boolean select(TreeItem newSelection){
  if (newSelection != null) {
    this.tree.setSelection(newSelection);
    Event event=new Event();
    event.item=newSelection;
    event.widget=this.tree;
    this.selectionListener.widgetSelected(new SelectionEvent(event));
    return true;
  }
  return false;
}
 

Example 2

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

Source file: RangeSlider.java

  22 
vote

/** 
 */
private void fireSelectionChanged(){
  Event event=new Event();
  event.button=1;
  Rectangle bounds=getCanvas().getBounds();
  int visualLow=getVisualLow();
  int visualHigh=getVisualHigh();
  event.x=visualLow + bounds.x;
  event.y=bounds.y;
  event.width=visualHigh - visualLow;
  event.height=bounds.height;
  event.item=null;
  notifyListeners(SWT.Selection,event);
}
 

Example 3

From project dozer, under directory /eclipse-plugin/net.sf.dozer.eclipse.plugin/src/org/dozer/eclipse/plugin/editorpage/imagecombo/.

Source file: ImageCombo.java

  22 
vote

void handleFocus(int type){
  if (isDisposed())   return;
switch (type) {
case SWT.FocusIn:
{
      if (hasFocus)       return;
      if (getEditable())       text.selectAll();
      hasFocus=true;
      Shell shell=getShell();
      shell.removeListener(SWT.Deactivate,listener);
      shell.addListener(SWT.Deactivate,listener);
      Display display=getDisplay();
      display.removeFilter(SWT.FocusIn,filter);
      display.addFilter(SWT.FocusIn,filter);
      Event e=new Event();
      notifyListeners(SWT.FocusIn,e);
      break;
    }
case SWT.FocusOut:
{
    if (!hasFocus)     return;
    Control focusControl=getDisplay().getFocusControl();
    if (focusControl == arrow || focusControl == table || focusControl == text)     return;
    hasFocus=false;
    Shell shell=getShell();
    shell.removeListener(SWT.Deactivate,listener);
    Display display=getDisplay();
    display.removeFilter(SWT.FocusIn,filter);
    Event e=new Event();
    notifyListeners(SWT.FocusOut,e);
    break;
  }
}
}
 

Example 4

From project Eclipse, under directory /com.mobilesorcery.sdk.ui/src/com/snapps/swt/.

Source file: SquareButton.java

  22 
vote

protected void doButtonClicked(){
  Event e=new Event();
  e.item=this;
  e.widget=this;
  e.type=SWT.Selection;
  notifyListeners(SWT.Selection,e);
}
 

Example 5

From project Foglyn, under directory /com.foglyn.ui/src/com/foglyn/ui/.

Source file: DateTimeDialog.java

  22 
vote

void gotoToday(){
  Calendar c=Calendar.getInstance();
  date.setYear(c.get(Calendar.YEAR));
  date.setMonth(c.get(Calendar.MONTH));
  date.setDay(c.get(Calendar.DAY_OF_MONTH));
  Event e=new Event();
  e.item=date;
  date.notifyListeners(SWT.Selection,e);
}
 

Example 6

From project iee, under directory /org.eclipse.iee.sample.graph/src/org/jfree/experimental/chart/swt/.

Source file: ChartComposite.java

  22 
vote

/** 
 * Forces a redraw of the canvas by invoking a new PaintEvent.
 */
public void forceRedraw(){
  Event ev=new Event();
  ev.gc=new GC(this.canvas);
  ev.x=0;
  ev.y=0;
  ev.width=this.canvas.getBounds().width;
  ev.height=this.canvas.getBounds().height;
  ev.count=0;
  this.canvas.notifyListeners(SWT.Paint,ev);
  ev.gc.dispose();
}
 

Example 7

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

Source file: CalendarComboCellEditor.java

  22 
vote

private void notifyParentAndFocus(KeyEvent e){
  if (_control == null || _control.isDisposed())   return;
  final Event event=new Event();
  event.character=e.character;
  event.keyCode=e.keyCode;
  event.stateMask=e.stateMask;
  final Composite parent=_control.getParent();
  parent.notifyListeners(SWT.KeyDown,event);
  parent.setFocus();
}
 

Example 8

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

Source file: DisplayUtils.java

  21 
vote

/** 
 * Perform a keypress using the supplied key and optional modifiers.
 * @param display The Display instance.
 * @param key The SWT key code.
 * @param modifiers Optional one or more SWT key modifiers
 */
public static void doKeypress(Display display,int key,int... modifiers){
  for (  int modifier : modifiers) {
    Event event=new Event();
    event.type=SWT.KeyDown;
    event.keyCode=modifier;
    post(display,event);
  }
  Event event=new Event();
  event.keyCode=key;
  event.type=SWT.KeyDown;
  post(display,event);
  event.type=SWT.KeyUp;
  post(display,event);
  for (  int modifier : modifiers) {
    event=new Event();
    event.type=SWT.KeyUp;
    event.keyCode=modifier;
    post(display,event);
  }
}
 

Example 9

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

Source file: CommitAttributePart.java

  21 
vote

private void fetchCommits(final Runnable postHandler){
  IHandlerService handlerService=(IHandlerService)getTaskEditorPage().getEditorSite().getService(IHandlerService.class);
  try {
    IEvaluationContext context=TaskDataHandler.createContext(new StructuredSelection(getTaskData()),handlerService);
    if (postHandler != null)     context.addVariable(TaskDataHandler.POST_HANDLER_CALLBACK,postHandler);
    handlerService.executeCommandInContext(fetchCommits.getCommand(),new Event(),context);
  }
 catch (  CommandException e) {
    GitHub.logError(e);
  }
}
 

Example 10

From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/model/.

Source file: MouseClickHandler.java

  19 
vote

/** 
 * This method is called whenever the mouse's wheel is rolled over a drawing.
 * @param event The mouse wheel event.
 */
public void receiveMouseWheel(Event event){
  double ratio=1.0 + event.count / 3 * Constant.ZOOM_RATE;
  Rectangle rect=workspace.getWindowSize();
  double x=(double)event.x;
  double y=(double)event.y;
  Point screenPoint=new Point(x - rect.getWidth() / 2,((rect.getHeight() - y) - rect.getHeight() / 2));
  Point modelPoint=null;
  Controller controller=br.org.archimedes.Utils.getController();
  try {
    workspace.setMousePosition(workspace.screenToModel(screenPoint));
    modelPoint=workspace.getMousePosition();
    Point viewport=workspace.getViewport();
    double zoom=1 / (workspace.getCurrentZoom() * ratio);
    double xModel=zoom * screenPoint.getX() + viewport.getX();
    double yModel=zoom * screenPoint.getY() + viewport.getY();
    Point newModelPoint=new Point(xModel,yModel);
    Vector modelVector=new Vector(newModelPoint,modelPoint);
    List<UndoableCommand> commands=new ArrayList<UndoableCommand>();
    commands.add(new RelativeZoomCommand(ratio));
    if (!newModelPoint.equals(modelPoint)) {
      commands.add(new PanCommand(viewport,viewport.addVector(modelVector)));
    }
    MacroCommand macro=new MacroCommand(commands);
    List<Command> list=new ArrayList<Command>();
    list.add(macro);
    controller.execute(list);
  }
 catch (  NullArgumentException e) {
    e.printStackTrace();
  }
catch (  NoActiveDrawingException e) {
  }
catch (  IllegalActionException e) {
  }
}
 

Example 11

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

Source file: Toolkit.java

  19 
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 12

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

Source file: LoadData.java

  19 
vote

/** 
 * {@inheritDoc}
 */
@Override public void handleEvent(Event event){
  final TableItem item=(TableItem)event.item;
  int index=event.index;
  try {
    String value=records.retrieve(rloc,index);
    item.setText(value);
  }
 catch (  IOException e) {
    logError(e);
  }
}
 

Example 13

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/wizards/timeseries/.

Source file: AbstractExperimentPage.java

  19 
vote

public void handleEvent(Event event){
  if (listCheckBox.getSelection()) {
    listText.forceFocus();
    rangeCheckBox.setSelection(false);
  }
  enableWidgets();
  validatePage();
}
 

Example 14

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/editor/.

Source file: PeakTableViewer.java

  19 
vote

public void handleEvent(Event event){
  if (event.detail == SWT.TRAVERSE_TAB_PREVIOUS || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
    tableViewer.editElement(tableViewer.getElementAt(table.getSelectionIndex()),myColumn - 1);
  }
  if (event.detail == SWT.TRAVERSE_TAB_NEXT || event.detail == SWT.TRAVERSE_ARROW_NEXT) {
    if (highestColumn == myColumn && table.getSelectionIndex() < ((CMLSpectrum)tableViewer.getInput()).getPeakListElements().get(0).getChildCount() - 1)     tableViewer.editElement(tableViewer.getElementAt(table.getSelectionIndex() + 1),0);
    if (highestColumn > myColumn)     tableViewer.editElement(tableViewer.getElementAt(table.getSelectionIndex()),myColumn + 1);
  }
}
 

Example 15

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

Source file: MDSashForm.java

  19 
vote

public void handleEvent(Event e){
switch (e.type) {
case SWT.MouseEnter:
    e.widget.setData("hover",Boolean.TRUE);
  ((Control)e.widget).redraw();
break;
case SWT.MouseExit:
e.widget.setData("hover",null);
((Control)e.widget).redraw();
break;
case SWT.Paint:
onSashPaint(e);
break;
case SWT.Resize:
hookSashListeners();
break;
default :
break;
}
}
 

Example 16

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

Source file: CenterImageLabelProvider.java

  19 
vote

@Override protected void paint(Event event,Object element){
  Image img=getImage(element);
  if (img != null) {
    Rectangle bounds=((TreeItem)event.item).getBounds(event.index);
    Rectangle imgBounds=img.getBounds();
    bounds.width/=2;
    bounds.width-=imgBounds.width / 2;
    bounds.height/=2;
    bounds.height-=imgBounds.height / 2;
    int x=bounds.width > 0 ? bounds.x + bounds.width : bounds.x;
    int y=bounds.height > 0 ? bounds.y + bounds.height : bounds.y;
    event.gc.drawImage(img,x,y);
  }
}
 

Example 17

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

Source file: AbstractInformationControl.java

  19 
vote

/** 
 * {@inheritDoc}This method is not intended to be overridden by subclasses.
 */
public void addFocusListener(final FocusListener listener){
  if (fFocusListeners.isEmpty()) {
    fShellListener=new Listener(){
      public void handleEvent(      Event event){
        Object[] listeners=fFocusListeners.getListeners();
        for (int i=0; i < listeners.length; i++) {
          FocusListener focusListener=(FocusListener)listeners[i];
          if (event.type == SWT.Activate) {
            focusListener.focusGained(new FocusEvent(event));
          }
 else {
            focusListener.focusLost(new FocusEvent(event));
          }
        }
      }
    }
;
    fShell.addListener(SWT.Deactivate,fShellListener);
    fShell.addListener(SWT.Activate,fShellListener);
  }
  fFocusListeners.add(listener);
}
 

Example 18

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

Source file: AbstractDataManagerView.java

  19 
vote

public void handleEvent(Event event){
  if (AbstractDataManagerView.this.saveFactory != null) {
    Data data[]=AbstractDataManagerView.this.manager.getSelectedData();
    Algorithm algorithm=AbstractDataManagerView.this.saveFactory.createAlgorithm(data,new Hashtable<String,Object>(),Activator.getCIShellContext());
    try {
      algorithm.execute();
    }
 catch (    AlgorithmExecutionException e) {
      if (AbstractDataManagerView.this.logger != null) {
        AbstractDataManagerView.this.logger.log(LogService.LOG_ERROR,e.getMessage(),e);
        e.printStackTrace();
      }
 else {
        AbstractDataManagerView.this.logger=Activator.getLogService();
        if (AbstractDataManagerView.this.logger != null) {
          AbstractDataManagerView.this.logger.log(LogService.LOG_ERROR,"org.cishell.framework.algorithm.AlgorithmExecutionException",e);
          e.printStackTrace();
        }
      }
    }
  }
}
 

Example 19

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

Source file: DawbResourcePage.java

  19 
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 20

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

Source file: DoubleClickModifier.java

  19 
vote

protected DoubleClickModifier(final ColumnViewer viewer){
  viewer.getControl().addListener(SWT.MouseDown,new Listener(){
    @Override public void handleEvent(    Event event){
      setEnabled(false);
    }
  }
);
  viewer.getControl().addListener(SWT.MouseDoubleClick,new Listener(){
    @Override public void handleEvent(    Event event){
      IStructuredSelection selection=(IStructuredSelection)viewer.getSelection();
      if (selection.toList().size() != 1) {
        return;
      }
      final ViewerCell cell=viewer.getCell(new Point(event.x,event.y));
      setEnabled(true);
      viewer.editElement(selection.getFirstElement(),cell != null ? cell.getColumnIndex() : 0);
    }
  }
);
}
 

Example 21

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

Source file: XYGraphMediaFactory.java

  19 
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 22

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

Source file: PlotPrintPreviewDialog.java

  19 
vote

private void paint(Event e,Orientation orientation){
  int canvasBorder=20;
  if (printer == null || printer.isDisposed())   return;
  printer.getPrinterData().orientation=orientation.getValue();
  Rectangle printerBounds=printer.getBounds();
  Point canvasSize=canvas.getSize();
  double viewScaleFactor=(canvasSize.x - canvasBorder * 2) * 1.0 / printerBounds.width;
  viewScaleFactor=Math.min(viewScaleFactor,(canvasSize.y - canvasBorder * 2) * 1.0 / printerBounds.height);
  int offsetX=(canvasSize.x - (int)(viewScaleFactor * printerBounds.width)) / 2;
  int offsetY=(canvasSize.y - (int)(viewScaleFactor * printerBounds.height)) / 2;
  e.gc.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
  e.gc.fillRectangle(offsetX,offsetY,(int)(viewScaleFactor * printerBounds.width),(int)(viewScaleFactor * printerBounds.height));
  e.gc.setLineStyle(SWT.LINE_DASH);
  e.gc.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
  int marginOffsetX=offsetX + (int)(viewScaleFactor * margin.left);
  int marginOffsetY=offsetY + (int)(viewScaleFactor * margin.top);
  if (image != null) {
    int imageWidth=image.getBounds().width;
    int imageHeight=image.getBounds().height;
    double dpiScaleFactorX=printer.getDPI().x * 1.0 / shell.getDisplay().getDPI().x;
    double dpiScaleFactorY=printer.getDPI().y * 1.0 / shell.getDisplay().getDPI().y;
    double imageSizeFactor=Math.min(1,(margin.right - margin.left) * 1.0 / (dpiScaleFactorX * imageWidth));
    imageSizeFactor=Math.min(imageSizeFactor,(margin.bottom - margin.top) * 1.0 / (dpiScaleFactorY * imageHeight));
    e.gc.drawImage(image,0,0,imageWidth,imageHeight,marginOffsetX,marginOffsetY,(int)(dpiScaleFactorX * imageSizeFactor * imageWidth* viewScaleFactor),(int)(dpiScaleFactorY * imageSizeFactor * imageHeight* viewScaleFactor));
  }
}
 

Example 23

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

Source file: ConvertToBPMN2ProcessDialog.java

  19 
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 24

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

  19 
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 25

From project eclipse-instasearch, under directory /instasearch/src/it/unibz/instasearch/jobs/.

Source file: UpdatePluginJob.java

  19 
vote

private void showUpdateManager(){
  PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
    public void run(){
      IHandlerService handlerService=(IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
      if (handlerService != null) {
        try {
          handlerService.executeCommand(UPDATE_MANAGER_COMMAND,new Event());
        }
 catch (        Exception e) {
          InstaSearchPlugin.log(e);
          setProperty(IProgressConstants.ACTION_PROPERTY,new ShowExceptionAction(e,"Error Launching Update Manager"));
        }
      }
    }
  }
);
}
 

Example 26

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.test.util/src/org/springsource/ide/eclipse/commons/frameworks/test/util/.

Source file: SWTBotUtils.java

  19 
vote

public static void doubleClick(SWTWorkbenchBot bot,final SWTBotTable table,int row,int col){
  table.click(row,col);
  UIThreadRunnable.asyncExec(bot.getDisplay(),new VoidResult(){
    public void run(){
      table.widget.notifyListeners(SWT.DefaultSelection,new Event());
    }
  }
);
}
 

Example 27

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

Source file: ImplementationsBlock.java

  19 
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 28

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

Source file: KarafConfigurationTab.java

  19 
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 29

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

  19 
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 30

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

Source file: CFileChooser.java

  19 
vote

public CFileChooser(Composite parent,int style){
  super(parent,style);
  setLayout(new GridLayout(2,false));
  text=new Text(this,SWT.BORDER);
  text.setEnabled(false);
  text.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
  text.addListener(SWT.Modify,new Listener(){
    public void handleEvent(    Event event){
      notifyListeners(SWT.Modify,event);
    }
  }
);
  final Button browseButton=new Button(this,SWT.NONE);
  browseButton.setText("Browse...");
  browseButton.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      FileDialog fileDialog=new FileDialog(getShell());
      fileDialog.setFilterExtensions(new String[]{"Diffs/Patches","All Files"});
      fileDialog.setFilterExtensions(new String[]{"*.diff; *.patch","*.*"});
      String result=fileDialog.open();
      if (result != null) {
        text.setText(result);
      }
    }
  }
);
}
 

Example 31

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

Source file: GridListEditor.java

  19 
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 32

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

Source file: CreateVolumePage1.java

  19 
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();
          }
        }
      }
);
    }
  }
);
}