本文整理汇总了Java中com.maddyhome.idea.copyright.options.LanguageOptions类的典型用法代码示例。如果您正苦于以下问题:Java LanguageOptions类的具体用法?Java LanguageOptions怎么用?Java LanguageOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LanguageOptions类属于com.maddyhome.idea.copyright.options包,在下文中一共展示了LanguageOptions类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCopyrightOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
@Nullable
public CopyrightProfile getCopyrightOptions(@NotNull PsiFile file) {
final VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile == null || myOptions.getOptions(virtualFile.getFileType().getName()).getFileTypeOverride() == LanguageOptions.NO_COPYRIGHT) return null;
final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
for (String scopeName : myModuleToCopyrights.keySet()) {
final NamedScope namedScope = validationManager.getScope(scopeName);
if (namedScope != null) {
final PackageSet packageSet = namedScope.getValue();
if (packageSet != null) {
if (packageSet.contains(file, validationManager)) {
final CopyrightProfile profile = myCopyrights.get(myModuleToCopyrights.get(scopeName));
if (profile != null) {
return profile;
}
}
}
}
}
return myDefaultCopyright != null ? myDefaultCopyright : null;
}
示例2: getCommentText
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
protected String getCommentText(String prefix, String suffix) {
if (commentText == null) {
FileType ftype = FileTypeUtil.getInstance().getFileTypeByFile(root);
LanguageOptions opts = CopyrightManager.getInstance(project).getOptions().getMergedOptions(ftype.getName());
String base = EntityUtil.decode(myCopyrightProfile.getNotice());
if (base.isEmpty()) {
commentText = "";
}
else {
String expanded = VelocityHelper.evaluate(manager.findFile(root), project, module, base);
String cmt = FileTypeUtil.buildComment(root.getFileType(), expanded, opts);
commentText = StringUtil.convertLineSeparators(prefix + cmt + suffix);
}
}
return commentText;
}
示例3: getCopyrightOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
@Nullable
public CopyrightProfile getCopyrightOptions(@NotNull PsiFile file) {
final VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile == null || myOptions.getOptions(virtualFile.getFileType().getName()).getFileTypeOverride() == LanguageOptions.NO_COPYRIGHT) return null;
final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
for (String scopeName : myModule2Copyrights.keySet()) {
final NamedScope namedScope = validationManager.getScope(scopeName);
if (namedScope != null) {
final PackageSet packageSet = namedScope.getValue();
if (packageSet != null) {
if (packageSet.contains(file, validationManager)) {
final CopyrightProfile profile = myCopyrights.get(myModule2Copyrights.get(scopeName));
if (profile != null) {
return profile;
}
}
}
}
}
return myDefaultCopyright != null ? myDefaultCopyright : null;
}
示例4: getDefaultOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
@Override
public LanguageOptions getDefaultOptions() {
LanguageOptions options = super.getDefaultOptions();
options.setFiller("=");
options.setBlock(false);
options.setPrefixLines(false);
options.setFileTypeOverride(LanguageOptions.USE_TEXT);
return options;
}
示例5: showPreview
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
private void showPreview(LanguageOptions options) {
final String defaultCopyrightText = myNoCopyright.isSelected() ? "" : FileTypeUtil
.buildComment(fileType, VelocityHelper.evaluate(null, null, null, EntityUtil.decode(CopyrightProfile.DEFAULT_COPYRIGHT_NOTICE)), options);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
preview.setText(defaultCopyrightText);
}
});
}
示例6: reset
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
public void reset() {
final LanguageOptions options =
parentPanel == null ? myManager.getOptions().getTemplateOptions() : myManager.getOptions().getOptions(fileType.getName());
boolean isBlock = options.isBlock();
if (isBlock) {
rbBlockComment.setSelected(true);
}
else {
rbLineComment.setSelected(true);
}
cbPrefixLines.setSelected(!allowBlock || options.isPrefixLines());
cbSeparatorAfter.setSelected(options.isSeparateAfter());
cbSeparatorBefore.setSelected(options.isSeparateBefore());
txtLengthBefore.setText(String.valueOf(options.getLenBefore()));
txtLengthAfter.setText(String.valueOf(options.getLenAfter()));
txtFiller.setText(options.getFiller() == LanguageOptions.DEFAULT_FILLER ? "" : options.getFiller());
cbBox.setSelected(options.isBox());
final int fileTypeOverride = options.getFileTypeOverride();
myUseDefaultSettingsRadioButton.setSelected(fileTypeOverride == LanguageOptions.USE_TEMPLATE);
myUseCustomFormattingOptionsRadioButton.setSelected(fileTypeOverride == LanguageOptions.USE_TEXT);
myNoCopyright.setSelected(fileTypeOverride == LanguageOptions.NO_COPYRIGHT);
if (options.isRelativeBefore()) {
rbBefore.setSelected(true);
}
else {
rbAfter.setSelected(true);
}
cbAddBlank.setSelected(options.isAddBlankAfter());
if (fileLocations != null) {
int choice = options.getFileLocation() - 1;
choice = Math.max(0, Math.min(choice, fileLocations.length - 1));
fileLocations[choice].setSelected(true);
}
updateOverride();
}
示例7: getOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
public LanguageOptions getOptions() {
// If this is a fully custom comment we should really ensure there are no blank lines in the comments outside
// of a block comment. If there are any blank lines the replacement logic will fall apart.
final LanguageOptions res = new LanguageOptions();
res.setBlock(rbBlockComment.isSelected());
res.setPrefixLines(!allowBlock || cbPrefixLines.isSelected());
res.setSeparateAfter(cbSeparatorAfter.isSelected());
res.setSeparateBefore(cbSeparatorBefore.isSelected());
try {
Object val = Integer.parseInt(txtLengthBefore.getText());
if (val instanceof Number) {
res.setLenBefore(((Number)val).intValue());
}
val = Integer.parseInt(txtLengthAfter.getText());
if (val instanceof Number) {
res.setLenAfter(((Number)val).intValue());
}
}
catch (NumberFormatException e) {
//leave blank
}
res.setBox(cbBox.isSelected());
String filler = txtFiller.getText();
if (filler.length() > 0) {
res.setFiller(filler);
}
else {
res.setFiller(LanguageOptions.DEFAULT_FILLER);
}
res.setFileTypeOverride(getOverrideChoice());
res.setRelativeBefore(rbBefore.isSelected());
res.setAddBlankAfter(cbAddBlank.isSelected());
if (fileLocations != null) {
for (int i = 0; i < fileLocations.length; i++) {
if (fileLocations[i].isSelected()) {
res.setFileLocation(i + 1);
}
}
}
return res;
}
示例8: getOverrideChoice
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
private int getOverrideChoice() {
return myUseDefaultSettingsRadioButton.isSelected()
? LanguageOptions.USE_TEMPLATE
: myNoCopyright.isSelected() ? LanguageOptions.NO_COPYRIGHT : LanguageOptions.USE_TEXT;
}
示例9: getDefaultOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
@Override
public LanguageOptions getDefaultOptions() {
return createDefaultOptions(false);
}
示例10: getDefaultOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
public LanguageOptions getDefaultOptions() {
return new LanguageOptions();
}
示例11: createDefaultOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
protected static LanguageOptions createDefaultOptions(boolean prefix) {
final LanguageOptions languageOptions = new LanguageOptions();
languageOptions.setPrefixLines(prefix);
return languageOptions;
}
示例12: getLanguageOptions
import com.maddyhome.idea.copyright.options.LanguageOptions; //导入依赖的package包/类
protected LanguageOptions getLanguageOptions() {
return langOpts;
}