Java Code Examples for org.eclipse.jdt.core.IPackageFragmentRoot#getHandleIdentifier()

The following examples show how to use org.eclipse.jdt.core.IPackageFragmentRoot#getHandleIdentifier() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeletePackageFragmentRootChange.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
public DeletePackageFragmentRootChange(IPackageFragmentRoot root, boolean isExecuteChange,
		IPackageFragmentRootManipulationQuery updateClasspathQuery) {
	Assert.isNotNull(root);
	Assert.isTrue(! root.isExternal());
	fHandle= root.getHandleIdentifier();
	fUpdateClasspathQuery= updateClasspathQuery;

	if (isExecuteChange) {
		// don't check for read-only resources since we already
		// prompt the user via a dialog to confirm deletion of
		// read only resource. The change is currently not used
		// as
		setValidationMethod(VALIDATE_NOT_DIRTY);
	} else {
		setValidationMethod(VALIDATE_NOT_DIRTY | VALIDATE_NOT_READ_ONLY);
	}
}
 
Example 2
Source File: DeletePackageFragmentRootChange.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public DeletePackageFragmentRootChange(IPackageFragmentRoot root, boolean isExecuteChange,
		IPackageFragmentRootManipulationQuery updateClasspathQuery) {
	Assert.isNotNull(root);
	Assert.isTrue(! root.isExternal());
	fHandle= root.getHandleIdentifier();
	fUpdateClasspathQuery= updateClasspathQuery;

	if (isExecuteChange) {
		// don't check for read-only resources since we already
		// prompt the user via a dialog to confirm deletion of
		// read only resource. The change is currently not used
		// as
		setValidationMethod(VALIDATE_NOT_DIRTY);
	} else {
		setValidationMethod(VALIDATE_NOT_DIRTY | VALIDATE_NOT_READ_ONLY);
	}
}
 
Example 3
Source File: Storage2UriMapperJavaImpl.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void addRoot(IPackageFragmentRoot root) {
	if (root != null) {
		// Do not cache intermediate bridge objects 
		if ("JImageModuleFragmentBridge".equals(root.getClass().getSimpleName())) {
			return;
		}
		String handleIdentifier = root.getHandleIdentifier();
		Map<String, IPackageFragmentRoot> roots = associatedRoots;
		if (!root.equals(roots.get(handleIdentifier))) {
			Map<String,IPackageFragmentRoot> copy = newLinkedHashMap(roots);
			copy.put(handleIdentifier, root);
			associatedRoots = copy;
		}
	}
}
 
Example 4
Source File: PackageFragmentRootReorgChange.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
PackageFragmentRootReorgChange(IPackageFragmentRoot root, IContainer destination, INewNameQuery newNameQuery,
		IPackageFragmentRootManipulationQuery updateClasspathQuery) {
	Assert.isTrue(! root.isExternal());
	fRootHandle= root.getHandleIdentifier();
	fNewNameQuery= newNameQuery;
	fUpdateClasspathQuery= updateClasspathQuery;
	fDestination= destination;

	// we already ask for confirmation of move read only
	// resources. Furthermore we don't do a validate
	// edit since move source folders doesn't change
	// an content
	setValidationMethod(VALIDATE_DEFAULT);
}
 
Example 5
Source File: PackageReorgChange.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
PackageReorgChange(IPackageFragment pack, IPackageFragmentRoot dest, INewNameQuery nameQuery) {
	fPackageHandle= pack.getHandleIdentifier();
	fDestinationHandle= dest.getHandleIdentifier();
	fNameQuery= nameQuery;

	// it is enough to check the package only since package reorg changes
	// are not undoable. Don't check for read only here since
	// we already ask for user confirmation and moving a read
	// only package doesn't go thorugh validate edit (no
	// file content is modified).
	setValidationMethod(VALIDATE_DEFAULT);
}
 
Example 6
Source File: PackageFragmentRootReorgChange.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
PackageFragmentRootReorgChange(IPackageFragmentRoot root, IContainer destination, INewNameQuery newNameQuery,
		IPackageFragmentRootManipulationQuery updateClasspathQuery) {
	Assert.isTrue(! root.isExternal());
	fRootHandle= root.getHandleIdentifier();
	fNewNameQuery= newNameQuery;
	fUpdateClasspathQuery= updateClasspathQuery;
	fDestination= destination;

	// we already ask for confirmation of move read only
	// resources. Furthermore we don't do a validate
	// edit since move source folders doesn't change
	// an content
	setValidationMethod(VALIDATE_DEFAULT);
}
 
Example 7
Source File: PackageReorgChange.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
PackageReorgChange(IPackageFragment pack, IPackageFragmentRoot dest, INewNameQuery nameQuery) {
	fPackageHandle= pack.getHandleIdentifier();
	fDestinationHandle= dest.getHandleIdentifier();
	fNameQuery= nameQuery;

	// it is enough to check the package only since package reorg changes
	// are not undoable. Don't check for read only here since
	// we already ask for user confirmation and moving a read
	// only package doesn't go thorugh validate edit (no
	// file content is modified).
	setValidationMethod(VALIDATE_DEFAULT);
}
 
Example 8
Source File: BinaryRefactoringHistoryWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the transformed handle corresponding to the specified input
 * handle.
 *
 * @param project
 *            the project, or <code>null</code> for the workspace
 * @param handle
 *            the handle to transform
 * @return the transformed handle, or the original one if nothing needed to
 *         be transformed
 */
private String getTransformedHandle(final String project, final String handle) {
	if (fSourceFolder != null) {
		final IJavaElement target= JavaCore.create(fSourceFolder);
		if (target instanceof IPackageFragmentRoot) {
			final IPackageFragmentRoot extended= (IPackageFragmentRoot) target;
			String sourceIdentifier= null;
			final IJavaElement element= JavaRefactoringDescriptorUtil.handleToElement(project, handle, false);
			if (element != null) {
				final IPackageFragmentRoot root= (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
				if (root != null)
					sourceIdentifier= root.getHandleIdentifier();
				else {
					final IJavaProject javaProject= element.getJavaProject();
					if (javaProject != null)
						sourceIdentifier= javaProject.getHandleIdentifier();
				}
				if (sourceIdentifier != null) {
					final IJavaElement result= JavaCore.create(extended.getHandleIdentifier() + element.getHandleIdentifier().substring(sourceIdentifier.length()));
					if (result != null)
						return JavaRefactoringDescriptorUtil.elementToHandle(project, result);
				}
			}
		}
	}
	return handle;
}
 
Example 9
Source File: JavaProjectsStateHelper.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public String initHandle(URI uri) {
	IPackageFragmentRoot root = getPackageFragmentRoot(uri);
	if (root != null)
		return root.getHandleIdentifier();
	return null;
}