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


Java IContentProposal类代码示例

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


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


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