Java 类org.eclipse.swt.widgets.List 实例源码

项目:convertigo-eclipse    文件:TransactionXSDTypesDialogComposite.java   
protected void initialize() {
    Label label0 = new Label (this, SWT.NONE);
    label0.setText ("Please choose type(s) which are returned by transaction response:");

    list = new List(this, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    GridData data = new GridData ();
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;
    data.heightHint = 200;
    list.setLayoutData (data);

    GridLayout gridLayout = new GridLayout();
    setLayout(gridLayout);
    setSize(new Point(408, 251));
}
项目:tap17-muggl-javaee    文件:FileSelectionComposite.java   
/**
 * If there is a current class this method will add it to the list of recently opened
 * files. Should it be on this list already, it will be removed. If the number of entries
 * on the list will exceed the maximum, the last entry is dropped.
 */
private void addClassToRecentFileList() {
    if (this.currentClass != null) {
        // Get the full path.
        String recentFile = this.currentClass.getFullPath();

        // Check if this file is already referenced. It it is, remove it.
        java.util.List<String> recentFilesPaths = Options.getInst().recentFilesPaths;
        recentFilesPaths.remove(recentFile);

        // Insert the file to the first position.
        recentFilesPaths.add(0, recentFile);

        // Check if the list got too long. Remove the last element in that case.
        if (recentFilesPaths.size() > Options.getInst().numberOfRecentFiles) {
            recentFilesPaths.remove(Options.getInst().numberOfRecentFiles);
        }

        // Write back the entries.
        Options.getInst().recentFilesPaths = recentFilesPaths;
    }
}
项目:Hydrograph    文件:FunctionsComposite.java   
/**
 * Create the composite.
 * 
 * @param parent
 * @param expressionEditorTextBox 
 * @param categoriesComposite
 * @param style
 */
public FunctionsComposite(Composite parent, StyledText expressionEditorTextBox, CategoriesComposite categoriesComposite, int style) {
    super(parent, style);
    setLayout(new GridLayout(1, false));
    this.expressionEditorTextBox=expressionEditorTextBox;
    functionUppersComposite = new FunctionsUpperComposite(this, SWT.BORDER);
    GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_composite.heightHint = 35;
    functionUppersComposite.setLayoutData(gd_composite);

    methodList = new List(this, SWT.BORDER | SWT.V_SCROLL);
    methodList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    addDragSupport();

    linkFunctionAndClassComposite(categoriesComposite);
    functionUppersComposite.setMethodList(methodList);
    functionUppersComposite.setClassNameList(categoriesComposite.getClassNamelist());

    addListnersToMethodList(methodList);
    addDoubleClickListner(methodList);
}
项目:Hydrograph    文件:CategoriesComposite.java   
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public CategoriesComposite(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout(1, false));

    categoriesUpperComposite = new CategoriesUpperComposite(this, SWT.BORDER);
    categoriesUpperComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    classNamelist = new List(this, SWT.BORDER | SWT.V_SCROLL);
    classNamelist.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    loadClassesFromRepo();
    addListnersToClassNameList(classNamelist);
    addSelectionListnerToClassNameList();
    categoriesUpperComposite.setClassNameList(classNamelist);
}
项目:Hydrograph    文件:CategoriesDialogSourceComposite.java   
private void addDragSupport(final List sourcePackageList, final Combo comboJarList) {
    DragSource dragSource = ExpressionEditorUtil.INSTANCE.getDragSource(sourcePackageList);
    dragSource.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) {
            event.data = formatDataToTransfer(sourcePackageList.getSelection());
        }

        private Object formatDataToTransfer(String[] selection) {
            StringBuffer buffer = new StringBuffer();
            for (String field : selection) {
                buffer.append(field + Constants.DOT + Constants.ASTERISK + SWT.SPACE + Constants.DASH + SWT.SPACE
                        + comboJarList.getItem(comboJarList.getSelectionIndex())
                        + Constants.FIELD_SEPRATOR_FOR_DRAG_DROP);
            }
            return buffer.toString();
        }
    });
}
项目:iTrace-Archive    文件:PluginPreferences.java   
@Override
protected Control createContents(Composite parent) {
    Label trackerListLabel = new Label(parent, SWT.NONE);
    trackerListLabel.setText("Eye Tracker Interface");

    //Get currently selected eye tracker type as index into list.
    TrackerType[] trackerKeys = EyeTrackerFactory.getAvailableEyeTrackers()
                                .keySet().toArray(new TrackerType[0]);
    int trackerSelectionIndex = Arrays.asList(trackerKeys).indexOf(
            TrackerType.valueOf(getPreferenceStore()
            .getString(EYE_TRACKER_TYPE)));

    //Create tracker list.
    trackerList = new List(parent, SWT.BORDER);
    String[] items = EyeTrackerFactory.getAvailableEyeTrackers().values()
                                      .toArray(new String[0]);
    trackerList.setItems(items);
    trackerList.setSelection(trackerSelectionIndex);

    return parent;
}
项目:BiglyBT    文件:ConfigView.java   
@Override
public CloneConstructor
getCloneConstructor()
{
    return( 
        new CloneConstructor()
        {
            public Class<? extends UISWTViewCoreEventListenerEx>
            getCloneClass()
            {
                return( ConfigView.class );
            }

            public java.util.List<Object>
            getParameters()
            {
                return( null );
            }
        });
}
项目:OCCI-Studio    文件:OcciActionDialog.java   
@Override
protected Control createDialogArea(Composite parent) {
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout layout = new GridLayout(2, false);
    container.setLayout(layout);
    Label lbtOcciServerUrl = new Label(container, SWT.NONE);
    lbtOcciServerUrl.setText(Messages.OcciActionDialog_Label);
    final List listOcciActions = new List (container, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
    listOcciActions.addSelectionListener(
              new SelectionAdapter() {
                  @Override
                  public void widgetSelected(SelectionEvent e) {
                      selectedAction = listOcciActions.getSelection()[0];
                  }                   
              }
            );
    listOcciActions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    for(Action action : actions) {
        listOcciActions.add(action.getScheme() +  action.getTerm());
    }
    return area;
}
项目:eclipse-weblogic-plugin    文件:ListFieldEditor.java   
@Override
public List getListControl(final Composite parent) {
    if (this.list == null) {
        this.list = new List(parent, 2820);

        this.list.addSelectionListener(this.getSelectionListener());
        this.list.addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(final DisposeEvent event) {
                ListFieldEditor.this.list = null;
            }
        });
    } else {
        this.checkParent(this.list, parent);
    }
    return this.list;
}
项目:texlipse    文件:ViewerListFieldEditor.java   
/**
 * Open the config editor dialog for editing an existing configuration.
 * This is called, when edit button is pressed.
 */
private void openEditorDialog() {

    List list = getListControl(parent);
    int index = list.getSelectionIndex();
    if (index < 0) {
        // no item selected from the list, do nothing
        return;
    }

    String name = list.getItem(index);
    if (name == null || name.length() == 0) {
        // no name for the item, can't load config
        return;
    }

    registry.setActiveViewer(name.substring(0, name.indexOf('(')-1));
    ViewerConfigDialog dialog = new ViewerConfigDialog(editButton.getShell(),
            (ViewerAttributeRegistry) registry.clone());

    int code = dialog.open();
    if (code == Window.OK) {
        registry.mergeWith(dialog.getRegistry());
        list.setItem(index, registry.getActiveViewer() + " (" + registry.getCommand() + ")");
    }
}
项目:texlipse    文件:KeyValueListFieldEditor.java   
/**
 * Creates and returns the contents of an area of the dialog which appears
 * below the message and above the button bar.
 * 
 * This implementation creates two labels and two textfields.
 * 
 * @param parent parent composite to contain the custom area
 * @return the custom area control, or <code>null</code>
 */
protected Control createCustomArea(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout());

    envVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    envVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
    envVarList.setItems(items);
    envVarList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            selections = envVarList.getSelectionIndices();
        }});

    return composite;
}
项目:texlipse    文件:StyleListFieldEditor.java   
/**
 * Creates and returns the contents of an area of the dialog which appears
 * below the message and above the button bar.
 * 
 * This implementation creates two labels and two textfields.
 * 
 * @param parent parent composite to contain the custom area
 * @return the custom area control, or <code>null</code>
 */
protected Control createCustomArea(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout());

    skVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    skVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
    skVarList.setItems(items);
    skVarList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            selections = skVarList.getSelectionIndices();
        }});

    return composite;
}
项目:texlipse    文件:TexlipseProjectCreationWizardPage.java   
/**
   * Creates a list element containing available templates (system and user)
   * and a text area next to it for showing description about the selected template
   * 
   * @param composite the parent container
   */
  private void createTemplateControl(Composite composite) {
      // add list for templates
      templateList = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
templateList.setItems(ProjectTemplateManager.loadTemplateNames());
      templateList.setLayoutData(new GridData(GridData.FILL_VERTICAL));
      templateList.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateTooltip"));
      templateList.addSelectionListener(new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            attributes.setTemplate(templateList.getSelection()[0]);
            updateEntries();
          }});

      templateList.setSelection(0);
      // this has to be done, because setSelection() doesn't generate an event
      attributes.setTemplate(templateList.getItem(0));


      // add TextField for the selected template's description
      descriptionField = new Text(composite, SWT.MULTI | SWT.BORDER);
      descriptionField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateDescriptionTooltip"));
      descriptionField.setLayoutData(new GridData(GridData.FILL_BOTH));
      descriptionField.setEditable(false);
  }
项目:TuxGuitar-1.3.1-fork    文件:TGChordRecognizer.java   
public void init(){
    Composite composite = new Composite(this,SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));

    this.proposalParameters = new ArrayList<int[]>();

    this.proposalList = new List(composite,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    this.proposalList.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    this.proposalList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if(getDialog().getEditor() != null){
                showChord(getProposalList().getSelectionIndex());
            }
        }
    });

}
项目:TuxGuitar-1.3.1-fork    文件:TGChordRecognizer.java   
public void notifyProposals(final long processId, final boolean sharp, final boolean redecorate, final boolean setChordName, final java.util.List<int[]> proposalParameters, final java.util.List<String> proposalNames) {
    final int params[] = (!proposalParameters.isEmpty() ? (int[])proposalParameters.get(0) : null);
    final String chordName = (params != null ? getChordName(params, sharp) : "");

    TGSynchronizer.getInstance(this.dialog.getContext().getContext()).executeLater(new Runnable() {
        public void run() {
            if(!getDialog().isDisposed() && isValidProcess(processId)){
                for(int[] currentProposalParameters : proposalParameters) {
                    addProposalParameters(currentProposalParameters);
                }
                for(String currentProposalName : proposalNames) {
                    addProposalName(currentProposalName);
                }
                if( redecorate && params != null ) {
                    redecorate(params);
                }
                if( setChordName ) {
                    getDialog().getEditor().setChordName( chordName != null ? chordName : ""  );
                }
            }
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:TGChordRecognizer.java   
/**
 * Shellsort, using a sequence suggested by Gonnet.
 * -- a little adopted
 * @param a List of Proposals, unsorted
 * @param sortIndex 1 to sort by don'tHaveGrade, 2 to sort by unusualGrade
 * @return sorted list by selected criteria
 */
public void shellsort( java.util.List<Proposal> a, int sortIndex ){
    int length = a.size();
    for( int gap = length / 2; gap > 0;
                 gap = gap == 2 ? 1 : (int) ( gap / 2.2 ) )
        for( int i = gap; i < length; i++ ){
            Proposal tmp = (Proposal)a.get(i);
            int j = i;

            for( ; j >= gap && 
            (  sortIndex == 1 ?
            tmp.dontHaveGrade > ((Proposal)a.get(j - gap)).dontHaveGrade :
            tmp.unusualGrade > ((Proposal)a.get(j - gap)).unusualGrade  )
            ; 
            j -= gap )
                a.set(j, a.get(j - gap));
            a.set( j , tmp);
        }
}
项目:tlaplus    文件:ShowUsesHandler.java   
/**
 * Called when the user selects an item in the List.
 */
public void widgetSelected(SelectionEvent e)
{
    List list = ((List) e.widget);
    Spec spec = ToolboxHandle.getCurrentSpec();
    if (spec != null)
    {
        spec.setModuleToShow(list.getSelection()[0]);

        String moduleName = list.getSelection()[0];
        spec.setModuleToShow(list.getSelection()[0]);
        int idx = selectString(moduleNames, moduleName);
        if (idx != -1)
        {
            setUseMarkers(showUses[idx], moduleName, spec);
        }

    }
}
项目:Ref-Finder    文件:RefDistillerView.java   
private void showRefs(Scanner input, ArrayList<String> refStrings) {
    while(input.hasNext()){
        String line = input.nextLine();
        if (!line.equals("") && line.length() > 0)
            refStrings.add(line);

    }
    if (refStrings.size() == 0){
        MessageBox dialog = 
                new MessageBox(parent.getShell(), SWT.ERROR | SWT.OK);
        dialog.setText("Error");
        dialog.setMessage("No refactoring information was found!");
        dialog.open();
    } else{
        list = new List(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
        list.setBounds (20, 100, 250, 250);
        list.setVisible(true);
        for (int i = 0; i < refStrings.size(); i++) {
            list.add(refStrings.get(i));
        }
    }
}
项目:mondo-integration    文件:MONDOServerView.java   
private void loadListOfServers(List list) {
    ServerStore serverStore = new ServerStore(
            uk.ac.york.mondo.integration.api.dt.Activator.getDefault().getPreferenceStore());
    java.util.List<Server> servers = serverStore.readAllServers();

    list.removeAll();

    list.add(CUSTOM_URL_TEXT);

    list.setSelection(0); // by default select option "Custom URL"

    for (Server server : servers) {
        list.add(server.getBaseURL());
    }
    userName.setEnabled(false);
    userName.setText("");
    frontRepoURL.setText("");
}
项目:mondo-integration    文件:MONDOServerView.java   
private Credentials getCredentials(String serverURL) {
    CredentialsStore.Credentials creds = null;

    if (CUSTOM_URL_TEXT.equals(serverURL)) {
        return new Credentials("", "");
    }

    ServerStore serverStore = new ServerStore(
            uk.ac.york.mondo.integration.api.dt.Activator.getDefault().getPreferenceStore());
    java.util.List<Server> servers = serverStore.readAllServers();

    for (Server server : servers) {
        if (serverURL.equals(server.getBaseURL())) {
            try {
                creds = uk.ac.york.mondo.integration.api.dt.Activator.getDefault().getCredentialsStore()
                        .get(server.getBaseURL());
            } catch (Exception e1) {
                logger.warn("Could not load credentials for server with URL " + serverURL);
            }

        }
    }

    return creds;
}
项目:PDFReporter-Studio    文件:EditExpressionXDialog.java   
private void handleAddInList(List inlist) {
    int index = Math.max(0, inlist.getSelectionIndex());
    OperandDialog dialog = new OperandDialog(getShell());
    ArrayList<AOperand> ops = new ArrayList<AOperand>(operands);
    if (index < ops.size())
        ops.add(index, new ParameterPOperand(value));
    else
        ops.add(new ParameterPOperand(value));
    dialog.setValues(value, ops, index);
    if (dialog.open() == Dialog.OK) {
        AOperand op = dialog.getOperand();
        if (index < ops.size())
            operands.add(index + 1, op);
        else
            ops.add(op);
        showInList(inlist);
    }
}
项目:PDFReporter-Studio    文件:EditExpressionDialog.java   
private void handleAddInList(List inlist) {
    int index = Math.max(0, inlist.getSelectionIndex());
    OperandDialog dialog = new OperandDialog(getShell());
    ArrayList<AOperand> ops = new ArrayList<AOperand>(operands);
    if (index < ops.size())
        ops.add(index, Factory.getDefaultOperand(value));
    else
        ops.add(Factory.getDefaultOperand(value));
    dialog.setValues(value, ops, index);
    if (dialog.open() == Dialog.OK) {
        AOperand op = dialog.getOperand();
        if (index < ops.size())
            operands.add(index + 1, op);
        else
            ops.add(op);
        showInList(inlist);
    }
}
项目:PDFReporter-Studio    文件:ResourceBundleNewWizardPage.java   
/**
 * Creates the bottom part of this wizard where selected locales are stored.
 * 
 * @param parent
 *            parent container
 */
private void createBottomSelectedLocalesComposite(Composite parent) {

    // Selected locales Group
    Group selectedGroup = new Group(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout = new GridLayout();
    layout.numColumns = 1;
    selectedGroup.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    selectedGroup.setLayoutData(gd);
    selectedGroup.setText(Messages.editor_wiz_selected);
    bundleLocalesList = new List(selectedGroup, SWT.READ_ONLY | SWT.MULTI  | SWT.BORDER);
    gd = new GridData(GridData.FILL_BOTH);
    bundleLocalesList.setLayoutData(gd);
    bundleLocalesList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            removeButton.setEnabled(bundleLocalesList.getSelectionIndices().length != 0);
            setAddButtonState();
        }
    });
    // add a single Locale so that the bundleLocalesList isn't empty on
    // startup
    bundleLocalesList.add(DEFAULT_LOCALE);
}
项目:PDFReporter-Studio    文件:IssueAttachmentDetailsPage.java   
private void refreshZipEntriesList() {
    zipFileContent.removeAll();
    if(!zipEntries.isEmpty()){
        java.util.List<String> fileLocations = new ArrayList<String>();
        for(ZipEntry ze : zipEntries){
            fileLocations.add(ze.getLocation());
        }
        Collections.sort(fileLocations);
        for(String loc : fileLocations){
            zipFileContent.add(loc);
        }
        zipFileContent.setFont(standardListFont);
    }
    else {
        zipFileContent.add(Messages.IssueAttachmentDetailsPage_NoAttachments);
        zipFileContent.setFont(ResourceManager.getItalicFont(standardListFont));
    }
}
项目:PDFReporter-Studio    文件:IssueAttachmentDetailsPage.java   
private void removeZipEntries(java.util.List<String> entries) {
    if(!zipEntries.isEmpty()){
        for (Iterator<ZipEntry> it = zipEntries.iterator(); it.hasNext(); ){
            ZipEntry ze = it.next();
            if(entries.contains(ze.getLocation())){
                switch (ze.getType()) {
                case HW_SW_INFO:
                    btnSoftwareAndHardware.setSelection(false);
                    break;
                case LOG:
                    btnLogFile.setSelection(false);
                    break;
                case PREFS:
                    btnJaspersoftStudioPreferences.setSelection(false);
                    break;
                default:
                    break;
                }
                it.remove();
            }
        }
    }
}
项目:vTM-eclipse    文件:SWTSet.java   
/**
 * Create the set with the specified controls.
 * @param controls The controls which make up this set.
 */
public SWTSet( Control ... controls )
{
   this.controls = controls;
   for( Control control : controls ) {
      if( this.label == null && control instanceof Label ) {
         this.label = (Label) control;
      }
      if( this.button == null && control instanceof Button ) {
         this.button = (Button) control;
      }
      if( this.text == null && control instanceof Text ) {
         this.text = (Text) control;
      }
      if( this.combo == null && control instanceof Combo ) {
         this.combo = (Combo) control;
      }
      if( this.list == null && control instanceof List ) {
         this.list = (List) control;
      }
   }
}
项目:JFaceUtils    文件:SystemInformationDialog.java   
/**
 * Copies the current selection to the clipboard.
 * 
 * @param list the data source
 */
protected void copy(final List list) {
    if (canCopy(list)) {
        final StringBuilder data = new StringBuilder();

        for (int row = 0; row < list.getSelectionCount(); row++) {
            data.append(list.getSelection()[row]);
            if (row != list.getSelectionCount() - 1) {
                data.append(NewLine.SYSTEM_LINE_SEPARATOR);
            }
        }

        final Clipboard clipboard = new Clipboard(list.getDisplay());
        clipboard.setContents(new String[] { data.toString() }, new TextTransfer[] { TextTransfer.getInstance() });
        clipboard.dispose();
    }
}
项目:JFaceUtils    文件:ListConsole.java   
protected void createContextMenu(final List list) {
    contextMenu = new Menu(list);

    copyMenuItem = createCopyMenuItem(list);

    new MenuItem(contextMenu, SWT.SEPARATOR);

    selectAllMenuItem = createSelectAllMenuItem(list);

    new MenuItem(contextMenu, SWT.SEPARATOR);

    clearMenuItem = createClearMenuItem();

    list.addMenuDetectListener(new MenuDetectListener() {
        @Override
        public void menuDetected(final MenuDetectEvent mde) {
            final boolean notEmpty = !isEmpty();
            selectAllMenuItem.setEnabled(notEmpty);
            clearMenuItem.setEnabled(notEmpty);
            copyMenuItem.setEnabled(list.getSelectionCount() > 0);
            contextMenu.setVisible(true);
        }
    });
    list.setMenu(contextMenu);
}
项目:JFaceUtils    文件:ListConsole.java   
protected MenuItem createSelectAllMenuItem(final List list) {
    final MenuItem selectAll = new MenuItem(contextMenu, SWT.PUSH);
    selectAll.setText(JFaceMessages.get("lbl.menu.item.select.all") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_SELECT_ALL));
    selectAll.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            list.selectAll();
        }
    });
    list.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(final KeyEvent ke) {
            if (ke.stateMask == SWT.MOD1 && ke.keyCode == SwtUtils.KEY_SELECT_ALL) {
                ke.doit = false;
                list.selectAll();
            }
        }
    });
    return selectAll;
}
项目:JFaceUtils    文件:ListConsole.java   
protected MenuItem createCopyMenuItem(final List list) {
    final MenuItem copy = new MenuItem(contextMenu, SWT.PUSH);
    copy.setText(JFaceMessages.get("lbl.menu.item.copy") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_COPY));
    copy.setAccelerator(SWT.MOD1 | SwtUtils.KEY_COPY);
    copy.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            copy(list);
        }
    });
    list.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(final KeyEvent e) {
            if (e.stateMask == SWT.MOD1 && e.keyCode == SwtUtils.KEY_COPY) {
                e.doit = false; // avoids unwanted scrolling
                copy(list);
            }
        }
    });
    return copy;
}
项目:JFaceUtils    文件:EnhancedErrorDialog.java   
@Override
protected List createDropDownList(final Composite parent) {
    final List list = super.createDropDownList(parent);
    if (list.getMenu() != null) {
        for (final MenuItem item : list.getMenu().getItems()) {
            if (item.getText().equals(JFaceResources.getString("copy"))) {
                item.setText(JFaceMessages.get("lbl.menu.item.copy") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_COPY));
                item.setAccelerator(SWT.MOD1 | SwtUtils.KEY_COPY);
                list.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(final KeyEvent e) {
                        if (SWT.MOD1 == e.stateMask && SwtUtils.KEY_COPY == e.keyCode) {
                            e.doit = false; // avoids unwanted scrolling
                            item.notifyListeners(SWT.Selection, null);
                        }
                    }
                });
                break;
            }
        }
    }
    return list;
}
项目:mytourbook    文件:ResourceBundleNewWizardPage.java   
/**
 * Creates the bottom part of this wizard where selected locales 
 * are stored.
 * @param parent parent container
 */
private void createBottomSelectedLocalesComposite(Composite parent) {

    // Selected locales Group
    Group selectedGroup = new Group(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout = new GridLayout();
    layout.numColumns = 1;
    selectedGroup.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    selectedGroup.setLayoutData(gd);
    selectedGroup.setText(MessagesEditorPlugin.getString(
            "editor.wiz.selected")); //$NON-NLS-1$
    bundleLocalesList = 
            new List(selectedGroup, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER);
    gd = new GridData(GridData.FILL_BOTH);
    bundleLocalesList.setLayoutData(gd);
    bundleLocalesList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            removeButton.setEnabled(
                    bundleLocalesList.getSelectionIndices().length != 0);
            setAddButtonState();
        }
    });
}
项目:mytourbook    文件:ResourceBundleNewWizardPage.java   
/**
 * Creates the bottom part of this wizard where selected locales 
 * are stored.
 * @param parent parent container
 */
private void createBottomSelectedLocalesComposite(Composite parent) {

    // Selected locales Group
    Group selectedGroup = new Group(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout = new GridLayout();
    layout.numColumns = 1;
    selectedGroup.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    selectedGroup.setLayoutData(gd);
    selectedGroup.setText(MessagesEditorPlugin.getString(
            "editor.wiz.selected")); //$NON-NLS-1$
    bundleLocalesList = 
            new List(selectedGroup, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER);
    gd = new GridData(GridData.FILL_BOTH);
    bundleLocalesList.setLayoutData(gd);
    bundleLocalesList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            removeButton.setEnabled(
                    bundleLocalesList.getSelectionIndices().length != 0);
            setAddButtonState();
        }
    });
}
项目:mytourbook    文件:ResourceBundleNewWizardPage.java   
/**
 * Creates the bottom part of this wizard where selected locales 
 * are stored.
 * @param parent parent container
 */
private void createBottomSelectedLocalesComposite(Composite parent) {

    // Selected locales Group
    Group selectedGroup = new Group(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout = new GridLayout();
    layout.numColumns = 1;
    selectedGroup.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    selectedGroup.setLayoutData(gd);
    selectedGroup.setText(MessagesEditorPlugin.getString(
            "editor.wiz.selected")); //$NON-NLS-1$
    bundleLocalesList = 
            new List(selectedGroup, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER);
    gd = new GridData(GridData.FILL_BOTH);
    bundleLocalesList.setLayoutData(gd);
    bundleLocalesList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            removeButton.setEnabled(
                    bundleLocalesList.getSelectionIndices().length != 0);
            setAddButtonState();
        }
    });
}
项目:birt    文件:ExcelFileSelectionWizardPage.java   
/**
 * Set the content of the ColumnsViewer
 * 
 */
private void setColumnsViewerContent( )
{
    selectedColumnsViewer.setContentProvider( new IStructuredContentProvider( ) {

        public Object[] getElements( Object inputElement )
        {
            if ( inputElement instanceof java.util.List )
            {
                return ( (java.util.List<?>) inputElement ).toArray( );
            }

            return new Object[0];
        }

        public void dispose( )
        {
        }

        public void inputChanged( Viewer viewer, Object oldInput,
                Object newInput )
        {
        }
    } );
}
项目:mondo-collab-framework    文件:MONDOServerView.java   
private void loadListOfServers(List list) {
    ServerStore serverStore = new ServerStore(
            uk.ac.york.mondo.integration.api.dt.Activator.getDefault().getPreferenceStore());
    java.util.List<Server> servers = serverStore.readAllServers();

    list.removeAll();

    list.add(CUSTOM_URL_TEXT);

    list.setSelection(0); // by default select option "Custom URL"

    for (Server server : servers) {
        list.add(server.getBaseURL());
    }
    userName.setEnabled(false);
    userName.setText("");
    frontRepoURL.setText("");
}
项目:mondo-collab-framework    文件:MONDOServerView.java   
private Credentials getCredentials(String serverURL) {
    CredentialsStore.Credentials creds = null;

    if (CUSTOM_URL_TEXT.equals(serverURL)) {
        return new Credentials("", "");
    }

    ServerStore serverStore = new ServerStore(
            uk.ac.york.mondo.integration.api.dt.Activator.getDefault().getPreferenceStore());
    java.util.List<Server> servers = serverStore.readAllServers();

    for (Server server : servers) {
        if (serverURL.equals(server.getBaseURL())) {
            try {
                creds = uk.ac.york.mondo.integration.api.dt.Activator.getDefault().getCredentialsStore()
                        .get(server.getBaseURL());
            } catch (Exception e1) {
                logger.warn("Could not load credentials for server with URL " + serverURL);
            }

        }
    }

    return creds;
}
项目:read-open-source-code    文件:ValidatorDialog.java   
public ValidatorDialog(Shell parent, Object in, TransMeta tr, String sname)
{
    super(parent, (BaseStepMeta)in, tr, sname);
    input=(ValidatorMeta)in;

    // Just to make sure everything is nicely in sync...
    //
    java.util.List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
    for (int i=0;i<infoStreams.size();i++) {
        input.getValidations().get(i).setSourcingStepName(infoStreams.get(i).getStepname());
    }

    selectedField = null;
    selectionList = new ArrayList<Validation>();

    // Copy the data from the input into the map...
    //
    for (Validation field : input.getValidations()) {
        selectionList.add(field.clone());
    }
}
项目:birt    文件:MultipleHyperlinksComposite.java   
private void doAdd( )
{
    HyperlinkEditorDialog dialog = new HyperlinkEditorDialog( getShell( ),
            null,
            fContext,
            fTriggerMatrix,
            fOptionalStyles );
    java.util.List<String> labels = Arrays.asList( fListHyperlinks.getItems( ) );
    dialog.setExistingLabels( labels );

    if ( dialog.open( ) == Window.OK )
    {
        URLValue value = dialog.getURLValue( );
        fMultiURLValues.getURLValues( ).add( value );
        value.eAdapters( ).addAll( fMultiURLValues.eAdapters( ) );

        String text = value.getLabel( ).getCaption( ).getValue( );
        fListHyperlinks.add( text );
        fURLValuesMap.put( text, value );
    }

    fListHyperlinks.setSelection( fListHyperlinks.getItemCount( ) - 1 );
}
项目:read-open-source-code    文件:Translator.java   
private void addList()
{
    Composite composite = new Composite(sashform, SWT.NONE);
    props.setLook(composite);
    FillLayout fillLayout = new FillLayout();
    fillLayout.marginWidth  = Const.FORM_MARGIN;
    fillLayout.marginHeight = Const.FORM_MARGIN;
    composite.setLayout(fillLayout);

    // Make a listbox
    wList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);

    // Add a selection listener.
    wList.addSelectionListener(new SelectionAdapter()
        {
            public void widgetSelected(SelectionEvent arg0)
            {
                refreshGrid();
            }
        }
    );
}