Skip to content
Snippets Groups Projects
Commit 6af8b257 authored by helene ortiz's avatar helene ortiz
Browse files

For each atomic command box, add a shortcut to its settings plugin.

parent 4ae35c5d
No related branches found
No related tags found
No related merge requests found
Showing with 46 additions and 8 deletions
......@@ -3,7 +3,8 @@
* Add 2 preference values to restore main window x and y.
* Fix bug in PropertyPlotData: NumberFormatException while trying to create an int from a float property.
* Add a new PWidget: PSelector
* For each atomic command box, add a shortcut to its settings plugin.
4.0.64 17/09/2020
------
* Shell for chat does not need to be blocking.
......
......@@ -359,4 +359,5 @@ enableRemoteAccessMessage=Enable remote access
widgetIsDisableForRemoteClientMessage=File Chooser is not available on remote client yet!\nPlease type the file name in the text box.
usersControllerMissingMessage=Functionnality not yet configured on this instrument.\nContact SCI
nomadlogsNotAvailableOnVisaMessage=Nomadlogs is not available yet on Visa instances.\nUse your web browser to see logs.
\ No newline at end of file
nomadlogsNotAvailableOnVisaMessage=Nomadlogs is not available yet on Visa instances.\nUse your web browser to see logs.
commandBoxGoToSettingsTooltip=Go to settings plugin for
\ No newline at end of file
......@@ -141,9 +141,9 @@ public class CommandBox {
}
this.commandZone = commandZone;
this.commandBoxPeer = commandBoxPeer;
this.selectionTreeData = selectionTreeData; // must be set before commandbox in commandboxpeer, for shortcut to settings
commandBoxPeer.setCommandBox(this);
this.selectionTreeData = selectionTreeData;
if (selectionTreeData != null) { // null if unknown command box
this.isSettings = selectionTreeData.isSettings();
} else {
......
......@@ -186,4 +186,7 @@ public class ArtificialCommandBoxPeer extends CommandBoxPeer {
public void setFocus() {
}
@Override
protected void addShortcutToSettingsPlugin() {
}
}
\ No newline at end of file
......@@ -74,6 +74,11 @@ public abstract class CommandBoxPeer {
public void setCommandBox(CommandBox commandBox) {
this.commandBox = commandBox;
// Does this node has an equivalent in settings tab ?
if (MainWindow.getInstance().getSettingsSelectionPlugin().hasSettingsPluginFor(commandBox.getName())) {
// Add shortcut to settings plugin
addShortcutToSettingsPlugin();
}
}
public void init() {
......@@ -492,4 +497,5 @@ public abstract class CommandBoxPeer {
public abstract void rescale();
public abstract void manageConfigurationErrorMessage(String message);
public abstract void setFocus();
protected abstract void addShortcutToSettingsPlugin();
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ package fr.ill.ics.client.view.command.content.swt;
import java.util.logging.Level;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent;
......@@ -41,7 +42,9 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import fr.ill.ics.client.control.MainWindow;
import fr.ill.ics.client.control.command.CommandWindow;
import fr.ill.ics.client.control.plugin.selection.SelectionPlugin;
import fr.ill.ics.client.view.MainWindowPeer;
import fr.ill.ics.client.view.command.CommandWindowPeer;
import fr.ill.ics.client.view.command.CommandZonePeer;
......@@ -1014,7 +1017,19 @@ public class SWTCommandBoxPeer extends CommandBoxPeer {
protected String getExtraLabelTextKey() {
return "";
}
@Override
protected void addShortcutToSettingsPlugin() {
controllerImageCanvas.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
MainWindow.getInstance().goToNode(SelectionPlugin.SETTINGS_ID, commandBox.getName());
}
});
controllerImageCanvas.setToolTipText(ConfigManager.getInstance().getString("commandBoxGoToSettingsTooltip") + " " + commandBox.getName());
controllerImageCanvas.setCursor(SWTWidgetFactory.getInstance().getHandCursor());
}
/*
@Override
protected void redrawCheckExpressionImage() {
......
......@@ -38,7 +38,7 @@ public abstract class PSelector extends PWidget implements NomadControllerProper
protected final static String PROPERTY_SELECTOR = "PROPERTY";
protected final static int BUTTON_HEIGHT = 25;
private final static int BUTTON_WIDTH = 100;
protected final static int BUTTON_WIDTH = 100;
protected WidgetDescriptor widgetDescriptor;
protected ControllerPluginPeer controllerPluginPeer;
......
......@@ -18,6 +18,8 @@
package fr.ill.ics.client.view.widget;
import fr.ill.ics.client.view.factory.WidgetFactory;
/**
* Abstraction of a button not linked to a property.
*
......@@ -25,9 +27,20 @@ package fr.ill.ics.client.view.widget;
*/
public abstract class PushButton extends NomadWidget {
protected int preferredHeight = WidgetFactory.BUTTON_HEIGHT;
protected int preferredWidth = WidgetFactory.BUTTON_WIDTH;
protected PushButton(PContainer parent) {
super(parent);
}
public void setPreferredHeight(int height) {
this.preferredHeight = height;
}
public void setPreferredWidth(int width) {
this.preferredWidth = width;
}
public abstract void setText(String text);
......
......@@ -49,7 +49,7 @@ public class SWTPSelector extends PSelector {
}
button = (SWTPushButton)SWTPWidgetFactory.getInstance().createPushButton(parent, initialValue, buttonWidth);
initialFontSize = button.getButton().getFont().getFontData()[0].getHeight();
button.getButton().setLayoutData(SWTWidgetFactory.getInstance().getImageGridData(Magnifier.getScaledValue(buttonWidth), Magnifier.getScaledValue(20), true));
button.getButton().setLayoutData(SWTWidgetFactory.getInstance().getImageGridData(BUTTON_WIDTH, BUTTON_HEIGHT, !inSpy));
button.getButton().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
......
......@@ -24,7 +24,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import fr.ill.ics.client.view.factory.WidgetFactory;
import fr.ill.ics.client.view.factory.swt.SWTWidgetFactory;
import fr.ill.ics.client.view.magnifier.Magnifier;
import fr.ill.ics.client.view.magnifier.swt.SWTMagnifier;
......@@ -111,7 +110,7 @@ public class SWTPushButton extends PushButton {
Magnifier.getInstance().removeWidgetMagnifyListener(this);
} else {
SWTMagnifier.getInstance().magnifyControl(button, initialFontSize);
button.setLayoutData(SWTWidgetFactory.getInstance().getImageGridData(WidgetFactory.BUTTON_WIDTH, WidgetFactory.BUTTON_HEIGHT, !inSpy));
button.setLayoutData(SWTWidgetFactory.getInstance().getImageGridData(preferredWidth, preferredHeight, !inSpy));
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment