@Override public boolean supportGoInto() { return getData() instanceof Container; }
@Override public int compare(Node o1, Node o2) { if (o1 instanceof ResourceNode && o2 instanceof ResourceNode) { return ((ResourceNode) o1).compareTo((ResourceNode) o2); } return 0; } },
protected Node createNode(Resource resource) { checkArgument(resource != null, "Not a resource"); switch (resource.getResourceType()) { case PROJECT: case FOLDER: return nodeFactory.newContainerNode((Container) resource, getSettings()); case FILE: return nodeFactory.newFileNode((File) resource, getSettings()); default: throw new IllegalArgumentException("Resource type was not recognized"); } } }
/** {@inheritDoc} */ @Override public void actionPerformed() { editorAgent.openEditor(getData()); } }
@Override public final NodePresentation getPresentation(boolean update) { if (nodePresentation == null) { nodePresentation = new NodePresentation(); } // need to force update presentation to correct display node in project explorer after restart // workspace details https://github.com/eclipse/che/issues/6314 // problem reproduce randomly updatePresentation(nodePresentation); return nodePresentation; }
@Override public int compareTo(ResourceNode o) { if (o instanceof PackageNode) { return getDisplayPackage().compareTo(((PackageNode) o).getDisplayPackage()); } return super.compareTo(o); } }
/** * Set recent file list. * * @param recentFiles recent file list */ public void setRecentFiles(List<File> recentFiles) { final List<FileNode> nodes = newArrayListWithCapacity(recentFiles.size()); for (File recentFile : recentFiles) { nodes.add(nodeFactory.newFileNode(recentFile, settingsProvider.getSettings())); } view.setRecentFiles(nodes); }
/** {@inheritDoc} */ @Override public void updatePresentation(@NotNull NodePresentation presentation) { super.updatePresentation(presentation); presentation.setPresentableText(getDisplayPackage()); presentation.setPresentableIcon(javaResources.packageItem()); }
@Nullable @Override public Resource apply(@Nullable Node input) { checkNotNull(input); checkState(input instanceof ResourceNode); return ((ResourceNode) input).getData(); } };
@Nullable @Override public Resource apply(@Nullable Node input) { checkNotNull(input); checkState(input instanceof ResourceNode); return ((ResourceNode) input).getData(); } };
@Nullable @Override public Resource apply(@Nullable Node input) { checkNotNull(input); checkState(input instanceof ResourceNode); return ((ResourceNode) input).getData(); } };
@Nullable @Override public Resource apply(@Nullable Node input) { checkNotNull(input); checkState(input instanceof ResourceNode); return ((ResourceNode) input).getData(); } };
@Nullable @Override public Resource apply(@Nullable Node input) { checkNotNull(input); checkState(input instanceof ResourceNode); return ((ResourceNode) input).getData(); } };
@Override public String getName() { return getData().getName(); }
@Override public boolean isLeaf() { return getData().getResourceType() == Resource.FILE; }
private int getClassIndex(Node node) { if (node instanceof ResourceNode && (((ResourceNode) node).getData().getResourceType() == FOLDER || ((ResourceNode) node).getData().getResourceType() == PROJECT)) { return 1; } if (node instanceof ResourceNode && ((ResourceNode) node).getData().getResourceType() == FILE) { return 2; } if (node instanceof SyntheticNode<?>) { return 3; } return 0; }
protected boolean isSourceOrPackage(ResourceNode node) { return node.getData().getParentWithMarker(SourceFolderMarker.ID).isPresent(); }
private boolean isNodeServesLocation(Node node, Path location) { return node instanceof ResourceNode && ((ResourceNode) node).getData().getLocation().equals(location); }
@Override public void onMarkerChanged(MarkerChangedEvent event) { if (event.getMarker().getType().equals(CutResourceMarker.ID) && getData().equals(event.getResource())) { resourceIsCut = event.getStatus() != Marker.REMOVED; } } });