diff --git a/ummisco.gama.ui.navigator/plugin.xml b/ummisco.gama.ui.navigator/plugin.xml
index 166bc3ee56..96bb4fabbb 100644
--- a/ummisco.gama.ui.navigator/plugin.xml
+++ b/ummisco.gama.ui.navigator/plugin.xml
@@ -57,6 +57,9 @@
+
+
diff --git a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tag.java b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tag.java
index e03c787166..a194fff328 100644
--- a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tag.java
+++ b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tag.java
@@ -1,12 +1,12 @@
/*******************************************************************************************************
*
- * Tag.java, in ummisco.gama.ui.navigator, is part of the source code of the
- * GAMA modeling and simulation platform (v.1.8.2).
+ * Tag.java, in ummisco.gama.ui.navigator, is part of the source code of the GAMA modeling and simulation platform
+ * (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
- *
+ *
********************************************************************************************************/
package ummisco.gama.ui.navigator.contents;
@@ -22,12 +22,20 @@
*/
public class Tag extends VirtualContent {
+ /** The search. */
+ private final boolean search;
+
+ /** The suffix. */
+ private final String suffix;
+
/**
* @param root
* @param name
*/
- public Tag(final Tags root, final String wrapped) {
+ public Tag(final Tags root, final String wrapped, final String suffix, final boolean search) {
super(root, wrapped);
+ this.search = search;
+ this.suffix = suffix;
}
/**
@@ -40,11 +48,6 @@ public boolean hasChildren() {
return false;
}
- // @Override
- // public Font getFont() {
- // return GamaFonts.getNavigLinkFont(); // by default
- // }
-
/**
* Method getNavigatorChildren()
*
@@ -61,16 +64,6 @@ public boolean hasChildren() {
@Override
public Image getImage() { return null; }
- /**
- * Method getColor()
- *
- * @see ummisco.gama.ui.navigator.contents.VirtualContent#getColor()
- */
- // @Override
- // public Color getColor() {
- // return ThemeHelper.isDark() ? GamaColors.system(SWT.COLOR_WHITE) : GamaColors.system(SWT.COLOR_BLACK);
- // }
-
@Override
public boolean handleDoubleClick() {
return true;
@@ -83,7 +76,7 @@ public int findMaxProblemSeverity() {
@Override
public void getSuffix(final StringBuilder sb) {
- // sb.append(suffix);
+ if (suffix != null) { sb.append(suffix); }
}
@Override
diff --git a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tags.java b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tags.java
index 473da4237c..5e58c6f4a4 100644
--- a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tags.java
+++ b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/Tags.java
@@ -1,20 +1,21 @@
/*******************************************************************************************************
*
- * Tags.java, in ummisco.gama.ui.navigator, is part of the source code of the
- * GAMA modeling and simulation platform (v.1.8.2).
+ * Tags.java, in ummisco.gama.ui.navigator, is part of the source code of the GAMA modeling and simulation platform
+ * (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
- *
+ *
********************************************************************************************************/
package ummisco.gama.ui.navigator.contents;
-import java.util.Collection;
+import java.util.Map;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import one.util.streamex.StreamEx;
import ummisco.gama.ui.resources.GamaColors.GamaUIColor;
import ummisco.gama.ui.resources.GamaIcons;
import ummisco.gama.ui.resources.IGamaColors;
@@ -29,15 +30,20 @@
public class Tags extends VirtualContent {
/** The tags. */
- final Collection tags;
+ final Map tags;
+
+ /** The search. */
+ final boolean search;
/**
* @param root
* @param name
*/
- public Tags(final WrappedFile root, final Collection object, final String name) {
+ public Tags(final WrappedFile root, final Map object, final String name,
+ final boolean doubleClickForSearching) {
super(root, name);
tags = object;
+ search = doubleClickForSearching;
}
/**
@@ -50,14 +56,6 @@ public boolean hasChildren() {
return !tags.isEmpty();
}
- // @Override
- // public Font getFont() {
- // return GamaFonts.getSmallFont(); // by default
- // }
-
- @Override
- public WrappedFile getParent() { return super.getParent(); }
-
/**
* Method getNavigatorChildren()
*
@@ -66,7 +64,7 @@ public boolean hasChildren() {
@Override
public Object[] getNavigatorChildren() {
if (tags.isEmpty()) return EMPTY;
- return tags.stream().map(each -> new Tag(this, each)).toArray();
+ return StreamEx.ofKeys(tags).map(each -> new Tag(this, each, tags.get(each), search)).toArray();
}
/**
diff --git a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedFile.java b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedFile.java
index 9e11871625..badf4417c0 100644
--- a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedFile.java
+++ b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedFile.java
@@ -1,12 +1,12 @@
/*******************************************************************************************************
*
- * WrappedFile.java, in ummisco.gama.ui.navigator, is part of the source code of the
- * GAMA modeling and simulation platform (v.1.8.2).
+ * WrappedFile.java, in ummisco.gama.ui.navigator, is part of the source code of the GAMA modeling and simulation
+ * platform (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
- *
+ *
********************************************************************************************************/
package ummisco.gama.ui.navigator.contents;
@@ -26,6 +26,7 @@
import org.eclipse.swt.graphics.Image;
import msi.gama.runtime.GAMA;
+import msi.gama.util.file.GamaShapeFile.ShapeInfo;
import msi.gama.util.file.IGamaFileMetaData;
import msi.gaml.compilation.kernel.GamaBundleLoader;
import ummisco.gama.ui.navigator.NavigatorContentProvider;
@@ -39,21 +40,23 @@ public class WrappedFile extends WrappedResource, IFile> {
/** The file parent. */
WrappedFile fileParent;
-
+
/** The is shape file. */
boolean isShapeFile;
-
+
/** The is shape file support. */
boolean isShapeFileSupport;
-
+
/** The image. */
Image image;
/**
* Instantiates a new wrapped file.
*
- * @param root the root
- * @param wrapped the wrapped
+ * @param root
+ * the root
+ * @param wrapped
+ * the wrapped
*/
public WrappedFile(final WrappedContainer> root, final IFile wrapped) {
super(root, wrapped);
@@ -128,11 +131,14 @@ public Object[] getFileChildren() {
final IFile p = getResource();
try {
final IContainer folder = p.getParent();
- final List sub = new ArrayList<>();
+ final List sub = new ArrayList<>();
for (final IResource r : folder.members()) {
- if (r instanceof IFile && isSupport(p, (IFile) r)) {
- sub.add((WrappedFile) getManager().findWrappedInstanceOf(r));
- }
+ if (r instanceof IFile && isSupport(p, (IFile) r)) { sub.add(getManager().findWrappedInstanceOf(r)); }
+ }
+ final IGamaFileMetaData metaData = GAMA.getGui().getMetaDataProvider().getMetaData(p, false, false);
+ if (metaData instanceof ShapeInfo info && !info.getAttributes().isEmpty()) {
+ final Tags wf = new Tags(this, info.getAttributes(), "Attributes", false);
+ if (wf.getNavigatorChildren().length > 0) { sub.add(wf); }
}
return sub.toArray();
} catch (final CoreException e) {
diff --git a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedGamaFile.java b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedGamaFile.java
index a4856c79b1..2bc33797a1 100644
--- a/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedGamaFile.java
+++ b/ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/contents/WrappedGamaFile.java
@@ -1,12 +1,12 @@
/*******************************************************************************************************
*
- * WrappedGamaFile.java, in ummisco.gama.ui.navigator, is part of the source code of the
- * GAMA modeling and simulation platform (v.1.8.2).
+ * WrappedGamaFile.java, in ummisco.gama.ui.navigator, is part of the source code of the GAMA modeling and simulation
+ * platform (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
- *
+ *
********************************************************************************************************/
package ummisco.gama.ui.navigator.contents;
@@ -31,6 +31,7 @@
import msi.gaml.compilation.GAML;
import msi.gaml.compilation.ast.ISyntacticElement;
import msi.gaml.descriptions.IExpressionDescription;
+import one.util.streamex.StreamEx;
import ummisco.gama.ui.navigator.NavigatorContentProvider;
import ummisco.gama.ui.resources.GamaIcons;
@@ -41,15 +42,17 @@ public class WrappedGamaFile extends WrappedFile {
/** The is experiment. */
boolean isExperiment;
-
+
/** The uri problems. */
IMap uriProblems;
/**
* Instantiates a new wrapped gama file.
*
- * @param root the root
- * @param wrapped the wrapped
+ * @param root
+ * the root
+ * @param wrapped
+ * the wrapped
*/
public WrappedGamaFile(final WrappedContainer> root, final IFile wrapped) {
super(root, wrapped);
@@ -66,9 +69,7 @@ public void computeURIProblems() {
for (final IMarker marker : markers) {
final String s = marker.getAttribute("URI_KEY", "UNKNOWN");
final int severity = marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
- if (uriProblems == null) {
- uriProblems = GamaMapFactory.createUnordered();
- }
+ if (uriProblems == null) { uriProblems = GamaMapFactory.createUnordered(); }
uriProblems.put(s, severity);
}
} catch (final CoreException ce) {}
@@ -87,14 +88,12 @@ public boolean hasChildren() {
@Override
public Object[] getNavigatorChildren() {
- if (NavigatorContentProvider.FILE_CHILDREN_ENABLED) { return getFileChildren(); }
+ if (NavigatorContentProvider.FILE_CHILDREN_ENABLED) return getFileChildren();
return EMPTY;
}
@Override
- public boolean isGamaFile() {
- return true;
- }
+ public boolean isGamaFile() { return true; }
@Override
public int countModels() {
@@ -121,16 +120,15 @@ protected void computeFileType() {
/**
* Checks for tag.
*
- * @param tag the tag
+ * @param tag
+ * the tag
* @return true, if successful
*/
public boolean hasTag(final String tag) {
final IGamaFileMetaData metaData = GAMA.getGui().getMetaDataProvider().getMetaData(getResource(), false, false);
// DEBUG.LOG("Tags of " + getName() + ": " + ((GamlFileInfo) metaData).getTags());
if (metaData instanceof GamlFileInfo) {
- for (final String t : ((GamlFileInfo) metaData).getTags()) {
- if (t.contains(tag)) { return true; }
- }
+ for (final String t : ((GamlFileInfo) metaData).getTags()) { if (t.contains(tag)) return true; }
}
return false;
}
@@ -138,39 +136,28 @@ public boolean hasTag(final String tag) {
@Override
public Object[] getFileChildren() {
final IGamaFileMetaData metaData = GAMA.getGui().getMetaDataProvider().getMetaData(getResource(), false, false);
- if (metaData instanceof GamlFileInfo) {
- final GamlFileInfo info = (GamlFileInfo) metaData;
+ if (metaData instanceof GamlFileInfo info) {
final List> l = new ArrayList<>();
final String path = getResource().getFullPath().toOSString();
final ISyntacticElement element = GAML.getContents(URI.createPlatformResourceURI(path, true));
if (element != null) {
- if (!GamlFileExtension.isExperiment(path)) {
- l.add(new WrappedModelContent(this, element));
- }
+ if (!GamlFileExtension.isExperiment(path)) { l.add(new WrappedModelContent(this, element)); }
element.visitExperiments(exp -> {
final IExpressionDescription d = exp.getExpressionAt(IKeyword.VIRTUAL);
- if (d == null || !d.equalsString("true")) {
- l.add(new WrappedExperimentContent(this, exp));
- }
+ if (d == null || !d.equalsString("true")) { l.add(new WrappedExperimentContent(this, exp)); }
});
}
if (!info.getImports().isEmpty()) {
final Category wf = new Category(this, info.getImports(), "Imports");
- if (wf.getNavigatorChildren().length > 0) {
- l.add(wf);
- }
+ if (wf.getNavigatorChildren().length > 0) { l.add(wf); }
}
if (!info.getUses().isEmpty()) {
final Category wf = new Category(this, info.getUses(), "Uses");
- if (wf.getNavigatorChildren().length > 0) {
- l.add(wf);
- }
+ if (wf.getNavigatorChildren().length > 0) { l.add(wf); }
}
if (!info.getTags().isEmpty()) {
- final Tags wf = new Tags(this, info.getTags(), "Tags");
- if (wf.getNavigatorChildren().length > 0) {
- l.add(wf);
- }
+ final Tags wf = new Tags(this, StreamEx.of(info.getTags()).toMap(s -> null), "Tags", true);
+ if (wf.getNavigatorChildren().length > 0) { l.add(wf); }
}
return l.toArray();
}
@@ -180,15 +167,15 @@ public Object[] getFileChildren() {
/**
* Gets the URI problem.
*
- * @param uri the uri
+ * @param uri
+ * the uri
* @return the URI problem
*/
public int getURIProblem(final URI uri) {
- if (uri == null) { return -1; }
- if (uriProblems == null) { return -1; }
+ if (uri == null || uriProblems == null) return -1;
final String fragment = uri.toString();
- final int[] severity = new int[] { -1 };
+ final int[] severity = { -1 };
uriProblems.forEachPair((s, arg1) -> {
if (s.startsWith(fragment)) {
severity[0] = arg1;