Skip to content

Commit

Permalink
[ui] Add label provider for hyper links.
Browse files Browse the repository at this point in the history
see #608

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Mar 24, 2017
1 parent 9ec8d92 commit 2edf18e
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 19 deletions.
2 changes: 1 addition & 1 deletion eclipse-sarl/features/io.sarl.compiler/feature.xml
Expand Up @@ -261,7 +261,6 @@
<import plugin="org.eclipse.emf.ecore.xmi" version="2.12.0" match="compatible"/>
<import plugin="org.eclipse.emf.ecore" version="2.10.2" match="greaterOrEqual"/>
<import plugin="org.eclipse.emf.common" version="2.10.1" match="greaterOrEqual"/>
<import plugin="org.antlr.runtime" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtend.lib"/>
<import plugin="org.eclipse.ui.editors" version="3.6.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide" version="3.6.0" match="greaterOrEqual"/>
Expand All @@ -272,6 +271,7 @@
<import plugin="org.eclipse.jdt.debug" version="3.6.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.expressions" version="3.4.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext.xbase.ide"/>
<import plugin="org.antlr.runtime" version="3.2.0" match="greaterOrEqual"/>
</requires>

<plugin
Expand Down
6 changes: 4 additions & 2 deletions eclipse-sarl/plugins/io.sarl.core/build.properties
@@ -1,6 +1,8 @@
source.. = src,\
src-gen
bin.includes = META-INF/,\
.,\
OSGI-INF/
OSGI-INF/,\
.,
bin.excludes = **/*.java._trace,\
**/*.sarl
jre.compilation.profile = JavaSE-1.8
3 changes: 3 additions & 0 deletions eclipse-sarl/plugins/io.sarl.core/pom.xml
Expand Up @@ -68,10 +68,13 @@
<languages>
<language>
<setup>io.sarl.lang.SARLStandaloneSetup</setup>
<javaSupport>true</javaSupport>
<outputConfigurations>
<outputConfiguration>
<createOutputDirectory>true</createOutputDirectory>
<outputDirectory>src-gen/</outputDirectory>
<cleanUpDerivedResources>true</cleanUpDerivedResources>
<installDslAsPrimarySource>true</installDslAsPrimarySource>
</outputConfiguration>
</outputConfigurations>
</language>
Expand Down
14 changes: 7 additions & 7 deletions eclipse-sarl/plugins/io.sarl.lang.mwe2/GenerateSARL2.mwe2
Expand Up @@ -557,12 +557,6 @@ Workflow {
bind = "org.eclipse.ui.views.contentoutline.IContentOutlinePage"
to = "io.sarl.lang.ui.outline.SARLOutlinePage"
}
ui = {
bind = "org.eclipse.jface.viewers.ILabelProvider"
annotatedWith = "org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkLabelProvider"
to = "org.eclipse.xtend.ide.hyperlinking.HyperLinkingLabelProvider"
functionName = "configureHyperlinkLabelProvider"
}
ui = {
bind = "org.eclipse.xtext.ui.editor.outline.actions.IOutlineContribution"
annotatedWithName = "SARLFieldOutlineFilter"
Expand Down Expand Up @@ -674,6 +668,12 @@ Workflow {
bind = "org.eclipse.xtext.xbase.validation.UIStrings"
to = "io.sarl.lang.ui.labeling.SARLUIStrings"
}
ui = {
bind = "org.eclipse.jface.viewers.ILabelProvider"
annotatedWith = "org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkLabelProvider"
to = "io.sarl.lang.ui.hyperlinking.SARLHyperLinkingLabelProvider"
functionName = "configureHyperlinkLabelProvider"
}

both = {
bind = "org.eclipse.xtext.generator.IContextualOutputConfigurationProvider"
Expand Down Expand Up @@ -836,7 +836,7 @@ Workflow {
to = "io.sarl.lang.parser.SARLSyntaxErrorMessageProvider"
singleton = true
}

ui = {
bind = "org.eclipse.xtext.ui.editor.autoedit.AbstractEditStrategyProvider"
to = "org.eclipse.xtend.ide.autoedit.AutoEditStrategyProvider"
Expand Down
3 changes: 2 additions & 1 deletion eclipse-sarl/plugins/io.sarl.lang.ui/META-INF/MANIFEST.MF
Expand Up @@ -22,7 +22,7 @@ Require-Bundle: io.sarl.lang;bundle-version="0.6.0";visibility:=reexport,
org.eclipse.ui;bundle-version="3.108.1",
org.eclipse.ui.editors;bundle-version="3.10.1",
org.arakhne.afc.core.references;bundle-version="14.0.0",
org.antlr.runtime
org.antlr.runtime;bundle-version="3.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Activator: io.sarl.lang.ui.internal.LangActivator
Export-Package: io.sarl.lang.bugfixes,
Expand All @@ -35,6 +35,7 @@ Export-Package: io.sarl.lang.bugfixes,
io.sarl.lang.ui.editor,
io.sarl.lang.ui.highlighting,
io.sarl.lang.ui.hover,
io.sarl.lang.ui.hyperlinking,
io.sarl.lang.ui.images;x-friends:="io.sarl.lang.ui.tests",
io.sarl.lang.ui.internal,
io.sarl.lang.ui.labeling;x-friends:="io.sarl.lang.ui.tests",
Expand Down
Expand Up @@ -44,6 +44,7 @@
import io.sarl.lang.ui.hover.SARLHoverSerializer;
import io.sarl.lang.ui.hover.SARLHoverSignatureProvider;
import io.sarl.lang.ui.hover.SARLHoverUIStrings;
import io.sarl.lang.ui.hyperlinking.SARLHyperLinkingLabelProvider;
import io.sarl.lang.ui.images.IQualifiedNameImageProvider;
import io.sarl.lang.ui.images.QualifiedPluginImageHelper;
import io.sarl.lang.ui.labeling.SARLDescriptionLabelProvider;
Expand Down Expand Up @@ -92,7 +93,6 @@
import org.eclipse.xtend.ide.hover.XtendAnnotationHover;
import org.eclipse.xtend.ide.hover.XtendHoverProvider;
import org.eclipse.xtend.ide.hover.XtendHoverSerializer;
import org.eclipse.xtend.ide.hyperlinking.HyperLinkingLabelProvider;
import org.eclipse.xtend.ide.hyperlinking.XtendHyperlinkHelper;
import org.eclipse.xtend.ide.macro.EclipseFileSystemSupportImpl;
import org.eclipse.xtend.ide.refactoring.XtendRenameStrategy;
Expand Down Expand Up @@ -548,13 +548,13 @@ public Class<? extends AbstractValidatorConfigurationBlock> bindAbstractValidato
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings provided by SARL API]
public void configureHyperlinkLabelProvider(Binder binder) {
binder.bind(ILabelProvider.class).annotatedWith(HyperlinkLabelProvider.class).to(HyperLinkingLabelProvider.class);
public Class<? extends HoverUiStrings> bindHoverUiStrings() {
return SARLHoverUIStrings.class;
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings provided by SARL API]
public Class<? extends HoverUiStrings> bindHoverUiStrings() {
return SARLHoverUIStrings.class;
public void configureHyperlinkLabelProvider(Binder binder) {
binder.bind(ILabelProvider.class).annotatedWith(HyperlinkLabelProvider.class).to(SARLHyperLinkingLabelProvider.class);
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings provided by SARL API]
Expand Down
@@ -0,0 +1,43 @@
/*
* $Id$
*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2017 the original authors or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.sarl.lang.ui.hyperlinking;

import org.eclipse.osgi.util.NLS;

/** Localized Messages.
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@SuppressWarnings("all")
public class Messages extends NLS {
private static final String BUNDLE_NAME = "io.sarl.lang.ui.hyperlinking.messages"; //$NON-NLS-1$
public static String SARLHyperLinkingLabelProvider_0;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}

private Messages() {
}
}
@@ -0,0 +1,61 @@
/*
* $Id$
*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2017 the original authors or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.sarl.lang.ui.hyperlinking;

import java.text.MessageFormat;

import javax.inject.Inject;

import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;

import io.sarl.lang.ui.labeling.SARLLabelProvider;

/**
* Label provider for hyperlinks.
*
* @author $Author: srodriguez$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @since 0.5
*/
public class SARLHyperLinkingLabelProvider extends SARLLabelProvider {

/** Constructor.
*
* @param delegate the delegate.
*/
@Inject
public SARLHyperLinkingLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}

@Override
public String getText(Object element) {
final String result = super.getText(element);
if (result != null) {
return MessageFormat.format(Messages.SARLHyperLinkingLabelProvider_0, result);
}
return null;
}

}
@@ -0,0 +1 @@
SARLHyperLinkingLabelProvider_0=Open Declaration - {0}
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-beamer-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-beamer-listing}[2017/03/22]
\ProvidesPackage{sarl-beamer-listing}[2017/03/23]
\RequirePackage{algpseudocode}
\RequirePackage{listings}
\RequirePackage{xspace}
Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-colorized-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-colorized-listing}[2017/03/22]
\ProvidesPackage{sarl-colorized-listing}[2017/03/23]
\RequirePackage{algpseudocode}
\RequirePackage{listings}
\RequirePackage{xspace}
Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-listing}[2017/03/22]
\ProvidesPackage{sarl-listing}[2017/03/23]
\RequirePackage{algpseudocode}
\RequirePackage{listings}
\RequirePackage{xspace}
Expand Down

0 comments on commit 2edf18e

Please sign in to comment.