當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。