import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
import org.opendaylight.yangide.core.model.YangElement;
import org.opendaylight.yangide.core.model.YangFile;
import org.opendaylight.yangide.core.model.YangFolder;
import org.opendaylight.yangide.core.model.YangModel;
import org.opendaylight.yangide.core.model.YangModelManager;
import org.opendaylight.yangide.core.model.YangProject;
+import org.osgi.framework.BundleContext;
/**
- * The activator class controls the plug-in life cycle
+ * The activator class controls the plug-in life cycle.
*/
public class YangCorePlugin extends Plugin {
- /** The plug-in ID */
+ /* The plug-in ID. */
public static final String PLUGIN_ID = "org.opendaylight.yangide.core"; //$NON-NLS-1$
/** Problem marker ID. */
public static final String YANGIDE_PROBLEM_MARKER = "org.opendaylight.yangide.core.problem";
- /** The shared instance */
+ /* The shared instance */
private static YangCorePlugin plugin;
@Override
return new YangJarFile(path, getYangModel());
}
- /**
- * @param deltaRes
- * @return
- */
public static YangElement create(IResource resource) {
switch (resource.getType()) {
case IResource.PROJECT:
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
return createYangFile(file);
}
-
- /**
- * @param resource
- */
+
public static YangFile createYangFile(IResource resource) {
return new YangFile((IFile) resource, create(resource.getParent()));
}
/**
* Returns the default buffer manager.
*/
- public synchronized static BufferManager getDefaultBufferManager() {
+ public static synchronized BufferManager getDefaultBufferManager() {
if (DEFAULT_BUFFER_MANAGER == null) {
DEFAULT_BUFFER_MANAGER = new BufferManager();
}
/**
* Returns an enumeration of all open buffers.
- * <p>
+ *
* The <code>Enumeration</code> answered is thread safe.
*
* @see OverflowingLRUCache
// java project doesn't exist: ignore
}
- for (IPath iPath : externalJarsPath) {
- try (JarFile jarFile = new JarFile(iPath.toFile())) {
+ for (IPath path : externalJarsPath) {
+ try (JarFile jarFile = new JarFile(path.toFile())) {
ZipEntry entry = jarFile.getEntry("META-INF/yang/");
if (entry != null) {
- this.manager.addJarFile(project, iPath);
+ this.manager.addJarFile(project, path);
}
} catch (IOException e) {
YangCorePlugin.log(e);
return true;
}, IResource.NONE);
- for (IFile iFile : indexedFiles) {
- this.manager.addSource(iFile);
+ for (IFile file : indexedFiles) {
+ this.manager.addSource(file);
}
} catch (CoreException e) {
this.manager.removeIndexFamily(project);
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
import org.opendaylight.yangide.core.YangModelException;
+import org.osgi.framework.BundleContext;
/**
- * The activator class controls the plug-in life cycle
+ * The activator class controls the plug-in life cycle.
*/
public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
- /**
- * The constructor
- */
public Activator() {
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
}
/**
- * Returns the shared instance
+ * Returns the shared instance.
*
* @return the shared instance
*/
}
/**
- * Returns an image descriptor for the image file at the given plug-in relative path
+ * Returns an image descriptor for the image file at the given plug-in relative path.
*
* @param path the path
* @return the image descriptor
/**
* Reports log to Error Log view.
*
- * @param statusErrorID plugin related error ID
* @param message error message
*/
public static void log(Throwable e, String message) {
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
-
+
/**
* Reports log to Error Log view.
*
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
import org.opendaylight.yangide.core.YangCorePlugin;
import org.opendaylight.yangide.ui.YangUIPlugin;
import org.opendaylight.yangide.ui.preferences.YangPreferenceConstants;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
/**
+ * YANG IDE M2E Eclipse Plugin.
+ *
* @author Konstantin Zaitsev
- * date: Jul 2, 2014
+ * @since Jul 2, 2014
*/
public class YangM2EPlugin extends Plugin implements BundleActivator {
// The plug-in ID
}
/**
- * Returns the shared instance
+ * Returns the shared instance.
*
* @return the shared instance
*/
return plugin;
}
- public static void traceTime(String category, String message, long start, long end) {
+ static void traceTime(String category, String message, long start, long end) {
if (YangUIPlugin.getDefault().getPreferenceStore().getBoolean(YangPreferenceConstants.ENABLE_TRACING)) {
Status status = new Status(IStatus.INFO, YangM2EPlugin.PLUGIN_ID, "[" + category + "] " + message + ": "
+ (end - start) + "ms");