23 | * Clicking on the text opens the link in the default external web browser.
24 | */
25 | public class LinkFieldEditor extends FieldEditor {
26 |
27 | /**
28 | * The text displayed in the Preferences page.
29 | */
30 | private final String text;
31 |
32 | /**
33 | * The link to open in the external browser.
34 | */
35 | private final String link;
36 |
37 | /**
38 | * The index of the first text character corresponding to the link.
39 | */
40 | private final int linkStartIndex;
41 |
42 | /**
43 | * The length of the link from linkStartIndex.
44 | */
45 | private final int linkLength;
46 |
47 | /**
48 | * Creates a new clickable text that opens a link on mouse click.
49 | *
50 | * @param text
51 | * The text to show in the Preferences page.
52 | * @param link
53 | * The link to open in the external web browser on mouse click.
54 | * @param parent
55 | * The parent of the link.
56 | */
57 | public LinkFieldEditor(String text, String link, Composite parent) {
58 | this(text, link, 0, text.length(), parent);
59 | }
60 |
61 | /**
62 | * Creates a new clickable text that opens a link on mouse click.
63 | *
64 | * @param text
65 | * The text to show in the Preferences page.
66 | * @param link
67 | * The link to open in the external web browser on mouse click.
68 | * @param linkStartIndex
69 | * The index of the first text character corresponding to the link.
70 | * @param linkLength
71 | * The length of the link starting from linkStartIndex.
72 | * @param parent
73 | * The parent of the link.
74 | */
75 | public LinkFieldEditor(String text, String link, int linkStartIndex, int linkLength, Composite parent) {
76 | super();
77 | this.text = text;
78 | this.link = link;
79 | this.linkStartIndex = linkStartIndex;
80 | this.linkLength = linkLength;
81 | createControl(parent);
82 | }
83 |
84 | @Override
85 | protected void doFillIntoGrid(Composite parent, int numColumns) {
86 | StyledText styledText = new StyledText(parent, SWT.NONE);
87 | styledText.setText(" " + text);
88 | styledText.setBackground(parent.getBackground());
89 | styledText.setMarginColor(parent.getBackground());
90 |
91 | GridData gd = new GridData();
92 | gd.horizontalSpan = numColumns;
93 | styledText.setLayoutData(gd);
94 | styledText.setLeftMargin(0);
95 |
96 | StyleRange style = new StyleRange();
97 | style.underline = true;
98 | style.underlineStyle = SWT.UNDERLINE_LINK;
99 | style.start = this.linkStartIndex;
100 | style.length = this.linkLength;
101 | styledText.setStyleRange(style);
102 |
103 | styledText.addListener(SWT.MouseDown, event -> {
104 | int clickOffset = styledText.getCaretOffset();
105 | if (this.linkStartIndex <= clickOffset && clickOffset < this.linkStartIndex + this.linkLength) {
106 | // Open the documentation with external browser
107 | Program.launch(link);
108 | }
109 | });
110 | styledText.setBottomMargin(5);
111 | styledText.setToolTipText(link);
112 | }
113 |
114 | @Override
115 | protected void adjustForNumColumns(int numColumns) {
116 | // is something really needed here?
117 | }
118 |
119 | @Override
120 | protected void doLoad() {
121 | // nothing to load
122 | }
123 |
124 | @Override
125 | protected void doLoadDefault() {
126 | // nothing to load
127 | }
128 |
129 | @Override
130 | protected void doStore() {
131 | // nothing to store
132 | }
133 |
134 | @Override
135 | public int getNumberOfControls() {
136 | return 1;
137 | }
138 |
139 | }
140 |
--------------------------------------------------------------------------------
/bundles/fr.kazejiyu.discord.rpc.integration.ui.preferences/src/fr/kazejiyu/discord/rpc/integration/ui/preferences/properties/AbstractPropertyPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) 2018-2020 Emmanuel CHEBBI
3 | *
4 | * This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License 2.0
6 | * which is available at https://www.eclipse.org/legal/epl-2.0/
7 | *
8 | * SPDX-License-Identifier: EPL-2.0
9 | ******************************************************************************/
10 | package fr.kazejiyu.discord.rpc.integration.ui.preferences.properties;
11 |
12 | import org.eclipse.core.resources.IProject;
13 | import org.eclipse.core.runtime.IAdaptable;
14 | import org.eclipse.swt.SWT;
15 | import org.eclipse.swt.layout.GridData;
16 | import org.eclipse.swt.widgets.Composite;
17 | import org.eclipse.swt.widgets.Label;
18 | import org.eclipse.ui.dialogs.PropertyPage;
19 |
20 | /**
21 | * Abstract PropertyPage providing new services to sub-classes.
22 | *
23 | * @author Emmanuel CHEBBI
24 | */
25 | abstract class AbstractPropertyPage extends PropertyPage {
26 |
27 | /** The project which properties are shown by this page. */
28 | protected IProject project;
29 |
30 | /**
31 | * Sets {@link #project} to the value of the current project.
32 | *
33 | * @return {@code true} if the current project has been resolved successfully,
34 | * {@code false} otherwise.
35 | */
36 | protected boolean resolveCurrentProject() {
37 | final IAdaptable adaptable = getElement();
38 |
39 | if (adaptable == null) {
40 | return false;
41 | }
42 | project = adaptable.getAdapter(IProject.class);
43 | return project != null;
44 | }
45 |
46 | protected static void addSeparator(Composite parent) {
47 | Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
48 | GridData gridData = new GridData();
49 | gridData.horizontalAlignment = GridData.FILL;
50 | gridData.grabExcessHorizontalSpace = true;
51 | separator.setLayoutData(gridData);
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/bundles/fr.kazejiyu.discord.rpc.integration/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
Represents Discord Rich Presence for Eclipse IDE plug-in.
18 | * 19 | *Provides utility methods to deal with Eclipse environment.
20 | * 21 | * @author Emmanuel CHEBBI 22 | */ 23 | public final class Plugin { 24 | 25 | public static final String ID = Activator.PLUGIN_ID; 26 | 27 | /** ID of the 'editor_input_adapter' extension point. */ 28 | public static final String EDITOR_INPUT_ADAPTER_EXTENSION_ID = "fr.kazejiyu.discord.rpc.integration.editor_input_adapter"; 29 | 30 | private Plugin() { 31 | // does not make sense to instantiate it 32 | } 33 | 34 | /** 35 | * Logs a specified message in Eclipse Error Log view. 36 | * 37 | * @param message 38 | * The message to log. 39 | */ 40 | public static void log(String message) { 41 | IStatus status = new Status(IStatus.INFO, ID, message); 42 | StatusManager.getManager().handle(status); 43 | } 44 | 45 | /** 46 | *Logs a specific Exception in Eclipse Error Log view.
47 | * 48 | *The exception's message is used as log's status message.
49 | * 50 | * @param e 51 | * The exception to log. Must not be {@code null}. 52 | * 53 | * @see #logException(String, Exception) 54 | * @see #logExceptionWithDialog(String, Exception) 55 | */ 56 | public static void logException(Exception e) { 57 | logException(e.getMessage(), e); 58 | } 59 | 60 | /** 61 | * Logs a specific Exception in Eclipse Error Log view. 62 | * 63 | * @param message 64 | * The log message. 65 | * @param e 66 | * The exception to log. Must not be {@code null}. 67 | * 68 | * @see #logException(String) 69 | * @see #logExceptionWithDialog(String, Exception) 70 | */ 71 | public static void logException(String message, Exception e) { 72 | IStatus status = new Status(IStatus.ERROR, ID, message, e); 73 | StatusManager.getManager().handle(status); 74 | } 75 | 76 | /** 77 | * Logs a specific Exception in Eclipse Error Log view and opens a non-modal error dialog. 78 | * 79 | * @param message 80 | * The log message. 81 | * @param e 82 | * The exception to log. Must not be {@code null}. 83 | * 84 | * @see #logException(Exception) 85 | * @see #logException(String, Exception) 86 | */ 87 | public static void logExceptionWithDialog(String message, Exception e) { 88 | IStatus status = new Status(IStatus.ERROR, ID, message, e); 89 | StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /bundles/fr.kazejiyu.discord.rpc.integration/src/fr/kazejiyu/discord/rpc/integration/core/DiscordRpcLifecycle.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2018-2020 Emmanuel CHEBBI 3 | * 4 | * This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License 2.0 6 | * which is available at https://www.eclipse.org/legal/epl-2.0/ 7 | * 8 | * SPDX-License-Identifier: EPL-2.0 9 | ******************************************************************************/ 10 | package fr.kazejiyu.discord.rpc.integration.core; 11 | 12 | import java.util.Optional; 13 | 14 | /** 15 | * Defines an object aimed to manage plug-in's Rich Presence by communicating with Discord. 16 | */ 17 | public interface DiscordRpcLifecycle extends AutoCloseable { 18 | 19 | /** 20 | * Initializes the connection to Discord session. 21 | * 22 | * @param applicationId 23 | * The ID of the Discord application to connect. 24 | * 25 | * @see #shutdown() 26 | */ 27 | void initialize(String applicationId); 28 | 29 | /** 30 | * Returns whether the instance is currently connected to a Discord client. 31 | * @return {@code true} if the instance is connected to a Discord client, 32 | * {@code false} otherwise 33 | */ 34 | boolean isConnected(); 35 | 36 | /** 37 | * Returns whether the proxy is connected to the given Discord application. 38 | * 39 | * @param applicationId 40 | * The ID of the Discord application to which the proxy may be connected. 41 | * 42 | * @return true if the proxy is connected to the given Discord application, false otherwise 43 | */ 44 | default boolean isConnectedTo(String applicationId) { 45 | return this.discordApplicationId() 46 | .map(id -> id.equals(applicationId)) 47 | .orElse(false); 48 | } 49 | 50 | /** 51 | * Returns the ID of the Discord application to which the object is currently connected. 52 | * @return the ID of the Discord application if a connection has been made, nothing otherwise 53 | */ 54 | OptionalShows given presence on Discord.
58 | * 59 | *Has no effect if {@link #isConnected()} is false.
60 | * 61 | * @param rp 62 | * Contains the elements to show on Discord. 63 | * Must not be {@code null}. 64 | * 65 | * @see #showNothing() 66 | */ 67 | void show(RichPresence rp); 68 | 69 | /** 70 | * Clear Discord's rich presence so that only "Playing Eclipse IDE" is shown. 71 | * 72 | * @see #show(RichPresence) 73 | */ 74 | void showNothing(); 75 | 76 | /** 77 | *Shutdowns the connection to Discord session.
78 | * 79 | *If this method is called while the connection has already being closed, it has no effect.
80 | * 81 | * @see #initialize(String) 82 | */ 83 | void shutdown(); 84 | 85 | @Override 86 | default void close() { 87 | shutdown(); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /bundles/fr.kazejiyu.discord.rpc.integration/src/fr/kazejiyu/discord/rpc/integration/core/DiscordRpcProxy.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2018-2020 Emmanuel CHEBBI 3 | * 4 | * This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License 2.0 6 | * which is available at https://www.eclipse.org/legal/epl-2.0/ 7 | * 8 | * SPDX-License-Identifier: EPL-2.0 9 | ******************************************************************************/ 10 | package fr.kazejiyu.discord.rpc.integration.core; 11 | 12 | import java.util.Optional; 13 | 14 | import club.minnced.discord.rpc.DiscordEventHandlers; 15 | import club.minnced.discord.rpc.DiscordRPC; 16 | import club.minnced.discord.rpc.DiscordRichPresence; 17 | import fr.kazejiyu.discord.rpc.integration.Plugin; 18 | import fr.kazejiyu.discord.rpc.integration.languages.Language; 19 | 20 | /** 21 | * Sends {@link RichPresence}s to Discord.
23 | * This interface should be implemented by clients who aim to define
24 | * the information shown in Discord for their own editor.
25 | *
26 | * @author Emmanuel CHEBBI
27 | */
28 | public interface EditorInputToRichPresenceAdapter extends Comparable
34 | * The higher the priority, the more the adapter will be favored.
35 | *
36 | * For instance, given two adapters registering themselves for inputs of type
37 | * {@link FileEditorInput} and which priorities are 0 and 1, then the adapter
38 | * of priority 1 will be chosen to handle the input.
39 | *
40 | * Built-in adapters have a priority of 0. Hence, giving a higher priority
41 | * ensures that the adapter will be preferred over default ones. This allows
42 | * to dynamically override other adapters if needed.
43 | *
44 | * It is advised to only choose tens, such as 10 or 20, instead of digits
45 | * so that it is easier to add new adapters later if needed.
46 | *
47 | * @return the priority associated with this adapter.
48 | */
49 | int getPriority();
50 |
51 | /**
52 | * Returns the class of the input expected as an argument of {@link #createRichPresence(GlobalPreferences, IEditorInput)}.
53 | * @return the class of the input expected as an argument of {@link #createRichPresence(GlobalPreferences, IEditorInput)}
54 | */
55 | Class extends IEditorInput> getExpectedEditorInputClass();
56 |
57 | /**
58 | * Creates the Rich Presence information to send to Discord.
59 | *
60 | * Important: this method may be called several times in a row with the same editor input.
61 | *
62 | * @param preferences
63 | * User's preferences regarding the information to show in Discord.
64 | * Must not be {@code null}.
65 | * @param input
66 | * The input of the active editor.
67 | * Must satisfy {@code getExpectedEditorInputClass().isInstance(input) == true}.
68 | *
69 | * @return the information to show in Discord if the input can be handled
70 | */
71 | Optional Returns an adapter able to turn {@code input} into a {@link ImmutableRichPresence}
28 | * instance. The adapter is one of the adapters registered to the
31 | * {@value #EDITOR_INPUT_ADAPTER_EXTENSION_ID} extension point.
41 | * Accepts {@code null} for indicating that no editor is activated.
42 | *
43 | * @param editor
44 | * The last editor selected by the user or null if there is none
45 | */
46 | public void setLastSelectedEditor(IEditorPart editor) {
47 | this.editor = editor;
48 | }
49 |
50 | /**
51 | * Returns the elapsed times.
52 | * @return the elapsed times
53 | */
54 | public SelectionTimes getElapsedTimes() {
55 | return times;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/bundles/fr.kazejiyu.discord.rpc.integration/src/fr/kazejiyu/discord/rpc/integration/files/EditorToRichPresenceAdapter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) 2018-2020 Emmanuel CHEBBI
3 | *
4 | * This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License 2.0
6 | * which is available at https://www.eclipse.org/legal/epl-2.0/
7 | *
8 | * SPDX-License-Identifier: EPL-2.0
9 | ******************************************************************************/
10 | package fr.kazejiyu.discord.rpc.integration.files;
11 |
12 | import static java.util.Objects.requireNonNull;
13 |
14 | import java.util.Optional;
15 | import java.util.function.Function;
16 | import java.util.function.Supplier;
17 |
18 | import org.eclipse.ui.IEditorPart;
19 |
20 | import fr.kazejiyu.discord.rpc.integration.core.PreferredRichPresence;
21 | import fr.kazejiyu.discord.rpc.integration.core.RichPresence;
22 | import fr.kazejiyu.discord.rpc.integration.core.SelectionTimes;
23 | import fr.kazejiyu.discord.rpc.integration.extensions.EditorInputToRichPresenceAdapter;
24 | import fr.kazejiyu.discord.rpc.integration.extensions.EditorRichPresenceFromInput;
25 | import fr.kazejiyu.discord.rpc.integration.extensions.internal.UnknownInputRichPresence;
26 | import fr.kazejiyu.discord.rpc.integration.settings.GlobalPreferences;
27 |
28 | /**
29 | * An adapter able to turn {@link EditionContext} instances into {@link RichPresence} ones.
30 | *
31 | * @author Emmanuel CHEBBI
32 | */
33 | public class EditorToRichPresenceAdapter implements Function
13 | * Each time a new editor is activated by the user, Discord is notified and updates its overlay accordingly.
14 | *
15 | * @author Emmanuel CHEBBI
16 | */
17 | package fr.kazejiyu.discord.rpc.integration.files;
18 |
--------------------------------------------------------------------------------
/bundles/fr.kazejiyu.discord.rpc.integration/src/fr/kazejiyu/discord/rpc/integration/languages/package-info.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) 2018-2020 Emmanuel CHEBBI
3 | *
4 | * This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License 2.0
6 | * which is available at https://www.eclipse.org/legal/epl-2.0/
7 | *
8 | * SPDX-License-Identifier: EPL-2.0
9 | ******************************************************************************/
10 | /**
11 | * Defines the languages handled by the plug-in.
12 | */
13 | package fr.kazejiyu.discord.rpc.integration.languages;
14 |
--------------------------------------------------------------------------------
/bundles/fr.kazejiyu.discord.rpc.integration/src/fr/kazejiyu/discord/rpc/integration/settings/DiscordIntegrationPreferencesInitializer.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) 2018-2020 Emmanuel CHEBBI
3 | *
4 | * This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License 2.0
6 | * which is available at https://www.eclipse.org/legal/epl-2.0/
7 | *
8 | * SPDX-License-Identifier: EPL-2.0
9 | ******************************************************************************/
10 | package fr.kazejiyu.discord.rpc.integration.settings;
11 |
12 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.CUSTOM_DISCORD_DETAILS_WORDING;
13 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.CUSTOM_DISCORD_STATE_WORDING;
14 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.RESET_ELAPSED_TIME;
15 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.RESET_ELAPSED_TIME_ON_NEW_PROJECT;
16 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_ELAPSED_TIME;
17 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_FILE_NAME;
18 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_LANGUAGE_ICON;
19 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_PROJECT_NAME;
20 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_RICH_PRESENCE;
21 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.USE_CUSTOM_APP;
22 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.USE_CUSTOM_WORDING;
23 |
24 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
25 | import org.eclipse.core.runtime.preferences.InstanceScope;
26 | import org.eclipse.jface.preference.IPreferenceStore;
27 | import org.eclipse.ui.preferences.ScopedPreferenceStore;
28 |
29 | import fr.kazejiyu.discord.rpc.integration.Activator;
30 |
31 | /**
32 | * Initializes the preferences for the preferences page.
33 | *
34 | * @author Emmanuel CHEBBI
35 | */
36 | public class DiscordIntegrationPreferencesInitializer extends AbstractPreferenceInitializer {
37 |
38 | @Override
39 | public void initializeDefaultPreferences() {
40 | IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
41 |
42 | store.setDefault(SHOW_FILE_NAME.property(), true);
43 | store.setDefault(SHOW_PROJECT_NAME.property(), true);
44 | store.setDefault(SHOW_ELAPSED_TIME.property(), true);
45 | store.setDefault(SHOW_LANGUAGE_ICON.property(), true);
46 | store.setDefault(SHOW_RICH_PRESENCE.property(), true);
47 | store.setDefault(RESET_ELAPSED_TIME.property(), RESET_ELAPSED_TIME_ON_NEW_PROJECT.property());
48 |
49 | store.setDefault(USE_CUSTOM_APP.property(), false);
50 |
51 | store.setDefault(USE_CUSTOM_WORDING.property(), false);
52 | store.setDefault(CUSTOM_DISCORD_DETAILS_WORDING.property(), "Editing ${file}");
53 | store.setDefault(CUSTOM_DISCORD_STATE_WORDING.property(), "Working on ${project}");
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/bundles/fr.kazejiyu.discord.rpc.integration/src/fr/kazejiyu/discord/rpc/integration/settings/GlobalPreferencesListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) 2018-2020 Emmanuel CHEBBI
3 | *
4 | * This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License 2.0
6 | * which is available at https://www.eclipse.org/legal/epl-2.0/
7 | *
8 | * SPDX-License-Identifier: EPL-2.0
9 | ******************************************************************************/
10 | package fr.kazejiyu.discord.rpc.integration.settings;
11 |
12 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.CUSTOM_APP_ID;
13 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.CUSTOM_DISCORD_DETAILS_WORDING;
14 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.CUSTOM_DISCORD_STATE_WORDING;
15 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.RESET_ELAPSED_TIME;
16 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.RESET_ELAPSED_TIME_ON_NEW_FILE;
17 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.RESET_ELAPSED_TIME_ON_NEW_PROJECT;
18 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.RESET_ELAPSED_TIME_ON_STARTUP;
19 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_ELAPSED_TIME;
20 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_FILE_NAME;
21 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_LANGUAGE_ICON;
22 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_PROJECT_NAME;
23 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.SHOW_RICH_PRESENCE;
24 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.USE_CUSTOM_APP;
25 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.USE_CUSTOM_WORDING;
26 | import static fr.kazejiyu.discord.rpc.integration.settings.Settings.fromProperty;
27 | import static java.lang.Boolean.parseBoolean;
28 | import static java.util.Objects.requireNonNull;
29 |
30 | import java.util.Collection;
31 | import java.util.HashMap;
32 | import java.util.Map;
33 | import java.util.function.BiConsumer;
34 |
35 | import org.eclipse.jface.util.IPropertyChangeListener;
36 | import org.eclipse.jface.util.PropertyChangeEvent;
37 |
38 | /**
39 | * Listens for change in plug-in's global preferences. Each change event is forwarded to a one or several
42 | * {@link SettingChangeListener SettingChangeListeners}.
39 | * Should be one of:
40 | *
66 | * False means that the connection with Discord should not be set at all. */
67 | SHOW_RICH_PRESENCE("SHOW_RICH_PRESENCE"),
68 |
69 | /** Indicates a nickname that should be shown in Discord instead of the project's name. */
70 | PROJECT_NAME("PROJECT_NAME"),
71 |
72 | /** Whether a custom Discord Application should be used instead of the default one. */
73 | USE_CUSTOM_APP("USE_CUSTOM_APP"),
74 |
75 | /** Indicates the ID of the custom Discord Application ID to use. */
76 | CUSTOM_APP_ID("CUSTOM_APP_ID"),
77 |
78 | /** Whether a custom wording, provided by the user, should be used instead of the built-in one. */
79 | USE_CUSTOM_WORDING("USE_CUSTOM_WORDING"),
80 |
81 | /**
82 | * The custom wording provided by the user for Discord's state field.
83 | * (https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields). */
84 | CUSTOM_DISCORD_STATE_WORDING("CUSTOM_DISCORD_STATE_WORDING"),
85 |
86 | /**
87 | * The custom wording provided by the user for Discord's details field.
88 | * (https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields). */
89 | CUSTOM_DISCORD_DETAILS_WORDING("CUSTOM_DISCORD_DETAILS_WORDING");
90 |
91 | /** Identifies the Discord application to which information has to be sent
92 | * in order to appear in Discord's UI. */
93 | public static final String DEFAULT_DISCORD_APPLICATION_ID = "413038514616139786";
94 |
95 | private static final Map A simple fake class that extends ChildOfIEditorInput. This class is used to test resolution of extensions in {@link EditorRichPresenceFromExtensionsTest}.
23 | *
24 | * Show no information in Discord.
25 | *
26 | * @author Emmanuel CHEBBI
27 | */
28 | public class UnknownInputRichPresence implements EditorInputToRichPresenceAdapter {
29 |
30 | @Override
31 | public int getPriority() {
32 | return Integer.MIN_VALUE;
33 | }
34 |
35 | @Override
36 | public Class extends IEditorInput> getExpectedEditorInputClass() {
37 | return IEditorInput.class;
38 | }
39 |
40 | @Override
41 | public Optional
41 | *
45 | */
46 | RESET_ELAPSED_TIME("RESET_ELAPSED_TIME"),
47 |
48 | /** Indicates that the elapsed time should only be reset when the software is started. */
49 | RESET_ELAPSED_TIME_ON_STARTUP("RESET_ELAPSED_TIME_ON_STARTUP"),
50 |
51 | /** Indicates that the elapsed time should be reset each time an editor opens for a file located in another project. */
52 | RESET_ELAPSED_TIME_ON_NEW_PROJECT("RESET_ELAPSED_TIME_ON_NEW_PROJECT"),
53 |
54 | /** Indicates that the elapsed time should be reset each time a new editor is focused. */
55 | RESET_ELAPSED_TIME_ON_NEW_FILE("RESET_ELAPSED_TIME_ON_NEW_FILE"),
56 |
57 | /** Whether the icon representing the language of the file being edited should be shown in Discord. */
58 | SHOW_LANGUAGE_ICON("SHOW_LANGUAGE_ICON"),
59 |
60 | /** Whether the project uses project-scope settings or global-scope settings. */
61 | USE_PROJECT_SETTINGS("USE_PROJECT_SETTINGS"),
62 |
63 | /**
64 | * Whether any information should be shown in Discord.
65 | *