private IHyperlinkDetector[] getHyperlinkDetectors() { IHyperlinkDetector[] allDetectors; IHyperlinkDetector[] configuredDetectors = configuration .getHyperlinkDetectors(viewer); if (configuredDetectors == null || configuredDetectors.length == 0) { allDetectors = new IHyperlinkDetector[0]; } else if (preferenceStore.getBoolean(URL_HYPERLINK_DETECTOR_KEY) || !preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED)) { allDetectors = configuredDetectors; } else { allDetectors = new IHyperlinkDetector[configuredDetectors.length + 1]; System.arraycopy(configuredDetectors, 0, allDetectors, 0, configuredDetectors.length); // URLHyperlinkDetector can only detect hyperlinks at the start of // the range. We need one that can detect all hyperlinks in a given // region. allDetectors[configuredDetectors.length] = new MultiURLHyperlinkDetector(); } return allDetectors; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { List<IHyperlinkDetector> detectors = new LinkedList<IHyperlinkDetector>(); IHyperlinkDetector[] inheritedDetectors = super.getHyperlinkDetectors(sourceViewer); if (inheritedDetectors != null) { for (final IHyperlinkDetector detector : inheritedDetectors) { detectors.add(new IHyperlinkDetector() { public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { try { return detector.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks); } catch (Throwable e) { // fail safe hyperlink detector - prevent others // from failing } return null; } }); } } detectors.add(detector); return detectors.toArray(new IHyperlinkDetector[detectors.size()]); }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null){ return null; } return new IHyperlinkDetector[] { new URLHyperlinkDetector() }; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) return null; return new IHyperlinkDetector[] { new URLHyperlinkDetector(), new BatchHyperlinkDetector(adaptable) }; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) return null; return new IHyperlinkDetector[] { new URLHyperlinkDetector(), new BashHyperlinkDetector(adaptable) }; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { IHyperlinkDetector[] hyperlinkDetectors = super.getHyperlinkDetectors(sourceViewer); List<IHyperlinkDetector> list = new ArrayList<>(Arrays.asList(hyperlinkDetectors)); list.add(new KspNameHyperLinkDetector()); list.add(new SqlTableHyperLinkDetector()); list.add(new CanonicalJavaNameHyperLinkDetector()); list.add(new DtoDefinitionPathHyperLinkDetector()); return list.toArray(new IHyperlinkDetector[] {}); }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { IHyperlinkDetector[] hyperlinkDetectors = super.getHyperlinkDetectors(sourceViewer); List<IHyperlinkDetector> list = new ArrayList<>(Arrays.asList(hyperlinkDetectors)); list.add(new FilePathHyperLinkDetector()); return list.toArray(new IHyperlinkDetector[] {}); }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null){ return null; } return new IHyperlinkDetector[] { new URLHyperlinkDetector(), new GradleHyperlinkDetector(adaptable) }; }
public Object execute(ExecutionEvent event) throws ExecutionException { TLAEditorAndPDFViewer editor = (TLAEditorAndPDFViewer) HandlerUtil.getActiveEditor(event); ISourceViewer internalSourceViewer = editor.getTLAEditor().getSourceViewer(); ITextSelection selection = (ITextSelection) editor.getTLAEditor().getSelectionProvider().getSelection(); IRegion region = new Region(selection.getOffset(), selection.getLength()); // get the detectors IHyperlinkDetector[] hyperlinkDetectors = editor.getTLAEditor().getSourceViewerConfiguration() .getHyperlinkDetectors(internalSourceViewer); if (hyperlinkDetectors != null) { for (int i = 0; i < hyperlinkDetectors.length; i++) { // detect IHyperlink[] hyperlinks = hyperlinkDetectors[i].detectHyperlinks(internalSourceViewer, region, false); if (hyperlinks != null && hyperlinks.length > 0) { // open IHyperlink hyperlink = hyperlinks[0]; hyperlink.open(); break; } } } return null; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { return new IHyperlinkDetector[] { new URLHyperlinkDetector(), // new SwaggerReferenceHyperlinkDetector(), // new PathParamHyperlinkDetector(), // new DefinitionHyperlinkDetector() }; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { return new IHyperlinkDetector[] { new URLHyperlinkDetector(), // new PathParamHyperlinkDetector(), // new DefinitionHyperlinkDetector(), // new OpenApi3ReferenceHyperlinkDetector(), // new SecuritySchemeHyperlinkDetector(), // new LinkOperationHyperlinkDetector(), // new LinkOperationRefHyperlinkDetector() }; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { List<IHyperlinkDetector> detectors = new LinkedList<IHyperlinkDetector>(); IHyperlinkDetector[] inheritedDetectors = getInheritedDetectors(sourceViewer); if (inheritedDetectors != null) { for (final IHyperlinkDetector detector : inheritedDetectors) { detectors.add(new IHyperlinkDetector() { public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { try { IHyperlink[] hyperlinks = detector.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks); hyperlinks = removeURLHyperlinksOfManagedResources(hyperlinks); return hyperlinks; } catch (Throwable e) { // fail safe hyperlink detector - prevent others // from failing } return null; } }); } } detectors.add(detector); return detectors.toArray(new IHyperlinkDetector[detectors.size()]); }
private IHyperlinkDetector[] getInheritedDetectors (ISourceViewer sourceViewer) { if (sourceViewer == null || fPreferenceStore == null) return super.getHyperlinkDetectors(sourceViewer); if (!fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED)) return null; return getRegisteredHyperlinkDetectors(sourceViewer); }
/** Custom IHyperlinkDetector. */ @Override public Class<? extends IHyperlinkDetector> bindIHyperlinkDetector() { return N4JSHyperlinkDetector.class; }
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) { return null; } return new IHyperlinkDetector[] { new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileHyperlinkDetector(resourceProvider.getResource()) }; }
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) { return null; } return new IHyperlinkDetector[] { new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionHyperlinkDetector(resourceProvider.getResource()) }; }
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) { return null; } return new IHyperlinkDetector[] { new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaHyperlinkDetector(resourceProvider.getResource()) }; }
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) { return null; } return new IHyperlinkDetector[] { new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueHyperlinkDetector(resourceProvider.getResource()) }; }
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) { return null; } return new IHyperlinkDetector[] { new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingHyperlinkDetector(resourceProvider.getResource()) }; }
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) { return null; } return new IHyperlinkDetector[] { new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsHyperlinkDetector(resourceProvider.getResource()) }; }
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { if (sourceViewer == null) { return null; } return new IHyperlinkDetector[] { new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestHyperlinkDetector(resourceProvider.getResource()) }; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { return new IHyperlinkDetector[]{new ImpexTypeHyperlinkDetector()}; }
private void resetHyperlinkDetectors() { IHyperlinkDetector[] detectors = configuration .getHyperlinkDetectors(this); int stateMask = configuration.getHyperlinkStateMask(this); setHyperlinkDetectors(detectors, stateMask); }
/** * Returns the hyperlink detectors which are to be used to detect * hyperlinks in the given source viewer. This implementation uses * {@link #internalGetHyperlinkDetectors(ISourceViewer)} to get the * hyperlink detectors. * <p> * Sets up the hyperlink detetctors such that they are active on both * {@link SWT#NONE} and on the configured modifier key combination if * the viewer is configured to open hyperlinks on direct click, i.e., if * {@link TextSourceViewerConfiguration#getHyperlinkStateMask(ISourceViewer) * getHyperlinkStateMask(ISourceViewer)} returns {@link SWT#NONE}. * </p> * * @param sourceViewer * the {@link ISourceViewer} to be configured by this * configuration * @return an array with {@link IHyperlinkDetector}s or {@code null} if * no hyperlink support should be installed */ @Override public final IHyperlinkDetector[] getHyperlinkDetectors( ISourceViewer sourceViewer) { IHyperlinkDetector[] detectors = internalGetHyperlinkDetectors( sourceViewer); if (detectors != null && detectors.length > 0 && getHyperlinkStateMask(sourceViewer) == SWT.NONE) { // Duplicate them all with a detector that is active on SWT.NONE int defaultMask = getConfiguredDefaultMask(); IHyperlinkDetector[] newDetectors = new IHyperlinkDetector[detectors.length * 2]; int j = 0; for (IHyperlinkDetector original : detectors) { if (original instanceof IHyperlinkDetectorExtension2) { int mask = ((IHyperlinkDetectorExtension2) original) .getStateMask(); if (mask == -1) { newDetectors[j++] = new FixedMaskHyperlinkDetector( original, defaultMask); if (defaultMask != SWT.NONE) { newDetectors[j++] = new NoMaskHyperlinkDetector( original); } } else { newDetectors[j++] = original; if (mask != SWT.NONE) { newDetectors[j++] = new NoMaskHyperlinkDetector( original); } } } else { newDetectors[j++] = original; } } IHyperlinkDetector[] result = new IHyperlinkDetector[j]; System.arraycopy(newDetectors, 0, result, 0, j); return result; } return detectors; }
protected InternalHyperlinkDetector(IHyperlinkDetector delegate) { this.delegate = delegate; }
protected FixedMaskHyperlinkDetector(IHyperlinkDetector delegate, int mask) { super(delegate); this.mask = mask; }
private NoMaskHyperlinkDetector(IHyperlinkDetector delegate) { // Private to allow instantiation only within this compilation unit super(delegate, SWT.NONE); }
/** * Add NCLEclipse Hyperlink Detector to Source Viewer Configuration */ public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { return new IHyperlinkDetector[] { new NCLEclipseHyperlinkDetector(sourceViewer), new URLHyperlinkDetector() }; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { return null; }
public Class<? extends IHyperlinkDetector> bindIHyperlinkDetector() { return DefaultHyperlinkDetector.class; }
public void setDetector(IHyperlinkDetector detector) { this.detector = detector; }
public IHyperlinkDetector getDetector() { return detector; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { return new IHyperlinkDetector[] { new URLHyperlinkDetector()}; }
@Override public Class<? extends IHyperlinkDetector> bindIHyperlinkDetector() { return GamlHyperlinkDetector.class; }
@Override public IHyperlinkDetector[] getHyperlinkDetectors(@Nullable ISourceViewer sourceViewer) { return new IHyperlinkDetector[] { new RustHyperlinkDetector(editor) }; }
public void setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors, int eventStateMask) { viewer.setHyperlinkDetectors(hyperlinkDetectors, eventStateMask); }