Skip to content

Commit

Permalink
Merge branch '2024-06' of github.com:gama-platform/new.gama into 2024-06
Browse files Browse the repository at this point in the history
  • Loading branch information
RoiArthurB committed Mar 8, 2024
2 parents 32057f2 + cc42208 commit e687af8
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 11 deletions.
13 changes: 11 additions & 2 deletions gama.core/src/gama/gaml/compilation/kernel/GamaBundleLoader.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************************************
*
* GamaBundleLoader.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform
* .
* (v.1.9.3).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
Expand Down Expand Up @@ -159,6 +159,9 @@ public static void ERROR(final String message, final Exception e) {
private static final Set<String> GAMA_CORE_DISPLAY_PLUGINS =
Set.of("gama.ui.display.java2d", "gama.ui.display.opengl");

/** The Constant GAMA_DIAGRAM_EDITOR_PLUGIN. */
private static final String GAMA_DIAGRAM_EDITOR_PLUGIN = "gama.ui.diagram";

/** The model plugins. */
private static final Multimap<Bundle, String> MODEL_PLUGINS = ArrayListMultimap.create();

Expand Down Expand Up @@ -524,7 +527,13 @@ public static boolean isDisplayPlugin(final String s) {
*/
public static void addDisplayPlugin(final String plugin) {
GAMA_DISPLAY_PLUGINS_NAMES.add(plugin);

}

/**
* Checks if is diagram editor loaded.
*
* @return true, if is diagram editor loaded
*/
public static boolean isDiagramEditorLoaded() { return Platform.getBundle(GAMA_DIAGRAM_EDITOR_PLUGIN) != null; }

}
6 changes: 3 additions & 3 deletions gama.product/gama.product
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>

<product name="Gama" uid="gama.ui.application.product" id="gama.ui.application.product" application="gama.ui.application.GamaApplication" type="features" includeLaunchers="true" autoIncludeRequirements="true" version="0.0.0.qualifier">
<product name="Gama" uid="gama.ui.application.product" id="gama.ui.application.product" application="gama.ui.application.GamaApplication" version="0.0.0.qualifier" type="features" includeLaunchers="true" autoIncludeRequirements="true">

<aboutInfo>
<image path="/gama.ui.application/icons/window/icon128.png"/>
Expand Down Expand Up @@ -120,11 +120,11 @@

<configurations>
<plugin id="org.apache.felix.scr" autoStart="true" startLevel="1" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="1" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="1" />
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.p2.reconciler.dropins" autoStart="true" startLevel="5" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<property name="org.eclipse.update.reconcile" value="false" />
<property name="version" value="SNAPSHOT" />
<property name="eclipse.buildId" value="${build.id}" />
Expand Down
27 changes: 24 additions & 3 deletions gama.ui.editor/src/gaml/compiler/ui/editor/GamlEditor.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************************************
*
* GamlEditor.java, in gama.ui.shared.modeling, is part of the source code of the GAMA modeling and simulation platform
* .
* GamlEditor.java, in gama.ui.editor, is part of the source code of the GAMA modeling and simulation platform
* (v.1.9.3).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
Expand Down Expand Up @@ -201,6 +201,9 @@ protected static IPreferenceStore getPreferences() {

}

/** The diagram opener. */
static IDiagramOpener diagramOpener;

/** The images. */
static Map<String, Image> images = new HashMap();

Expand Down Expand Up @@ -478,7 +481,6 @@ public void createPartControl(final Composite compo) {
// toolbarParent.setBackground(IGamaColors.WHITE.color());

// Asking the editor to fill the rest
// final int style = GamaToolbarFactory.REDUCED_VIEW_TOOLBAR_HEIGHT.getValue() ? SWT.NONE : SWT.BORDER;
final var editor = new Composite(toolbarParent, SWT.NONE);
final var data = new GridData(SWT.FILL, SWT.FILL, true, true);
editor.setLayoutData(data);
Expand Down Expand Up @@ -1136,4 +1138,23 @@ protected CompositeRuler createCompositeRuler() {
*/
public URI getURI() { return fileURI; }

/**
*
*/
public void switchToDiagram() {
if (diagramOpener != null) { diagramOpener.open(this); }
}

/**
* Switch to text.
*/
public void switchToText() {
if (diagramOpener != null) { diagramOpener.close(this); }
}

/**
* @param generateDiagramHandler
*/
public static void setDiagramOpener(final IDiagramOpener opener) { diagramOpener = opener; }

}
32 changes: 32 additions & 0 deletions gama.ui.editor/src/gaml/compiler/ui/editor/IDiagramOpener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*******************************************************************************************************
*
* IDiagramOpener.java, in gama.ui.editor, is part of the source code of the GAMA modeling and simulation platform
* (v.1.9.3).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package gaml.compiler.ui.editor;

/**
* The class IDiagramOpener.
*
* @author drogoul
* @since 28 févr. 2024
*
*/
public interface IDiagramOpener {

/**
* Open.
*/
void open(GamlEditor editor);

/**
* Close.
*/
void close(GamlEditor editor);

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************************************
*
* EditorToolbar.java, in gama.ui.shared.modeling, is part of the source code of the GAMA modeling and simulation
* platform .
* EditorToolbar.java, in gama.ui.editor, is part of the source code of the GAMA modeling and simulation platform
* (v.1.9.3).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
Expand All @@ -28,6 +28,7 @@
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.ToolItem;

import gama.gaml.compilation.kernel.GamaBundleLoader;
import gama.ui.shared.bindings.GamaKeyBindings;
import gama.ui.shared.utils.WorkbenchHelper;
import gama.ui.shared.views.toolbar.GamaToolbarSimple;
Expand All @@ -43,7 +44,7 @@
public class EditorToolbar {

/** The previous. */
ToolItem next, previous;
ToolItem next, previous, diagram;

/** The find. */
EditorSearchControls find;
Expand Down Expand Up @@ -108,6 +109,16 @@ public void widgetSelected(final SelectionEvent e) {
editor.openOutlinePopup();
}
});
if (GamaBundleLoader.isDiagramEditorLoaded()) {
diagram = toolbar.button("editor/command.graphical", null, "Switch to diagram", new SelectionAdapter() {

@Override
public void widgetSelected(final SelectionEvent e) {
if (editor == null) return;
editor.switchToDiagram();
}
});
}

// Attaching listeners to the global commands in order to enable/disable the
// toolbar items
Expand Down
Binary file added gama.ui.shared/icons/editor/command.graphical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gama.ui.shared/icons/editor/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gama.ui.shared/icons/editor/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e687af8

Please sign in to comment.