Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
AspectJ tools most notably contains the AspectJ compiler (AJC). AJC applies aspects to Java classes during
compilation, fully replacing Javac for plain Java classes and also compiling native AspectJ or annotation-based
@AspectJ syntax. Furthermore, AJC can weave aspects into existing class files in a post-compile binary weaving step.
This library is a superset of AspectJ weaver and hence also of AspectJ runtime.
/*******************************************************************************
* Copyright (c) 2006, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.core.internal.preferences;
import java.lang.ref.WeakReference;
import java.util.*;
import org.eclipse.core.internal.preferences.exchange.ILegacyPreferences;
import org.eclipse.core.internal.runtime.RuntimeLog;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.preferences.*;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
/**
* Class which handles all registry-related work for the preferences. This code has
* been separated into a separate class to ensure that the preferences will be able
* to run without the registry being present.
*/
public class PreferenceServiceRegistryHelper implements IRegistryChangeListener {
private static final String ELEMENT_INITIALIZER = "initializer"; //$NON-NLS-1$
private static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
private static final String ATTRIBUTE_STORAGE = "storage"; //$NON-NLS-1$
private static final String ELEMENT_SCOPE = "scope"; //$NON-NLS-1$
private static final String ELEMENT_MODIFIER = "modifier"; //$NON-NLS-1$
// Store this around for performance
private final static IExtension[] EMPTY_EXTENSION_ARRAY = new IExtension[0];
private static final Map scopeRegistry = Collections.synchronizedMap(new HashMap());
private ListenerList modifyListeners;
private final PreferencesService service;
private final IExtensionRegistry registry;
/*
* Create and return an IStatus object with ERROR severity and the
* given message and exception.
*/
private static IStatus createStatusError(String message, Exception e) {
return new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, IStatus.ERROR, message, e);
}
/*
* Create and return an IStatus object with WARNING severity and the
* given message and exception.
*/
private static IStatus createStatusWarning(String message, Exception e) {
return new Status(IStatus.WARNING, PrefsMessages.OWNER_NAME, IStatus.WARNING, message, e);
}
/*
* Log the given status.
*/
private static void log(IStatus status) {
RuntimeLog.log(status);
}
/*
* Constructor for the class.
*/
public PreferenceServiceRegistryHelper(PreferencesService service, Object registryObject) {
super();
this.service = service;
this.registry = (IExtensionRegistry) registryObject;
initializeScopes();
registry.addRegistryChangeListener(this);
}
void stop() {
registry.removeRegistryChangeListener(this);
}
/*
* Add the given configuration element into our list of preference modify listeners.
*/
private void addModifyListener(IConfigurationElement element) {
String key = element.getAttribute(ATTRIBUTE_CLASS);
if (key == null) {
String message = NLS.bind(PrefsMessages.preferences_missingClassAttribute, element.getDeclaringExtension().getUniqueIdentifier());
log(new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, IStatus.ERROR, message, null));
return;
}
try {
Object listener = element.createExecutableExtension(ATTRIBUTE_CLASS);
if (!(listener instanceof PreferenceModifyListener)) {
log(new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, IStatus.ERROR, PrefsMessages.preferences_classCastListener, null));
return;
}
modifyListeners.add((PreferenceModifyListener) listener);
} catch (CoreException e) {
log(e.getStatus());
}
}
/*
* Apply the runtime defaults for the bundle with the given name. Check
* to see if there is a preference initializer registered and if so, then run it.
* Otherwise call the legacy Plugin preference initialization code.
*/
public WeakReference