diff options
author | bvosburgh | 2012-07-20 21:21:07 +0000 |
---|---|---|
committer | bvosburgh | 2012-07-20 21:21:07 +0000 |
commit | a9acc40fabcdda7547981853cb47172a73175b41 (patch) | |
tree | 61f25593bcebffa356a03d0d6388a5d0e44060fa /jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb | |
parent | 04bfbb636dce962376aa61d6ae51f627522c65b1 (diff) | |
download | webtools.dali-a9acc40fabcdda7547981853cb47172a73175b41.tar.gz webtools.dali-a9acc40fabcdda7547981853cb47172a73175b41.tar.xz webtools.dali-a9acc40fabcdda7547981853cb47172a73175b41.zip |
rework plug-in classes
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb')
4 files changed, 52 insertions, 88 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java deleted file mode 100644 index e69681806f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.eclipselink.core; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.osgi.framework.BundleContext; - -public class JptJaxbEclipseLinkCorePlugin - extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.eclipselink.core"; //$NON-NLS-1$ - - - // ********** singleton ********** - private static JptJaxbEclipseLinkCorePlugin INSTANCE; - - /** - * Return the singleton JPT EclipseLink plug-in. - */ - public static JptJaxbEclipseLinkCorePlugin instance() { - return INSTANCE; - } - - /** - * Log the specified status. - */ - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - /** - * Log the specified message. - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - /** - * Log the specified exception or error. - */ - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - - // ********** plug-in implementation ********** - - public JptJaxbEclipseLinkCorePlugin() { - super(); - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - INSTANCE = this; - } - - @Override - public void stop(BundleContext context) throws Exception { - INSTANCE = null; - super.stop(context); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java index 9e6c36dc82..4294916e5c 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java @@ -1,12 +1,12 @@ /******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ + * Copyright (c) 2011, 2012 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ package org.eclipse.jpt.jaxb.eclipselink.core.internal.libval; import java.util.HashSet; @@ -80,10 +80,8 @@ public class ELJaxbUserLibraryValidator status = LibValUtil.validate(libraryPaths, classNames); - if (! status.isOK()) { - return new Status(IStatus.WARNING, JptJaxbCorePlugin.PLUGIN_ID, JptCommonEclipseLinkCoreMessages.ELJaxbUserLibraryValidator_noXjcClasses); - } - - return Status.OK_STATUS; + return status.isOK() ? + Status.OK_STATUS : + JptJaxbCorePlugin.instance().buildStatus(IStatus.WARNING, JptCommonEclipseLinkCoreMessages.ELJaxbUserLibraryValidator_noXjcClasses); } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/plugin/JptJaxbEclipseLinkCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/plugin/JptJaxbEclipseLinkCorePlugin.java new file mode 100644 index 0000000000..03199d2e0b --- /dev/null +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/plugin/JptJaxbEclipseLinkCorePlugin.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.jaxb.eclipselink.core.internal.plugin; + +import org.eclipse.jpt.common.core.internal.utility.JptPlugin; + +public class JptJaxbEclipseLinkCorePlugin + extends JptPlugin +{ + // ********** singleton ********** + + private static JptJaxbEclipseLinkCorePlugin INSTANCE; + + /** + * Return the singleton Dali JAXB EclipseLink core plug-in. + */ + public static JptJaxbEclipseLinkCorePlugin instance() { + return INSTANCE; + } + + + // ********** Dali plug-in ********** + + public JptJaxbEclipseLinkCorePlugin() { + super(); + } + + @Override + protected void setInstance(JptPlugin plugin) { + INSTANCE = (JptJaxbEclipseLinkCorePlugin) plugin; + } +} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java index 60a8593632..64644cb824 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java @@ -16,10 +16,10 @@ import org.eclipse.core.resources.IResource; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.jaxb.core.JaxbNode; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; import org.eclipse.wst.validation.internal.core.Message; import org.eclipse.wst.validation.internal.provisional.core.IMessage; import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; +import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidator; public class ELJaxbValidationMessageBuilder { @@ -78,7 +78,7 @@ public class ELJaxbValidationMessageBuilder { // } IMessage message = new EclipseLinkMessage(ELJaxbValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject); // TODO "EclipseLink JAXB" validation marker? - message.setMarkerId(JptJaxbCorePlugin.VALIDATION_MARKER_ID); + message.setMarkerId(JaxbValidator.MARKER_ID); return message; } @Override |