org.eclipse.swt.widgets.List Java Examples
The following examples show how to use
org.eclipse.swt.widgets.List.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphModelDialog.java From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 | 7 votes |
private java.util.List<Point> getNodeSizes() { java.util.List<Point> sizes = new ArrayList<>(); Image image = new Image( shell.getDisplay(), 100, 100 ); GC gc = new GC( image ); gc.setFont( GUIResource.getInstance().getFontMediumBold() ); for ( GraphNode node : graphModel.getNodes() ) { Point textExtent = gc.textExtent( node.getName() ); int width = textExtent.x + 2 * 10; // 10 : margin int height = textExtent.y + 2 * 10; sizes.add( new Point( width, height ) ); } gc.dispose(); image.dispose(); return sizes; }
Example #2
Source File: Translator.java From hop with Apache License 2.0 | 6 votes |
private java.util.List<KeyOccurrence> getTodoList( String locale, String messagesPackage, String sourceFolder, boolean strict ) { // Get the list of keys that need a translation... // java.util.List<KeyOccurrence> keys = crawler.getOccurrencesForPackage( messagesPackage ); java.util.List<KeyOccurrence> todo = new ArrayList<KeyOccurrence>(); for ( KeyOccurrence keyOccurrence : keys ) { // Avoid the System keys. Those are taken care off in a different package // if ( showKey( keyOccurrence.getKey(), keyOccurrence.getMessagesPackage() ) ) { String value = store.lookupKeyValue( locale, messagesPackage, keyOccurrence.getKey() ); if ( Utils.isEmpty( value ) || ( wAll.getSelection() && !strict ) ) { todo.add( keyOccurrence ); } } } return todo; }
Example #3
Source File: DisplayLabDokumenteDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent){ Composite composite = new Composite(parent, SWT.BORDER); composite.setLayout(new GridLayout(1, true)); composite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); final List list = new List(composite, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, true).applyTo(list); for (LabResult lr : this.labResultList) { list.add(lr.getResult()); } list.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e){ if (docManager != null && list.getSelectionCount() > 0) { openDocument(list.getSelection()[0]); } } }); SWTHelper.center(UiDesk.getTopShell(), getShell()); return composite; }
Example #4
Source File: ExcelFileSelectionWizardPage.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) { } } ); }
Example #5
Source File: ExcelFileSelectionWizardPage.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * remove the given items from the saved selectedComlumnsInfo * * @param removedItemsList * list that contains the given elements that are going to be * removed */ private void removeItemsFromSelectedOnes( java.util.List<String[]> removedItemsList ) { for ( int i = 0; i < removedItemsList.size( ); i++ ) { for ( int j = 0; j < savedSelectedColumnsInfoList.size( ); j++ ) { if ( removedItemsList.get( i )[0].equals( savedSelectedColumnsInfoList.get( j )[0] ) && ( (String[]) removedItemsList.get( i ) )[1].equals( ( (String[]) savedSelectedColumnsInfoList.get( j ) )[1] ) && ( (String[]) removedItemsList.get( i ) )[2].equals( ( (String[]) savedSelectedColumnsInfoList.get( j ) )[2] ) ) { savedSelectedColumnsInfoList.remove( j ); break; } } } }
Example #6
Source File: CommandCategoryEditor.java From e4macs with Eclipse Public License 1.0 | 6 votes |
/** * @see Dialog#createDialogArea(Composite) */ protected Control createDialogArea(Composite parent) { Composite result = new Composite(parent, SWT.NONE); result.setLayout(new GridLayout()); result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); catList = new List(result, SWT.BORDER | SWT.MULTI ); catList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (categoryArray != null){ for (int i=0; i< categoryArray.size(); i++){ catList.add(getLabel(categoryArray.get(i))); } catList.pack(true); catList.computeSize(SWT.DEFAULT, SWT.DEFAULT); catList.setVisible(true); } result.setVisible(true); catList.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { catList = null; } }); return result; }
Example #7
Source File: MoveTermDialog.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite control = (Composite) super.createDialogArea(parent); Label termPositionLabel = new Label(control, SWT.NONE); GridData termPositionGrid = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); termPositionGrid.horizontalIndent = 1; termPositionLabel.setLayoutData(termPositionGrid); termPositionLabel.setText("Create Term: "); this.positionList = new List(control, SWT.SINGLE); GridData positionListGrid = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); positionListGrid.horizontalAlignment = 1; this.positionList.setLayoutData(positionListGrid); this.positionList.add("As Subterm."); this.positionList.add("As Neighbor."); return control; }
Example #8
Source File: ImportValueDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Constructs a new instance of the dialog */ public ImportValueDialog( String style, java.util.List<String> choices ) { super( DLG_TITLE ); assert DATA_TYPE_CHOICE_SET.contains( style ); this.style = style; this.choiceList = choices; expectedColumnDataType = DataAdapterUtil.modelDataTypeToCoreDataType( style ); try { compatibleDataTypes = DataAdapterUtil.getCompatibleDataTypes( expectedColumnDataType ); } catch ( AdapterException e ) { e.printStackTrace( ); } }
Example #9
Source File: TransitionOrderingPropertySection.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createList(final Composite mainComposite) { final List list = getWidgetFactory().createList(mainComposite, SWT.BORDER | SWT.V_SCROLL); list.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 90).create()); listViewer = new ListViewer(list); listViewer.setContentProvider(new ObservableListContentProvider<Element>()); listViewer.setLabelProvider(new LabelProvider(){ @Override public String getText(final Object element) { if(element != null && element instanceof Connection){ final String transitionName = ((Connection) element).getName(); return transitionName +" -- "+((Connection) element).getTarget().getName(); } return super.getText(element); } }); listViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { updateButtonsEnablement(); } }); }
Example #10
Source File: Translator.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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(); } } ); }
Example #11
Source File: ActionMailDialog.java From hop with Apache License 2.0 | 6 votes |
private void setEncodings() { // Encoding of the text file: if ( !gotEncodings ) { gotEncodings = true; wEncoding.removeAll(); java.util.List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() ); for ( Charset charSet : values ) { wEncoding.add( charSet.displayName() ); } // Now select the default! String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" ); int idx = Const.indexOfString( defEncoding, wEncoding.getItems() ); if ( idx >= 0 ) { wEncoding.select( idx ); } } }
Example #12
Source File: JobEntryMailDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void setEncodings() { // Encoding of the text file: if ( !gotEncodings ) { gotEncodings = true; wEncoding.removeAll(); java.util.List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() ); for ( Charset charSet : values ) { wEncoding.add( charSet.displayName() ); } // Now select the default! String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" ); int idx = Const.indexOfString( defEncoding, wEncoding.getItems() ); if ( idx >= 0 ) { wEncoding.select( idx ); } } }
Example #13
Source File: Translator2.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public boolean quitFile() { java.util.List<MessagesStore> changedMessagesStores = store.getChangedMessagesStores(); if ( !changedMessagesStores.isEmpty() ) { MessageBox mb = new MessageBox( shell, SWT.YES | SWT.NO | SWT.ICON_WARNING ); mb.setMessage( BaseMessages.getString( PKG, "i18nDialog.ChangedFilesWhenExit", changedMessagesStores.size() + EMPTY_STRING ) ); mb.setText( BaseMessages.getString( PKG, "i18nDialog.Warning" ) ); int answer = mb.open(); if ( answer == SWT.NO ) { return false; } } WindowProperty winprop = new WindowProperty( shell ); props.setScreen( winprop ); props.saveProps(); shell.dispose(); display.dispose(); return true; }
Example #14
Source File: KbdMacroListEditor.java From e4macs with Eclipse Public License 1.0 | 6 votes |
/** * @see Dialog#createDialogArea(Composite) */ protected Control createDialogArea(Composite parent) { Composite result = new Composite(parent, SWT.NONE); result.setLayout(new GridLayout()); result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); macList = new List(result, SWT.BORDER | SWT.MULTI ); macList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (macroArray != null){ for (int i=0; i< macroArray.size(); i++){ macList.add(getLabel(macroArray.get(i))); } macList.pack(true); macList.computeSize(SWT.DEFAULT, SWT.DEFAULT); macList.setVisible(true); } result.setVisible(true); macList.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { macList = null; } }); return result; }
Example #15
Source File: ViewerListFieldEditor.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * 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() + ")"); } }
Example #16
Source File: CCombo.java From birt with Eclipse Public License 1.0 | 6 votes |
void createPopup(String[] items, int selectionIndex) { // create shell and list popup = new Shell (getShell(), SWT.NO_TRIM | SWT.ON_TOP); int style = getStyle(); int listStyle = SWT.SINGLE | SWT.V_SCROLL; if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT; if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT; if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT; list = new List (popup, listStyle); if (font != null) list.setFont(font); if (foreground != null) list.setForeground(foreground); if (background != null) list.setBackground(background); int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate}; for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener); int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener); if (items != null) list.setItems(items); if (selectionIndex != -1) list.setSelection(selectionIndex); }
Example #17
Source File: KeyValueListFieldEditor.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * 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; }
Example #18
Source File: ValidatorDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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() ); } }
Example #19
Source File: TexlipseProjectCreationWizardPage.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * 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); }
Example #20
Source File: SWTFactory.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
public static List createList(Composite parent, int hspan, int style, int nLines) { List l = new List(parent, style); l.setFont(parent.getFont()); GC gc = new GC(l); int cyLine; try{ cyLine = gc.textExtent("Wq").y; //$NON-NLS-1$ } finally{ gc.dispose(); } GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = hspan; gd.heightHint = cyLine * nLines + 5; l.setLayoutData(gd); return l; }
Example #21
Source File: ImportValueDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
private String[] sortSelectedList(java.util.List<String> itemList) { //sort original data java.util.List<String> tempResult = new ArrayList<String>(); java.util.List datas = new ArrayList(); for(String item : itemList) { if(displayObjectMaps.get(item) != null) { datas.add(displayObjectMaps.get(item)); } } Collections.sort(datas); for(int i = 0;i<datas.size();i++) { tempResult.add((String)(objectDisplayMaps.get(datas.get(i)))); } return tempResult.toArray(new String[tempResult.size()]); }
Example #22
Source File: SelectFallDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent){ Composite ret = new Composite(parent, SWT.None); ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); GridLayout gl_ret = new GridLayout(1, false); gl_ret.marginWidth = 0; gl_ret.marginHeight = 0; ret.setLayout(gl_ret); list = new List(ret, SWT.BORDER); list.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); reloadFaelleList(); ToolBarManager tbManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.WRAP); tbManager.add(GlobalActions.neuerFallAction); tbManager.createControl(ret); ElexisEventDispatcher.getInstance().addListeners(updateFallListener); return ret; }
Example #23
Source File: SeriesPageBubble.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
private void refresh(List l) { int index = l.getSelectionIndex(); if(l == list_x) { btnShowInChartX.setSelection(termDataX.get(index).isDisplayed()); } else { labelShowColor.setBackground(termDataY.get(index).getColor(this.getDisplay())); btnShowInChartY.setSelection(termDataY.get(index).isDisplayed()); } this.layout(); }
Example #24
Source File: TextFileImportWizardPage2.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public TextFileImportWizardPage2( String arg, PropsUI props, java.util.List<String> rows, Vector<TextFileInputFieldInterface> fields ) { super( arg ); this.props = props; this.rows = rows; this.fields = fields; setTitle( BaseMessages.getString( PKG, "TextFileImportWizardPage2.DialogTitle" ) ); setDescription( "Give a name to the fields in this text file" ); }
Example #25
Source File: RipDatabaseWizardPage1.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public RipDatabaseWizardPage1( String arg, java.util.List<DatabaseMeta> databases ) { super( arg ); this.props = PropsUI.getInstance(); this.databases = databases; setTitle( "Enter the source and target database" ); setDescription( "Select the source and target databases." ); setPageComplete( false ); }
Example #26
Source File: CustomMatchConditionDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 为List组件设置数据 * @param list * @param data */ private void setListData(List list, Map<String, String> data) { list.removeAll(); if (data == null) { return; } for (Entry<String, String> entry : data.entrySet()) { list.add(entry.getKey()); } }
Example #27
Source File: ShowDeclarationsHandler.java From tlaplus with MIT License | 5 votes |
/** * This is the method that puts the content into the popup's * dialog area. It puts an org.eclipse.swt.widgets.List * (note that this isn't an ordinary Java List) there. * */ protected Control createDialogArea(Composite composite) { // create the list list = new List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.RESIZE); // Populate the popup's display area. setList(); // list.addKeyListener(listener); /* * To put a Composite instead of a List in the * dialog area, do something like the following: Composite stuff = new Composite(composite, SWT.NONE); stuff.setLayoutData(new GridData()); stuff.setLayout(new FillLayout(SWT.VERTICAL)); Button button1 = new Button(stuff, SWT.FLAT); button1.setText("Button 1"); // button1.setParent(stuff); Button button2 = new Button(stuff, SWT.PUSH); button2.setText("Button 2"); */ list.addSelectionListener(new ShowDeclarationsSelectionListener(EditorUtil.getTLAEditorWithFocus())); // Adding the KeyListener after the SelectionListener is necessary for the handling // of keystrokes to work. If they're added in the opposite order, some keys change // the selection and call the SelectionListener. list.addKeyListener(new ShowDeclarationsKeyListener(this)); // Testing // System.out.println("testing showAll = " + showAll); // It is necessary to select an item on the list if one is to be // able to listen for keystrokes. Otherwise, a keystroke causes the // current selection to change, calling the SelectionListener's widgetSelected() // method. list.setSelection(0); return list; }
Example #28
Source File: CustomMatchConditionDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 初始化已保存的条件列表 * @param comp 父容器 */ private void initCustomFilterList(Composite comp) { customFilterList = new List(comp, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); customFilterList.setLayoutData(new GridData(GridData.FILL_BOTH)); setListData(customFilterList, customFilters); customFilterList.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { // 调编辑的方法 edit(); } }); }
Example #29
Source File: SeriesPageBubble.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
private void buildListPerSubclass(Term t, List l, java.util.List<BubbleDataTerm> templist) { EList<Term> subterms = t.getSubclasses(); for(Term subterm : subterms) { templist.add(new BubbleDataTerm(subterm)); l.add(subterm.getName()); } }
Example #30
Source File: CopyTableWizardPage1.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public CopyTableWizardPage1( String arg, java.util.List<DatabaseMeta> databases ) { super( arg ); this.props = PropsUI.getInstance(); this.databases = databases; setTitle( BaseMessages.getString( PKG, "CopyTableWizardPage1.Dialog.Title" ) ); setDescription( BaseMessages.getString( PKG, "CopyTableWizardPage1.Dialog.Description" ) ); setPageComplete( false ); }