code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@SuppressWarnings("static-method")
protected void safeRefresh(IProject project, IProgressMonitor monitor) {
try {
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (CoreException exception) {
SARLEclipsePlugin.getDefault().log(exception);
}
} | java |
public static String[] getSARLProjectSourceFolders() {
return new String[] {
SARLConfig.FOLDER_SOURCE_SARL,
SARLConfig.FOLDER_SOURCE_JAVA,
SARLConfig.FOLDER_RESOURCES,
SARLConfig.FOLDER_TEST_SOURCE_SARL,
SARLConfig.FOLDER_SOURCE_GENERATED,
SARLConfig.FOLDER_TEST_SOURCE_GENERATED,
};
} | java |
public static void configureSARLProject(IProject project, boolean addNatures,
boolean configureJavaNature, boolean createFolders, IProgressMonitor monitor) {
try {
final SubMonitor subMonitor = SubMonitor.convert(monitor, 11);
// Add Natures
final IStatus status = Status.OK_STATUS;
if (addNatures) {
... | java |
public static void configureSARLSourceFolders(IProject project, boolean createFolders, IProgressMonitor monitor) {
try {
final SubMonitor subMonitor = SubMonitor.convert(monitor, 8);
final OutParameter<IFolder[]> sourceFolders = new OutParameter<>();
final OutParameter<IFolder[]> testSourceFolders = new Out... | java |
public static List<IClasspathEntry> getDefaultSourceClassPathEntries(IPath projectFolder) {
final IPath srcJava = projectFolder.append(
Path.fromPortableString(SARLConfig.FOLDER_SOURCE_JAVA));
final IClasspathEntry srcJavaEntry = JavaCore.newSourceEntry(srcJava.makeAbsolute());
final IPath srcSarl = projectF... | java |
@SuppressWarnings("checkstyle:npathcomplexity")
protected void collectProjectFoldersFromDirectory(Collection<File> folders, File directory,
Set<String> directoriesVisited, boolean nestedProjects, IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return;
}
monitor.subTask(NLS.bind(
Messages.SARLPr... | java |
public static IStatus addNatures(IProject project, IProgressMonitor monitor, String... natureIdentifiers) {
if (project != null && natureIdentifiers != null && natureIdentifiers.length > 0) {
try {
final SubMonitor subMonitor = SubMonitor.convert(monitor, natureIdentifiers.length + 2);
final IProjectDescri... | java |
public static IStatus addSarlNatures(IProject project, IProgressMonitor monitor) {
return addNatures(project, monitor, getSarlNatures());
} | java |
public IAnnotation getAnnotation(IAnnotatable element, String qualifiedName) {
if (element != null) {
try {
final int separator = qualifiedName.lastIndexOf('.');
final String simpleName;
if (separator >= 0 && separator < (qualifiedName.length() - 1)) {
simpleName = qualifiedName.substring(separato... | java |
public JvmConstructor getJvmConstructor(IMethod constructor, XtendTypeDeclaration context)
throws JavaModelException {
if (constructor.isConstructor()) {
final JvmType type = this.typeReferences.findDeclaredType(
constructor.getDeclaringType().getFullyQualifiedName(),
context);
if (type instanceof ... | java |
protected IFormalParameterBuilder[] createFormalParametersWith(
ParameterBuilder parameterBuilder,
IMethod operation) throws JavaModelException, IllegalArgumentException {
final boolean isVarargs = Flags.isVarargs(operation.getFlags());
final ILocalVariable[] rawParameters = operation.getParameters();
final... | java |
public void createStandardConstructorsWith(
ConstructorBuilder codeBuilder,
Collection<IMethod> superClassConstructors,
XtendTypeDeclaration context) throws JavaModelException {
if (superClassConstructors != null) {
for (final IMethod constructor : superClassConstructors) {
if (!isGeneratedOperation(c... | java |
public void createActionsWith(
ActionBuilder codeBuilder,
Collection<IMethod> methods,
XtendTypeDeclaration context) throws JavaModelException, IllegalArgumentException {
if (methods != null) {
for (final IMethod operation : methods) {
if (!isGeneratedOperation(operation)) {
final ISarlActionBuil... | java |
public boolean isSubClassOf(TypeFinder typeFinder, String subClass, String superClass) throws JavaModelException {
final SuperTypeIterator typeIterator = new SuperTypeIterator(typeFinder, false, subClass);
while (typeIterator.hasNext()) {
final IType type = typeIterator.next();
if (Objects.equals(type.getFull... | java |
public static int compare(XExpression e1, XExpression e2) {
if (e1 == e2) {
return 0;
}
if (e1 == null) {
return Integer.MIN_VALUE;
}
if (e2 == null) {
return Integer.MAX_VALUE;
}
return e1.toString().compareTo(e2.toString());
} | java |
protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) {
wc.setAttribute(
IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
name);
} | java |
protected ILaunchConfigurationWorkingCopy initLaunchConfiguration(String configurationType, String projectName,
String id, boolean resetJavaMainClass) throws CoreException {
final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
final ILaunchConfigurationType configType = launchManager... | java |
protected static String trimFileExtension(String fileName) {
if (fileName.lastIndexOf('.') == -1) {
return fileName;
}
return fileName.substring(0, fileName.lastIndexOf('.'));
} | java |
protected void generateMetadata(IXmlStyleAppendable it) {
it.appendTagWithValue("property", //$NON-NLS-1$
Strings.concat(";", getMimeTypes()), //$NON-NLS-1$
"name", "mimetypes"); //$NON-NLS-1$ //$NON-NLS-2$
final StringBuilder buffer = new StringBuilder();
for (final String fileExtension : getLanguage().... | java |
@SuppressWarnings("static-method")
protected void generateStyles(IXmlStyleAppendable it) {
it.appendTag("style", //$NON-NLS-1$
"id", "comment", //$NON-NLS-1$ //$NON-NLS-2$
"_name", "Comment", //$NON-NLS-1$ //$NON-NLS-2$
"map-to", "def:comment"); //$NON-NLS-1$ //$NON-NLS-2$
it.appendTag("style", //$NON-... | java |
protected void selectSRE() {
final File file;
if (StandardSREPage.this.workingCopy.getJarFile() != null) {
file = StandardSREPage.this.workingCopy.getJarFile().toFile();
} else {
file = null;
}
final FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
dialog.setText(Messages.StandardSREPage_4);... | java |
private void initializeFields() {
final IPath path = this.workingCopy.getJarFile();
String tooltip = null;
String basename = null;
if (path != null) {
tooltip = path.toOSString();
final IPath tmpPath = path.removeTrailingSeparator();
if (tmpPath != null) {
basename = tmpPath.lastSegment();
}
}... | java |
public static IPath getSourceBundlePath(Bundle bundle, IPath bundleLocation) {
IPath sourcesPath = null;
// Not an essential functionality, make it robust
try {
final IPath srcFolderPath = getSourceRootProjectFolderPath(bundle);
if (srcFolderPath == null) {
//common case, jar file.
final IPath bundl... | java |
public static IPath getBundlePath(Bundle bundle) {
IPath path = getBinFolderPath(bundle);
if (path == null) {
// common jar file case, no bin folder
try {
path = new Path(FileLocator.getBundleFile(bundle).getAbsolutePath());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return... | java |
public void setReferenceInto(XFeatureCall container) {
JvmVoid jvmVoid = this.jvmTypesFactory.createJvmVoid();
if (jvmVoid instanceof InternalEObject) {
final InternalEObject jvmVoidProxy = (InternalEObject) jvmVoid;
final EObject param = getSarlFormalParameter();
final Resource resource = param.eResourc... | java |
public void setParameterType(String type) {
String typeName;
if (Strings.isEmpty(type)) {
typeName = Object.class.getName();
} else {
typeName = type;
}
this.parameter.setParameterType(newTypeRef(this.context, typeName));
} | java |
@Pure
public IExpressionBuilder getDefaultValue() {
if (this.defaultValue == null) {
this.defaultValue = this.expressionProvider.get();
this.defaultValue.eInit(this.parameter, new Procedures.Procedure1<XExpression>() {
public void apply(XExpression it) {
getSarlFormalParameter().setDefaultValue(it);... | java |
@SuppressWarnings("static-method")
public JvmAnnotationReference findAnnotation(JvmAnnotationTarget annotationTarget, String lookupType) {
// avoid creating an empty list for all given targets but check for #eIsSet first
if (annotationTarget.eIsSet(TypesPackage.Literals.JVM_ANNOTATION_TARGET__ANNOTATIONS)) {
fo... | java |
public List<String> getTempResourceRoots() {
final List<String> tmp = this.tmpResources == null ? Collections.emptyList() : this.tmpResources;
this.tmpResources = null;
return tmp;
} | java |
@SuppressWarnings("checkstyle:all")
protected StringConcatenationClient generateTopElement(CodeElementExtractor.ElementDescription description,
boolean forInterface, boolean forAppender) {
final String topElementName = Strings.toFirstUpper(description.getName());
final TypeReference builderType = getCodeElement... | java |
protected List<StringConcatenationClient> generateTopElements(boolean forInterface, boolean forAppender) {
final List<StringConcatenationClient> topElements = new ArrayList<>();
for (final CodeElementExtractor.ElementDescription description : getCodeElementExtractor().getTopElements(
getGrammar(), getCodeBuilde... | java |
protected void generateIScriptBuilder() {
final List<StringConcatenationClient> topElements = generateTopElements(true, false);
final TypeReference builder = getScriptBuilderInterface();
final StringConcatenationClient content = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStrin... | java |
protected void generateScriptSourceAppender() {
final List<StringConcatenationClient> topElements = generateTopElements(false, true);
final TypeReference appender = getCodeElementExtractor().getElementAppenderImpl("Script"); //$NON-NLS-1$
final StringConcatenationClient content = new StringConcatenationClient() {... | java |
protected void generateScriptBuilderImpl() {
final List<StringConcatenationClient> topElements = generateTopElements(false, false);
final TypeReference script = getScriptBuilderImpl();
final TypeReference scriptInterface = getScriptBuilderInterface();
final StringConcatenationClient content = new StringConcaten... | java |
public static Class<?> findClass(String classname) {
Class<?> type = null;
final ClassLoader loader = ClassLoaderFinder.findClassLoader();
if (loader != null) {
try {
type = loader.loadClass(classname);
} catch (ClassNotFoundException e) {
//
}
}
if (type == null) {
try {
type = ClassF... | java |
protected void generatePreamble(IStyleAppendable it) {
clearHilights();
final String nm = getLanguageSimpleName().toLowerCase();
final String cmd = Strings.toFirstUpper(getLanguageSimpleName().toLowerCase()) + "HiLink"; //$NON-NLS-1$
appendComment(it, "Quit when a syntax file was already loaded"); //$NON-NLS-1$... | java |
protected void generatePostamble(IStyleAppendable it) {
appendComment(it, "catch errors caused by wrong parenthesis"); //$NON-NLS-1$
appendCmd(it, "syn region sarlParenT transparent matchgroup=sarlParen start=\"(\" end=\")\" contains=@sarlTop,sarlParenT1"); //$NON-NLS-1$
appendCmd(it, "syn region sarlParenT1 tra... | java |
protected void generatePrimitiveTypes(IStyleAppendable it, Iterable<String> types) {
final Iterator<String> iterator = types.iterator();
if (iterator.hasNext()) {
appendComment(it, "primitive types."); //$NON-NLS-1$
appendMatch(it, "sarlArrayDeclaration", "\\(\\s*\\[\\s*\\]\\)*", true); //$NON-NLS-1$//$NON-NL... | java |
protected void generateComments(IStyleAppendable it) {
appendComment(it, "comments"); //$NON-NLS-1$
appendRegion(it, "sarlComment", "/\\*", "\\*/", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
appendCmd(it, "syn match sarlCommentStar contained \"^\\s*\\*[^/]\"me=e-1"); //$NON-NLS-1$
append... | java |
protected void generateStrings(IStyleAppendable it) {
appendComment(it, "Strings constants"); //$NON-NLS-1$
appendMatch(it, "sarlSpecialError", "\\\\.", true); //$NON-NLS-1$ //$NON-NLS-2$
appendMatch(it, "sarlSpecialCharError", "[^']", true); //$NON-NLS-1$ //$NON-NLS-2$
appendMatch(it, "sarlSpecialChar", "\\\\\... | java |
protected void generateNumericConstants(IStyleAppendable it) {
appendComment(it, "numerical constants"); //$NON-NLS-1$
appendMatch(it, "sarlNumber", "[0-9][0-9]*\\.[0-9]\\+([eE][0-9]\\+)\\?[fFdD]\\?"); //$NON-NLS-1$ //$NON-NLS-2$
appendMatch(it, "sarlNumber", "0[xX][0-9a-fA-F]\\+"); //$NON-NLS-1$ //$NON-NLS-2$
... | java |
protected void generateAnnotations(IStyleAppendable it) {
appendComment(it, "annnotation"); //$NON-NLS-1$
appendMatch(it, "sarlAnnotation", "@[_a-zA-Z][_0-9a-zA-Z]*\\([.$][_a-zA-Z][_0-9a-zA-Z]*\\)*"); //$NON-NLS-1$ //$NON-NLS-2$
appendCluster(it, "sarlAnnotation"); //$NON-NLS-1$
hilight("sarlAnnotation", VimSyn... | java |
protected void generateKeywords(IStyleAppendable it, String family, VimSyntaxGroup color, Iterable<String> keywords) {
appendComment(it, "keywords for the '" + family + "' family."); //$NON-NLS-1$ //$NON-NLS-2$
final Iterator<String> iterator = keywords.iterator();
if (iterator.hasNext()) {
it.append("syn keyw... | java |
protected IStyleAppendable appendCmd(IStyleAppendable it, String text) {
return appendCmd(it, true, text);
} | java |
protected void generateFileTypeDetectionScript(String basename) {
final CharSequence scriptContent = getFileTypeDetectionScript();
if (scriptContent != null) {
final String textualContent = scriptContent.toString();
if (!Strings.isEmpty(textualContent)) {
final byte[] bytes = textualContent.getBytes();
... | java |
protected CharSequence getFileTypeDetectionScript() {
return concat(
"\" Vim filetype-detection file", //$NON-NLS-1$
"\" Language: " + getLanguageSimpleName(), //$NON-NLS-1$
"\" Version: " + getLanguageVersion(), //$NON-NLS-1$
"", //$NON-NLS-1$
"au BufRead,BufNewFile *." + getLanguage().getFileExt... | java |
@Override
protected Set<OutputConfiguration> getOutputConfigurations(IProject project) {
final Set<OutputConfiguration> original = this.configurationProvider.getOutputConfigurations(getProject());
return Sets.filter(original, it -> !ExtraLanguageOutputConfigurations.isExtraLanguageOutputConfiguration(it.getName())... | java |
public static IntegerRange parseRange(String stringRange, int minValue) {
final String sepPattern = "[,;\\-:]"; //$NON-NLS-1$
try {
final Matcher matcher = Pattern.compile("^\\s*" //$NON-NLS-1$
+ "(?:(?<left>[0-9]+)\\s*(?:(?<sep1>" + sepPattern + ")\\s*(?<right1>[0-9]+)?)?)" //$NON-NLS-1$ //$NON-NLS-2$
... | java |
public static boolean isHtmlFileExtension(String extension) {
for (final String ext : HTML_FILE_EXTENSIONS) {
if (Strings.equal(ext, extension)) {
return true;
}
}
return false;
} | java |
@Inject
public void setDocumentParser(SarlDocumentationParser parser) {
assert parser != null;
this.parser = parser;
this.parser.reset();
} | java |
public Iterable<ValidationComponent> getStandardValidationComponents(File inputFile) {
final ValidationHandler handler = new ValidationHandler();
getDocumentParser().extractValidationComponents(inputFile, handler);
return handler.getComponents();
} | java |
public final List<DynamicValidationComponent> getMarkerSpecificValidationComponents(File inputFile,
File rootFolder,
DynamicValidationContext context) {
return getSpecificValidationComponents(
transform(inputFile, false),
inputFile,
rootFolder,
context);
} | java |
public static IBundleDependencies getJanusPlatformClasspath() {
final Bundle bundle = Platform.getBundle(JanusEclipsePlugin.JANUS_KERNEL_PLUGIN_ID);
return BundleUtil.resolveBundleDependencies(bundle,
new JanusBundleJavadocURLMappings(),
JANUS_ROOT_BUNDLE_NAMES);
} | java |
public static int compare(XtendParameter p1, XtendParameter p2) {
if (p1 != p2) {
if (p1 == null) {
return Integer.MIN_VALUE;
}
if (p2 == null) {
return Integer.MAX_VALUE;
}
final JvmTypeReference t1 = p1.getParameterType();
final JvmTypeReference t2 = p2.getParameterType();
if (t1 != t2)... | java |
public ISarlBehaviorUnitBuilder addSarlBehaviorUnit(String name) {
ISarlBehaviorUnitBuilder builder = this.iSarlBehaviorUnitBuilderProvider.get();
builder.eInit(getSarlBehavior(), name, getTypeResolutionContext());
return builder;
} | java |
public ISarlFieldBuilder addVarSarlField(String name) {
ISarlFieldBuilder builder = this.iSarlFieldBuilderProvider.get();
builder.eInit(getSarlBehavior(), name, "var", getTypeResolutionContext());
return builder;
} | java |
public ISarlActionBuilder addDefSarlAction(String name) {
ISarlActionBuilder builder = this.iSarlActionBuilderProvider.get();
builder.eInit(getSarlBehavior(), name, "def", getTypeResolutionContext());
return builder;
} | java |
public ISarlClassBuilder addSarlClass(String name) {
ISarlClassBuilder builder = this.iSarlClassBuilderProvider.get();
builder.eInit(getSarlBehavior(), name, getTypeResolutionContext());
return builder;
} | java |
public void addSarlCapacityUses(String... name) {
if (name != null && name.length > 0) {
SarlCapacityUses member = SarlFactory.eINSTANCE.createSarlCapacityUses();
this.sarlBehavior.getMembers().add(member);
member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember());
Collection<JvmParameterizedTy... | java |
public void addSarlRequiredCapacity(String... name) {
if (name != null && name.length > 0) {
SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity();
this.sarlBehavior.getMembers().add(member);
member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember());
Collection<JvmPar... | java |
@SuppressWarnings("static-method")
@Provides
@Singleton
public SarlConfig getSarlcConfig(ConfigurationFactory configFactory, Injector injector) {
final SarlConfig config = SarlConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
} | java |
public static RefactoringStatus validatePackageName(String newName) {
if (!PACKAGE_NAME_PATTERN.matcher(newName).find()) {
RefactoringStatus.createErrorStatus(MessageFormat.format(Messages.SARLJdtPackageRenameParticipant_0, newName));
}
return new RefactoringStatus();
} | java |
protected void setPackageName(String newName, ResourceSet resourceSet) {
final EObject object = resourceSet.getEObject(this.uriProvider.apply(resourceSet), true);
if (object instanceof SarlScript) {
((SarlScript) object).setPackage(newName);
} else {
throw new RefactoringException("SARL script not loaded.")... | java |
protected TextEdit getDeclarationTextEdit(String newName, ResourceSet resourceSet) {
final EObject object = resourceSet.getEObject(this.uriProvider.apply(resourceSet), true);
if (object instanceof SarlScript) {
final ITextRegion region = getOriginalPackageRegion((SarlScript) object);
if (region != null) {
... | java |
protected ITextRegion getOriginalPackageRegion(final SarlScript script) {
return this.locationInFileProvider.getFullTextRegion(script,
XtendPackage.Literals.XTEND_FILE__PACKAGE, 0);
} | java |
@Inject
public void setOutputLanguage(@Named(Constants.LANGUAGE_NAME) String outputLanguage) {
if (!Strings.isNullOrEmpty(outputLanguage)) {
final String[] parts = outputLanguage.split("\\.+"); //$NON-NLS-1$
if (parts.length > 0) {
final String simpleName = parts[parts.length - 1];
if (!Strings.i... | java |
public static Function2<String, String, String> getFencedCodeBlockFormatter() {
return (languageName, content) -> {
/*final StringBuilder result = new StringBuilder();
result.append("<div class=\\\"highlight"); //$NON-NLS-1$
if (!Strings.isNullOrEmpty(languageName)) {
result.append(" highlight-").ap... | java |
public static Function2<String, String, String> getBasicCodeBlockFormatter() {
return (languageName, content) -> {
return Pattern.compile("^", Pattern.MULTILINE).matcher(content).replaceAll("\t"); //$NON-NLS-1$ //$NON-NLS-2$
};
} | java |
public void reset() {
this.rawPatterns.clear();
this.compiledPatterns.clear();
this.inlineFormat = DEFAULT_INLINE_FORMAT;
this.blockFormat = null;
this.outlineOutputTag = DEFAULT_OUTLINE_OUTPUT_TAG;
this.dynamicNameExtractionPattern = DEFAULT_TAG_NAME_PATTERN;
this.lineContinuation = DEFAULT_LINE_C... | java |
public void setPattern(Tag tag, String regex) {
if (Strings.isNullOrEmpty(regex)) {
this.rawPatterns.remove(tag);
this.compiledPatterns.remove(tag);
} else {
this.rawPatterns.put(tag, regex);
this.compiledPatterns.put(tag, Pattern.compile("^\\s*" + regex, PATTERN_COMPILE_OPTIONS)); //$NON-NLS-1$
... | java |
public String getPattern(Tag tag) {
final String pattern = this.rawPatterns.get(tag);
if (pattern == null) {
return tag.getDefaultPattern();
}
return pattern;
} | java |
public Tag getTagForPattern(CharSequence text) {
for (final Tag tag : Tag.values()) {
Pattern pattern = this.compiledPatterns.get(tag);
if (pattern == null) {
pattern = Pattern.compile("^\\s*" + getPattern(tag), Pattern.DOTALL); //$NON-NLS-1$
this.compiledPatterns.put(tag, pattern);
}
final... | java |
public String getLineSeparator() {
if (Strings.isNullOrEmpty(this.lineSeparator)) {
final String nl = System.getProperty("line.separator"); //$NON-NLS-1$
if (Strings.isNullOrEmpty(nl)) {
return "\n"; //$NON-NLS-1$
}
return nl;
}
return this.lineSeparator;
} | java |
protected void extractDynamicName(Tag tag, CharSequence name, OutParameter<String> dynamicName) {
if (tag.hasDynamicName()) {
final Pattern pattern = Pattern.compile(getDynamicNameExtractionPattern());
final Matcher matcher = pattern.matcher(name);
if (matcher.matches()) {
dynamicName.set(Strings.nu... | java |
public String transform(File inputFile) {
final String content;
try (FileReader reader = new FileReader(inputFile)) {
content = read(reader);
} catch (IOException exception) {
reportError(Messages.SarlDocumentationParser_0, exception);
return null;
}
return transform(content, inputFile);
} | java |
protected String postProcessing(CharSequence text) {
final String lineContinuation = getLineContinuation();
if (lineContinuation != null) {
final Pattern pattern = Pattern.compile(
"\\s*\\\\[\\n\\r]+\\s*", //$NON-NLS-1$
Pattern.DOTALL);
final Matcher matcher = pattern.matcher(text.toString().t... | java |
protected static String formatBlockText(String content, String languageName, Function2<String, String, String> blockFormat) {
String replacement = Strings.nullToEmpty(content);
final String[] lines = replacement.trim().split("[\n\r]+"); //$NON-NLS-1$
int minIndent = Integer.MAX_VALUE;
final Pattern wpPatter... | java |
protected void generateInnerDocumentationAdapter() {
final TypeReference adapter = getCodeElementExtractor().getInnerBlockDocumentationAdapter();
final StringConcatenationClient content = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("public ... | java |
public void setAutoFormattingEnabled(Boolean enable) {
final IPreferenceStore store = getWritablePreferenceStore(null);
if (enable == null) {
store.setToDefault(AUTOFORMATTING_PROPERTY);
} else {
store.setValue(AUTOFORMATTING_PROPERTY, enable.booleanValue());
}
} | java |
public void setReturnType(String type) {
if (!Strings.isEmpty(type)
&& !Objects.equals("void", type)
&& !Objects.equals(Void.class.getName(), type)) {
this.sarlAction.setReturnType(newTypeRef(container, type));
} else {
this.sarlAction.setReturnType(null);
}
} | java |
public void addAnnotation(String type) {
if (!Strings.isEmpty(type)) {
XAnnotation annotation = XAnnotationsFactory.eINSTANCE.createXAnnotation();
annotation.setAnnotationType(newTypeRef(getSarlAction(), type).getType());
getSarlAction().getAnnotations().add(annotation);
}
} | java |
public static void useJanusMessageFormat() {
final String format = System.getProperty(FORMAT_PROPERTY_KEY, null);
if (format == null || format.isEmpty()) {
System.setProperty(FORMAT_PROPERTY_KEY, JANUS_FORMAT);
}
} | java |
public static Logger createPlatformLogger() {
final Logger logger = Logger.getAnonymousLogger();
for (final Handler handler : logger.getHandlers()) {
logger.removeHandler(handler);
}
final Handler stderr = new StandardErrorOutputConsoleHandler();
stderr.setLevel(Level.ALL);
final Handler stdout = new Sta... | java |
public static Level getLoggingLevelFromProperties() {
if (levelFromProperties == null) {
final String verboseLevel = JanusConfig.getSystemProperty(JanusConfig.VERBOSE_LEVEL_NAME, JanusConfig.VERBOSE_LEVEL_VALUE);
levelFromProperties = parseLoggingLevel(verboseLevel);
}
return levelFromProperties;
} | java |
@SuppressWarnings({ "checkstyle:returncount", "checkstyle:cyclomaticcomplexity" })
public static Level parseLoggingLevel(String level) {
if (level == null) {
return Level.INFO;
}
switch (level.toLowerCase()) {
case "none": //$NON-NLS-1$
case "false": //$NON-NLS-1$
case "0": //$NON-NLS-1$
return Level... | java |
@SuppressWarnings({ "checkstyle:magicnumber", "checkstyle:returncount" })
public static Level fromInt(int num) {
switch (num) {
case 0:
return Level.OFF;
case 1:
return Level.SEVERE;
case 2:
return Level.WARNING;
case 3:
return Level.INFO;
case 4:
return Level.FINE;
case 5:
return Level... | java |
@SuppressWarnings({ "checkstyle:magicnumber", "checkstyle:returncount", "checkstyle:npathcomplexity" })
public static int toInt(Level level) {
if (level == Level.OFF) {
return 0;
}
if (level == Level.SEVERE) {
return 1;
}
if (level == Level.WARNING) {
return 2;
}
if (level == Level.INFO) {
re... | java |
public static void startServices(IServiceManager manager) {
final List<Service> otherServices = new ArrayList<>();
final List<Service> infraServices = new ArrayList<>();
final LinkedList<DependencyNode> serviceQueue = new LinkedList<>();
final Accessors accessors = new StartingPhaseAccessors();
// Build the ... | java |
public static void stopServices(IServiceManager manager) {
final List<Service> otherServices = new ArrayList<>();
final List<Service> infraServices = new ArrayList<>();
final LinkedList<DependencyNode> serviceQueue = new LinkedList<>();
final Accessors accessors = new StoppingPhaseAccessors();
// Build the d... | java |
@SuppressWarnings("checkstyle:npathcomplexity")
private static void runDependencyGraph(Queue<DependencyNode> roots, List<Service> infraServices, List<Service> freeServices,
Accessors accessors) {
final boolean async = accessors.isAsyncStateWaitingEnabled();
final Set<Class<? extends Service>> executed = new Tre... | java |
public static SynchronizedIterable<AgentContext> getContextsOf(Agent agent) throws Exception {
final ExternalContextAccess skill = SREutils.getInternalSkill(agent, ExternalContextAccess.class);
assert skill != null;
return skill.getAllContexts();
} | java |
public static AgentContext getContextIn(Agent agent) throws Exception {
final InnerContextAccess skill = SREutils.getInternalSkill(agent, InnerContextAccess.class);
if (skill instanceof InnerContextSkill) {
final InnerContextSkill janusSkill = (InnerContextSkill) skill;
if (janusSkill.hasInnerContext()) {
... | java |
@SuppressWarnings("static-method")
protected void _toJavaStatement(SarlBreakExpression breakExpression, ITreeAppendable appendable, boolean isReferenced) {
appendable.newLine().append("break;"); //$NON-NLS-1$
} | java |
@SuppressWarnings("static-method")
protected Map<XVariableDeclaration, XFeatureCall> getReferencedLocalVariable(XExpression expression, boolean onlyWritable) {
final Map<XVariableDeclaration, XFeatureCall> localVariables = new TreeMap<>((k1, k2) -> {
return k1.getIdentifier().compareTo(k2.getIdentifier());
});
... | java |
protected boolean isAtLeastJava8(EObject context) {
return this.generatorConfigProvider.get(EcoreUtil.getRootContainer(context)).getJavaSourceVersion().isAtLeast(JavaVersion.JAVA8);
} | java |
protected void _toJavaExpression(SarlAssertExpression assertExpression, ITreeAppendable appendable) {
if (!assertExpression.isIsStatic() && isAtLeastJava8(assertExpression)) {
appendable.append("/* error - couldn't compile nested assert */"); //$NON-NLS-1$
}
} | java |
protected void jvmOperationCallToJavaExpression(final XExpression sourceObject, final JvmOperation operation,
XExpression receiver, List<XExpression> arguments, ITreeAppendable appendable) {
String name = null;
assert operation != null;
if (appendable.hasName(operation)) {
name = appendable.getName(operatio... | java |
@SuppressWarnings("static-method")
protected boolean canBeNotStaticAnonymousClass(XClosure closure, LightweightTypeReference typeRef,
JvmOperation operation) {
return !typeRef.isSubtypeOf(Serializable.class);
} | java |
Collection<V> wrapValues(K key, Collection<V> values) {
final Object backEnd = DataViewDelegate.undelegate(values);
if (backEnd instanceof List<?>) {
return new SingleKeyValueListView(key, (List<V>) values);
}
if (backEnd instanceof Set<?>) {
return new SingleKeyValueSetView(key, (Set<V>) values);
}
t... | java |
@SuppressWarnings({ "unchecked", "checkstyle:illegaltype" })
Collection<V> copyValues(Collection<V> values) {
final Object backEnd = DataViewDelegate.undelegate(values);
if (backEnd instanceof List<?>) {
return Lists.newArrayList(values);
}
if (backEnd instanceof TreeSet<?>) {
TreeSet<V> c = (TreeSet<V>)... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.