Commit 03e73039 authored by helene ortiz's avatar helene ortiz
Browse files

Move method writeToClipboard from TokenWidget to Nomad.

Add method isProd in Nomad class.
parent 0468f8af
4.0.136 dd/mm/2022
-------
* Add a method isProd() in Nomad class.
* Move method writeToClipboard() in Nomad class.
4.0.135 04/03/2022
-------
* Use last version of nomad-command-system (4.0.53).
......
......@@ -49,7 +49,6 @@ import fr.ill.ics.client.control.command.commandline.CommandLine;
import fr.ill.ics.client.control.command.navigation.button.TabButton;
import fr.ill.ics.client.control.experiment.ExperimentData;
import fr.ill.ics.client.control.login.Authentication;
import fr.ill.ics.client.control.login.UserConnection;
import fr.ill.ics.client.control.plot.PlotyManager;
import fr.ill.ics.client.control.plugin.selection.CommandsSelectionPlugin;
import fr.ill.ics.client.control.plugin.selection.HardwareSelectionPlugin;
......@@ -704,14 +703,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
// npm start -- -proposal 94/2018/0 -width 231 -height 987
String prodArgument = "";
int mode = UserConnection.MODE_FULL_TEST;
try {
mode = Integer.valueOf(ConfigManager.getInstance().getStringOrNothingAtAll(UserConnection.NOMAD_SENDDATA));
} catch (Exception e) {
mode = UserConnection.MODE_FULL_TEST;
}
if (mode == UserConnection.MODE_REAL) {
if (Nomad.isProd()) {
prodArgument = "-prod";
}
......@@ -866,14 +858,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
if (cameoServer != null) {
long instrumentId = ExperimentData.getInstance().getInstrumentId();
String prodArgument = "";
int mode = UserConnection.MODE_FULL_TEST;
try {
mode = Integer.valueOf(ConfigManager.getInstance().getStringOrNothingAtAll(UserConnection.NOMAD_SENDDATA));
} catch (Exception e) {
mode = UserConnection.MODE_FULL_TEST;
}
if (mode == UserConnection.MODE_REAL) {
if (Nomad.isProd()) {
prodArgument = "-prod";
}
......
......@@ -17,10 +17,6 @@
*/
package fr.ill.ics.client.view.token;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.io.IOException;
import fr.ill.ics.bridge.events.ChatEvent;
......@@ -37,6 +33,7 @@ import fr.ill.ics.client.view.chat.Chat;
import fr.ill.ics.client.view.factory.ImageFactory;
import fr.ill.ics.client.view.users.ConnectedUsers;
import fr.ill.ics.client.view.util.dialog.DialogManager;
import fr.ill.ics.common.Nomad;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
import fr.ill.ics.util.ConfigManager;
......@@ -187,14 +184,14 @@ public abstract class TokenWidget implements ChatEventListener {
if (MainWindow.getInstance().visa()) {
meetingURL = meetingURL.replaceFirst("https", "visa");
writeToClipboard(meetingURL);
Nomad.writeToClipboard(meetingURL);
} else {
try {
Runtime.getRuntime().exec("/usr/bin/chromium --profile-directory=Default --app-id=ibiognfelmneebngbnbeonnllapmffmb --app=" + meetingURL);
} catch (IOException e) {
DialogManager.getInstance().nomadMessageDialog("errorWhileOpeningMeetingURLMessage", "videoImageToolTip");
e.printStackTrace();
writeToClipboard(meetingURL);
Nomad.writeToClipboard(meetingURL);
}
}
} else {
......@@ -202,13 +199,6 @@ public abstract class TokenWidget implements ChatEventListener {
}
}
}
private void writeToClipboard(String string) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable transferable = new StringSelection(string);
clipboard.setContents(transferable, null);
}
public abstract void onChatClick();
......
......@@ -18,6 +18,10 @@
package fr.ill.ics.common;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
......@@ -1340,5 +1344,21 @@ public abstract class Nomad {
String controllerType = Nomad.getControllerType(controllerName);
return ScannableProperties.getInstance().getShortPropertyName(controllerType, setPoint);
}
public static void writeToClipboard(String string) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable transferable = new StringSelection(string);
clipboard.setContents(transferable, null);
}
public static boolean isProd() {
int mode = UserConnection.MODE_FULL_TEST;
try {
mode = Integer.valueOf(ConfigManager.getInstance().getStringOrNothingAtAll(UserConnection.NOMAD_SENDDATA));
} catch (Exception e) {
mode = UserConnection.MODE_FULL_TEST;
}
return (mode == UserConnection.MODE_REAL);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment