diff options
Diffstat (limited to 'plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin')
4 files changed, 0 insertions, 328 deletions
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/IJavaProjectInfo.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/IJavaProjectInfo.java deleted file mode 100644 index 7ca310870..000000000 --- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/IJavaProjectInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.plugin; - -/** - * Insert the type's description here. - * Creation date: (05/07/01 10:06:28 PM) - * @author: Administrator - */ -public interface IJavaProjectInfo { -public String getSourcePath(); -} diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaEMFNature.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaEMFNature.java deleted file mode 100644 index f66bc9c6b..000000000 --- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaEMFNature.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.plugin; -/* - * $RCSfile: JavaEMFNature.java,v $ $Revision: 1.17 $ $Date: 2006/09/14 18:31:08 $ - */ - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jdt.core.JavaCore; - -import org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory; -import org.eclipse.jem.internal.java.adapters.*; -import org.eclipse.jem.java.adapters.JavaXMIFactory; -import org.eclipse.jem.util.emf.workbench.EMFWorkbenchContextBase; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.emf.workbench.nature.EMFNature; -import org.eclipse.jem.workbench.utility.IJavaEMFNature; -import org.eclipse.jem.workbench.utility.JemProjectUtilities; - -public class JavaEMFNature extends EMFNature implements IJavaEMFNature { -/** - * JavaMOFNatureRuntime constructor comment. - */ -public JavaEMFNature() { - super(); -} -/** - * Get a IJavaMOFNatureRuntime that corresponds to the supplied project. - * @return IJavaMOFNatureRuntime - * @param project com.ibm.itp.core.api.resources.IProject - */ -public static JavaEMFNature createRuntime(IProject project) throws CoreException { - if(!hasRuntime(project)) - if (JavaCore.create(project).exists()) - addNatureToProject(project, IJavaEMFNature.NATURE_ID); - else - return null; - - return getRuntime(project); -} - -/** - * Return the nature's ID. - */ -public java.lang.String getNatureID() { - return IJavaEMFNature.NATURE_ID; -} -/** - * Return the ID of the plugin that this nature is contained within. - */ -protected java.lang.String getPluginID() { - return JavaPlugin.getDefault().getBundle().getSymbolicName(); -} -/** - * Get a IJavaMOFNatureRuntime that corresponds to the supplied project. - * First check for registered natures. - * @return IJavaMOFNatureRuntime - * @param project com.ibm.itp.core.api.resources.IProject - */ -public static JavaEMFNature getRuntime(IProject project) { - JavaEMFNature nature = null; - List runtimes = EMFNature.getRegisteredRuntimes(project); - for (int i=0; i<runtimes.size(); i++) { - if (runtimes.get(i) instanceof JavaEMFNature) - nature = (JavaEMFNature) runtimes.get(i); - } - if (nature == null) - nature = primGetRuntime(project); - return nature; -} -/** - * Return whether or not the project has a runtime created on it. - * Check for registered natures first. - * @return boolean - * @param project com.ibm.itp.core.api.resources.IProject - */ -public static boolean hasRuntime(IProject project) { - JavaEMFNature nature = null; - List runtimes = EMFNature.getRegisteredRuntimes(project); - for (int i=0; i<runtimes.size(); i++) { - if (runtimes.get(i) instanceof JavaEMFNature) - nature = (JavaEMFNature) runtimes.get(i); - } - if (nature == null) - return primHasRuntime(project); - else - return true; - -} -/** - * Get a IJavaMOFNatureRuntime that corresponds to the supplied project. - * Do not check for other registered types. - * @return IJavaMOFNatureRuntime - * @param project com.ibm.itp.core.api.resources.IProject - */ -public static JavaEMFNature primGetRuntime(IProject project) { - try { - return (JavaEMFNature) project.getNature(IJavaEMFNature.NATURE_ID); - } catch (CoreException e) { - return null; - } -} -/** - * Return whether or not the project has a runtime created on it. - * Do not check for registered nature ids. - * @return boolean - * @param project com.ibm.itp.core.api.resources.IProject - */ -public static boolean primHasRuntime(IProject project) { - try { - return project.hasNature(IJavaEMFNature.NATURE_ID); - } catch (CoreException e) { - return false; - } -} - -/** - * primary contribute to context - */ -public void primaryContributeToContext(EMFWorkbenchContextBase aNature) { - if (emfContext == aNature) return; - emfContext = aNature; - ResourceSet set = aNature.getResourceSet(); - set.getResourceFactoryRegistry().getProtocolToFactoryMap().put(JavaXMIFactory.SCHEME, JavaXMIFactory.INSTANCE); - WorkbenchURIConverter conv = (WorkbenchURIConverter) set.getURIConverter(); - configureURIConverter(conv); - addAdapterFactories(set); -} - -/** - * secondary contribute to context - */ -public void secondaryContributeToContext(EMFWorkbenchContextBase aNature) { - primaryContributeToContext(aNature); -} - -/** - * Remove the project as a container from the converter and add - * the source folder. - */ -protected void configureURIConverter(WorkbenchURIConverter conv) { - conv.removeInputContainer(getProject()); - conv.addInputContainer(getEMFRoot()); -} - -/** - * Add Adaptor factories to aContext which is now - * being used for this nature. - */ -protected void addAdapterFactories(ResourceSet aSet) { - addJavaReflectionAdapterFactories(aSet); -} - -protected void addJavaReflectionAdapterFactories(ResourceSet aSet) { - List factories = aSet.getAdapterFactories(); - // The context may already have a JavaReflection adaptor factory, so remove it - // This should maybe be considered a logic error, but we can recover easily - if (!factories.isEmpty()) { - AdapterFactory factory = EcoreUtil.getAdapterFactory(factories, ReadAdaptor.TYPE_KEY); - if (factory != null) - factories.remove(factory); - } - - factories.add(adapterFactory); -} - -private JavaJDOMAdapterFactory adapterFactory; - -/* (non-Javadoc) - * @see org.eclipse.jem.util.emf.workbench.nature.EMFNature#setProject(org.eclipse.core.resources.IProject) - */ -public void setProject(IProject newProject) { - super.setProject(newProject); - adapterFactory = new JavaJDOMAdapterFactory(JemProjectUtilities.getJavaProject(project)); -} - -} diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaPlugin.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaPlugin.java deleted file mode 100644 index 4a6b0bf83..000000000 --- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaPlugin.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.plugin; -/* - * $RCSfile: JavaPlugin.java,v $ $Revision: 1.13 $ $Date: 2006/05/17 20:13:58 $ - */ - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -import org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory; -import org.eclipse.jem.internal.java.adapters.jdk.JavaJDKAdapterFactory; -import org.eclipse.jem.java.util.JavaContext; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jem.util.logger.proxyrender.EclipseLogger; -import org.eclipse.jem.util.plugin.JEMUtilPlugin; - -/** - * This is a top-level class of the java plugin tool. - * - * @see AbstractUIPlugin for additional information on UI plugins - */ - -public class JavaPlugin extends Plugin { - - private static JavaPlugin INSTANCE; - private Logger logger; - - /** - * Create the Java plugin and cache its default instance - */ - public JavaPlugin() { - INSTANCE = this; - } - - public Logger getLogger() { - if (logger == null) - logger = EclipseLogger.getEclipseLogger(this); - return logger; - } - - /** - * Get the plugin singleton. - */ - static public JavaPlugin getDefault() { - return INSTANCE; - } - - /* (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - INSTANCE = this; - JavaContext.setReflectionAdapterFactoryClass(JavaJDOMAdapterFactory.class); - JEMUtilPlugin.getPluginResourceSet().getAdapterFactories().add(new JavaJDKAdapterFactory()); - } - -} diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaProjectInfo.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaProjectInfo.java deleted file mode 100644 index 216e57668..000000000 --- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/plugin/JavaProjectInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.plugin; -/* - - - */ -/** - * Insert the type's description here. - * Creation date: (05/07/01 10:09:26 PM) - * @author: Administrator - */ -public class JavaProjectInfo implements IJavaProjectInfo { - - public final static String DEFAULT_JAVA_OUTPUT_PATH = "bin";//$NON-NLS-1$ - public final static String DEFAULT_SOURCE_PATH = "source";//$NON-NLS-1$ - protected String sourcePath; -/** - * JavaProjectInfo constructor comment. - */ -public JavaProjectInfo() { - super(); -} -/** - * Subclasses should override as necessary - */ -protected String getDefaultSourcePath() { - return DEFAULT_SOURCE_PATH; -} -/** - * Get the class path for the reciever. By default ask the template - * @return java.lang.String - */ -public String getSourcePath() { - if (sourcePath == null) - sourcePath = getDefaultSourcePath(); - return sourcePath; -} -public void setSourcePath(String path) { - sourcePath = path; -} -} |