@Nullable @Override public String apply(@Nullable Resource input) { checkNotNull(input); return input.getName(); } };
@Override public SVGResource getIcon(Resource resource) { return "Dockerfile".equals(resource.getName()) ? icons.dockerfile() : null; }
@Override public String getName() { return getData().getName(); }
@Nullable @Override public String apply(@Nullable Resource input) { checkNotNull(input); if (input.isFile()) { return input.asFile().getNameWithoutExtension(); } return input.getName(); } };
private String generateWarningMessage(Resource[] resources) { if (resources.length == 1) { String name = resources[0].getName(); String type = getDisplayType(resources[0]);
/** {@inheritDoc} */ @Override public void intercept(Resource resource) { if (!Boolean.valueOf(preferencesManager.getValue(PREF_SHOW_ARTIFACT_ID))) { return; } if (resource.isProject() && ((Project) resource).isTypeOf(MAVEN_ID)) { final String artifact = ((Project) resource).getAttribute(ARTIFACT_ID); if (!isNullOrEmpty(artifact) && !artifact.equals(resource.getName())) { resource.addMarker(new PresentableTextMarker(resource.getName() + " [" + artifact + "]")); } } } }
if (container[i].getName().equals(path.lastSegment())) { index = i; break;
protected void paste(Path destination) { if (resources == null || resources.length == 0) { Log.debug(getClass(), "Resources to process was not found"); return; } final Resource[] resourcesToProcess = copyOf(resources, resources.length); final Path lastCopiedResource = destination.append(resourcesToProcess[resourcesToProcess.length - 1].getName()); pasteSuccessively(promises.resolve(null), resourcesToProcess, 0, destination) .then( ignored -> { eventBus.fireEvent(new RevealResourceEvent(lastCopiedResource)); }); }
private Promise<Void> pasteSuccessively( Promise<Void> promise, Resource[] resources, int position, final Path destination) { if (position == resources.length) { return promise; } final Resource resource = resources[position]; final Promise<Void> derivedPromise; if (move) { derivedPromise = promise.thenPromise( ignored -> moveResource(resource, destination.append(resource.getName()))); } else { derivedPromise = promise.thenPromise( ignored -> copyResource(resource, destination.append(resource.getName()))); } return pasteSuccessively(derivedPromise, resources, ++position, destination); }
public void showDialog() { Resource[] resources = appContext.getResources(); checkState(resources != null && resources.length > 0); if (resources.length == 1) { Resource resource = appContext.getResource(); if (resource instanceof Container) { view.setMessage(constant.addToIndexFolder(resource.getName())); } else { view.setMessage(constant.addToIndexFile(resource.getName())); } } else { view.setMessage(constant.addToIndexMultiSelect()); } view.setUpdated(false); view.showDialog(); }
final String name = endPoint.getName(); path = path.removeLastSegments(1).append(name.substring(0, name.length() - ext.length() - 1));
/** {@inheritDoc} */ @Override public void intercept(Resource resource) { if (resource.isFile() && POM_XML.equals(resource.getName())) { Project project = resource.getProject(); if (project != null && project.isTypeOf(MAVEN_ID) && resource.getParent().getLocation().equals(project.getLocation())) { String artifact = project.getAttribute(ARTIFACT_ID); if (!isNullOrEmpty(artifact) && !UNKNOWN_VALUE.equals(artifact)) { resource.addMarker(new PresentableTextMarker(artifact)); } } } } }
@Override public void makeCall(AsyncCallback<Void> callback) { String warningMessage = generateWarningMessage(resources); boolean anyDirectories = false; String directoryName = null; for (Resource resource : resources) { if (resource instanceof Folder) { anyDirectories = true; directoryName = resource.getName(); break; } } if (anyDirectories) { warningMessage += resources.length == 1 ? localization.deleteAllFilesAndSubdirectories(directoryName) : localization.deleteFilesAndSubdirectoriesInTheSelectedDirectory(); } dialogFactory .createConfirmDialog( localization.deleteDialogTitle(), warningMessage, onConfirm(resources, callback), onCancel(callback)) .show(); } });
/** {@inheritDoc} */ @Override public void show(RefactorInfo refactorInfo) { MoveType moveType = refactorInfo.getMoveType(); RefactoredItemType refactoredItemType = refactorInfo.getRefactoredItemType(); treePanelToHide.setVisible(REFACTOR_MENU.equals(moveType)); patternsPanelToHide.setVisible(COMPILATION_UNIT.equals(refactoredItemType)); Resource[] selectedItems = refactorInfo.getResources(); int selectionSize = selectedItems.length; boolean isMultiSelection = selectionSize > 1; classNameUR.setText( isMultiSelection ? locale.multiSelectionReferences(selectionSize) : selectedItems[0].getName()); className.setText( isMultiSelection ? locale.multiSelectionDestination(selectionSize) : selectedItems[0].getName()); show(); }
@Override public void actionPerformed(ActionEvent event) { Resource folder = getSelectedItem(); if (folder == null) { return; } Path location = folder.getLocation(); if (location == null) { return; } MutableProjectConfig mutableProjectConfig = new MutableProjectConfig(); mutableProjectConfig.setPath(location.toString()); mutableProjectConfig.setName(folder.getName()); projectConfigWizard.show(mutableProjectConfig); } }
public void showDialog(Project project) { Resource[] resources = appContext.getResources(); checkState(resources != null && resources.length > 0); this.project = project; if (resources.length == 1) { Resource resource = appContext.getResource(); String selectedItemName = resource.getName(); if (resource instanceof Container) { view.setMessage(constant.removeFromIndexFolder(selectedItemName)); } else { view.setMessage(constant.removeFromIndexFile(selectedItemName)); } } else { view.setMessage(constant.removeFromIndexAll()); } view.setRemoved(false); view.showDialog(); }
@Override public void updateInPerspective(@NotNull ActionEvent event) { if (!(activePart instanceof ProjectExplorerPresenter)) { event.getPresentation().setEnabledAndVisible(false); return; } event.getPresentation().setText("Refresh"); event.getPresentation().setVisible(true); final Resource[] resources = appContext.getResources(); if (resources == null || resources.length != 1) { event.getPresentation().setEnabled(false); return; } final Resource resource = resources[0]; if (resource instanceof Container) { event.getPresentation().setText("Refresh '" + resource.getName() + "'"); } else { final Container parent = resource.getParent(); if (parent != null) { event.getPresentation().setText("Refresh '" + parent.getName() + "'"); } else { event.getPresentation().setEnabled(false); return; } } event.getPresentation().setEnabled(true); }