code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current);
}
} | java |
public static boolean isPlatformSRE(ISREInstall sre) {
if (sre != null) {
LOCK.lock();
try {
return platformSREInstalls.contains(sre.getId());
} finally {
LOCK.unlock();
}
}
return false;
} | java |
public static void clearSREConfiguration() throws CoreException {
final SARLEclipsePlugin plugin = SARLEclipsePlugin.getDefault();
plugin.getPreferences().remove(getCurrentPreferenceKey());
plugin.savePreferences();
} | java |
private static void initializeSREExtensions() {
final MultiStatus status = new MultiStatus(SARLEclipsePlugin.PLUGIN_ID,
IStatus.OK, "Exceptions occurred", null); //$NON-NLS-1$
final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
SARLEclipsePlugin.PLUGIN_ID, SARLEclipseC... | java |
public static String getSREsAsXML(IProgressMonitor monitor) throws CoreException {
initializeSREs();
try {
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilder builder = factory.newDocumentBuilder();
final Document xmldocument = builder.newDocument();
final ... | java |
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
private static String initializePersistedSREs() {
// // FOR DEBUG
// try {
// clearSREConfiguration();
// } catch (CoreException e1) {
// e1.printStackTrace();
// }
final String rawXml = SARLEclipsePlugin.getDefault().getPreferences().get(
... | java |
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:variabledeclarationusagedistance",
"checkstyle:npathcomplexity"})
private static void initializeSREs() {
ISREInstall[] newSREs = new ISREInstall[0];
boolean savePrefs = false;
LOCK.lock();
final String previousDefault = defaultSREId;
try {
... | java |
public static String createUniqueIdentifier() {
String id;
do {
id = UUID.randomUUID().toString();
} while (getSREFromId(id) != null);
return id;
} | java |
public static boolean isUnpackedSRE(File directory) {
File manifestFile = new File(directory, "META-INF"); //$NON-NLS-1$
manifestFile = new File(manifestFile, "MANIFEST.MF"); //$NON-NLS-1$
if (manifestFile.canRead()) {
try (InputStream manifestStream = new FileInputStream(manifestFile)) {
final Manifest ma... | java |
public static boolean isPackedSRE(File jarFile) {
try (JarFile jFile = new JarFile(jarFile)) {
final Manifest manifest = jFile.getManifest();
if (manifest == null) {
return false;
}
final Attributes sarlSection = manifest.getAttributes(SREConstants.MANIFEST_SECTION_SRE);
if (sarlSection == null) {
... | java |
public static String getDeclaredBootstrap(IPath path) {
try {
final IFile location = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
if (location != null) {
final IPath pathLocation = location.getLocation();
if (pathLocation != null) {
final File file = pathLocation.toFile();
if (file.... | java |
protected Object processElement(Object obj, Class<?> expectedType) {
if (obj == null || obj instanceof Proxy) {
return obj;
}
if (obj instanceof Doc) {
return wrap(obj);
} else if (expectedType != null && expectedType.isArray()) {
final Class<?> componentType = expectedType.getComponentType();
if (D... | java |
protected Object wrap(Object object) {
if (object == null || object instanceof Proxy) {
return object;
}
final Class<?> type = object.getClass();
return Proxy.newProxyInstance(type.getClassLoader(), type.getInterfaces(), new ProxyHandler(object));
} | java |
protected void writePackageFiles(QualifiedName name, String lineSeparator,
IExtraLanguageGeneratorContext context) {
final IFileSystemAccess2 fsa = context.getFileSystemAccess();
final String outputConfiguration = getOutputConfigurationName();
QualifiedName libraryName = null;
for (final String segment : nam... | java |
@SuppressWarnings("static-method")
protected boolean generatePythonClassDeclaration(String typeName, boolean isAbstract,
List<? extends JvmTypeReference> superTypes, String comment, boolean ignoreObjectType, PyAppendable it,
IExtraLanguageGeneratorContext context) {
if (!Strings.isEmpty(typeName)) {
it.appe... | java |
protected static boolean generateDocString(String comment, PyAppendable it) {
final String cmt = comment == null ? null : comment.trim();
if (!Strings.isEmpty(cmt)) {
assert cmt != null;
it.append("\"\"\"").increaseIndentation(); //$NON-NLS-1$
for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-... | java |
protected static boolean generateBlockComment(String comment, PyAppendable it) {
final String cmt = comment == null ? null : comment.trim();
if (!Strings.isEmpty(cmt)) {
assert cmt != null;
for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-1$
it.append("# ").append(line).newLine(); //$NON-NLS... | java |
@SuppressWarnings({ "checkstyle:parameternumber" })
protected boolean generateTypeDeclaration(
String fullyQualifiedName,
String name, boolean isAbstract,
List<? extends JvmTypeReference> superTypes,
String comment,
boolean ignoreObjectType, List<? extends XtendMember> members, PyAppendable it,
IExtr... | java |
protected boolean generateEnumerationDeclaration(SarlEnumeration enumeration, PyAppendable it, IExtraLanguageGeneratorContext context) {
if (!Strings.isEmpty(enumeration.getName())) {
it.append("class ").append(enumeration.getName()); //$NON-NLS-1$
it.append("(Enum"); //$NON-NLS-1$
it.append(newType("enum.En... | java |
protected boolean generatePythonConstructors(String container, List<? extends XtendMember> members,
PyAppendable it, IExtraLanguageGeneratorContext context) {
// Prepare field initialization
boolean hasConstructor = false;
for (final XtendMember member : members) {
if (context.getCancelIndicator().isCancele... | java |
@SuppressWarnings("static-method")
protected JvmType newType(String pythonName) {
final JvmGenericType type = TypesFactory.eINSTANCE.createJvmGenericType();
final int index = pythonName.indexOf("."); //$NON-NLS-1$
if (index <= 0) {
type.setSimpleName(pythonName);
} else {
type.setPackageName(pythonName.s... | java |
protected void generatePythonField(SarlField field, PyAppendable it, IExtraLanguageGeneratorContext context) {
generateBlockComment(getTypeBuilder().getDocumentation(field), it);
if (!field.isStatic()) {
it.append("self."); //$NON-NLS-1$
}
final String fieldName = it.declareUniqueNameVariable(field, field.ge... | java |
protected void generateGuardEvaluators(String container, PyAppendable it, IExtraLanguageGeneratorContext context) {
final Map<String, Map<String, List<Pair<XExpression, String>>>> allGuardEvaluators = context.getMapData(EVENT_GUARDS_MEMENTO);
final Map<String, List<Pair<XExpression, String>>> guardEvaluators = allG... | java |
protected void _before(SarlCapacityUses uses, IExtraLanguageGeneratorContext context) {
// Rename the function in order to produce the good features at the calls.
for (final JvmTypeReference capacity : uses.getCapacities()) {
final JvmType type = capacity.getType();
if (type instanceof JvmDeclaredType) {
... | java |
@Check(CheckType.NORMAL)
public void checkExtraLanguageRules(EObject currentObject) {
final List<AbstractExtraLanguageValidator> validators = this.validatorProvider.getValidators(
currentObject.eResource());
if (!validators.isEmpty()) {
for (final AbstractExtraLanguageValidator validator : validators) {
... | java |
public void setComment(String comment) {
this.comment = comment;
if (!Strings.isEmpty(comment)) {
this.name = MessageFormat.format("{0} [{1}]", getClass().getName(), comment); //$NON-NLS-1$
} else {
this.name = getClass().getName();
}
} | java |
protected GeneratorConfig createDefaultGeneratorConfig() {
final GeneratorConfig config = new GeneratorConfig();
if (this.defaultVersion == null) {
this.defaultVersion = JavaVersion.fromQualifier(System.getProperty("java.specification.version")); //$NON-NLS-1$
if (this.defaultVersion != null) {
config.set... | java |
protected InferredPrototype createPrototype(QualifiedActionName id,
boolean isVarargs, FormalParameterProvider parameters) {
assert parameters != null;
final ActionParameterTypes key = new ActionParameterTypes(isVarargs, parameters.getFormalParameterCount());
final Map<ActionParameterTypes, List<InferredStanda... | java |
@SuppressWarnings("static-method")
public ITextReplacerContext fix(final ITextReplacerContext context, IComment comment) {
final IHiddenRegion hiddenRegion = comment.getHiddenRegion();
if (detectBugSituation(hiddenRegion) && fixBug(hiddenRegion)) {
// Indentation of the first comment line
final ITextRegionAc... | java |
public void putDefaultClasspathEntriesIn(Collection<IClasspathEntry> classpathEntries) {
final IPath newPath = this.jreGroup.getJREContainerPath();
if (newPath != null) {
classpathEntries.add(JavaCore.newContainerEntry(newPath));
} else {
final IClasspathEntry[] entries = PreferenceConstants.getDefaultJRELi... | java |
public IPath getOutputLocation() {
IPath outputLocationPath = new Path(getProjectName()).makeAbsolute();
outputLocationPath = outputLocationPath.append(
Path.fromPortableString(SARLConfig.FOLDER_BIN));
return outputLocationPath;
} | java |
protected static Action findAction(EObject grammarComponent, String assignmentName) {
for (final Action action : GrammarUtil.containedActions(grammarComponent)) {
if (GrammarUtil.isAssignedAction(action)) {
if (Objects.equals(assignmentName, action.getFeature())) {
return action;
}
}
}
return n... | java |
protected EObject getContainerInRule(EObject root, EObject content) {
EObject container = content;
do {
final EClassifier classifier = getGeneratedTypeFor(container);
if (classifier != null) {
return container;
}
container = container.eContainer();
} while (container != root);
final EClassifier ... | java |
protected CellEditor createClassCellEditor() {
return new DialogCellEditor(getControl()) {
@Override
protected Object openDialogBox(Control cellEditorWindow) {
final OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog(
getControl().getShell(),
false,
PlatformUI.getWorkbench().getP... | java |
private void enableButtons() {
final int itemCount = this.list.getTable().getItemCount();
final boolean hasElement = itemCount > 0;
IStructuredSelection selection;
if (hasElement) {
selection = this.list.getStructuredSelection();
final int selectionCount = selection.size();
if (selectionCount <= 0 || s... | java |
protected void setTypeConversions(List<Pair<String, String>> typeConversions, boolean notifyController) {
this.conversions.clear();
if (typeConversions != null) {
for (final Pair<String, String> entry : typeConversions) {
this.conversions.add(new ConversionMapping(entry.getKey(), entry.getValue()));
}
}... | java |
protected void addTypeConversion(String javaType, String targetType, boolean updateSelection) {
final ConversionMapping entry = new ConversionMapping(javaType, targetType);
this.conversions.add(entry);
//refresh from model
refreshListUI();
if (updateSelection) {
this.list.setSelection(new StructuredSelecti... | java |
@SuppressWarnings("unchecked")
protected void removeCurrentTypeConversion() {
final IStructuredSelection selection = this.list.getStructuredSelection();
final String[] types = new String[selection.size()];
final Iterator<ConversionMapping> iter = selection.iterator();
int i = 0;
while (iter.hasNext()) {
t... | java |
protected void moveSelectionTop() {
final IStructuredSelection selection = this.list.getStructuredSelection();
final int index = this.conversions.indexOf(selection.getFirstElement());
if (index > 0) {
final int endIndex = index + selection.size() - 1;
for (int i = 0; i < selection.size(); ++i) {
final C... | java |
protected void moveSelectionUp() {
final IStructuredSelection selection = this.list.getStructuredSelection();
final int index = this.conversions.indexOf(selection.getFirstElement());
if (index > 0) {
final ConversionMapping previous = this.conversions.remove(index - 1);
this.conversions.add(index + selectio... | java |
protected void moveSelectionDown() {
final IStructuredSelection selection = this.list.getStructuredSelection();
final int index = this.conversions.indexOf(selection.getFirstElement());
if (index >= 0 && (index + selection.size()) < this.conversions.size()) {
final ConversionMapping next = this.conversions.remo... | java |
protected void moveSelectionBottom() {
final IStructuredSelection selection = this.list.getStructuredSelection();
final int index = this.conversions.indexOf(selection.getFirstElement());
if (index >= 0 && (index + selection.size()) < this.conversions.size()) {
for (int i = 0; i < selection.size(); ++i) {
f... | java |
protected void removeTypeConversions(String... types) {
for (final String type : types) {
final Iterator<ConversionMapping> iterator = this.conversions.iterator();
while (iterator.hasNext()) {
final ConversionMapping pair = iterator.next();
if (Strings.equal(pair.getSource(), type)) {
iterator.remo... | java |
protected void refreshListUI() {
final Display display = Display.getDefault();
if (display.getThread().equals(Thread.currentThread())) {
if (!this.list.isBusy()) {
this.list.refresh();
}
} else {
display.syncExec(new Runnable() {
@SuppressWarnings("synthetic-access")
@Override
public void... | java |
private void sortByTargetColumn() {
this.list.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if (e1 != null && e2 != null) {
return e1.toString().compareToIgnoreCase(e2.toString());
}
return super.compare(viewer, e1, e2);
}
@Ov... | java |
private void updateStatus(Throwable event) {
Throwable cause = event;
while (cause != null
&& (!(cause instanceof CoreException))
&& cause.getCause() != null
&& cause.getCause() != cause) {
cause = cause.getCause();
}
if (cause instanceof CoreException) {
updateStatus(((CoreException) cause).g... | java |
public void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException {
final SubMonitor subMonitor = SubMonitor.convert(monitor, 4);
try {
monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_create, 3);
if (this.currProject == null) {
updateProject(subMonito... | java |
protected IProject createProvisonalProject() {
final IStatus status = changeToNewProject();
if (status != null) {
updateStatus(status);
if (!status.isOK()) {
ErrorDialog.openError(
getShell(),
NewWizardMessages.NewJavaProjectWizardPageTwo_error_title,
null,
status);
}
}
retu... | java |
protected void removeProvisonalProject() {
if (!this.currProject.exists()) {
this.currProject = null;
return;
}
final IRunnableWithProgress op = new IRunnableWithProgress() {
@SuppressWarnings("synthetic-access")
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException,... | java |
public ADDRESST registerParticipant(ADDRESST address, EventListener entity) {
synchronized (mutex()) {
addListener(address, entity);
this.participants.put(entity.getID(), address);
}
return address;
} | java |
public ADDRESST unregisterParticipant(UUID entityID) {
synchronized (mutex()) {
removeListener(this.participants.get(entityID));
return this.participants.remove(entityID);
}
} | java |
public SynchronizedCollection<ADDRESST> getParticipantAddresses() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedCollection(this.participants.values(), mutex);
}
} | java |
public SynchronizedSet<UUID> getParticipantIDs() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedSet(this.participants.keySet(), mutex);
}
} | java |
protected void addSourceFolder(String path) {
final List<String> existingFolders1 = this.project.getCompileSourceRoots();
final List<String> existingFolders2 = this.project.getTestCompileSourceRoots();
if (!existingFolders1.contains(path) && !existingFolders2.contains(path)) {
getLog().info(MessageFormat.forma... | java |
private List<LightweightTypeReference> cloneTypeReferences(List<JvmTypeReference> types,
Map<String, JvmTypeReference> typeParameterMap) {
final List<LightweightTypeReference> newList = new ArrayList<>(types.size());
for (final JvmTypeReference type : types) {
newList.add(cloneTypeReference(type, typeParamete... | java |
@BQConfigProperty("Specify the levels of specific warnings")
public void setWarningLevels(Map<String, Severity> levels) {
if (levels == null) {
this.warningLevels = new HashMap<>();
} else {
this.warningLevels = levels;
}
} | java |
protected static String quoteRegex(String regex) {
if (regex == null) {
return ""; //$NON-NLS-1$
}
return regex.replaceAll(REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_PROTECT);
} | java |
protected static String orRegex(Iterable<String> elements) {
final StringBuilder regex = new StringBuilder();
for (final String element : elements) {
if (regex.length() > 0) {
regex.append("|"); //$NON-NLS-1$
}
regex.append("(?:"); //$NON-NLS-1$
regex.append(quoteRegex(element));
regex.append(")"... | java |
@SafeVarargs
protected static Set<String> sortedConcat(Iterable<String>... iterables) {
final Set<String> set = new TreeSet<>();
for (final Iterable<String> iterable : iterables) {
for (final String obj : iterable) {
set.add(obj);
}
}
return set;
} | java |
public void addMimeType(String mimeType) {
if (!Strings.isEmpty(mimeType)) {
for (final String mtype : mimeType.split("[:;,]")) { //$NON-NLS-1$
this.mimeTypes.add(mtype);
}
}
} | java |
@Pure
public List<String> getMimeTypes() {
if (this.mimeTypes.isEmpty()) {
return Arrays.asList("text/x-" + getLanguageSimpleName().toLowerCase()); //$NON-NLS-1$
}
return this.mimeTypes;
} | java |
@Pure
public String getBasename(String defaultName) {
if (Strings.isEmpty(this.basename)) {
return defaultName;
}
return this.basename;
} | java |
@SuppressWarnings("checkstyle:nestedifdepth")
private static void exploreGrammar(Grammar grammar, Set<String> expressionKeywords,
Set<String> modifiers, Set<String> primitiveTypes, Set<String> punctuation,
Set<String> literals, Set<String> excludedKeywords, Set<String> ignored) {
for (final AbstractRule rule :... | java |
protected final void generate(Set<String> literals, Set<String> expressionKeywords,
Set<String> modifiers, Set<String> primitiveTypes, Set<String> punctuation,
Set<String> ignored, Set<String> specialKeywords, Set<String> typeDeclarationKeywords) {
final T appendable = newStyleAppendable();
generate(appendabl... | java |
public static CharSequence concat(CharSequence... lines) {
return new CharSequence() {
private final StringBuilder content = new StringBuilder();
private int next;
private int length = -1;
@Override
public String toString() {
ensure(length());
return this.content.toString();
}
privat... | java |
protected void generateReadme(String basename) {
final Object content = getReadmeFileContent(basename);
if (content != null) {
final String textualContent = content.toString();
if (!Strings.isEmpty(textualContent)) {
final byte[] bytes = textualContent.getBytes();
for (final String output : getOutputs... | java |
protected String getLanguageSimpleName() {
final String name = getGrammar().getName();
final int index = name.lastIndexOf('.');
if (index > 0) {
return name.substring(index + 1);
}
return name;
} | java |
@Pure
protected String lines(String prefix, String... lines) {
final String delimiter = getCodeConfig().getLineDelimiter();
final StringBuilder buffer = new StringBuilder();
for (final String line : lines) {
buffer.append(prefix);
buffer.append(line);
buffer.append(delimiter);
}
return buffer.toStri... | java |
@SuppressWarnings("static-method")
protected OutputConfiguration createStandardOutputConfiguration() {
final OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
defaultOutput.setDescription(Messages.SarlOutputConfigurationProvider_0);
defaultOutput.setOutputDirectory(SA... | java |
@Provides
@io.janusproject.kernel.annotations.Kernel
@Singleton
public static AgentContext getKernel(ContextSpaceService contextService,
@Named(JanusConfig.DEFAULT_CONTEXT_ID_NAME) UUID janusContextID,
@Named(JanusConfig.DEFAULT_SPACE_ID_NAME) UUID defaultJanusSpaceId) {
return contextService.createContext(j... | java |
@Provides
public static AgentInternalEventsDispatcher createAgentInternalEventsDispatcher(Injector injector) {
final AgentInternalEventsDispatcher aeb = new AgentInternalEventsDispatcher(injector.getInstance(ExecutorService.class));
// to be able to inject the ExecutorService and SubscriberFindingStrategy
inject... | java |
protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) {
// For capacity call redirection
LightweightTypeReference fieldType = resolvedTypes.getActualType(field);
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
Im... | java |
protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) {
// For capacity call redirection
if (thisFeature instanceof JvmDeclaredType) {
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapaci... | java |
protected static boolean runRejectedTask(Runnable runnable, ThreadPoolExecutor executor) {
// Runs the task directly in the calling thread of the {@code execute} method,
// unless the executor has been shut down, in which case the task
// is discarded.
if (!executor.isShutdown()) {
runnable.run();
return ... | java |
@Pure
public static <C extends Capacity> C createSkillDelegator(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller)
throws Exception {
final String name = capacity.getName() + CAPACITY_WRAPPER_NAME;
final Class<?> type = Class.forName(name, true, capacity.getClassLoader());
final Constructor<?>... | java |
@Pure
public static <C extends Capacity> C createSkillDelegatorIfPossible(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller)
throws ClassCastException {
try {
return Capacities.createSkillDelegator(originalSkill, capacity, capacityCaller);
} catch (Exception e) {
return capacity.cast(origi... | java |
protected void build(EObject object, ISourceAppender appender) throws IOException {
final IJvmTypeProvider provider = getTypeResolutionContext();
if (provider != null) {
final Map<Key<?>, Binding<?>> bindings = this.originalInjector.getBindings();
Injector localInjector = CodeBuilderFactory.createOverridingIn... | java |
protected boolean isEarlyExitSARLStatement(XExpression expression) {
if (expression instanceof XAbstractFeatureCall) {
// Do not call expression.getFeature() since the feature may be unresolved.
// The type resolution at this point causes exceptions in the reentrant type resolver.
// The second parameter (fa... | java |
public void addUpperConstraint(String type) {
final JvmUpperBound constraint = this.jvmTypesFactory.createJvmUpperBound();
constraint.setTypeReference(newTypeRef(this.context, type));
getJvmTypeParameter().getConstraints().add(constraint);
} | java |
public void addLowerConstraint(String type) {
final JvmLowerBound constraint = this.jvmTypesFactory.createJvmLowerBound();
constraint.setTypeReference(newTypeRef(this.context, type));
getJvmTypeParameter().getConstraints().add(constraint);
} | java |
public ImageDescriptor getImageDescriptor(String imagePath) {
ImageDescriptor descriptor = getImageRegistry().getDescriptor(imagePath);
if (descriptor == null) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SARLEclipsePlugin.PLUGIN_ID, imagePath);
if (descriptor != null) {
getImageRegistry().pu... | java |
@SuppressWarnings("static-method")
public IStatus createMultiStatus(Iterable<? extends IStatus> status) {
final IStatus max = findMax(status);
final MultiStatus multiStatus;
if (max == null) {
multiStatus = new MultiStatus(PLUGIN_ID, 0, null, null);
} else {
multiStatus = new MultiStatus(PLUGIN_ID, 0, ma... | java |
public void logErrorMessage(String message) {
getILog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, null));
} | java |
@SuppressWarnings({"static-method", "checkstyle:regexp"})
public void logDebugMessage(String message, Throwable cause) {
Debug.println(message);
if (cause != null) {
Debug.printStackTrace(cause);
}
} | java |
public void savePreferences() {
final IEclipsePreferences prefs = getPreferences();
try {
prefs.flush();
} catch (BackingStoreException e) {
getILog().log(createStatus(IStatus.ERROR, e));
}
} | java |
public void openError(Shell shell, String title, String message, Throwable exception) {
final Throwable ex = (exception != null) ? Throwables.getRootCause(exception) : null;
if (ex != null) {
log(ex);
final IStatus status = createStatus(IStatus.ERROR, message, ex);
ErrorDialog.openError(shell, title, messa... | java |
public static IJavaSearchScope createSearchScope(IJavaProject project, Class<?> type, boolean onlySubTypes) {
try {
final IType superType = project.findType(type.getName());
return SearchEngine.createStrictHierarchyScope(
project,
superType,
// only sub types
onlySubTypes,
// include th... | java |
private void fillWizardPageWithSelectedTypes() {
final StructuredSelection selection = getSelectedItems();
if (selection == null) {
return;
}
for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) {
final Object obj = iter.next();
if (obj instanceof TypeNameMatch) {
accessedHistoryIte... | java |
protected IScope createCastOperatorScope(EObject context, EReference reference, IResolvedTypes resolvedTypes) {
if (!(context instanceof SarlCastedExpression)) {
return IScope.NULLSCOPE;
}
final SarlCastedExpression call = (SarlCastedExpression) context;
final XExpression receiver = call.getTarget();
if (r... | java |
public void eInit(IJvmTypeProvider context) {
setTypeResolutionContext(context);
if (this.block == null) {
this.block = XbaseFactory.eINSTANCE.createXBlockExpression();
}
} | java |
@Pure
public String getAutoGeneratedActionString(Resource resource) {
TaskTags tags = getTaskTagProvider().getTaskTags(resource);
String taskTag;
if (tags != null && tags.getTaskTags() != null && !tags.getTaskTags().isEmpty()) {
taskTag = tags.getTaskTags().get(0).getName();
} else {
taskTag = "TODO";
... | java |
public IExpressionBuilder addExpression() {
final IExpressionBuilder builder = this.expressionProvider.get();
builder.eInit(getXBlockExpression(), new Procedures.Procedure1<XExpression>() {
private int index = -1;
public void apply(XExpression it) {
if (this.index >= 0) {
getXBlockExpression(... | java |
private void handleAntScriptBrowseButtonPressed() {
FileDialog dialog= new FileDialog(getContainer().getShell(), SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*." + ANTSCRIPT_EXTENSION }); //$NON-NLS-1$
String currentSourceString= getAntScriptValue();
int lastSeparatorIndex= currentSourceString.lastInd... | java |
private String getAntScriptValue() {
String antScriptText= fAntScriptNamesCombo.getText().trim();
if (antScriptText.indexOf('.') < 0)
antScriptText+= "." + ANTSCRIPT_EXTENSION; //$NON-NLS-1$
return antScriptText;
} | java |
protected Label createLabel(Composite parent, String text, boolean bold) {
Label label= new Label(parent, SWT.NONE);
if (bold)
label.setFont(JFaceResources.getBannerFont());
label.setText(text);
GridData gridData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
label.setLayoutData(gridData);
retur... | java |
protected void createLibraryHandlingGroup(Composite parent) {
fLibraryHandlingGroup= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
fLibraryHandlingGroup.setLayout(layout);
fLibraryHandlingGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | Gri... | java |
@Override
protected void updateModel() {
super.updateModel();
String comboText= fAntScriptNamesCombo.getText();
IPath path= Path.fromOSString(comboText);
if (path.segmentCount() > 0 && ensureAntScriptFileIsValid(path.toFile()) && path.getFileExtension() == null)
path= path.addFileExtension(ANTSCRIPT_EXTENS... | java |
private IPath getAbsoluteLocation(IPath location) {
if (location.isAbsolute())
return location;
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
if (location.segmentCount() >= 2 && !"..".equals(location.segment(0))) { //$NON-NLS-1$
IFile file= root.getFile(location);
IPath absolutePath= fi... | java |
private boolean ensureAntScriptFileIsValid(File antScriptFile) {
if (antScriptFile.exists() && antScriptFile.isDirectory() && fAntScriptNamesCombo.getText().length() > 0) {
setErrorMessage(FatJarPackagerMessages.FatJarPackageWizardPage_error_antScriptLocationIsDir);
fAntScriptNamesCombo.setFocus();
return fa... | java |
protected static String getPathLabel(IPath path, boolean isOSPath) {
String label;
if (isOSPath) {
label= path.toOSString();
} else {
label= path.makeRelative().toString();
}
return label;
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.