Package org.eclipse.swt.events

Examples of org.eclipse.swt.events.SelectionListener


    placeHolder = new Composite(buttonComposite, SWT.NONE);
    placeHolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // add importButton listener
    SelectionListener importButtonSelectionListener = new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        invokeImportDialog();
      }
    };
    importButton.addSelectionListener(importButtonSelectionListener);

    // add exportButton listener
    SelectionListener exportButtonSelectionListener = new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        invokeExportDialog();
      }
    };
    exportButton.addSelectionListener(exportButtonSelectionListener);
View Full Code Here


      layout.marginBottom = 5;
      browseButtonsComposite.setLayout(layout);
     
      browseWorkspaceButton = new Button(browseButtonsComposite, SWT.PUSH);
      browseWorkspaceButton.setText(XMLCatalogMessages.UI_BUTTON_MENU_BROWSE_WORKSPACE);
      browseWorkspaceButton.addSelectionListener(new SelectionListener(){

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
          String value = invokeWorkspaceFileSelectionDialog();
          if(value != null) {
            resourceLocationField.setText(value);
          }
        }
      });
     
      browseFileSystemButton = new Button(browseButtonsComposite, SWT.PUSH);
      browseFileSystemButton.setText(XMLCatalogMessages.UI_BUTTON_MENU_BROWSE_FILE_SYSTEM);
      browseFileSystemButton.addSelectionListener(new SelectionListener(){

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
          String value = invokeFileSelectionDialog();
          if(value != null) {
            resourceLocationField.setText(value);
          }
        }
      });
     
      // Key Type
      //
      Label keyTypeLabel = new Label(group, SWT.NONE);
      keyTypeLabel.setText(XMLCatalogMessages.UI_KEY_TYPE_COLON);

      keyTypeCombo = new Combo(group, SWT.READ_ONLY);
      gd = new GridData();
      gd.horizontalAlignment = SWT.FILL;
      gd.grabExcessHorizontalSpace = true;
      keyTypeCombo.setLayoutData(gd);
      updateKeyTypeCombo(getEntry().getEntryType());
      keyTypeCombo.addModifyListener(modifyListener);
      // WorkbenchHelp.setHelp(keyTypeCombo,
      // XMLBuilderContextIds.XMLP_ENTRY_KEY_TYPE);

      // Key
      //
      Label keyValueLabel = new Label(group, SWT.NONE);
      keyValueLabel.setText(XMLCatalogMessages.UI_LABEL_KEY_COLON);
      keyField = new Text(group, SWT.SINGLE | SWT.BORDER);
      // WorkbenchHelp.setHelp(keyField,
      // XMLBuilderContextIds.XMLP_ENTRY_KEY);
      keyField.setLayoutData(gd);
      keyField.setText(getDisplayValue(getEntry().getKey()));
      keyField.addModifyListener(modifyListener);

      Composite group2 = new Composite(composite, SWT.NONE);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      group2.setLayoutData(gd);

      layout = new GridLayout();
      group2.setLayout(layout);

      // checkbox -- note parent is dialogArea
      //
      checkboxButton = new Button(group2, SWT.CHECK);
      // WorkbenchHelp.setHelp(checkboxButton,
      // XMLBuilderContextIds.XMLP_ENTRY_SPECIFY_ALTERNATIVE);
      checkboxButton.setText(XMLCatalogMessages.UI_LABEL_SPECIFY_ALTERNATIVE_WEB_URL);
      checkboxButton.setLayoutData(new GridData());
      checkboxButton.setSelection(getEntry().getAttributeValue(ICatalogEntry.ATTR_WEB_URL) != null);
      SelectionListener buttonListener = new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent event) {
          // no impl
        }

        public void widgetSelected(SelectionEvent event) {
View Full Code Here

      layout.marginBottom = 5;
      browseButtonsComposite.setLayout(layout);
     
      browseWorkspaceButton = new Button(browseButtonsComposite, SWT.PUSH);
      browseWorkspaceButton.setText(XMLCatalogMessages.UI_BUTTON_MENU_BROWSE_WORKSPACE);
      browseWorkspaceButton.addSelectionListener(new SelectionListener(){
 
        public void widgetDefaultSelected(SelectionEvent e) {
        }
 
        public void widgetSelected(SelectionEvent e) {
          String value = invokeWorkspaceFileSelectionDialog();
          if(value != null) {
            resourceLocationField.setText(value);
          }
        }
      });
     
      browseFileSystemButton = new Button(browseButtonsComposite, SWT.PUSH);
      browseFileSystemButton.setText(XMLCatalogMessages.UI_BUTTON_MENU_BROWSE_FILE_SYSTEM);
      browseFileSystemButton.addSelectionListener(new SelectionListener(){
 
        public void widgetDefaultSelected(SelectionEvent e) {
        }
 
        public void widgetSelected(SelectionEvent e) {
View Full Code Here

      layout.marginBottom = 5;
      browseButtonsComposite.setLayout(layout);
     
      browseWorkspaceButton = new Button(browseButtonsComposite, SWT.PUSH);
      browseWorkspaceButton.setText(XMLCatalogMessages.UI_BUTTON_MENU_BROWSE_WORKSPACE);
      browseWorkspaceButton.addSelectionListener(new SelectionListener(){

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
          String value = invokeWorkspaceFileSelectionDialog();
          if(value != null) {
            catalogLocationField.setText(value);
          }
        }
      });
     
      browseFileSystemButton = new Button(browseButtonsComposite, SWT.PUSH);
      browseFileSystemButton.setText(XMLCatalogMessages.UI_BUTTON_MENU_BROWSE_FILE_SYSTEM);
      browseFileSystemButton.addSelectionListener(new SelectionListener(){

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
View Full Code Here

      public void modifyText(ModifyEvent e) {
        setPageComplete(validatePage());
      }
    });
    button.addSelectionListener(new SelectionListener() {

      public void widgetSelected(SelectionEvent e) {
        FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
        dialog
            .setText(OntoUML.diagram.part.Messages.WizardNewFileCreationPage_SelectNewFileDialog);
View Full Code Here

                        showCompareButton = new Button(parent, SWT.TOGGLE | SWT.FLAT);
                        showCompareButton.setImage(SVNUIPlugin.getImage(ISVNUIConstants.IMG_SYNCPANE)); //$NON-NLS-1$
                        showCompareButton.setToolTipText(RbSubclipseMessages.getString("PAGE_CODE_COMPARE"));
                        showCompareButton.setSelection(showCompare);
                        showCompareButton.addSelectionListener(
                              new SelectionListener(){
                                  public void widgetSelected(SelectionEvent e) {
                                      showComparePane(!showCompare);
                                  }
                                  public void widgetDefaultSelected(SelectionEvent e) {
                                  }
View Full Code Here

//        formatAndStyleRangeHelper = new StyledTextForShowingCodeFactory();
//        labelExample = formatAndStyleRangeHelper.createStyledTextForCodePresentation(parent);
//        updateLabelExample(PyFormatStd.getFormat(), PydevPrefs.getChainedPrefStore());

        // colors on list listener
        mColorsList.addSelectionListener(new SelectionListener() {
            public void widgetDefaultSelected(SelectionEvent e) { }
            public void widgetSelected(SelectionEvent e) {
              onColorSelectionChanged();
            }
        });
View Full Code Here

//        formatAndStyleRangeHelper = new StyledTextForShowingCodeFactory();
//        labelExample = formatAndStyleRangeHelper.createStyledTextForCodePresentation(parent);
//        updateLabelExample(PyFormatStd.getFormat(), PydevPrefs.getChainedPrefStore());

        // colors on list listener
        mColorsList.addSelectionListener(new SelectionListener() {
            public void widgetDefaultSelected(SelectionEvent e) { }
            public void widgetSelected(SelectionEvent e) {
              onColorSelectionChanged();
            }
        });
View Full Code Here

    styleText.setText("Style:");

    // style combo
    mStyleCombo = new Combo(settingsComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
    mStyleCombo.setEnabled(false);
    mStyleCombo.addSelectionListener(new SelectionListener() {
      public void widgetSelected(SelectionEvent e) {
        if (mCurrentSelectedAnnotation == null) {
          mCurrentSelectedAnnotation = getDefaultAnnotation();
        }

        mCurrentSelectedAnnotation = new AnnotationStyle(
                mCurrentSelectedAnnotation.getAnnotation(), AnnotationStyle.Style
                        .valueOf(mStyleCombo.getText()), mCurrentSelectedAnnotation.getColor(),
                mCurrentSelectedAnnotation.getLayer());

        mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
      }

      public void widgetDefaultSelected(SelectionEvent e) {
        // not needed
      }

    });
    AnnotationStyle.Style possibleStyles[] = AnnotationStyle.Style.values();

    for (AnnotationStyle.Style style : possibleStyles) {
      mStyleCombo.add(style.name());
    }

    // text color label
    Label colorText = new Label(settingsComposite, SWT.NONE);
    colorText.setText("Color:");

    mColorSelector = new ColorSelector(settingsComposite);
    mColorSelector.setEnabled(false);
    mColorSelector.addListener(new IPropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent event) {
        if (mCurrentSelectedAnnotation == null) {
          mCurrentSelectedAnnotation = getDefaultAnnotation();
        }

        RGB colorRGB = mColorSelector.getColorValue();

        Color color = new Color(colorRGB.red, colorRGB.green, colorRGB.blue);

        mCurrentSelectedAnnotation = new AnnotationStyle(
                mCurrentSelectedAnnotation.getAnnotation(), mCurrentSelectedAnnotation.getStyle(),
                color, mCurrentSelectedAnnotation.getLayer());

        mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
      }
    });

    Button moveLayerUpButton = new Button(settingsComposite, SWT.NONE);
    moveLayerUpButton.setText("Move layer up");
    GridDataFactory.fillDefaults().span(2, 1).applyTo(moveLayerUpButton);
    moveLayerUpButton.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
      }

      public void widgetSelected(SelectionEvent e) {
        if (mCurrentSelectedAnnotation == null) {
          mCurrentSelectedAnnotation = getDefaultAnnotation();
        }

        mCurrentSelectedAnnotation = new AnnotationStyle(
                mCurrentSelectedAnnotation.getAnnotation(), AnnotationStyle.Style
                        .valueOf(mStyleCombo.getText()), mCurrentSelectedAnnotation.getColor(),
                mCurrentSelectedAnnotation.getLayer() + 1);

        mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);

        mTypeList.refresh(((IStructuredSelection) mTypeList.getSelection()).getFirstElement(),
                true);
      }
    });

    Button moveLayerDownButton = new Button(settingsComposite, SWT.NONE);
    moveLayerDownButton.setText("Move layer down");
    GridDataFactory.fillDefaults().span(2, 1).applyTo(moveLayerDownButton);

    moveLayerDownButton.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
      }

      public void widgetSelected(SelectionEvent e) {
View Full Code Here

    Button addButton = new Button(composite, SWT.PUSH);
    addButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_BEGINNING));
    addButton.setText("Add");
    addButton.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
        // never called
      }

      /**
       * Opens a file dialog and adds the selected files to the file table viewer.
       */
      public void widgetSelected(SelectionEvent e) {

        // open a file dialog
        FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.MULTI);
        fd.setText("Choose text files");
        fd.setFilterExtensions(new String[] { "*.txt", "*.rtf" });

        if (fd.open() != null) {
          for (String fileItem : fd.getFileNames()) {
            fileTable.add(new File(fd.getFilterPath() + File.separator + fileItem));
          }

          computePageComplete();
        }
      }
    });

    Button removeButton = new Button(composite, SWT.PUSH);
    removeButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_BEGINNING));
    removeButton.setText("Remove");
    removeButton.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
        // never called
      }

      /**
       * Removes selected elements from the file table viewer.
       */
      public void widgetSelected(SelectionEvent e) {
        IStructuredSelection selection = (IStructuredSelection) fileTable.getSelection();

        Iterator seletionIterator = selection.iterator();

        Object selectedElements[] = new Object[selection.size()];

        for (int i = 0; i < selection.size(); i++) {
          selectedElements[i] = seletionIterator.next();
        }

        fileTable.remove(selectedElements);

        computePageComplete();
      }
    });

    Button selectAllButton = new Button(composite, SWT.PUSH);
    selectAllButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_BEGINNING));
    selectAllButton.setText("Select All");
    selectAllButton.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
        // never called
      }

      /**
       * Selects all elements in the file table viewer.
       */
      public void widgetSelected(SelectionEvent e) {
        fileTable.getTable().selectAll();
        fileTable.setSelection(fileTable.getSelection());
      }
    });

    Button deselectAllButton = new Button(composite, SWT.PUSH);
    deselectAllButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_BEGINNING));
    deselectAllButton.setText("Deselect All");
    deselectAllButton.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
        // never called
      }

      /**
       * Deselects all elements in the file table viewer.
       */
      public void widgetSelected(SelectionEvent e) {
        fileTable.getTable().deselectAll();
        fileTable.setSelection(fileTable.getSelection());
      }
    });

    Label corpusFolderLabel = new Label(composite, SWT.NONE);
    corpusFolderLabel.setText("Into corpus:");

    final Text corpusText = new Text(composite, SWT.READ_ONLY | SWT.BORDER);
    corpusText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    if (importDestinationPath != null) {
      corpusText.setText(importDestinationPath.toString());
      computePageComplete();
    }

    Button browseForCorpusFolder = new Button(composite, SWT.NONE);
    browseForCorpusFolder.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_BEGINNING));
    browseForCorpusFolder.setText("Browse");
    browseForCorpusFolder.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
        // never called
      }

View Full Code Here

TOP

Related Classes of org.eclipse.swt.events.SelectionListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.