当前位置: 首页>>代码示例>>Java>>正文


Java IOverwriteQuery类代码示例

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


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

示例1: createRuntime

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
protected IRuntime createRuntime(IServerType st, IPath path, IProgressMonitor monitor, IOverwriteQuery query)
		throws CoreException {
	IRuntime runtime = ServerCore.findRuntime(runtimeName);
	if (runtime != null) {
		if (!query(query, NLS.bind(Messages.ServerHandler_QUERY_RUNTIME_EXISTS,
				runtimeName))) {
			monitor.worked(1);
			return runtime;
		}
		else {
			runtime.delete();
		}
	}
	IRuntimeWorkingCopy wc = st.getRuntimeType().createRuntime(runtimeName, new SubProgressMonitor(monitor, 1));
	wc.setName(runtimeName);

	if (path != null) {
		wc.setLocation(path);
	}

	runtime = wc.save(true, new SubProgressMonitor(monitor, 1));

	return runtime;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:25,代码来源:ServerHandler.java

示例2: createServer

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
private IServer createServer(IServerType st, IRuntime runtime, IProgressMonitor monitor, IOverwriteQuery query,
		ServerHandlerCallback callback) throws CoreException {
	IServer server = ServerCore.findServer(serverName);
	if (server != null) {
		if (!query(query,
				NLS.bind(Messages.ServerHandler_QUERY_SERVER_EXISTS, serverName))) {
			monitor.worked(1);
			return server;
		}
		else {
			IFolder serverConfiguration = server.getServerConfiguration();
			server.delete();
			if (serverConfiguration != null) {
				serverConfiguration.delete(true, true, monitor);
			}
		}
	}

	IServerWorkingCopy wc = st.createServer(serverName, null, runtime, new SubProgressMonitor(monitor, 1));
	wc.setName(serverName);
	if (callback != null) {
		callback.configureServer(wc);
	}
	server = wc.save(true, new SubProgressMonitor(monitor, 1));
	return server;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:27,代码来源:ServerHandler.java

示例3: queryOverwrite

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
/**
 * Queries the user whether the resource with the specified path should be overwritten by a file
 * system object that is being imported.
 *
 * @param resourcePath the workspace path of the resource that needs to be overwritten
 * @return <code>true</code> to overwrite, <code>false</code> to not overwrite
 * @exception OperationCanceledException if canceled
 */
boolean queryOverwrite(IPath resourcePath) throws OperationCanceledException {
  String overwriteAnswer =
      overwriteCallback.queryOverwrite(resourcePath.makeRelative().toString());

  if (overwriteAnswer.equals(IOverwriteQuery.CANCEL)) {
    throw new OperationCanceledException("DataTransferMessages.DataTransfer_emptyString");
  }

  if (overwriteAnswer.equals(IOverwriteQuery.NO)) {
    return false;
  }

  if (overwriteAnswer.equals(IOverwriteQuery.NO_ALL)) {
    this.overwriteState = OVERWRITE_NONE;
    return false;
  }

  if (overwriteAnswer.equals(IOverwriteQuery.ALL)) {
    this.overwriteState = OVERWRITE_ALL;
  }

  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:ImportOperation.java

示例4: queryOverwrite

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
/**
   * Queries the user whether the resource with the specified path should be
   * overwritten by a file system object that is being imported.
   * 
   * @param resourcePath the workspace path of the resource that needs to be overwritten
   * @return <code>true</code> to overwrite, <code>false</code> to not overwrite
   * @exception OperationCanceledException if canceled
   */
  boolean queryOverwrite(IPath resourcePath)
          throws OperationCanceledException {
      String overwriteAnswer = overwriteCallback.queryOverwrite(resourcePath
              .makeRelative().toString());

      if (overwriteAnswer.equals(IOverwriteQuery.CANCEL)) {
	throw new OperationCanceledException(DataTransferMessages.DataTransfer_emptyString);
}

      if (overwriteAnswer.equals(IOverwriteQuery.NO)) {
          return false;
      }

      if (overwriteAnswer.equals(IOverwriteQuery.NO_ALL)) {
          this.overwriteState = OVERWRITE_NONE;
          return false;
      }

      if (overwriteAnswer.equals(IOverwriteQuery.ALL)) {
	this.overwriteState = OVERWRITE_ALL;
}

      return true;
  }
 
开发者ID:crapo,项目名称:sadlos2,代码行数:33,代码来源:OwlImportOperation.java

示例5: unpackResourceProject

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
public static IProject unpackResourceProject(IProject project, Example.Resource resource) throws Exception
{
	if (resource.getType() == Type.ENVIRONMENT)
		CloudScaleProjectSupport.addProjectNature(project);

	ZipFile file = new ZipFile(resource.getArchive().getFile());
	ZipFileStructureProvider provider = new ZipFileStructureProvider(file);
	IPath containerPath = project.getFullPath();
	Object source = provider.getRoot();

	IOverwriteQuery query = new IOverwriteQuery()
	{
		@Override
		public String queryOverwrite(String path)
		{
			return IOverwriteQuery.ALL;
		};
	};
	ImportOperation operation = new ImportOperation(containerPath, source, provider, query);
	operation.run(null);

	return project;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:24,代码来源:ExampleService.java

示例6: importFilesFromZip

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
/**
 * extract zip file and import files into project
 * 
 * @param srcZipFile
 * @param destPath
 * @param monitor
 * @param query
 * @throws CoreException
 */
private static void importFilesFromZip( ZipFile srcZipFile, IPath destPath,
		IProgressMonitor monitor, IOverwriteQuery query )
		throws CoreException
{
	try
	{
		ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(
				srcZipFile );
		List list = prepareFileList( structureProvider, structureProvider
				.getRoot( ), null );
		ImportOperation op = new ImportOperation( destPath,
				structureProvider.getRoot( ), structureProvider, query,
				list );
		op.run( monitor );
	}
	catch ( Exception e )
	{
		String message = srcZipFile.getName( ) + ": " + e.getMessage( ); //$NON-NLS-1$
		Logger.logException( e );
		throw BirtCoreException.getException( message, e );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:32,代码来源:BirtWizardUtil.java

示例7: importProject

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
private static IProject importProject(File probandsFolder, String projectName, boolean prepareDotProject)
		throws Exception {
	File projectSourceFolder = new File(probandsFolder, projectName);
	if (!projectSourceFolder.exists()) {
		throw new IllegalArgumentException("proband not found in " + projectSourceFolder);
	}

	if (prepareDotProject) {
		prepareDotProject(projectSourceFolder);
	}

	IProgressMonitor monitor = new NullProgressMonitor();
	IWorkspace workspace = ResourcesPlugin.getWorkspace();

	IProjectDescription newProjectDescription = workspace.newProjectDescription(projectName);
	IProject project = workspace.getRoot().getProject(projectName);
	project.create(newProjectDescription, monitor);
	project.open(monitor);
	if (!project.getLocation().toFile().exists()) {
		throw new IllegalArgumentException("test project correctly created in " + project.getLocation());
	}

	IOverwriteQuery overwriteQuery = new IOverwriteQuery() {
		@Override
		public String queryOverwrite(String file) {
			return ALL;
		}
	};
	ImportOperation importOperation = new ImportOperation(project.getFullPath(), projectSourceFolder,
			FileSystemStructureProvider.INSTANCE, overwriteQuery);
	importOperation.setCreateContainerStructure(false);
	importOperation.run(monitor);

	return project;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:36,代码来源:ProjectUtils.java

示例8: run

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
	BundleImportStructureProvider bundleImportStructureProvider = new BundleImportStructureProvider(bundle);
	final IWorkspace workspace = ResourcesPlugin.getWorkspace();
	final IProject project = workspace.getRoot().getProject(projectName);
	IOverwriteQuery overwriteQuery = new IOverwriteQuery() {
		public String queryOverwrite(String file) {
			return ALL;
		}
	};
	ImportOperation importOperation = new ImportOperation(project.getFullPath(), bundleProjectEntryPath,
			bundleImportStructureProvider, overwriteQuery);
	importOperation.setCreateContainerStructure(false);
	importOperation.run(monitor);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:16,代码来源:BundleProjectImportOperation.java

示例9: createProject

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
public IProject createProject(URL location, String sourceFolder) throws CoreException {
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(sourceFolder);
    try {
        project.create(new NullProgressMonitor());
        project.open(new NullProgressMonitor());
    } catch (CoreException ex) {
        MessageDialog.openError(null, Messages.Error,
                NLS.bind(Messages.CreateProjectErrorFmt, project.getName(), ex.getMessage()));
        return null;
    }

    try {
        File templateRoot = new File(location.getPath(), sourceFolder);
        RelativeFileSystemStructureProvider structureProvider = new RelativeFileSystemStructureProvider(templateRoot);
        ImportOperation operation = new ImportOperation(project.getFullPath(), templateRoot, structureProvider,
                new IOverwriteQuery() {
            @Override
            public String queryOverwrite(String pathString) {
                return ALL;
            }
        }, structureProvider.getChildren(templateRoot));

        operation.setContext(Display.getDefault().getActiveShell());
        operation.run(null);
    } catch (Exception e) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage()));
    }

    return project;
}
 
开发者ID:yamcs,项目名称:yamcs-studio,代码行数:31,代码来源:DefaultYamcsStudioProject.java

示例10: MomlExportOperation

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
/**
 * Create an instance of this class. Use this constructor if you wish to recursively export a single resource
 */
public MomlExportOperation(IResource res, String destinationPath, IOverwriteQuery overwriteImplementor) {
  super();
  resource = res;
  path = new Path(destinationPath);
  overwriteCallback = overwriteImplementor;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:10,代码来源:MomlExportOperation.java

示例11: EnsembleFileSystemExportOperation

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
/**
 *  Create an instance of this class.  Use this constructor if you wish to
 *  recursively export a single resource
 */
public EnsembleFileSystemExportOperation(IResource res, String destinationPath,
        IOverwriteQuery overwriteImplementor) {
    super();
    resource = res;
    path = new Path(destinationPath);
    overwriteCallback = overwriteImplementor;
    cancelledOnce = false;
    exporter = getEnsembleFileSystemExporter();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:14,代码来源:EnsembleFileSystemExportOperation.java

示例12: NativeBinaryExportOperation

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
public NativeBinaryExportOperation(
		List<AbstractNativeBinaryBuildDelegate> delegates,
		File destination,
		IOverwriteQuery query) {
	this.delegates = delegates;
	this.overwriteQuery = query;
	this.destinationDir = destination;
}
 
开发者ID:eclipse,项目名称:thym,代码行数:9,代码来源:NativeBinaryExportOperation.java

示例13: execute

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
@Override
protected void execute(IProgressMonitor monitor) throws CoreException,
		InvocationTargetException, InterruptedException {
	SubMonitor sm = SubMonitor.convert(monitor);
	sm.setWorkRemaining(delegates.size()*10);
	for (AbstractNativeBinaryBuildDelegate delegate : delegates) {
		if(monitor.isCanceled()){ 
			break; 
		}
		delegate.setRelease(true);
		delegate.buildNow(sm.newChild(10));
		try {
			File buildArtifact = delegate.getBuildArtifact();
			File destinationFile = new File(destinationDir, buildArtifact.getName());
			if(destinationFile.exists()){
				String callback = overwriteQuery.queryOverwrite(destinationFile.toString());
				if(IOverwriteQuery.NO.equals(callback)){
					continue;
				}
				if(IOverwriteQuery.CANCEL.equals(callback)){
					break;
				}
			}
			File artifact = delegate.getBuildArtifact();
			if(artifact.isDirectory()){
				FileUtils.copyDirectoryToDirectory(artifact, destinationDir);
			}else{
				FileUtils.copyFileToDirectory(artifact, destinationDir);
			}
			sm.done();
		} catch (IOException e) {
			HybridCore.log(IStatus.ERROR, "Error on NativeBinaryExportOperation", e);
		}
	}
	monitor.done(); 
}
 
开发者ID:eclipse,项目名称:thym,代码行数:37,代码来源:NativeBinaryExportOperation.java

示例14: createExampleProject

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
public static IProject createExampleProject(IProject project, Example.Resource resource)
{
	try
	{

		if (resource.getType() == Type.ENVIRONMENT)
			CloudScaleProjectSupport.addProjectNature(project);

		ZipFile file = new ZipFile(resource.getArchive().getFile());
		ZipFileStructureProvider provider = new ZipFileStructureProvider(file);
		IPath containerPath = project.getFullPath();
		Object source = provider.getRoot();

		IOverwriteQuery query = new IOverwriteQuery()
		{
			@Override
			public String queryOverwrite(String path)
			{
				return IOverwriteQuery.ALL;
			};
		};
		ImportOperation operation = new ImportOperation(containerPath, source, provider, query);
		try
		{
			operation.run(null);
		} catch (Exception ex)
		{
			ex.printStackTrace();
		}
	} catch (Exception e)
	{
		e.printStackTrace();
		project = null;
	}

	return project;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:38,代码来源:ExampleProjectWizard.java

示例15: configureWebApp

import org.eclipse.ui.dialogs.IOverwriteQuery; //导入依赖的package包/类
/**
 * Configure the web application general descriptions
 * 
 * @param webApp
 * @param project
 * @param query
 * @param monitor
 * @throws CoreException
 */
public static void configureWebApp( WebAppBean webAppBean,
		IProject project, IOverwriteQuery query, IProgressMonitor monitor )
		throws CoreException
{
	// cancel progress
	if ( monitor.isCanceled( ) )
		return;

	if ( webAppBean == null || project == null )
	{
		return;
	}

	// create WebArtifact
	WebArtifactEdit webEdit = WebArtifactEdit
			.getWebArtifactEditForWrite( project );
	if ( webEdit == null )
		return;

	try
	{
		WebApp webapp = (WebApp) webEdit.getDeploymentDescriptorRoot( );
		webapp.setDescription( webAppBean.getDescription( ) );
		webEdit.saveIfNecessary( monitor );
	}
	finally
	{
		webEdit.dispose( );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:40,代码来源:WebArtifactUtil.java


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