依次点击菜单:Help->Install New Software,在弹出的窗口中点击如下下拉框,选择CDT-http…,然后点击Next进行安装.
与第一步类似,点击菜单点击菜单:Help->Install New Software,在弹出的对话框中做如下选择.
打开 window->show view,选择others。然后选择plug-in Development 下的plug-ins,再点击Open按钮。在弹出的在plugin-ins串口找到 org.eclipse.cdt.ui ,右键单击,选择import as -> source project,导入之后在你的 workspace就可以看到这个插件工程。
找到org.eclipse.cdt.ui/src/org.eclipse.cdt.internal.ui.text.contentassist/ContentAssistProcessor.java
修改public void setCompletionProposalAutoActivationCharacters(char[] activationSet)
public void setCompletionProposalAutoActivationCharacters(char[] activationSet) {
//fCompletionAutoActivationCharacters= activationSet;
String test = ".ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char[] triggers = test.toCharArray();
fCompletionAutoActivationCharacters = triggers;
}
找到
/org.eclipse.cdt.ui/src/org.eclipse.cdt.internal.ui.text.contentassist/CContentAssistProcessor.java
修改protected boolean verifyAutoActivation(ITextViewer viewer, int offset)
switch语句中增加了default分支.
protected boolean verifyAutoActivation(ITextViewer viewer, int offset) {
IDocument doc = viewer.getDocument();
if (doc == null) {
return false;
}
if (offset <= 0) {
return false;
}
try {
char activationChar = doc.getChar(--offset);
switch (activationChar) {
case ':':
return offset > 0 && doc.getChar(--offset) == ':';
case '>':
return offset > 0 && doc.getChar(--offset) == '-';
case '.':
// Avoid completion of float literals
CHeuristicScanner scanner = new CHeuristicScanner(doc);
int token = scanner.previousToken(--offset, Math.max(0, offset - 200));
// The scanner reports numbers as identifiers
if (token == Symbols.TokenIDENT
&& !Character.isJavaIdentifierStart(doc.getChar(scanner.getPosition() + 1))) {
// Not a valid identifier
return false;
}
return true;
default:
return Character.isAlphabetic(activationChar) || activationChar=='_';
}
} catch (BadLocationException e) {
}
return false;
}
在工程上右键,然后点击Export按钮,选择Plug-in Development下的Deployable plug-ins and fragment,然后点击next。再选择路径后,点击finish就完成了
实际上jar插件只要放入插件目录中替代就行了,也就是将第五步产生的jar文件复制到C:\Users*.p2\pool\plugins目录下,将原来的替换。