public String getRepositoryLocation() throws MalformedRepositoryLocationException { if (tree.getSelectionPath() != null) { Entry selectedEntry = (Entry) tree.getSelectionPath().getLastPathComponent(); RepositoryLocation selectedLocation = selectedEntry.getLocation(); if (selectedEntry instanceof Folder) { if (enforceValidRepositoryEntryName) { selectedLocation = new RepositoryLocation(selectedLocation, locationFieldRepositoryEntry.getText()); } else { selectedLocation = new RepositoryLocation(selectedLocation, locationField.getText()); } } if (RepositoryLocationChooser.this.resolveRelativeTo != null && resolveBox.isSelected()) { return selectedLocation.makeRelative(RepositoryLocationChooser.this.resolveRelativeTo); } else { return selectedLocation.getAbsoluteLocation(); } } else { if (enforceValidRepositoryEntryName) { return locationFieldRepositoryEntry.getText(); } else { return locationField.getText(); } } }
@Override public void apply() { RepositoryLocation absLoc; try { absLoc = operator.getParameterAsRepositoryLocation(key); final RepositoryLocation processLoc = operator.getProcess().getRepositoryLocation().parent(); if (processLoc == null) { SwingTools.showVerySimpleErrorMessage( "quickfix_failed", "Process is not stored in repository."); } else { String relative = absLoc.makeRelative(processLoc); operator.setParameter(key, relative); } } catch (UserError e) { // Should not happen. Parameter should be set, otherwise we would not have created this // prefix. SwingTools.showVerySimpleErrorMessage("quickfix_failed", e.toString()); } }