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


Java ISourceManipulation类代码示例

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


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

示例1: DeleteSourceManipulationChange

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
public DeleteSourceManipulationChange(ISourceManipulation sm, boolean isExecuteChange) {
  Assert.isNotNull(sm);
  fHandle = getJavaElement(sm).getHandleIdentifier();

  if (isExecuteChange) {
    if (sm instanceof ICompilationUnit) {
      // don't check anything in this case. We have a warning dialog
      // already presented to the user that the file is dirty.
      setValidationMethod(VALIDATE_DEFAULT);
    } else {
      setValidationMethod(VALIDATE_NOT_DIRTY);
    }
  } else {
    setValidationMethod(VALIDATE_NOT_DIRTY | VALIDATE_NOT_READ_ONLY);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:DeleteSourceManipulationChange.java

示例2: DeleteSourceManipulationChange

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
public DeleteSourceManipulationChange(ISourceManipulation sm, boolean isExecuteChange) {
	Assert.isNotNull(sm);
	fHandle= getJavaElement(sm).getHandleIdentifier();

	if (isExecuteChange) {
		if (sm instanceof ICompilationUnit) {
			// don't check anything in this case. We have a warning dialog
			// already presented to the user that the file is dirty.
			setValidationMethod(VALIDATE_DEFAULT);
		} else {
			setValidationMethod(VALIDATE_NOT_DIRTY);
		}
	} else {
		setValidationMethod(VALIDATE_NOT_DIRTY | VALIDATE_NOT_READ_ONLY);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:DeleteSourceManipulationChange.java

示例3: tryDeletingAllJavaChildren

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
private static void tryDeletingAllJavaChildren(IPackageFragment pack) throws CoreException {
  IJavaElement[] kids = pack.getChildren();
  for (int i = 0; i < kids.length; i++) {
    if (kids[i] instanceof ISourceManipulation) {
      if (kids[i].exists() && !kids[i].isReadOnly()) JavaProjectHelper.delete(kids[i]);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:RefactoringTest.java

示例4: createSourceManipulationDeleteChange

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
private static Change createSourceManipulationDeleteChange(ISourceManipulation element) {
  // XXX workaround for bug 31384, in case of linked ISourceManipulation delete the resource
  if (element instanceof ICompilationUnit || element instanceof IPackageFragment) {
    IResource resource;
    if (element instanceof ICompilationUnit)
      resource = ReorgUtils.getResource((ICompilationUnit) element);
    else resource = ((IPackageFragment) element).getResource();
    if (resource != null && resource.isLinked()) return createDeleteChange(resource);
  }
  return new DeleteSourceManipulationChange(element, true);
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:DeleteChangeCreator.java

示例5: doDelete

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
@Override
protected Change doDelete(IProgressMonitor pm) throws CoreException {
  ISourceManipulation element = getSourceManipulation();
  // we have to save dirty compilation units before deleting them. Otherwise
  // we will end up showing ghost compilation units in the package explorer
  // since the primary working copy still exists.
  if (element instanceof ICompilationUnit) {
    pm.beginTask("", 2); // $NON-NLS-1$
    ICompilationUnit unit = (ICompilationUnit) element;
    saveCUnitIfNeeded(unit, new SubProgressMonitor(pm, 1));

    IResource resource = unit.getResource();
    ResourceDescription resourceDescription = ResourceDescription.fromResource(resource);
    element.delete(false, new SubProgressMonitor(pm, 1));
    resourceDescription.recordStateFromHistory(resource, new SubProgressMonitor(pm, 1));
    return new UndoDeleteResourceChange(resourceDescription);

  } else if (element instanceof IPackageFragment) {
    ICompilationUnit[] units = ((IPackageFragment) element).getCompilationUnits();
    pm.beginTask("", units.length + 1); // $NON-NLS-1$
    for (int i = 0; i < units.length; i++) {
      // fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=66835
      saveCUnitIfNeeded(units[i], new SubProgressMonitor(pm, 1));
    }
    element.delete(false, new SubProgressMonitor(pm, 1));
    return new NullChange(); // caveat: real undo implemented by UndoablePackageDeleteChange

  } else {
    element.delete(false, pm);
    return null; // should not happen
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:DeleteSourceManipulationChange.java

示例6: createSourceManipulationDeleteChange

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
private static Change createSourceManipulationDeleteChange(ISourceManipulation element) {
	//XXX workaround for bug 31384, in case of linked ISourceManipulation delete the resource
	if (element instanceof ICompilationUnit || element instanceof IPackageFragment){
		IResource resource;
		if (element instanceof ICompilationUnit)
			resource= ReorgUtils.getResource((ICompilationUnit)element);
		else
			resource= ((IPackageFragment)element).getResource();
		if (resource != null && resource.isLinked())
			return createDeleteChange(resource);
	}
	return new DeleteSourceManipulationChange(element, true);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:DeleteChangeCreator.java

示例7: doDelete

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
@Override
protected Change doDelete(IProgressMonitor pm) throws CoreException {
	ISourceManipulation element= getSourceManipulation();
	// we have to save dirty compilation units before deleting them. Otherwise
	// we will end up showing ghost compilation units in the package explorer
	// since the primary working copy still exists.
	if (element instanceof ICompilationUnit) {
		pm.beginTask("", 2); //$NON-NLS-1$
		ICompilationUnit unit= (ICompilationUnit)element;
		saveCUnitIfNeeded(unit, new SubProgressMonitor(pm, 1));

		IResource resource= unit.getResource();
		ResourceDescription resourceDescription = ResourceDescription.fromResource(resource);
		element.delete(false, new SubProgressMonitor(pm, 1));
		resourceDescription.recordStateFromHistory(resource, new SubProgressMonitor(pm, 1));
		return new UndoDeleteResourceChange(resourceDescription);

	} else if (element instanceof IPackageFragment) {
		ICompilationUnit[] units= ((IPackageFragment)element).getCompilationUnits();
		pm.beginTask("", units.length + 1); //$NON-NLS-1$
		for (int i = 0; i < units.length; i++) {
			// fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=66835
			saveCUnitIfNeeded(units[i], new SubProgressMonitor(pm, 1));
		}
		element.delete(false, new SubProgressMonitor(pm, 1));
		return new NullChange(); // caveat: real undo implemented by UndoablePackageDeleteChange

	} else {
		element.delete(false, pm);
		return null; //should not happen
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:DeleteSourceManipulationChange.java

示例8: getSourceManipulation

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
private ISourceManipulation getSourceManipulation() {
  return (ISourceManipulation) getModifiedElement();
}
 
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:DeleteSourceManipulationChange.java

示例9: getJavaElement

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
private static IJavaElement getJavaElement(ISourceManipulation sm) {
  // all known ISourceManipulations are IJavaElements
  return (IJavaElement) sm;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:DeleteSourceManipulationChange.java

示例10: getSourceManipulation

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
private ISourceManipulation getSourceManipulation() {
	return (ISourceManipulation) getModifiedElement();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:DeleteSourceManipulationChange.java

示例11: getJavaElement

import org.eclipse.jdt.core.ISourceManipulation; //导入依赖的package包/类
private static IJavaElement getJavaElement(ISourceManipulation sm) {
	//all known ISourceManipulations are IJavaElements
	return (IJavaElement)sm;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:DeleteSourceManipulationChange.java


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