Java Code Examples for org.eclipse.swt.widgets.List#getItems()

The following examples show how to use org.eclipse.swt.widgets.List#getItems() . 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: KeywordTab.java    From cdt-proc with Eclipse Public License 1.0 5 votes vote down vote up
public void storeValues() {
	List list = listViewer.getList();
	String items[] = list.getItems();
	StringBuilder sb = new StringBuilder();

	for (int i = 0; i < items.length; i++) {
		sb.append(items[i] + PreferenceConstants.PREF_STORE_DELIMITER);
	}

	UIActivator.getDefault().replaceKeyword(keywordKind, list.getItems());

	store.setValue(prefName, sb.toString());
}
 
Example 2
Source File: KbdMacroListEditor.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * If the widget set is different from active set, then update the active set
 */
private void checkActive() {
	List myList = getListUnchecked();
	if (myList != null) {
		String[] items = myList.getItems();
		if (active.size() != items.length && !active.equals(Arrays.asList(items))) {
			active.clear();
			for (String item : items) {
				active.add(item);
			}
		}
	}    	
}
 
Example 3
Source File: KbdMacroListEditor.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * If the active set is different from widget set, then update the widget set
 */
private void activeChangeCheck() {
	List myList = getListUnchecked();
	if (myList != null) {
		String[] items = myList.getItems();
		if (active.size() != items.length && !active.equals(Arrays.asList(items))) {
			myList.removeAll();
			for (String item : active) {
				myList.add(item);
			}
			setPresentsDefaultValue(checkDefaults(active));
			super.selectionChanged();
		}
	}    	
}
 
Example 4
Source File: CommandCategoryEditor.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
private void checkCats(){
  	List myList = this.getListUnchecked();
  	if (myList != null) {
	String[] items = myList.getItems();
	if (items.length != active.size()) {
		// a remove happened 
		ArrayList<Category> moveCats = new ArrayList<Category>();
		String[] catLabels = new String[active.size()];
		for (int i = 0; i < active.size(); i++) {
			catLabels[i] = getLabel(active.get(i));
		}
		for (int i = 0; i < catLabels.length; i++) {
			boolean ok = false;
			for (int j = 0; j < items.length; j++) {
				if (items[j].equals(catLabels[i])) {
					ok = true;
					break;
				}
			}
			if (!ok) {
				moveCats.add(active.get(i));
			}
		}
		if (!moveCats.isEmpty()) {
			active.removeAll(moveCats);
			inactive.addAll(moveCats);
		}
	}
}
  }