You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Few inputs on Console Hyperlinks that can be implemented in RITE
We can print hyperlinks for erroneous YAML/OWL/CSV files while performing Manifest Import. That way, the user can quickly use the hyperlink to explore the eroneous file. Example screenshot:
To achieve this, we can either use Eclipse consolePatternMatcherListeners extension point in plugin.xml or programmatically by adding an org.eclipse.ui.console.IPatternMatchListener instance programmatically to the RackConsole object
I have taken the latter approach, and here is an example
console.addPatternMatchListener(new IPatternMatchListener() {
@Override
public void connect(TextConsole console) {
// TODO Auto-generated method stub
}
@Override
public void disconnect() {
// TODO Auto-generated method stub
}
@Override
public void matchFound(PatternMatchEvent event) {
File file =
new File(
"/Users/223057479/ingestion_packages/turnstile-ingestion-package/manifest.yaml");
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IPath location = Path.fromOSString(file.getAbsolutePath());
IFile ifile = workspace.getRoot().getFileForLocation(location);
FileLink link = new FileLink(ifile, null, -1, -1, -1);
try {
console.addHyperlink(link, event.getOffset(), event.getLength());
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public String getPattern() {
// TODO Auto-generated method stub
return Pattern.compile("(ERROR.*yaml.*)|(ERROR.*csv.*)").pattern();
}
@Override
public int getCompilerFlags() {
// TODO Auto-generated method stub
return 0;
}
@Override
public String getLineQualifier() {
// TODO Auto-generated method stub
return null;
}
});
In the above code snippet, getPattern() is doing a regex pattern match on lines that start with "ERROR" and subsequently check if any YAML or CSV files are referenced in the message. The IPatternMatchListener registers to the RackConsole using connect() method and actively looks for a line in the console that can pattern match with the regex.
If a regex pattern match succeeds, like the one in the screenshot, the method matchFound(PatternMatchEvent event) is called, where we can add the Hyperlink to the RackConsole. The hyperlink also contains the file path and the editor to launch when the hyperlink is clicked.
Add hyperlinks to the csv files in the ingestion package, not to the actual source of truth (like the PDFs)
The hyperlinks will take people from the .yaml files to the files that are being referenced in the .yaml file
E.g.:
The text was updated successfully, but these errors were encountered: