当前位置: 首页>>代码示例>>Java>>正文


Java ContentProposal类代码示例

本文整理汇总了Java中org.eclipse.jface.fieldassist.ContentProposal的典型用法代码示例。如果您正苦于以下问题:Java ContentProposal类的具体用法?Java ContentProposal怎么用?Java ContentProposal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContentProposal类属于org.eclipse.jface.fieldassist包,在下文中一共展示了ContentProposal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindToViewModel

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
public void bindToViewModel(PatriciaTrie<ContentProposal> proposals, String[] sortedNames) {
	final TagListContentProposalProvider proposalProvider = new TagListContentProposalProvider(proposals);
	ContentProposalAdapter proposalAdapter = new ContentProposalAdapter(
			tagEntry, new ComboContentAdapter(), proposalProvider, null, null);
	proposalAdapter.setPropagateKeys(true);
	proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);

	proposalAdapter.addContentProposalListener(new IContentProposalListener() {

		@Override
		public void proposalAccepted(IContentProposal userSelectedProposal) {
			if (proposalProvider.getMakeNewProposal() == userSelectedProposal) {
				for (TagListSelectedEventHandler handler: eventHandlers) {
					handler.requestNewTag(userSelectedProposal.getContent());
					
					clearText();
				}
			}
			addTagInternal(userSelectedProposal.getContent());
		}

	});
	
	tagEntry.setItems(sortedNames);
}
 
开发者ID:sjclemen,项目名称:peten,代码行数:26,代码来源:TagListCombo.java

示例2: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
	// TODO:
	// cap the number of proposals
	// exclude tags already part of our set
	// if the current selection is a suffix of our last guess, reuse
	// the prefix
	SortedMap<String, ContentProposal> selectedProposals = contentProposals
			.prefixMap(contents.toLowerCase());
	
	ArrayList<ContentProposal> proposals = new ArrayList<ContentProposal>(
			selectedProposals.values());

	if (!selectedProposals.containsKey(contents)) {
		ContentProposal makeNew = new ContentProposal(contents,
				"Create new tag: " + contents, "Creates a new tag");
		makeNewProposal = makeNew;

		proposals.add(makeNew);
	}
	return proposals.toArray(new ContentProposal[0]);
}
 
开发者ID:sjclemen,项目名称:peten,代码行数:23,代码来源:TagListCombo.java

示例3: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
	NpmModule module = IDENpmModulesManager.getInstance().getNPMModule(moduleName);
	if (module.isLoaded()) {
		List<IContentProposal> list = new ArrayList<>();
		try {
			for (String proposal : module.getAvailableVersions()) {
				if (proposal.length() >= contents.length()
						&& proposal.substring(0, contents.length()).equalsIgnoreCase(contents)) {
					list.add(new ContentProposal(proposal));
				}
			}
		} catch (IOException e) {
			// Should never occurred.
		}
		return list.toArray(new IContentProposal[list.size()]);
	} else {
		NpmInstallWidget.this.openPopup = true;
		validateVersionASynch(module);
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:23,代码来源:NpmInstallWidget.java

示例4: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
	if (contents.length() > 1) {
		list = loadList(contents);
	}

	List<ContentProposal> partialList = new Vector<ContentProposal>();
	if (list != null && !list.isEmpty()) {
		for (BTSObject o : list) {
			if (o.getName() != null && o.getName().startsWith(contents)
					|| o.get_id().equals(contents)) {
				String desc = o.getName() + "\n" + o.get_id() + "\n" + o.getDBCollectionKey();
				ContentProposal p = new ContentProposal(o.get_id(), o.getName(), desc);
				partialList.add(p);
			}
		}

		Collections.sort(partialList, getComparator());
	}
	return partialList.toArray(new IContentProposal[partialList.size()]);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:ObjectSelectionProposalProvider.java

示例5: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
	List<IContentProposal> partialList = new Vector<IContentProposal>();

	if (list != null && !list.isEmpty()) {
		for (BTSPassportEntry e : list) {
			if (e.getValue() != null && e.getValue().startsWith(contents)) {
				ContentProposal p = new ContentProposal(e.getValue());
				partialList.add(p);
			}
		}

		Collections.sort(partialList, getComparator());
	}
	return partialList.toArray(new IContentProposal[partialList.size()]);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:PassportEntryContentProposalProvider.java

示例6: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position){
	if (contents == null || contents.length() < 1)
		return null;
	
	if (position == 1) {
		// refresh all available from database
		queryResults.clear();
		queryResults = query.execute();
	}
	
	proposals.clear();
	
	for (T a : queryResults) {
		String label = getLabelForObject(a);
		if (label.toLowerCase().startsWith(contents.toLowerCase())) {
			proposals.add(new PersistentObjectContentProposal<T>(label, a));
		}
	}
	
	return proposals.toArray(new ContentProposal[] {});
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:23,代码来源:PersistentObjectProposalProvider.java

示例7: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
public IContentProposal[] getProposals(String contents, int position){
	// System.out.println("getProposals()");
	List<ContentProposal> cp = new LinkedList<ContentProposal>();
	List<String[]> cities = ContactGeonames.getLabeledCities();
	for (int i = 0; i < cities.size(); i++) {
		String[] currCity = cities.get(i);
		if (contents == null) {
			cp.add(new ContentProposal(currCity[0], currCity[0] + " (" + currCity[1] + ")",
				null));
		} else if (currCity[0].toLowerCase().startsWith(contents.toLowerCase())) {
			cp.add(new ContentProposal(currCity[0], currCity[0] + " (" + currCity[1] + ")",
				null));
		}
	}
	
	return cp.toArray(new ContentProposal[] {});
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:18,代码来源:CityInformationProposalProvider.java

示例8: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position){
	List<IContentProposal> ret = new ArrayList<IContentProposal>();
	if (contents != null && !contents.isEmpty()) {
		String addressString = getContentAddress(contents);
		if (!addressString.isEmpty()) {
			Query<Kontakt> query = new Query<Kontakt>(Kontakt.class);
			query.add(Kontakt.FLD_E_MAIL, Query.LIKE, addressString + "%");
			List<Kontakt> contacts = query.execute();
			
			for (Kontakt contact : contacts) {
				String mailAddress = contact.getMailAddress();
				ret.add(new ContentProposal(mailAddress));
			}
		}
	}
	return ret.toArray(new IContentProposal[ret.size()]);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:19,代码来源:MailAddressContentProposalProvider.java

示例9: addTagVm

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
private void addTagVm(TagVM tvm) {
	if (nameToTag.containsKey(tvm.getName()) || tagMap.containsKey(tvm.getId())) {
		throw new RuntimeException("Tried to insert already-existing id or name.");
	}
	
	tagMap.put(tvm.getId(), tvm);
	nameToTag.put(tvm.getName(), tvm);
	contentProposals.put(tvm.getName().toLowerCase(), new ContentProposal(tvm.getName()));
	
	for (TagListVMEventListener eventListener : eventListeners) {
		eventListener.onAdd(tvm);
	}
}
 
开发者ID:sjclemen,项目名称:peten,代码行数:14,代码来源:TagListVM.java

示例10: renameTagVm

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
private void renameTagVm(TagVM tvm, String oldName, String newName) {
	contentProposals.remove(tvm.getName().toLowerCase());
	contentProposals.put(tvm.getName().toLowerCase(), new ContentProposal(tvm.getName()));
	
	tvm.setName(newName);
	
	nameToTag.remove(tvm.getName());
	nameToTag.put(tvm.getName(), tvm);

	for (TagListVMEventListener eventListener : eventListeners) {
		eventListener.onRename(tvm, oldName, newName);
	}
}
 
开发者ID:sjclemen,项目名称:peten,代码行数:14,代码来源:TagListVM.java

示例11: setProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
private void setProposals(Map<String, String> proposals) {
    contentProposals = new ContentProposal[proposals.size()];
    int i = 0;
    for (Map.Entry<String, String> entry : proposals.entrySet())
    {
      ContentProposal proposal = new ContentProposal(entry.getKey(), entry.getValue());
      contentProposals[i++] = proposal;
    }
}
 
开发者ID:anb0s,项目名称:EasyShell,代码行数:10,代码来源:CommandVariableContentProposalProvider.java

示例12: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
public IContentProposal[] getProposals(String contents, int position) {
    ArrayList list = new ArrayList();
    
    if (proposals!=null) { 
        for (int i = 0; i < proposals.length; i++) {
            if (proposals[i].length() >= contents.length()
                    && proposals[i].substring(0, contents.length())
                            .equalsIgnoreCase(contents)) {
                list.add(new ContentProposal(proposals[i]));
            }
        }
        
        // bug 787
        // add the currently typed in string as the default choice, to avoid pressing enter and having our text replaced 
        int index = -1;
        for (int i=0; i < list.size(); i++)
        {
            if (((ContentProposal)list.get(i)).getContent().equals(contents)) {
                index =i;
                break;
            }
        }
        
        // move to first if already in the list, otherwise add it.  
        if (index>=0) 
            list.remove(index);
        list.add(0, new ContentProposal(contents));
    
    }
    return (IContentProposal[]) list.toArray(new IContentProposal[list.size()]);
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:32,代码来源:NotThatSimpleContentProposalProvider.java

示例13: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position){
	List<IContentProposal> ret = new ArrayList<IContentProposal>();
	if (contents != null && !contents.isEmpty()) {
		labelToCoding.keySet().stream().forEach(label -> {
			String match = contents.toLowerCase();
			if (label.toLowerCase().contains(match)) {
				ret.add(new ContentProposal(label));
			}
		});
	}
	return ret.toArray(new IContentProposal[ret.size()]);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:14,代码来源:CodingContentProposalProvider.java

示例14: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
public IContentProposal[] getProposals(String contents, int position){
	List<ContentProposal> cp = new LinkedList<ContentProposal>();
	List<String> zips = ContactGeonames.getZip();
	for (int i = 0; i < zips.size(); i++) {
		String currZip = zips.get(i);
		if (contents == null)
			cp.add(new ContentProposal(currZip));
		if (currZip.startsWith(contents))
			cp.add(new ContentProposal(currZip));
	}
	
	return cp.toArray(new ContentProposal[] {});
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:14,代码来源:ZipInformationProposalProvider.java

示例15: getProposals

import org.eclipse.jface.fieldassist.ContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position){
	switch (titlePosition) {
	case TITLE_POSITION_PREFIX:
		return titleProposalPrefix.toArray(new ContentProposal[] {});
	case TITLE_POSITION_SUFFIX:
		return titleProposalSuffix.toArray(new ContentProposal[] {});
	default:
		return null;
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:12,代码来源:TitleProposalProvider.java


注:本文中的org.eclipse.jface.fieldassist.ContentProposal类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。