protected boolean rootDirectoryChanged() { String _rootDirectory = rootDirectory; rootDirectory = rootDirectoryCombo.getText().trim(); IPath p = new Path(rootDirectory); if(p.isRoot()) { setErrorMessage(Messages.MavenImportWizardPage_forbiddenImportFromRoot); return false; } setErrorMessage(null); return _rootDirectory == null || !_rootDirectory.equals(rootDirectory); }
/** * Returns the element data for the given element identifier. * The given element must be present in this tree. */ public synchronized Object getElementDataIgnoreCase(IPath key) { /* don't allow modification of the implicit root */ if (key.isRoot()) return null; DataTreeLookup lookup = lookupCacheIgnoreCase; // Grab it in case it's replaced concurrently. if (lookup == null || lookup.key != key) lookupCacheIgnoreCase = lookup = tree.lookupIgnoreCase(key); if (lookup.isPresent) return lookup.data; elementNotFound(key); return null; // can't get here }
/** * Returns the element data for the given element identifier. * The given element must be present in this tree. */ public synchronized Object getElementData(IPath key) { /* don't allow modification of the implicit root */ if (key.isRoot()) return null; DataTreeLookup lookup = lookupCache; // Grab it in case it's replaced concurrently. if (lookup == null || lookup.key != key) lookupCache = lookup = tree.lookup(key); if (lookup.isPresent) return lookup.data; elementNotFound(key); return null; // can't get here }
/** * Returns the element data for the given element identifier. * The given element must be present in this tree. */ public synchronized Object getElementDataIgnoreCase(IPath key) { /* don't allow modification of the implicit root */ if (key.isRoot()) return null; DataTreeLookup lookup = lookupCacheIgnoreCase; // Grab it in case it's replaced concurrently. if (lookup == null || lookup.key != key) lookupCacheIgnoreCase = lookup = tree.lookupIgnoreCase(key); if (lookup.isPresent) return lookup.data; elementNotFound(key); return null; // can't get here }
/** * Returns the element data for the given element identifier. * The given element must be present in this tree. */ public synchronized Object getElementDataIgnoreCase(IPath key) { /* don't allow modification of the implicit root */ if (key.isRoot()) return null; DataTreeLookup lookup = lookupCacheIgnoreCase; // Grab it in case it's replaced concurrently. if (lookup == null || lookup.key != key) lookupCacheIgnoreCase = lookup = tree.lookupIgnoreCase(key); if (lookup.isPresent) return lookup.data; elementNotFound(key); return null; // can't get here }
/** * Returns the element data for the given element identifier. * The given element must be present in this tree. */ public synchronized Object getElementData(IPath key) { /* don't allow modification of the implicit root */ if (key.isRoot()) return null; DataTreeLookup lookup = lookupCache; // Grab it in case it's replaced concurrently. if (lookup == null || lookup.key != key) lookupCache = lookup = tree.lookup(key); if (lookup.isPresent) return lookup.data; elementNotFound(key); return null; // can't get here }
/** * Returns the element data for the given element identifier. * The given element must be present in this tree. */ public synchronized Object getElementData(IPath key) { /* don't allow modification of the implicit root */ if (key.isRoot()) return null; DataTreeLookup lookup = lookupCache; // Grab it in case it's replaced concurrently. if (lookup == null || lookup.key != key) lookupCache = lookup = tree.lookup(key); if (lookup.isPresent) return lookup.data; elementNotFound(key); return null; // can't get here }
/** * Listen to resource change events concerning external annotations, that potentially affect a cached ClassFile. */ @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta != null && delta.getFullPath().isRoot() && this.tree.children != null) { for (IResourceDelta child : delta.getAffectedChildren()) { DirectoryNode directoryNode = this.tree.children.get(child.getFullPath()); if (directoryNode != null) traverseForDirectories(directoryNode, child); } } }
/** * Listen to resource change events concerning external annotations, that potentially affect a cached ClassFile. */ @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta != null && delta.getFullPath().isRoot() && this.tree.children != null) { for (IResourceDelta child : delta.getAffectedChildren()) { DirectoryNode directoryNode = this.tree.children.get(child.getFullPath()); if (directoryNode != null) traverseForDirectories(directoryNode, child); } } }
/** * Listen to resource change events concerning external annotations, that potentially affect a cached ClassFile. */ @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta != null && delta.getFullPath().isRoot() && this.tree.children != null) { for (IResourceDelta child : delta.getAffectedChildren()) { DirectoryNode directoryNode = this.tree.children.get(child.getFullPath()); if (directoryNode != null) traverseForDirectories(directoryNode, child); } } }
/** * Simplifies the given node, and answers its replacement. */ @Override AbstractDataTreeNode simplifyWithParent(IPath key, DeltaDataTree parent, IComparator comparer) { AbstractDataTreeNode[] simplifiedChildren = simplifyWithParent(children, key, parent, comparer); /* don't compare root nodes */ if (!key.isRoot() && comparer.compare(parent.getData(key), data) == 0) return new NoDataDeltaNode(name, simplifiedChildren); return new DataDeltaNode(name, data, simplifiedChildren); }
/** * Replaces the node at the specified key with the given node */ protected void replaceNode(IPath key, DataTreeNode node) { DataTreeNode found; if (key.isRoot()) { this.setRootNode(node); } else { found = this.findNodeAt(key.removeLastSegments(1)); found.replaceChild(key.lastSegment(), node); } }
/** * Simplifies the given node, and answers its replacement. */ @Override AbstractDataTreeNode simplifyWithParent(IPath key, DeltaDataTree parent, IComparator comparer) { AbstractDataTreeNode[] simplifiedChildren = simplifyWithParent(children, key, parent, comparer); /* don't compare root nodes */ if (!key.isRoot() && comparer.compare(parent.getData(key), data) == 0) return new NoDataDeltaNode(name, simplifiedChildren); return new DataDeltaNode(name, data, simplifiedChildren); }
/** * Replaces the node at the specified key with the given node */ protected void replaceNode(IPath key, DataTreeNode node) { DataTreeNode found; if (key.isRoot()) { this.setRootNode(node); } else { found = this.findNodeAt(key.removeLastSegments(1)); found.replaceChild(key.lastSegment(), node); } }
/** * Simplifies the given node, and answers its replacement. */ @Override AbstractDataTreeNode simplifyWithParent(IPath key, DeltaDataTree parent, IComparator comparer) { AbstractDataTreeNode[] simplifiedChildren = simplifyWithParent(children, key, parent, comparer); /* don't compare root nodes */ if (!key.isRoot() && comparer.compare(parent.getData(key), data) == 0) return new NoDataDeltaNode(name, simplifiedChildren); return new DataDeltaNode(name, data, simplifiedChildren); }
/** * Replaces the node at the specified key with the given node */ protected void replaceNode(IPath key, DataTreeNode node) { DataTreeNode found; if (key.isRoot()) { this.setRootNode(node); } else { found = this.findNodeAt(key.removeLastSegments(1)); found.replaceChild(key.lastSegment(), node); } }
/** * @see AbstractDataTree#createSubtree(IPath, AbstractDataTreeNode) */ @Override public void createSubtree(IPath key, AbstractDataTreeNode node) { if (isImmutable()) handleImmutableTree(); if (key.isRoot()) { setParent(null); setRootNode(node); } else { addChild(key.removeLastSegments(1), key.lastSegment(), node); } }
/** * @see AbstractDataTree#createSubtree(IPath, AbstractDataTreeNode) */ @Override public void createSubtree(IPath key, AbstractDataTreeNode node) { if (isImmutable()) handleImmutableTree(); if (key.isRoot()) { setParent(null); setRootNode(node); } else { addChild(key.removeLastSegments(1), key.lastSegment(), node); } }
/** * @see AbstractDataTree#createSubtree(IPath, AbstractDataTreeNode) */ @Override public void createSubtree(IPath key, AbstractDataTreeNode node) { if (isImmutable()) handleImmutableTree(); if (key.isRoot()) { setParent(null); setRootNode(node); } else { addChild(key.removeLastSegments(1), key.lastSegment(), node); } }
private IPath internalGetContextRoot(IPath path) { IFile baseResource = FileBuffers.getWorkspaceFileAtLocation(path); if (baseResource != null && baseResource.getProject().isAccessible()) { IProject project = baseResource.getProject(); ProjectDescription description = getInstance().createDescription(project); IPath rootPath = description.getLocalRoot(baseResource.getFullPath()); return rootPath; } // try to handle out-of-workspace paths IPath root = path.makeAbsolute(); while (root.segmentCount() > 0 && !root.isRoot()) root = root.removeLastSegments(1); if (root == null) root = path; return root; }