• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IContentProposal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
    String contentsLc = contents.toLowerCase();
    String contentsNq = PATTERN_QUOTE.matcher(contentsLc).replaceAll(""); //$NON-NLS-1$

    List<IContentProposal> list = new ArrayList<>();
    for (IContentProposal proposal : proposals) {
        String content = proposal.getContent();
        if (content.contains(contentsLc)
                // ignore quotes
                || PATTERN_QUOTE.matcher(content).replaceAll("").contains(contentsNq)) { //$NON-NLS-1$
            list.add(proposal);
        }
    }
    return list.toArray(new IContentProposal[list.size()]);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:17,代码来源:PgStatementAutoCompleteField.java


示例2: bindToViewModel

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例3: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例4: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(final String contents, final int position) {
    // Work-around to make sure that the popup doesn't open when the
    // user has opened the dropdown of the combo. By returning an empty
    // list, the popup won't be shown.
    if (ignoreServerChangeEvents || serverCombo.getListVisible()) {
        return new IContentProposal[0];
    }

    final List<IContentProposal> list = new ArrayList<IContentProposal>(proposals.size());
    if (StringUtil.isNullOrEmpty(contents)) {
        for (int i = 0; i < proposals.size(); i++) {
            list.add(new ContentProposal(proposals.get(i)));
        }
    } else {
        final String search = contents.toLowerCase().trim();
        for (int i = 0; i < proposals.size(); i++) {
            final String p = proposals.get(i);
            if (StringUtil.containsIgnoreCase(p, search)) {
                list.add(new ContentProposal(p));
            }
        }
    }

    return list.toArray(new IContentProposal[list.size()]);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:27,代码来源:ServerTypeSelectControl.java


示例5: filterProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
private IContentProposal[] filterProposals(
		IContentProposal[] proposals, String filterString) {
	if (filterString.length() == 0) {
		return proposals;
	}

	// Check each string for a match. Use the string displayed to the
	// user, not the proposal content.
	ArrayList list = new ArrayList();
	for (int i = 0; i < proposals.length; i++) {
		String string = getString(proposals[i]);
		if (string.length() >= filterString.length()
				&& string.substring(0, filterString.length())
						.equalsIgnoreCase(filterString)) {
			list.add(proposals[i]);
		}

	}
	return (IContentProposal[]) list.toArray(new IContentProposal[list
			.size()]);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:22,代码来源:MyContentProposalAdapter.java


示例6: proposalAccepted

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
private void proposalAccepted(IContentProposal proposal) {
	switch (proposalAcceptanceStyle) {
	case (PROPOSAL_REPLACE):
		setControlContent(proposal.getContent(), proposal
				.getCursorPosition());
		break;
	case (PROPOSAL_INSERT):
		insertControlContent(proposal.getContent(), proposal
				.getCursorPosition());
		break;
	default:
		// do nothing. Typically a listener is installed to handle this in
		// a custom way.
		break;
	}

	// In all cases, notify listeners of an accepted proposal.
	notifyProposalAccepted(proposal);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:20,代码来源:MyContentProposalAdapter.java


示例7: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
private IContentProposal[] getProposals() {
	if (proposalProvider == null || !isValid()) {
		return null;
	}
	if (DEBUG) {
		System.out.println(">>> obtaining proposals from provider"); //$NON-NLS-1$
	}
	int position = insertionPos;
	if (position == -1) {
		position = getControlContentAdapter().getCursorPosition(
				getControl());
	}
	String contents = getControlContentAdapter().getControlContents(
			getControl());
	IContentProposal[] proposals = proposalProvider.getProposals(contents,
			position);
	return proposals;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:19,代码来源:MyContentProposalAdapter.java


示例8: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例9: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例10: getComparator

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
private Comparator<IContentProposal> getComparator() {
	if (comparator == null) {
		comparator = new Comparator<IContentProposal>() {

			@Override
			public int compare(IContentProposal p1, IContentProposal p2) {
				if (p1 != null && p2 != null) {
					if (p1.getLabel() != null) {
						return p1.getLabel().compareTo(p2.getLabel());
					}
				}
				return 0;
			}

		};
	}
	return comparator;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:ObjectSelectionProposalProvider.java


示例11: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例12: getComparator

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
private Comparator<? super IContentProposal> getComparator() {
	if (comparator == null) {
		comparator = new Comparator<IContentProposal>() {

			@Override
			public int compare(IContentProposal p1, IContentProposal p2) {
				if (p1 != null && p2 != null) {
					if (p1.getLabel() != null) {
						return p1.getLabel().compareTo(p2.getLabel());
					}
				}
				return 0;
			}

		};
	}
	return comparator;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:PassportEntryContentProposalProvider.java


示例13: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
public IContentProposal[] getProposals(String contents, int position) {
// System.out.println("getProposals:"+contents);
   if (filterProposals) {
      ArrayList list = new ArrayList();
      for (int i = 0; i < proposals.length; i++) {
         if (proposals[i].length() >= contents.length() 
             && proposals[i].substring(0, contents.length()).equalsIgnoreCase(contents)) {
            list.add(makeContentProposal(proposals[i], labels[i]));
         }
      }
      return (IContentProposal[]) list.toArray(new IContentProposal[list.size()]);
   }
   
   if (contentProposals == null) {
      contentProposals = new IContentProposal[proposals.length];
      for (int i = 0; i < proposals.length; i++) {
         contentProposals[i] = makeContentProposal(proposals[i], labels[i]);
      }
   }
   return contentProposals;
}
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:22,代码来源:ContentProposalProvider.java


示例14: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
	List<IContentProposal> proposals = new ArrayList<IContentProposal>();
	for (IContentProposalProvider provider : proposalProviders) {
		IContentProposal[] icp = provider.getProposals(contents, position);
		if (icp == null) continue;
		for (IContentProposal prop: icp) 
			proposals.add(prop);
	}
	Collections.sort(proposals, new Comparator<IContentProposal>() {
		@Override
		public int compare(IContentProposal arg0, IContentProposal arg1) {
			return arg0.getLabel().compareTo(arg1.getLabel());
		}			
	});
	return proposals.toArray(new IContentProposal[0]);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:MultiContentProposalProvider.java


示例15: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
public IContentProposal[] getProposals(String contents, int position) {
	List<Proposal> primaryProposals= new ArrayList<Proposal>();
	List<Proposal> secondaryProposals= new ArrayList<Proposal>();
	String[] proposalStrings= parser.getVariables();
	String contentToCursor= contents.substring(0, position);
	for (int i= 0; i < proposalStrings.length; i++) {
		if (stringOverlap(contentToCursor, proposalStrings[i]) > 0)
			primaryProposals.add(new Proposal(proposalStrings[i]));
		else
			secondaryProposals.add(new Proposal(proposalStrings[i]));
	}

	this.latestContents= contents;
	this.latestPosition= position;

	primaryProposals.addAll(secondaryProposals);
	return primaryProposals.toArray(new IContentProposal[0]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:GenerateToStringDialog.java


示例16: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例17: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例18: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的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


示例19: getProposals

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position){
	if (filterProposals) {
		ArrayList<IContentProposal> list = new ArrayList<IContentProposal>();
		for (int i = 0; i < proposals.length; i++) {
			if (proposals[i].length() >= contents.length()
				&& proposals[i].substring(0, contents.length()).equalsIgnoreCase(contents)) {
				list.add(makeContentProposal(proposals[i], labels[i], detailDescription[i]));
			}
		}
		return (IContentProposal[]) list.toArray(new IContentProposal[list.size()]);
	}
	if (contentProposals == null) {
		refreshProposals();
	}
	return contentProposals;
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:18,代码来源:Feld8402ContentProposalProvider.java


示例20: makeContentProposal

import org.eclipse.jface.fieldassist.IContentProposal; //导入依赖的package包/类
private IContentProposal makeContentProposal(final String proposal, final String label, final String detailDescription){
	return new IContentProposal() {
		
		public String getContent(){
			return proposal;
		}
		
		public String getDescription(){
			return detailDescription;
		}
		
		public String getLabel(){
			return proposal + " - " + label;
		}
		
		public int getCursorPosition(){
			return proposal.length();
		}
	};
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:21,代码来源:Feld8402ContentProposalProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AlgorithmParameterGenerator类代码示例发布时间:2022-05-21
下一篇:
Java WebappClassLoader类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap