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

Java Workspace类代码示例

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

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



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

示例1: getAdapter

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
 */
@SuppressWarnings("unchecked")
public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
	ILocationDescriptor res = null;

	if (adaptableObject instanceof IMarker) {
		final IMarker marker = (IMarker)adaptableObject;
		final MarkerManager manager = ((Workspace)ResourcesPlugin.getWorkspace()).getMarkerManager();
		try {
			final String markerType = marker.getType();
			for (IMarkerToLocationDescriptor adapter : ADAPTERS) {
				if (manager.isSubtype(markerType, ADAPTER_TYPE.get(adapter))) {
					res = adapter.getAdapter(marker);
					if (res != null) {
						break;
					}
				}
			}
		} catch (CoreException e) {
			Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
					.getMessage(), e));
		}
	}

	return res;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:31,代码来源:MarkerToLocationDescriptorAdapterFactory.java


示例2: UMLFileTreeNode

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
/**
     * constructor.
     * 
     * @param workspace
     * @param path
     * @param parentElement
     * @param fragment
     * @param adapterFactoryContentProvider
     */
    public UMLFileTreeNode(IPath pPath, Workspace workspace, EObject obj, Object parentElement, boolean isFragmented,
    AdapterFactoryContentProvider propSourceProvider) {
        // super(path, workspace);
        super(parentElement);
        path = pPath;
        eobject = obj;
        parent = parentElement;
        fragment = isFragmented;
        propertySourceProvider = propSourceProvider;
        if (eobject != null) {
            if(!eobject.eResource().isTrackingModification()){
                eobject.eResource().setTrackingModification(true);
            }
        }
        
//        String fragment = EcoreUtil.getURI(eobject).fragment();
//        Object object = UMLCacheManager.getInstance().get(UMLCacheManager.RESOURCE_URI_CACHE, fragment);
//        
//        if (object == null){ 
//            String uriStr = EcoreUtil.getURI(eobject).toString();
//            UMLCacheManager.getInstance().put(UMLCacheManager.RESOURCE_URI_CACHE, fragment, uriStr);
//        }
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:33,代码来源:UMLFileTreeNode.java


示例3: postHook

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
public void postHook(IWorkbenchPage page) {
    try {
        URI newFile = (new File(this.newFilename)).toURI().normalize();
        URI workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getLocationURI().normalize();

        if (newFile.toString().toLowerCase().startsWith(workspaceFile.toString().toLowerCase())) {
            String path = newFile.toString().substring(workspaceFile.toString().length());
            path = path.replaceAll("%20", " "); //$NON-NLS-1$ //$NON-NLS-2$

            IFile file = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(new Path(path), IResource.FILE);
            file.getParent().refreshLocal(1, null);
            IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());

            if (desc == null)
                desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor("xml.xml"); //$NON-NLS-1$
            page.openEditor(new FileEditorInput(file), desc.getId());
        }

    } catch (Exception ex) {
        // hide any errors.
    }

}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:24,代码来源:ExportMSC.java


示例4: scheduleBuildIfNecessary

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
/**
 * Schedules a build with the given projects. Does nothing if the {@link Platform platform} is not running, or the
 * iterable of projects is empty.
 *
 * @param toUpdate
 *            an iterable of projects to build.
 */
public void scheduleBuildIfNecessary(final Iterable<IProject> toUpdate) {
	if (Platform.isRunning() && !Iterables.isEmpty(toUpdate)) {
		final Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace();
		final IBuildConfiguration[] projectsToReBuild = from(asList(workspace.getBuildOrder()))
				.filter(config -> Iterables.contains(toUpdate, config.getProject()))
				.toArray(IBuildConfiguration.class);

		if (!Arrays2.isEmpty(projectsToReBuild)) {
			new RebuildWorkspaceProjectsJob(projectsToReBuild).schedule();
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:RebuildWorkspaceProjectsScheduler.java


示例5: register

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
/**
 * registers the given {@link IMarkerToLocationDescriptor} for the given marker type.
 * 
 * @param adapter
 *            the {@link IMarkerToLocationDescriptor}
 * @param markerType
 *            the marker type
 */
public static void register(IMarkerToLocationDescriptor adapter, String markerType) {
	ADAPTER_TYPE.put(adapter, markerType);

	final MarkerManager manager = ((Workspace)ResourcesPlugin.getWorkspace()).getMarkerManager();
	int i = 0;
	for (IMarkerToLocationDescriptor registeredAdapter : ADAPTERS) {
		if (manager.isSubtype(markerType, ADAPTER_TYPE.get(registeredAdapter))) {
			break;
		}
		i++;
	}

	ADAPTERS.add(i, adapter);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:23,代码来源:MarkerToLocationDescriptorAdapterFactory.java


示例6: createFile

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
private static File createFile(IPath workspaceRelativeAbsPathOfFile, String contents) throws CoreException {
  // TODO: Convert to ResouceUtils.createFile
  Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace();
  File file = (File) workspace.newResource(workspaceRelativeAbsPathOfFile, IResource.FILE);
  ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(contents.getBytes());
  file.create(byteArrayInputStream, false, null);
  JobsUtilities.waitForIdle();
  return file;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:10,代码来源:AbstractGWTPluginTestCase.java


示例7: syncBuild

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
/**
 * Synchronous run of a builder with the given name on the given project.
 * 
 * @param project
 * @param kind
 *            See {@link IncrementalProjectBuilder} for the available types.
 * @param builderName
 * @param args
 * @param monitor
 * @return A status indicating if the build succeeded or failed
 */
public static IStatus syncBuild(IProject project, int kind, String builderName, Map args, IProgressMonitor monitor)
{
	try
	{
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
		BuildManager buildManager = ((Workspace) workspace).getBuildManager();
		return buildManager.build(new BuildConfiguration(project), kind, builderName, args, monitor);
	}
	catch (IllegalStateException e)
	{
		return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, "Error while getting the Workspace", e); //$NON-NLS-1$
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:25,代码来源:BuildUtil.java


示例8: doBuild

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
/**
 * Like the super implementation, except the build is not triggered if
 * both toBeDeleted and toBeUpdated are empty. {@inheritDoc}
 */
@SuppressWarnings("nls")
@Override
protected void doBuild(final ToBeBuilt toBeBuilt, final IProgressMonitor monitor, final BuildType type) throws CoreException {
  if (toBeBuilt.getToBeDeleted().size() != 0 || toBeBuilt.getToBeUpdated().size() != 0) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Starting " + type.name() + " build:" + "\ndeleted(" + toBeBuilt.getToBeDeleted().size() + ")=" + toBeBuilt.getToBeDeleted().toString()
          + "\nupdated(" + toBeBuilt.getToBeUpdated().size() + ")=" + toBeBuilt.getToBeUpdated().toString());
    }

    SubMonitor progress = SubMonitor.convert(monitor, 1 + 1 + 1); // build + participant + rebuild

    ResourceSet resourceSet = getResourceSetProvider().get(getProject());
    resourceSet.getLoadOptions().put(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE, Boolean.TRUE);
    if (resourceSet instanceof ResourceSetImpl) {
      ((ResourceSetImpl) resourceSet).setURIResourceMap(Maps.<URI, Resource> newHashMap());
    }
    BuildData buildData = new BuildData(getProject().getName(), resourceSet, toBeBuilt, queuedBuildData);
    ImmutableList<Delta> deltas = builderState.update(buildData, progress.newChild(1));
    if (participant != null) {
      final BuildContext buildContext = new BuildContext(this, resourceSet, deltas, type);
      // remember the current workspace tree
      final ElementTree oldTree = ((Workspace) ResourcesPlugin.getWorkspace()).getElementTree();
      oldTree.immutable();
      participant.build(buildContext, progress.newChild(1));
      if (buildContext.isRebuildRequired() && rebuilds++ <= 2) {
        final ElementTree newTree = ((Workspace) ResourcesPlugin.getWorkspace()).getElementTree();
        newTree.immutable();
        final ResourceDelta generatedDelta = ResourceDeltaFactory.computeDelta((Workspace) ResourcesPlugin.getWorkspace(), oldTree, newTree, getProject().getFullPath(), -1);
        // rebuild the generated delta
        ResourcesPlugin.getWorkspace().checkpoint(false);
        incrementalBuild(generatedDelta, progress.newChild(1));
      }
    } else {
      progress.worked(2);
    }
    resourceSet.getResources().clear();
    resourceSet.eAdapters().clear();
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Build done.");
    }
  } else if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Ignoring empty " + type.name() + " build.");
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:49,代码来源:RebuildingXtextBuilder.java


示例9: saveServerConfigurations

import org.eclipse.core.internal.resources.Workspace; //导入依赖的package包/类
/**
 * Save state of server configurations
 */
public void saveServerConfigurations()
{
	new DelayedSnapshotJob(((Workspace) ResourcesPlugin.getWorkspace()).getSaveManager()).schedule();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:8,代码来源:WebServerCorePlugin.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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