本文整理汇总了Java中com.intellij.codeInsight.CodeInsightBundle类的典型用法代码示例。如果您正苦于以下问题:Java CodeInsightBundle类的具体用法?Java CodeInsightBundle怎么用?Java CodeInsightBundle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CodeInsightBundle类属于com.intellij.codeInsight包,在下文中一共展示了CodeInsightBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: highlightExitPoints
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
private void highlightExitPoints(final LuaReturnStatement statement,
final LuaBlock block) {
final Instruction[] flow = block.getControlFlow();
final Collection<PsiElement> exitStatements = findExitPointsAndStatements(flow);
if (!exitStatements.contains(statement)) {
return;
}
final PsiElement originalTarget = getExitTarget(statement);
for (PsiElement exitStatement : exitStatements) {
if (getExitTarget(exitStatement) == originalTarget) {
addOccurrence(exitStatement);
}
}
myStatusText = CodeInsightBundle.message("status.bar.exit.points.highlighted.message",
exitStatements.size(),
HighlightUsagesHandler.getShortcutText());
}
示例2: appendPropertyKeyNotFoundProblem
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
private static void appendPropertyKeyNotFoundProblem(@NotNull String bundleName,
@NotNull String key,
@NotNull PsiExpression expression,
@NotNull InspectionManager manager,
@NotNull List<ProblemDescriptor> problems,
boolean onTheFly) {
final String description = CodeInsightBundle.message("inspection.unresolved.property.key.reference.message", key);
final List<PropertiesFile> propertiesFiles = filterNotInLibrary(expression.getProject(),
I18nUtil.propertiesFilesByBundleName(bundleName, expression));
problems.add(
manager.createProblemDescriptor(
expression,
description,
propertiesFiles.isEmpty() ? null : new JavaCreatePropertyFix(expression, key, propertiesFiles),
ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, onTheFly
)
);
}
示例3: getFlagsDescription
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
private static String getFlagsDescription(final PsiModifierListOwner aClass) {
int flags = getFlags(aClass, false);
String adj = "";
for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
if (provider.getLayerIcon(aClass, false) != null) {
adj += " " + provider.getLayerDescription();
}
}
if ((flags & FLAGS_ABSTRACT) != 0) adj += " " + CodeInsightBundle.message("node.abstract.flag.tooltip");
if ((flags & FLAGS_FINAL) != 0) adj += " " + CodeInsightBundle.message("node.final.flag.tooltip");
if ((flags & FLAGS_STATIC) != 0) adj += " " + CodeInsightBundle.message("node.static.flag.tooltip");
PsiModifierList list = aClass.getModifierList();
if (list != null) {
int level = PsiUtil.getAccessLevel(list);
if (level != PsiUtil.ACCESS_LEVEL_PUBLIC) {
adj += " " + StringUtil.capitalize(PsiBundle.visibilityPresentation(PsiUtil.getAccessModifier(level)));
}
}
return adj;
}
示例4: doOKAction
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
@Override
protected void doOKAction() {
if (!createPropertiesFileIfNotExists()) return;
Collection<PropertiesFile> propertiesFiles = getAllPropertiesFiles();
for (PropertiesFile propertiesFile : propertiesFiles) {
IProperty existingProperty = propertiesFile.findPropertyByKey(getKey());
final String propValue = myValue.getText();
if (existingProperty != null && !Comparing.strEqual(existingProperty.getValue(), propValue)) {
final String messageText = CodeInsightBundle.message("i18nize.dialog.error.property.already.defined.message", getKey(), propertiesFile.getName());
final int code = Messages.showOkCancelDialog(myProject,
messageText,
CodeInsightBundle.message("i18nize.dialog.error.property.already.defined.title"),
null);
if (code == Messages.CANCEL) {
return;
}
}
}
super.doOKAction();
}
示例5: highlightExitPoints
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
private void highlightExitPoints(final PyReturnStatement statement,
final PyFunction function) {
final ControlFlow flow = ControlFlowCache.getControlFlow(function);
final Collection<PsiElement> exitStatements = findExitPointsAndStatements(flow);
if (!exitStatements.contains(statement)) {
return;
}
final PsiElement originalTarget = getExitTarget(statement);
for (PsiElement exitStatement : exitStatements) {
if (getExitTarget(exitStatement) == originalTarget) {
addOccurrence(exitStatement);
}
}
myStatusText = CodeInsightBundle.message("status.bar.exit.points.highlighted.message",
exitStatements.size(),
HighlightUsagesHandler.getShortcutText());
}
示例6: isAvailable
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
public static boolean isAvailable(PsiFile file) {
final Project project = file.getProject();
final String title = CodeInsightBundle.message("i18nize.dialog.error.jdk.title");
try {
return ResourceBundleManager.getManager(file) != null;
}
catch (ResourceBundleManager.ResourceBundleNotFoundException e) {
final IntentionAction fix = e.getFix();
if (fix != null) {
if (Messages.showOkCancelDialog(project, e.getMessage(), title, Messages.getErrorIcon()) == Messages.OK) {
try {
fix.invoke(project, null, file);
return false;
}
catch (IncorrectOperationException e1) {
LOG.error(e1);
}
}
}
Messages.showErrorDialog(project, e.getMessage(), title);
return false;
}
}
示例7: createNorthPanel
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
@NotNull
private JComponent createNorthPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBag gb = new GridBag().setDefaultInsets(4, 4, 4, 4).setDefaultWeightY(1).setDefaultFill(GridBagConstraints.BOTH);
JLabel keyPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.abbreviation"));
keyPrompt.setLabelFor(myKeyField);
panel.add(keyPrompt, gb.nextLine().next());
panel.add(myKeyField, gb.next().weightx(1));
JLabel descriptionPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.description"));
descriptionPrompt.setLabelFor(myDescription);
panel.add(descriptionPrompt, gb.next());
panel.add(myDescription, gb.next().weightx(3));
return panel;
}
示例8: chooseTarget
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
@Nullable
private static PsiElementClassMember chooseTarget(PsiFile file, Editor editor, Project project) {
final PsiElementClassMember[] targetElements = getTargetElements(file, editor);
if (targetElements == null || targetElements.length == 0) return null;
if (!ApplicationManager.getApplication().isUnitTestMode()) {
MemberChooser<PsiElementClassMember> chooser = new MemberChooser<PsiElementClassMember>(targetElements, false, false, project);
chooser.setTitle(CodeInsightBundle.message("generate.delegate.target.chooser.title"));
chooser.setCopyJavadocVisible(false);
chooser.show();
if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE) return null;
final List<PsiElementClassMember> selectedElements = chooser.getSelectedElements();
if (selectedElements != null && selectedElements.size() > 0) return selectedElements.get(0);
}
else {
return targetElements[0];
}
return null;
}
示例9: AbstractGenerateEqualsWizard
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
public AbstractGenerateEqualsWizard(Project project, Builder<C, M, I> builder) {
super(CodeInsightBundle.message("generate.equals.hashcode.wizard.title"), project);
myBuilder = builder;
myClass = builder.getPsiClass();
myClassFields = builder.getClassFields();
myFieldsToHashCode = builder.getFieldsToHashCode();
myFieldsToNonNull = builder.getFieldsToNonNull();
myEqualsPanel = builder.getEqualsPanel();
myHashCodePanel = builder.getHashCodePanel();
myNonNullPanel = builder.getNonNullPanel();
addTableListeners();
addSteps();
init();
updateButtons();
}
示例10: reset
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
public void reset(String intentionCategory) {
try {
readHTML(toHTML(CodeInsightBundle.message("intention.settings.category.text", intentionCategory)));
setupPoweredByPanel(null);
URL beforeURL = getClass().getClassLoader().getResource(getClass().getPackage().getName().replace('.','/') + "/" + BEFORE_TEMPLATE);
showUsages(myBeforePanel, myBeforeSeparator, myBeforeUsagePanels, new ResourceTextDescriptor[]{new ResourceTextDescriptor(beforeURL)});
URL afterURL = getClass().getClassLoader().getResource(getClass().getPackage().getName().replace('.','/') + "/" + AFTER_TEMPLATE);
showUsages(myAfterPanel, myAfterSeparator, myAfterUsagePanels, new ResourceTextDescriptor[]{new ResourceTextDescriptor(afterURL)});
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
myPanel.revalidate();
}
});
}
catch (IOException e) {
LOG.error(e);
}
}
示例11: createCenterPanel
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
@Override
protected JComponent createCenterPanel() {
myTitle.setText(myText);
myOptionsPanel.setBorder(IdeBorderFactory.createTitledBorder(CodeInsightBundle.message("reformat.directory.dialog.options")));
myFiltersPanel.setBorder(IdeBorderFactory.createTitledBorder(CodeInsightBundle.message("reformat.directory.dialog.filters")));
myMaskWarningLabel.setIcon(AllIcons.General.Warning);
myMaskWarningLabel.setVisible(false);
myIncludeSubdirsCb.setVisible(shouldShowIncludeSubdirsCb());
initFileTypeFilter();
initScopeFilter();
restoreCbsStates();
return myWholePanel;
}
示例12: LayoutCodeDialog
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
public LayoutCodeDialog(@NotNull Project project,
@NotNull PsiFile file,
boolean textSelected,
final String helpId) {
super(project, true);
myFile = file;
myProject = project;
myTextSelected = textSelected;
myHelpId = helpId;
myLastRunOptions = new LastRunReformatCodeOptionsProvider(PropertiesComponent.getInstance());
myRunOptions = createOptionsBundledOnDialog();
setOKButtonText(CodeInsightBundle.message("reformat.code.accept.button.text"));
setTitle("Reformat File: " + file.getName());
init();
}
示例13: generateTypeParametersSection
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
private void generateTypeParametersSection(final StringBuilder buffer, final PsiClass aClass) {
final LinkedList<ParamInfo> result = new LinkedList<ParamInfo>();
final PsiTypeParameter[] typeParameters = aClass.getTypeParameters();
for (int i = 0; i < typeParameters.length; i++) {
PsiTypeParameter typeParameter = typeParameters[i];
String name = "<" + typeParameter.getName() + ">";
final DocTagLocator<PsiDocTag> locator = typeParameterLocator(i);
final Pair<PsiDocTag, InheritDocProvider<PsiDocTag>> inClassComment = findInClassComment(aClass, locator);
if (inClassComment != null) {
result.add(new ParamInfo(name, inClassComment));
}
else {
final Pair<PsiDocTag, InheritDocProvider<PsiDocTag>> pair = findInHierarchy(aClass, locator);
if (pair != null) {
result.add(new ParamInfo(name, pair));
}
}
}
generateParametersSection(buffer, CodeInsightBundle.message("javadoc.type.parameters"), result);
}
示例14: getMethodCandidateInfo
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
private static String getMethodCandidateInfo(GrReferenceExpression expr) {
final GroovyResolveResult[] candidates = expr.multiResolve(false);
final String text = expr.getText();
if (candidates.length > 0) {
@NonNls final StringBuilder sb = new StringBuilder();
for (final GroovyResolveResult candidate : candidates) {
final PsiElement element = candidate.getElement();
if (!(element instanceof PsiMethod)) {
continue;
}
final String str = PsiFormatUtil
.formatMethod((PsiMethod)element, candidate.getSubstitutor(),
PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_PARAMETERS,
PsiFormatUtilBase.SHOW_TYPE);
createElementLink(sb, element, str);
}
return CodeInsightBundle.message("javadoc.candidates", text, sb);
}
return CodeInsightBundle.message("javadoc.candidates.not.found", text);
}
示例15: startTemplateWithPrefix
import com.intellij.codeInsight.CodeInsightBundle; //导入依赖的package包/类
public void startTemplateWithPrefix(final Editor editor,
final TemplateImpl template,
final int templateStart,
@Nullable final PairProcessor<String, String> processor,
@Nullable final String argument) {
final int caretOffset = editor.getCaretModel().getOffset();
final TemplateState templateState = initTemplateState(editor);
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(myProject, new Runnable() {
@Override
public void run() {
editor.getDocument().deleteString(templateStart, caretOffset);
editor.getCaretModel().moveToOffset(templateStart);
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
editor.getSelectionModel().removeSelection();
Map<String, String> predefinedVarValues = null;
if (argument != null) {
predefinedVarValues = new HashMap<String, String>();
predefinedVarValues.put(TemplateImpl.ARG, argument);
}
templateState.start(template, processor, predefinedVarValues);
}
}, CodeInsightBundle.message("insert.code.template.command"), null);
}