• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EMFPlugin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.emf.common.EMFPlugin的典型用法代码示例。如果您正苦于以下问题:Java EMFPlugin类的具体用法?Java EMFPlugin怎么用?Java EMFPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EMFPlugin类属于org.eclipse.emf.common包,在下文中一共展示了EMFPlugin类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startCDOServer

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
@BeforeClass
public static void startCDOServer() throws IOException, CommitException {
    server = new CDOServer(false);
    server.start();
    IConnector connector = M2DocCDOUtils
            .getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":" + CDOServer.PORT);
    CDOSession session = M2DocCDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME, CDOServer.USER_NAME,
            CDOServer.PASSWORD);
    final CDOTransaction transaction = M2DocCDOUtils.openTransaction(session);
    final CDOResource resource = transaction.createResource("anydsl.ecore");
    final ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
    final Resource anyDSLResource = resourceSet.getResource(URI.createFileURI("resources/anydsl.ecore"), true);
    resource.getContents().addAll(anyDSLResource.getContents());
    resource.save(null);
    transaction.commit();
    transaction.close();
    session.close();
    connector.close();

    if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
        ConfigurationProviderService.getInstance().register(CONFIGURATION_PROVIDER);
        M2DocUtils.registerServicesConfigurator(SERVICES_CONFIGURATOR_DESCRIPTOR);
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:26,代码来源:ServerWithoutAuthentication.java


示例2: startCDOServer

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
@BeforeClass
public static void startCDOServer() throws IOException, CommitException {
    server = new CDOServer(true);
    server.start();
    IConnector connector = M2DocCDOUtils
            .getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":" + CDOServer.PORT);
    CDOSession session = M2DocCDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME, CDOServer.USER_NAME,
            CDOServer.PASSWORD);
    final CDOTransaction transaction = M2DocCDOUtils.openTransaction(session);
    final CDOResource resource = transaction.createResource("anydsl.ecore");
    final ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
    final Resource anyDSLResource = resourceSet.getResource(URI.createFileURI("resources/anydsl.ecore"), true);
    resource.getContents().addAll(anyDSLResource.getContents());
    resource.save(null);
    transaction.commit();
    transaction.close();
    session.close();
    connector.close();

    if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
        ConfigurationProviderService.getInstance().register(CONFIGURATION_PROVIDER);
        M2DocUtils.registerServicesConfigurator(SERVICES_CONFIGURATOR_DESCRIPTOR);
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:26,代码来源:ServerWithAuthentication.java


示例3: getUri

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
/**
 * 
 * @param anyResource
 *            any resource is just to
 * @param resourcePath
 *            the Java NIO path of the resource to load as a
 *            `platform:/resource/` if the Eclipse platform is running,
 *            otherwise loads it as a file resource.
 */
private URI getUri(Resource anyResource, java.nio.file.Path resourcePath) {
	Preconditions.checkArgument(anyResource instanceof XtextResource,
			"Expected an Xtext resource. Got: " + anyResource);
	if (EMFPlugin.IS_ECLIPSE_RUNNING) {
		IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
		java.nio.file.Path workspaceRootPath = Paths.get(workspaceRoot.getLocationURI());
		java.nio.file.Path relativePath = workspaceRootPath.relativize(resourcePath);
		Path relativeResourcePath = new Path(relativePath.toString());
		return URI.createPlatformResourceURI(relativeResourcePath.toOSString(), true);
	} else {
		final PathToFileUriConverter uriConverter = getUriConverter(anyResource);
		return uriConverter.createFileUri(resourcePath);
	}

}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:25,代码来源:JenaBasedSadlModelProcessor.java


示例4: findModuleURL

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
/**
 * 
 * @param moduleName
 * @param clazz
 * @return
 */
@SuppressWarnings("restriction")
private URL findModuleURL(String moduleName, Class<?> clazz) {
	URL moduleURL = null;
	if (EMFPlugin.IS_ECLIPSE_RUNNING)
		try {
			moduleURL = org.eclipse.acceleo.common.internal.utils.workspace.AcceleoWorkspaceUtil.getResourceURL(
					clazz, moduleName);
		} catch (IOException e) {
			// Swallow this, we'll try and locate the module through the
			// class loader
		}
	if (moduleURL == null)
		moduleURL = clazz.getResource(moduleName);
	return moduleURL;
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:22,代码来源:JavaGenerator.java


示例5: WorkingSetManagerBrokerImpl

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
/**
 * Creates a new working set broker instance with the given injector and status helper arguments. The injector is
 * used to inject members into the available contributions. Also restores its most recent state from the preference
 * store.
 *
 * @param injector
 *            the injector for initializing the contributions.
 * @param statusHelper
 *            convenient way to create {@link IStatus status} instances.
 *
 */
@Inject
private WorkingSetManagerBrokerImpl(final Injector injector, final StatusHelper statusHelper) {
	this.injector = injector;
	this.statusHelper = statusHelper;
	this.activeWorkingSetManager = new AtomicReference<>();
	this.workingSetTopLevel = new AtomicBoolean(false);
	this.alreadyQueuedNavigatorRefresh = new AtomicBoolean(false);
	this.contributions = initContributions();
	topLevelElementChangeListeners = newHashSet();
	workingSetManagerStateChangeListeners = newHashSet();
	restoreState(new NullProgressMonitor());
	if (EMFPlugin.IS_ECLIPSE_RUNNING) {
		final String pluginId = N4JSActivator.getInstance().getBundle().getSymbolicName();
		final IWorkspace workspace = ResourcesPlugin.getWorkspace();
		try {
			workspace.addSaveParticipant(pluginId, new SaveParticipantAdapter() {
				@Override
				public void saving(final ISaveContext context) throws CoreException {
					saveState(new NullProgressMonitor());
				}
			});
		} catch (final CoreException e) {
			LOGGER.error("Error occurred while attaching save participant to workspace.", e);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:38,代码来源:WorkingSetManagerBrokerImpl.java


示例6: stopCDOServer

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
@AfterClass
public static void stopCDOServer() {
    server.stop();

    if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
        ConfigurationProviderService.getInstance().getProviders().remove(CONFIGURATION_PROVIDER);
        M2DocUtils.unregisterServicesConfigurator(SERVICES_CONFIGURATOR_DESCRIPTOR);
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:10,代码来源:ServerWithoutAuthenticationTemplateOnServer.java


示例7: initialize

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
public static void initialize(Consumer<UnitTestEnvironmentSetupDelegate> initializer) throws IllegalAccessException {
     BasicConfigurator.resetConfiguration();
     BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%m%n")));

     if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
         final Set<URI> baseURIs = new HashSet<>();
         initializer.accept(new UnitTestEnvironmentSetupDelegate() {
             @Override
             public void registerQVTOResolutionURIs(URI uriToRegister) {
                 baseURIs.add(uriToRegister);
             }
             
             @Override
             public void registerPlatformUris(String platformID, URI uri) {
                 EcorePlugin.getPlatformResourceMap().put(platformID, uri);
             }
         });
         
         Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
         OCL.initialize(null);
         NotationPackage.eINSTANCE.eClass();
         StylePackage.eINSTANCE.eClass();
         TextualCommonsPackage.eINSTANCE.eClass();
         org.eclipse.papyrus.infra.gmfdiag.style.StylePackage.eINSTANCE.eClass();
         
         @SuppressWarnings("unchecked")
List<UnitResolverFactory> fFactories = (List<UnitResolverFactory>) 
                 FieldUtils.readField(UnitResolverFactory.Registry.INSTANCE, "fFactories", true);
         fFactories.clear();
         fFactories.add(new MockUnitResolverFactory(new ArrayList<>(baseURIs)));
         
         BlackboxRegistry.INSTANCE.registerModule(CooperateLibrary.class,
                 "de.cooperateproject.qvtoutils.CooperateLibrary", "CooperateLibrary",
                 new String[] { EcorePackage.eNS_URI });
     }
 }
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:37,代码来源:TransformationTestBase.java


示例8: toEmfUri

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
/**
 * Returns with the EMF URI of the resource given as the absolute FS path string.
 * <p>
 * If the Eclipse platform is up and available, then creates a platform resource URI,
 * otherwise creates an EMF URI with the {@code file} scheme. 
 */
public static URI toEmfUri(String absoluteFilePath) {
	if (EMFPlugin.IS_ECLIPSE_RUNNING) {
		File file = new File(absoluteFilePath);
		java.nio.file.Path path = Paths.get(file.toURI());
		java.nio.file.Path relativePath = Paths.get(getWorkspaceRoot().getLocationURI()).relativize(path);
		return URI.createPlatformResourceURI(relativePath.toString(), true);
	} else {
		return URI.createFileURI(absoluteFilePath);
	}
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:17,代码来源:ResourceManager.java


示例9: close

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.acceleo.engine.generation.writers.AbstractAcceleoWriter#close()
 */
@Override
public void close() throws IOException {
	if (!EMFPlugin.IS_ECLIPSE_RUNNING || this.delegate instanceof BufferedWriter) {
		delegate.close();
	} else {
		Writer writer = null;
		OutputStream fileOutputStream = null;
		OutputStreamWriter fileWriter = null;
		try {
			if (selectedCharset == null) {
				writer = new BufferedWriter(new FileWriter(new File(targetPath)));
			} else {
				fileOutputStream = new FileOutputStream(new File(targetPath));
				fileWriter = new OutputStreamWriter(fileOutputStream, selectedCharset);
				writer = new BufferedWriter(fileWriter);
			}
			writer.append(toString());
			writer.flush();
		} catch (Exception e) {
			Activator
					.getDefault()
					.getLog()
					.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
							"An exception occurred while writing to writer", e));
		} finally {
			if (writer != null) {
				writer.close();
			}
			if (fileWriter != null) {
				fileWriter.close();
			}
			if (fileOutputStream != null) {
				fileOutputStream.close();
			}
		}
	}
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:43,代码来源:NoJMergeAcceleoFileWriter.java


示例10: getProperties

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
/**
 * If the module(s) called by this launcher require properties files, return
 * their qualified path from here.Take note that the first added properties
 * files will take precedence over subsequent ones if they contain
 * conflicting keys.
 *
 * @return The list of properties file we need to add to the generation
 * context.
 * @see java.util.ResourceBundle#getBundle(String) @generated
 */
@Override
public List<String> getProperties() {
    /*
     * If you want to change the content of this method, do NOT forget to change the "@generated"
     * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
     * of the Acceleo module with the main template that has caused the creation of this class will
     * revert your modifications.
     */

    /*
     * TODO if your generation module requires access to properties files, add their qualified path to the list here.
     * 
     * Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse
     * plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties
     * files to the "propertiesFiles" list:
     * 
     * final String prefix = "platform:/plugin/";
     * final String pluginName = "org.eclipse.acceleo.module.sample";
     * final String packagePath = "/org/eclipse/acceleo/module/sample/properties/";
     * final String fileName = "default.properties";
     * propertiesFiles.add(prefix + pluginName + packagePath + fileName);
     * 
     * With this mechanism, you can load properties files from your plugin or from another plugin.
     * 
     * You may want to load properties files from the file system, for that you need to add the absolute path of the file:
     * 
     * propertiesFiles.add("C:\Users\MyName\MyFile.properties");
     * 
     * If you want to let your users add properties files located in the same folder as the model:
     **/
    if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) {
        propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource()));
    }
    /* 
     * To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents).
     */
    return propertiesFiles;
}
 
开发者ID:BenRhouma,项目名称:AcceleoStandAlone,代码行数:49,代码来源:Main.java


示例11: start

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
	if (EMFPlugin.IS_ECLIPSE_RUNNING) {
		initializeResourceServiceProviderRegistry(context);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:Activator.java


示例12: createGlobalRegistry

import org.eclipse.emf.common.EMFPlugin; //导入依赖的package包/类
/**
 * Creates the {@link EPackage.Registry#INSTANCE instance} of the global registry.
 * If a {@link System#getSecurityManager() security manager} is active,
 * and <code>"classLoader"</code> {@link RuntimePermission permission} is not granted,
 * a secure delegator instance is created,
 * i.e., a private registry implementation that securely accesses class loaders 
 * and keeps them private, will be used.
 */
public static EPackage.Registry createGlobalRegistry()
{
  try
  {
    String className = System.getProperty("org.eclipse.emf.ecore.EPackage.Registry.INSTANCE");
    if (className == null)
    {
      if (EcorePlugin.getDefaultRegistryImplementation() != null)
      {
        return EcorePlugin.getDefaultRegistryImplementation();
      }
      else if (!EMFPlugin.IS_ECLIPSE_RUNNING)
      {
        try
        {
          SecurityManager securityManager = System.getSecurityManager();
          if (securityManager != null)
          {
            securityManager.checkPermission(new RuntimePermission("classLoader"));
          }
          return new Delegator();
        }
        catch (Throwable throwable)
        {
          return new SecureDelegator();
        }
      }
      else
      {
        return new EPackageRegistryImpl();
      }
    }
    else
    {
      return (EPackage.Registry)Class.forName(className).newInstance();
    }
  }
  catch (Exception exception)
  {
    EcorePlugin.INSTANCE.log(exception);
    return new EPackageRegistryImpl();
  }
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:52,代码来源:EPackageRegistryImpl.java



注:本文中的org.eclipse.emf.common.EMFPlugin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XmlRpcException类代码示例发布时间:2022-05-20
下一篇:
Java FileSystemException类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap