46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/com.mousefeed/doc/testPlan.txt:
--------------------------------------------------------------------------------
1 | Start Eclipse Application
2 |
3 | SHORTCUT REMINDER
4 |
5 | Click File/Refresh menu item
6 |
7 | The reminder popup "F5 (Refresh)" shows up near the cursor.
8 | It disappears in a few seconds.
9 |
10 | Click on the "Search" ToolBar button.
11 |
12 | The reminder popup "Ctrl+H (Search...)" shows up near the cursor.
13 |
14 | Open a text file. Call the actions "Copy", "Paste", "Find/Replace", "Find Next"
15 |
16 | The reminder popup should show up after the each action,
17 | reminding their keyboard shortcuts.
18 |
19 |
20 |
21 | PREFERENCES
22 |
23 | - PROMOTE KEYS CHECKBOX
24 |
25 | Uncheck it, click File/Refresh menu item
26 |
27 | No reminder popup
28 |
29 | Check it, click File/Refresh menu item
30 |
31 | Reminder popup
32 |
--------------------------------------------------------------------------------
/com.mousefeed/header.txt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software, Sigasi & Robert Wloch 2012.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
--------------------------------------------------------------------------------
/com.mousefeed/html/concepts/maintopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Main Topic
7 |
8 |
9 |
10 |
Main Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/concepts/subtopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic
7 |
8 |
9 |
10 |
Sub Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/concepts/subtopic2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic 2
7 |
8 |
9 |
10 |
Sub Topic 2
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/gettingstarted/maintopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Main Topic
7 |
8 |
9 |
10 |
Main Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/gettingstarted/subtopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic
7 |
8 |
9 |
10 |
Sub Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/gettingstarted/subtopic2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic 2
7 |
8 |
9 |
10 |
Sub Topic 2
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/reference/maintopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Main Topic
7 |
8 |
9 |
10 |
Main Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/reference/subtopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic
7 |
8 |
9 |
10 |
Sub Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/reference/subtopic2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic 2
7 |
8 |
9 |
10 |
Sub Topic 2
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/tasks/maintopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Main Topic
7 |
8 |
9 |
10 |
Main Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/tasks/subtopic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic
7 |
8 |
9 |
10 |
Sub Topic
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/tasks/subtopic2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sub Topic 2
7 |
8 |
9 |
10 |
Sub Topic 2
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/html/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Table of Contents
7 |
8 |
9 |
10 |
Table of Contents
11 | Please enter your text here.
12 |
13 |
--------------------------------------------------------------------------------
/com.mousefeed/plugin.properties:
--------------------------------------------------------------------------------
1 | # Copyright (C) Heavy Lifting Software, Sigasi & Robert Wloch 2012.
2 | #
3 | # This file is part of MouseFeed.
4 | #
5 | # MouseFeed is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Lesser General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # MouseFeed is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU Lesser General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Lesser General Public License
16 | # along with MouseFeed. If not, see .
17 | actionInvocation=Action Invocation
18 | configureActionInvocation=Last Action Invocation...
19 | configureActionInvocationDesc=Configure previous action invocation (MouseFeed Plugin).
20 | mouseFeedCommandCategory=MouseFeed
--------------------------------------------------------------------------------
/com.mousefeed/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
10 |
11 |
13 |
14 |
16 |
17 |
19 |
20 |
22 |
23 |
24 |
26 |
30 |
31 |
36 |
37 |
38 |
40 |
42 |
43 |
44 |
46 |
48 |
49 |
50 |
52 |
56 |
57 |
62 |
63 |
64 |
66 |
69 |
70 |
71 |
73 |
77 |
78 |
79 |
81 |
83 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/com.mousefeed/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | com.mousefeed
7 | parent
8 | 2.0.3-SNAPSHOT
9 | ../pom.xml
10 |
11 |
12 | com.mousefeed
13 | com.mousefeed
14 | Mousefeed Plugin
15 | 2.0.3-SNAPSHOT
16 |
17 | eclipse-plugin
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/client/Messages.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.client;
20 |
21 | import static org.apache.commons.lang.StringUtils.isBlank;
22 |
23 | import java.text.MessageFormat;
24 | import java.util.MissingResourceException;
25 | import java.util.ResourceBundle;
26 |
27 | /**
28 | * Provides localized messages. Messages are retrieved with
29 | * {@link #get(String, Object...)}. If it is be provided with a class to
30 | * retrieve the messages for, one can drop this class name from the key names.
31 | *
32 | * @see #get(String, Object...)
33 | * @author Andriy Palamarchuk
34 | */
35 | public class Messages {
36 | /**
37 | * The base name of the messages properties file for {@link #BUNDLE}.
38 | */
39 | private static final String MESSAGES_BASE = Messages.class.getPackage()
40 | .getName() + ".messages";
41 |
42 | /**
43 | * The messages resource bundle.
44 | */
45 | private static final ResourceBundle BUNDLE = ResourceBundle
46 | .getBundle(MESSAGES_BASE);
47 |
48 | /**
49 | * The class to find messages for by using keys missing class name.
50 | */
51 | private final Class> forClass;
52 |
53 | /**
54 | * Constructor. For an object created by this constructor it is necessary to
55 | * pass full message key to {@link #get(String, Object...)}.
56 | *
57 | * @see #Messages(Class)
58 | */
59 | public Messages() {
60 | this(AbstractNoForClassIsSpecified.class);
61 | }
62 |
63 | /**
64 | * Constructor. For an object created by this constructor the messages
65 | * associated with the specified class can be retrieved by passing a key
66 | * part after class base name as well as full message key to
67 | * {@link #get(String, Object...)}.
68 | *
69 | * @param forClass
70 | * the class to retrieve messages for. Passing null
71 | * value is equivalent to {@link #Messages()}.
72 | * @see #get(String, Object...)
73 | */
74 | public Messages(final Class> forClass) {
75 | this.forClass = forClass == null ? AbstractNoForClassIsSpecified.class
76 | : forClass;
77 | }
78 |
79 | /**
80 | * Returns the message for the defined key. If the object is provided with a
81 | * class to retrieve messages for (e.g. is created with
82 | * {@link #Messages(Class)}), this method tries to retrieve the message on a
83 | * key composed with that class name and the provided key. If the message is
84 | * not found, it finds the message using the provided key as is. If no class
85 | * is provided, the method returns searches the message using the provided
86 | * key.
87 | *
88 | * @param key
89 | * the message id. Not null or empty string.
90 | * @param arguments
91 | * the message arguments when the message will be formatted by
92 | * {@link MessageFormat#format}.
93 | * @return the message for the defined key. Never null.
94 | * @throws NullPointerException
95 | * if the provided key is blank.
96 | * @throws MissingResourceException
97 | * if the provided key is not found.
98 | */
99 | public String get(final String key, final Object... arguments)
100 | throws NullPointerException, MissingResourceException {
101 | if (isBlank(key)) {
102 | throw new NullPointerException("Blank key was provided: '" + key
103 | + "'");
104 | }
105 | try {
106 | final String forClassKey = forClass.getSimpleName() + "." + key;
107 | return getFromBundle(forClassKey, arguments);
108 | } catch (final MissingResourceException e) {
109 | return getFromBundle(key, arguments);
110 | }
111 | }
112 |
113 | /**
114 | * Retrieves the string specified by the key from bundle.
115 | *
116 | * @param key
117 | * the message key. Not blank.
118 | * @return the message by the key. The message is formatted with
119 | * {@link MessageFormat#format(Object)} if any arguments are
120 | * provided.
121 | */
122 | private String getFromBundle(final String key, final Object... arguments) {
123 | final String pattern = BUNDLE.getString(key);
124 | return arguments.length == 0 ? pattern : MessageFormat.format(pattern,
125 | arguments);
126 | }
127 |
128 | /**
129 | * A "null" class used to initialize {@link Messages#forClass} if no class
130 | * is specified.
131 | */
132 | private abstract static class AbstractNoForClassIsSpecified {
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/client/OnWrongInvocationMode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.client;
20 |
21 | /**
22 | * What to do if an action is called with a wrong mode.
23 | * E.g. in a situation when an action must be called with a keyboard,
24 | * but is called with a mouse.
25 | *
26 | * @author Andriy Palamarchuk
27 | */
28 | public enum OnWrongInvocationMode {
29 | /**
30 | * Allow user to proceed.
31 | */
32 | DO_NOTHING,
33 |
34 | /**
35 | * Remind the user that he uses incorrect access mode.
36 | */
37 | REMIND,
38 |
39 | /**
40 | * Prevent the action from running, remind the user.
41 | */
42 | ENFORCE;
43 |
44 | /**
45 | * The default access mode.
46 | */
47 | public static final OnWrongInvocationMode DEFAULT = REMIND;
48 |
49 | /**
50 | * Provides label text.
51 | */
52 | private static final Messages MESSAGES =
53 | new Messages(OnWrongInvocationMode.class);
54 |
55 | /**
56 | * Human-readable label text.
57 | * @return the label text. Never null.
58 | */
59 | public String getLabel() {
60 | return MESSAGES.get(name());
61 | }
62 |
63 | /**
64 | * Labels of the enumeration values.
65 | * @return the labels of the enumeration values.
66 | * Array of the same size as {@link #values()}.
67 | */
68 | public static String[] getLabels() {
69 | final String[] labels = new String[values().length];
70 | for (int i = 0; i < values().length; i++) {
71 | labels[i] = values()[i].getLabel();
72 | }
73 | return labels;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/client/collector/AbstractActionDesc.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.client.collector;
20 |
21 | import static org.apache.commons.lang.StringUtils.isBlank;
22 | import static org.apache.commons.lang.Validate.isTrue;
23 | /**
24 | * Information about an action invoked by the user.
25 | *
26 | * @author Andriy Palamarchuk
27 | */
28 | public abstract class AbstractActionDesc {
29 | /**
30 | * @see #getLabel()
31 | */
32 | private String label;
33 |
34 | /**
35 | * @see #getAccelerator()
36 | */
37 | private String accelerator;
38 |
39 | /**
40 | * The id of the user action.
41 | * @return the string identifying the action invoked by the user.
42 | * The default behavior is to return {@link #getLabel()}.
43 | * Subclasses should provide better values.
44 | * Never blank.
45 | */
46 | public String getId() {
47 | return getLabel();
48 | }
49 |
50 | /**
51 | * The action human-readable label.
52 | * @return the label. Should not be blank after initialized.
53 | * The '&' characters are removed from the original value.
54 | */
55 | public String getLabel() {
56 | return label;
57 | }
58 |
59 | /**
60 | * @param label the new label. Not blank.
61 | * @see #getLabel()
62 | */
63 | public void setLabel(final String label) {
64 | isTrue(label != null);
65 | if (isBlank(label))
66 | this.label = "";
67 | else
68 | this.label = label.replace("&", "");
69 | }
70 |
71 | /**
72 | * Indicates whether the action has a keyboard shortcut.
73 | * @return true if the action description has
74 | * keyboard shortcut.
75 | */
76 | public boolean hasAccelerator() {
77 | return getAccelerator() != null;
78 | }
79 |
80 | /**
81 | * The keyboard combination to call the action.
82 | * @return a string describing the action keyboard combination.
83 | * Can be null if there is no keyboard combination for the
84 | * action.
85 | */
86 | public String getAccelerator() {
87 | return accelerator;
88 | }
89 |
90 | /**
91 | * @param accelerator the new shortcut value. Can be null.
92 | * @see #getAccelerator()
93 | */
94 | public void setAccelerator(final String accelerator) {
95 | this.accelerator = accelerator;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/client/collector/Collector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.client.collector;
20 |
21 | import static org.apache.commons.lang.Validate.notNull;
22 |
23 | /**
24 | * Collects user activity data.
25 | * @author Andriy Palamarchuk
26 | */
27 | public class Collector {
28 |
29 | /**
30 | * @see #getLastAction()
31 | */
32 | private AbstractActionDesc lastAction;
33 |
34 | /**
35 | * Default constructor. Does nothing.
36 | */
37 | public Collector() {
38 | }
39 |
40 | /**
41 | * The last non-internal action provided to the collector.
42 | * @return the last action provided to the method
43 | * {@link #onAction(AbstractActionDesc)},
44 | * null if there were no calls to that method yet.
45 | * @see #onAction(AbstractActionDesc)
46 | */
47 | public AbstractActionDesc getLastAction() {
48 | return lastAction;
49 | }
50 |
51 | /**
52 | * Must be called on user action.
53 | * @param action the action. Not be null.
54 | */
55 | public void onAction(final AbstractActionDesc action) {
56 | notNull(action);
57 | lastAction = action;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/client/collector/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
24 |
25 | Classes to collect and analyze user data.
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/client/messages.properties:
--------------------------------------------------------------------------------
1 | # Properties naming conventions:
2 | # [ | common][.type].id[.usage]
3 | #
4 | # [ | common] - "common" if the key is used in multiple classes.
5 | # If it is a class-specific key use the base name of the class,
6 | # e.g. PreferencePage
7 | #
8 | # type - dot delimited words from the most general to the most specific.
9 | # Construct it, so the message for the same area are kept together.
10 | # Common types - 'error', 'validation', 'types'.
11 | #
12 | # id - the message id.
13 | #
14 | # usage - the message usage. For grouping messages for the same area.
15 | # For example, a message dialog can take a title and a text message
16 | # as parameters. The code calling message dialog can define keys, which are
17 | # the same except this field will have value "title" for the title text
18 | # and "message" for the message text.
19 | #
20 | # First are listed the common messages
21 |
22 | common.cancel=Cancel
23 | common.ok=OK
24 |
25 | ActionInvocationModeControl.actionTable.column.action=Action
26 | ActionInvocationModeControl.actionTable.column.onWrongInvocationMode=On Mouse Click
27 | ActionInvocationModeControl.label.addActionConfigReminder=Use action "" Invocation... to add entries.
28 | ActionInvocationModeControl.removeButton.label=&Remove Selected
29 |
30 | ActionInvocationPreferencePage.description=How actions are accessed:
31 | ActionInvocationPreferencePage.field.defaultOnWrongInvocationMode.label=When an action is called with a mouse click
32 | ActionInvocationPreferencePage.field.invocationControlEnabledCheckbox.label=Enable action invocation control
33 | ActionInvocationPreferencePage.field.invocationControlEnabledCheckbox.tooltip=Help to learn the desired way to invoke actions
34 | ActionInvocationPreferencePage.field.configureKeyboardShortcutCheckbox.label=Configure keyboard shortcut for often used actions
35 | ActionInvocationPreferencePage.field.configureKeyboardShortcutCheckbox.tooltip=Open the Keys preference page to set a keyboard shortcut for actions without one that you use often
36 | ActionInvocationPreferencePage.field.configureKeyboardShortcutThreshold.label=Action invocation counter threshold for configuring keyboard shortcut for often used actions
37 | ActionInvocationPreferencePage.field.configureKeyboardShortcutThreshold.tooltip=Open the Keys preference page to set a keyboard shortcut for actions without one that you used as many time as you set here
38 |
39 | ConfigureActionInvocationDialog.field.actionName.label=Action: {0}
40 | ConfigureActionInvocationDialog.field.onWrongInvocationMode.label=When the action is called with a mouse click
41 | ConfigureActionInvocationDialog.field.onWrongInvocationMode.value.default=Do as Configured in MouseFeed Preferences
42 | ConfigureActionInvocationDialog.title=MouseFeed: Action "{0}" Invocation
43 |
44 | ConfigureActionInvocationHandler.menuItem.lastActionInvocation.label="{0}" Invocation...
45 |
46 | LastActionInvocationRemiderFactory.text=Tip: Last Action Invocation... ({0})
47 | LastActionInvocationRemiderFactory.configureActionInvocation-noBinding=
48 |
49 | # this message is used for the Messages unit tests only
50 | MessagesTest.message=Message with arguments {0}, {1}
51 |
52 | NagPopUp.title.canceled=Canceled by MouseFeed
53 | NagPopUp.title.reminder=MouseFeed
54 | NagPopUp.message.configureShortcut=Configure a shortcut for {0}...
55 |
56 | OnWrongInvocationMode.DO_NOTHING=Do Nothing
57 | OnWrongInvocationMode.ENFORCE=Enforce the Action Keyboard Shortcut
58 | OnWrongInvocationMode.REMIND=Remind the Action Keyboard Shortcut
59 |
60 | PreferencePage.description=Set general MouseFeed preferences:
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/client/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
24 |
25 | Provides classes shared between the MouseFeed clients.
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/AcceleratorSearchResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | /**
22 | * Result of an action accelerator search.
23 | *
24 | * @author Andriy Palamarchuk
25 | */
26 | public class AcceleratorSearchResult {
27 | /**
28 | * Default constructor does nothing.
29 | */
30 | public AcceleratorSearchResult() {
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/ActionDescImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.StringUtils.isBlank;
22 | import static org.apache.commons.lang.StringUtils.isNotBlank;
23 | import static org.apache.commons.lang.Validate.isTrue;
24 |
25 | import com.mousefeed.client.collector.AbstractActionDesc;
26 |
27 | /**
28 | * Eclipse-specific action description.
29 | *
30 | * @author Andriy Palamarchuk
31 | */
32 | public class ActionDescImpl extends AbstractActionDesc {
33 | /**
34 | * @see #getClassName()
35 | */
36 | private String className;
37 |
38 | /**
39 | * @see #getDef()
40 | */
41 | private String def;
42 |
43 | /**
44 | * Default constructor does nothing.
45 | */
46 | public ActionDescImpl() {
47 | }
48 |
49 | /**
50 | * @return the id. Returns the first non-blank value of the following:
51 | * {@link #getDef()}, {@link #getClassName()}. If all of these are blank,
52 | * returns base implementation.
53 | */
54 | @Override
55 | public String getId() {
56 | if (isNotBlank(getDef())) {
57 | return getDef();
58 | }
59 | if (isNotBlank(getClassName())) {
60 | return getClassName();
61 | }
62 | return super.getId();
63 | }
64 |
65 | /**
66 | * The action/command class name.
67 | * @return the className. Can be null.
68 | * @see #getId()
69 | */
70 | public String getClassName() {
71 | return className;
72 | }
73 |
74 | /**
75 | * @param className the className to set.
76 | * If blank, the existing value does not change.
77 | * @see #getClassName()
78 | */
79 | public void setClassName(final String className) {
80 | if (isBlank(className)) {
81 | return;
82 | }
83 |
84 | isNullOrNotEqual(this.className, className);
85 | this.className = className;
86 | }
87 |
88 | /**
89 | * The action/command definition id.
90 | * @return the definition id. Can be null.
91 | * @see #getId()
92 | */
93 | public String getDef() {
94 | return def;
95 | }
96 |
97 | /**
98 | * @param def the definition id to set.
99 | * If blank, the existing value does not change.
100 | * @see #getDef()
101 | */
102 | public void setDef(final String def) {
103 | if (isBlank(def)) {
104 | return;
105 | }
106 |
107 | isNullOrNotEqual(this.def, def);
108 | this.def = def;
109 | }
110 |
111 | /**
112 | * Throws IllegalArgumentException if val1 is not
113 | * null and is equal val2.
114 | * @param val1 the main value to check. Can be null.
115 | * @param val2 the value to check against. Assumed not null.
116 | */
117 | private void isNullOrNotEqual(final String val1, final String val2) {
118 | isTrue(val1 == null || val2.equals(val1),
119 | "Should be different: " + val2 + " and " + val1);
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/Activator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.Validate.isTrue;
22 |
23 | import com.mousefeed.client.collector.Collector;
24 | import org.eclipse.jface.resource.ImageDescriptor;
25 | import org.eclipse.ui.plugin.AbstractUIPlugin;
26 |
27 | /**
28 | * The activator class controls the plug-in life cycle.
29 | * @author Andriy Palamarchuk
30 | */
31 | public class Activator extends AbstractUIPlugin {
32 |
33 | /**
34 | * The plug-in ID.
35 | */
36 | public static final String PLUGIN_ID = "com.mousefeed";
37 |
38 | /**
39 | * The shared instance.
40 | */
41 | private static Activator plugin;
42 |
43 | /**
44 | * @see #getCollector()
45 | */
46 | private final Collector collector = new Collector();
47 |
48 | /**
49 | * The constructor.
50 | */
51 | public Activator() {
52 | isTrue(plugin == null);
53 | plugin = this;
54 | }
55 |
56 | /**
57 | * Returns the shared instance.
58 | *
59 | * @return the shared instance.
60 | * null before an activator is created or after it is stopped.
61 | */
62 | public static Activator getDefault() {
63 | return plugin;
64 | }
65 |
66 | /**
67 | * Returns an image descriptor for the image file at the given
68 | * plug-in relative path.
69 | *
70 | * @param path the path
71 | * @return the image descriptor
72 | */
73 | public static ImageDescriptor getImageDescriptor(final String path) {
74 | return imageDescriptorFromPlugin(PLUGIN_ID, path);
75 | }
76 |
77 | /**
78 | * Gathers user activity data.
79 | * @return the data collector. Not null.
80 | */
81 | public Collector getCollector() {
82 | return collector;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/CommandActionDescGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.Validate.notNull;
22 |
23 | import com.mousefeed.client.collector.AbstractActionDesc;
24 | import org.eclipse.core.commands.Command;
25 | import org.eclipse.core.commands.common.NotDefinedException;
26 | import org.eclipse.jface.bindings.TriggerSequence;
27 | import org.eclipse.ui.PlatformUI;
28 | import org.eclipse.ui.keys.IBindingService;
29 | import org.eclipse.ui.menus.CommandContributionItem;
30 |
31 | /**
32 | /**
33 | * Generates {@link ActionDescImpl} from {@link CommandContributionItem}.
34 | * Pure strategy.
35 | *
36 | * @author Andriy Palamarchuk
37 | */
38 | class CommandActionDescGenerator {
39 | /**
40 | * Retrieves a command from a command contribution item.
41 | */
42 | private final CommandContributionItemCommandLocator locator =
43 | new CommandContributionItemCommandLocator();
44 |
45 | /**
46 | * The binding service used to retrieve bindings data.
47 | */
48 | private final IBindingService bindingService;
49 |
50 | /**
51 | * Constructor.
52 | */
53 | public CommandActionDescGenerator() {
54 | bindingService =
55 | (IBindingService) PlatformUI.getWorkbench().getAdapter(
56 | IBindingService.class);
57 | }
58 |
59 | /**
60 | * Generates action description from the command contribution item.
61 | * @param commandContributionItem the contribution item to generate
62 | * an action description for.
63 | * Not null.
64 | * @return the action description for the provided action.
65 | * Never null.
66 | */
67 | public AbstractActionDesc generate(
68 | final CommandContributionItem commandContributionItem) {
69 | notNull(commandContributionItem);
70 |
71 | final ActionDescImpl actionDesc = new ActionDescImpl();
72 | final Command command = locator.get(commandContributionItem);
73 | if (command == null) {
74 | return null;
75 | }
76 | try {
77 | actionDesc.setLabel(command.getName());
78 | } catch (final NotDefinedException e) {
79 | // should never happen
80 | throw new RuntimeException(e);
81 | }
82 | final String commandId = command.getId();
83 | actionDesc.setDef(commandId);
84 | final TriggerSequence binding =
85 | bindingService.getBestActiveBindingFor(commandId);
86 | if (binding != null) {
87 | actionDesc.setAccelerator(binding.format());
88 | }
89 | return actionDesc;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/CommandContributionItemCommandLocator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.Validate.notNull;
22 | import java.lang.reflect.Field;
23 | import org.eclipse.core.commands.Command;
24 | import org.eclipse.core.commands.ParameterizedCommand;
25 | import org.eclipse.ui.menus.CommandContributionItem;
26 |
27 | /**
28 | * Retrieves {@link Command} from {@link CommandContributionItem}.
29 | *
30 | * @author Andriy Palamarchuk
31 | */
32 | public class CommandContributionItemCommandLocator {
33 | /**
34 | * Name of the field storing command in the {@link CommandContributionItem}
35 | * object.
36 | */
37 | private static final String COMMAND_FIELD = "command";
38 |
39 | /**
40 | * Default constructor does nothing.
41 | */
42 | public CommandContributionItemCommandLocator() {
43 | }
44 |
45 | /**
46 | * Performs the actual retrieval.
47 | * @param item the command contribution item to retrieve command from.
48 | * @return the command stored in the command contribution item.
49 | * Can be null if the command can't be found.
50 | */
51 | public Command get(final CommandContributionItem item) {
52 | final ParameterizedCommand parCommand = getItemParCommand(item);
53 | return parCommand == null ? null : parCommand.getCommand();
54 | }
55 |
56 | /**
57 | * Parameterized command of the command contribution item.
58 | * @param item the item to extract the command from.
59 | * @return the command or null if can't be found.
60 | */
61 | private ParameterizedCommand getItemParCommand(
62 | final CommandContributionItem item) {
63 | final Field commandField = getCommandField();
64 | try {
65 | commandField.setAccessible(true);
66 | return (ParameterizedCommand) commandField.get(item);
67 | } catch (final SecurityException e) {
68 | throw new RuntimeException(e);
69 | } catch (final IllegalArgumentException e) {
70 | throw new RuntimeException(e);
71 | } catch (final IllegalAccessException e) {
72 | throw new RuntimeException(e);
73 | }
74 | }
75 |
76 | /**
77 | * The command field of the command contribution item class.
78 | * @return the command field. Never null.
79 | */
80 | private Field getCommandField() {
81 | try {
82 | final Field commandField =
83 | CommandContributionItem.class.getDeclaredField(
84 | COMMAND_FIELD);
85 | notNull(commandField);
86 | return commandField;
87 | } catch (final SecurityException e) {
88 | throw new RuntimeException(e);
89 | } catch (final NoSuchFieldException e) {
90 | throw new RuntimeException(e);
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/DestroyFontDisposeListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import org.eclipse.swt.events.DisposeEvent;
22 | import org.eclipse.swt.events.DisposeListener;
23 | import org.eclipse.swt.graphics.Font;
24 |
25 | /**
26 | * Disposes the provided font when the widget it listens to is disposed.
27 | * @author Andriy Palamarchuk
28 | */
29 | class DestroyFontDisposeListener implements DisposeListener {
30 | /**
31 | * The font to destroy.
32 | */
33 | private final Font newFont;
34 |
35 | public DestroyFontDisposeListener(final Font newFont) {
36 | this.newFont = newFont;
37 | }
38 |
39 | public void widgetDisposed(final DisposeEvent e) {
40 | newFont.dispose();
41 | }
42 | }
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/HandledActionDescGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.Validate.notNull;
22 |
23 | import com.mousefeed.client.collector.AbstractActionDesc;
24 | import org.eclipse.core.commands.Command;
25 | import org.eclipse.core.commands.common.NotDefinedException;
26 | import org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem;
27 | import org.eclipse.jface.bindings.TriggerSequence;
28 | import org.eclipse.ui.PlatformUI;
29 | import org.eclipse.ui.keys.IBindingService;
30 |
31 | /**
32 | * /** Generates {@link ActionDescImpl} from {@link HandledContributionItem}.
33 | * Pure strategy.
34 | *
35 | * @author Robert Wloch (robert@rowlo.de)
36 | */
37 | @SuppressWarnings("restriction")
38 | class HandledActionDescGenerator {
39 | /**
40 | * Retrieves a command from a handled contribution item.
41 | */
42 | private final HandledContributionItemCommandLocator locator = new HandledContributionItemCommandLocator();
43 |
44 | /**
45 | * The binding service used to retrieve bindings data.
46 | */
47 | private final IBindingService bindingService;
48 |
49 | /**
50 | * Constructor.
51 | */
52 | public HandledActionDescGenerator() {
53 | bindingService = (IBindingService) PlatformUI.getWorkbench()
54 | .getAdapter(IBindingService.class);
55 | }
56 |
57 | /**
58 | * Generates action description from the handled contribution item.
59 | *
60 | * @param handledContributionItem
61 | * the contribution item to generate an action description for.
62 | * Not null.
63 | * @return the action description for the provided action.
64 | */
65 | public AbstractActionDesc generate(
66 | final HandledContributionItem handledContributionItem) {
67 | notNull(handledContributionItem);
68 |
69 | final ActionDescImpl actionDesc = new ActionDescImpl();
70 | final Command command = locator.get(handledContributionItem);
71 | if (command == null) {
72 | return null;
73 | }
74 | try {
75 | actionDesc.setLabel(command.getName());
76 | } catch (final NotDefinedException e) {
77 | // should never happen
78 | throw new RuntimeException(e);
79 | }
80 | final String commandId = command.getId();
81 | actionDesc.setDef(commandId);
82 | final TriggerSequence binding = bindingService
83 | .getBestActiveBindingFor(commandId);
84 | if (binding != null) {
85 | actionDesc.setAccelerator(binding.format());
86 | }
87 | return actionDesc;
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/HandledContributionItemCommandLocator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.Validate.notNull;
22 |
23 | import java.lang.reflect.Field;
24 | import org.eclipse.core.commands.Command;
25 | import org.eclipse.core.commands.ParameterizedCommand;
26 | import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
27 | import org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem;
28 |
29 | /**
30 | * Retrieves {@link Command} from {@link HandledContributionItem}.
31 | *
32 | * @author Robert Wloch (robert@rowlo.de)
33 | */
34 | @SuppressWarnings("restriction")
35 | public class HandledContributionItemCommandLocator {
36 | /**
37 | * Name of the field storing model in the {@link HandledContributionItem}
38 | * object.
39 | */
40 | private static final String MODEL_FIELD = "model";
41 | private static final String MODELITEM_FIELD = "modelItem";
42 |
43 | /**
44 | * Default constructor does nothing.
45 | */
46 | public HandledContributionItemCommandLocator() {
47 | }
48 |
49 | /**
50 | * Performs the actual retrieval.
51 | *
52 | * @param item
53 | * the handled contribution item to retrieve command from.
54 | * @return the command stored in the handled contribution item. Can be
55 | * null if the command can't be found.
56 | */
57 | public Command get(final HandledContributionItem item) {
58 | final ParameterizedCommand parCommand = getItemParCommand(item);
59 | return parCommand == null ? null : parCommand.getCommand();
60 | }
61 |
62 | /**
63 | * Parameterized command of the handled contribution item.
64 | *
65 | * @param item
66 | * the item to extract the command from.
67 | * @return the command or null if can't be found.
68 | */
69 | private ParameterizedCommand getItemParCommand(
70 | final HandledContributionItem item) {
71 | // the ParameterizedCommand is stored in the field
72 | // HandledContributionItem.model.wbCommand
73 | final Field modelField = getModelField(item);
74 | try {
75 | modelField.setAccessible(true);
76 | final MHandledItem mItem = (MHandledItem) modelField.get(item);
77 | return mItem.getWbCommand();
78 | } catch (final SecurityException e) {
79 | throw new RuntimeException(e);
80 | } catch (final IllegalArgumentException e) {
81 | throw new RuntimeException(e);
82 | } catch (final IllegalAccessException e) {
83 | throw new RuntimeException(e);
84 | }
85 | }
86 |
87 | /**
88 | * The model field of the handled contribution item class.
89 | *
90 | * @return the model field. Never null.
91 | */
92 | private Field getModelField(final HandledContributionItem item) {
93 | try {
94 | final Field modelField = item.getClass().getDeclaredField(MODEL_FIELD); //Eclipse 4.2-4.5 get model field in HandledContributionItem
95 | notNull(modelField);
96 | return modelField;
97 | } catch (final SecurityException e) {
98 | throw new RuntimeException(e);
99 | } catch (final NoSuchFieldException e) {
100 | try {
101 | final Field modelItemField = item.getClass().getSuperclass() //Eclipse 4.6 get modelItem field in AbstractContributionItem
102 | .getDeclaredField(MODELITEM_FIELD);
103 | notNull(modelItemField);
104 | return modelItemField;
105 | } catch (final SecurityException ee) {
106 | throw new RuntimeException(ee);
107 | } catch (final NoSuchFieldException ee) {
108 | throw new RuntimeException(ee);
109 | }
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/LastActionInvocationRemiderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import com.mousefeed.client.Messages;
22 | import org.eclipse.jface.bindings.TriggerSequence;
23 | import org.eclipse.ui.IWorkbench;
24 | import org.eclipse.ui.PlatformUI;
25 | import org.eclipse.ui.keys.IBindingService;
26 |
27 | /**
28 | * Generates text for the reminder to configure the last action invocation.
29 | *
30 | * @author Andriy Palamarchuk
31 | */
32 | public class LastActionInvocationRemiderFactory {
33 | /**
34 | * The id of the action to configure action invocation.
35 | */
36 | private static final String CONFIGURE_ACTION_INVOCATION_ACTION_ID =
37 | "com.mousefeed.commands.configureActionInvocation";
38 |
39 | /**
40 | * Provides messages text.
41 | */
42 | private static final Messages MESSAGES = new Messages(
43 | LastActionInvocationRemiderFactory.class);
44 |
45 | /**
46 | * Default constructor does nothing.
47 | */
48 | public LastActionInvocationRemiderFactory() {
49 | }
50 |
51 | /**
52 | * The reminder text.
53 | * @return the reminder text. Not null.
54 | */
55 | public String getText() {
56 | final TriggerSequence[] bindings =
57 | getBindingService().getActiveBindingsFor(
58 | CONFIGURE_ACTION_INVOCATION_ACTION_ID);
59 | final String binding = bindings.length == 0
60 | ? MESSAGES.get("configureActionInvocation-noBinding")
61 | : bindings[0].format();
62 | return MESSAGES.get("text", binding);
63 | }
64 |
65 | /**
66 | * The workbench binding service.
67 | * @return the binding service. Not null.
68 | */
69 |
70 | private IBindingService getBindingService() {
71 | return (IBindingService) getWorkbench().getAdapter(
72 | IBindingService.class);
73 | }
74 |
75 | /**
76 | * Current workbench. Not null.
77 | */
78 | private IWorkbench getWorkbench() {
79 | return PlatformUI.getWorkbench();
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/Layout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.Validate.isTrue;
22 | import static org.apache.commons.lang.Validate.notNull;
23 |
24 | import org.eclipse.swt.SWT;
25 | import org.eclipse.swt.layout.FormAttachment;
26 | import org.eclipse.swt.layout.FormData;
27 | import org.eclipse.swt.layout.FormLayout;
28 | import org.eclipse.swt.widgets.Control;
29 |
30 | /**
31 | * A layout helper.
32 | * Provides routines and constant for layout out the plugin UI.
33 | * Is not intended to be instantiated or sub-classed.
34 | *
35 | * @author Andriy Palamarchuk
36 | */
37 | public final class Layout {
38 | /**
39 | * Distance between controls placed one above another.
40 | */
41 | public static final int STACKED_V_OFFSET = 10;
42 |
43 | /**
44 | * Horizontal distance between two different consecutive controls.
45 | */
46 | public static final int H_OFFSET = 10;
47 |
48 | /**
49 | * Distance between a label and its control below.
50 | */
51 | public static final int STACKED_LABEL_V_OFFSET = 0;
52 |
53 | /**
54 | * Margin around the borders of a window.
55 | */
56 | public static final int WINDOW_MARGIN = 10;
57 |
58 | /**
59 | * Numerator of 100% when denominator is 100.
60 | */
61 | public static final int WHOLE_SIZE = 100;
62 |
63 | /**
64 | * Private constructor to insure no instances are ever created.
65 | */
66 | private Layout() { }
67 |
68 | /**
69 | * Places control right under aboveControl.
70 | * The controls' container must have FormLayout.
71 | * @param control the control to place. Must have the same parent as
72 | * aboveControl. Not null.
73 | * @param aboveControl the control to place under.
74 | * If null, control is placed
75 | * {@link #WINDOW_MARGIN} pixels from the left side of the container,
76 | * and gap is interpreted as 0.
77 | * This is done to eliminate a special treatment of the topmost controls
78 | * in the client code.
79 | * @param gap distance in pixels between the bottom of
80 | * aboveControl and top of control.
81 | * Greater than 0.
82 | * @return the layout data of the control.
83 | */
84 | public static FormData placeUnder(final Control control, final Control aboveControl,
85 | final int gap) {
86 | notNull(control);
87 | isTrue(aboveControl == null
88 | || control.getParent().equals(aboveControl.getParent()));
89 | isTrue(control.getParent().getLayout() instanceof FormLayout);
90 | isTrue(gap >= 0);
91 |
92 | final FormData formData = new FormData();
93 | formData.left = aboveControl == null
94 | ? getLeftAttachment()
95 | : new FormAttachment(aboveControl, 0, SWT.LEFT);
96 | final int offset = aboveControl == null ? WINDOW_MARGIN : gap;
97 | formData.top = new FormAttachment(aboveControl, offset);
98 | control.setLayoutData(formData);
99 | return formData;
100 | }
101 |
102 | /**
103 | * Form attachment placing the control {@link #WINDOW_MARGIN} pixels from
104 | * the left border.
105 | * @return form attachment. Never null.
106 | */
107 | private static FormAttachment getLeftAttachment() {
108 | return new FormAttachment(0, WINDOW_MARGIN);
109 | }
110 | }
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/Startup.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import org.eclipse.swt.SWT;
22 | import org.eclipse.swt.widgets.Display;
23 | import org.eclipse.ui.IStartup;
24 | import org.eclipse.ui.PlatformUI;
25 |
26 | /**
27 | * Hooks up the plugin listeners.
28 | * @author Andriy Palamarchuk
29 | */
30 | public class Startup implements IStartup {
31 |
32 | /**
33 | * Default constructor does nothing.
34 | */
35 | public Startup() {
36 | }
37 |
38 | /**
39 | * Hooks up event listeners.
40 | */
41 | public void earlyStartup() {
42 | getDisplay().asyncExec(new Runnable() {
43 | public void run() {
44 | getDisplay().addFilter(
45 | SWT.Selection, new GlobalSelectionListener());
46 | }
47 | });
48 | }
49 |
50 | /**
51 | * Current workbench display.
52 | * Not null.
53 | * @return the workbench display.
54 | */
55 | public Display getDisplay() {
56 | return PlatformUI.getWorkbench().getDisplay();
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/TextActionHandlerActionLocator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse;
20 |
21 | import static org.apache.commons.lang.Validate.isTrue;
22 | import static org.apache.commons.lang.Validate.notNull;
23 |
24 | import java.lang.reflect.Field;
25 | import java.util.Collections;
26 | import java.util.HashMap;
27 | import java.util.Map;
28 | import org.eclipse.jface.action.IAction;
29 |
30 | /**
31 | * Searches for an action inside of
32 | * org.eclipse.ui.actions.TextActionHandler utility actions.
33 | * If an action is found, provides action definition id, for the global
34 | * action belonging to the same command.
35 | *
36 | * @author Andriy Palamarchuk
37 | */
38 | public class TextActionHandlerActionLocator {
39 |
40 | /**
41 | * Name of class org.eclipse.ui.actions.TextActionHandler.
42 | */
43 | private static final String HANDLER_CLASS_NAME =
44 | "org.eclipse.ui.actions.TextActionHandler";
45 |
46 | /**
47 | * Action fields mapped to an action definition id.
48 | * Key - name of the field in
49 | * org.eclipse.ui.actions.TextActionHandler, storing an
50 | * action, value - the action definitions id for this action.
51 | */
52 | private static final Map HANDLER_ACTIONS;
53 | static {
54 | final Map map = new HashMap();
55 | map.put("copyAction", "org.eclipse.ui.edit.copy");
56 | HANDLER_ACTIONS = Collections.unmodifiableMap(map);
57 | }
58 |
59 | /**
60 | * Default constructor does nothing.
61 | */
62 | public TextActionHandlerActionLocator() {
63 | }
64 |
65 | /**
66 | * Indicates whether this class can search for an action inside
67 | * of the search target.
68 | * @param searchTarget where to search. Not null.
69 | * @return true if this class can search for an action inside
70 | * of the search target.
71 | */
72 | public boolean isSearchable(final IAction searchTarget) {
73 | notNull(searchTarget);
74 | return searchTarget.getClass().getName().startsWith(
75 | HANDLER_CLASS_NAME + "$");
76 | }
77 |
78 | /**
79 | * Finds an action inside of searchTarget.
80 | * @param action the action to search. Not null.
81 | * @param searchTarget where to search. Not null.
82 | * @return the action definition id for the global action for the same
83 | * command as action, if it
84 | */
85 | public String findActionDefinitionId(final IAction action, final IAction searchTarget) {
86 | try {
87 | return doFindActionDefinitionId(action, searchTarget);
88 | } catch (final SecurityException e) {
89 | throw new AssertionError(e);
90 | } catch (final NoSuchFieldException e) {
91 | throw new AssertionError(e);
92 | } catch (final IllegalAccessException e) {
93 | throw new AssertionError(e);
94 | }
95 | }
96 |
97 | /**
98 | * Contains all the logic of
99 | * {@link #findActionDefinitionId(IAction, IAction)}, leaving to it only
100 | * exception handling.
101 | */
102 | private String doFindActionDefinitionId(final IAction action,
103 | final IAction searchTarget)
104 | throws NoSuchFieldException, IllegalAccessException {
105 | notNull(action);
106 | notNull(searchTarget);
107 |
108 | final Object handler = getTextActionHandler(searchTarget);
109 | for (final String fieldName : HANDLER_ACTIONS.keySet()) {
110 | final IAction handlerAction =
111 | getActionFromField(handler, fieldName);
112 | if (handlerAction == null) {
113 | continue;
114 | }
115 | if (action.getClass().equals(
116 | handlerAction.getClass())) {
117 | return HANDLER_ACTIONS.get(fieldName);
118 | }
119 | }
120 | return null;
121 | }
122 |
123 | /**
124 | * Retrieves an action from the provided action field.
125 | */
126 | private IAction getActionFromField(final Object o, final String fieldName)
127 | throws NoSuchFieldException, IllegalAccessException {
128 | final Field actionField =
129 | o.getClass().getDeclaredField(fieldName);
130 | actionField.setAccessible(true);
131 | return (IAction) actionField.get(o);
132 | }
133 |
134 | /**
135 | * Retrieves org.eclipse.ui.actions.TextActionHandler from the
136 | * nested class action.
137 | * @param action the action to retrieve handler from. Not null.
138 | * @return the handler. Never null.
139 | */
140 | private Object getTextActionHandler(final IAction action)
141 | throws NoSuchFieldException, IllegalAccessException {
142 | notNull(action);
143 | final Field handlerField =
144 | action.getClass().getDeclaredField("this$0");
145 | notNull(handlerField);
146 | handlerField.setAccessible(true);
147 |
148 | final Object handler = handlerField.get(action);
149 | notNull(handler);
150 | isTrue(handler.getClass().getName().equals(HANDLER_CLASS_NAME));
151 | return handler;
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/commands/ConfigureActionInvocationDialog.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.commands;
20 |
21 | import static com.mousefeed.eclipse.Layout.STACKED_V_OFFSET;
22 | import static com.mousefeed.eclipse.Layout.placeUnder;
23 | import static org.apache.commons.lang.Validate.notNull;
24 |
25 | import com.mousefeed.client.Messages;
26 | import com.mousefeed.client.OnWrongInvocationMode;
27 | import com.mousefeed.client.collector.AbstractActionDesc;
28 | import com.mousefeed.eclipse.preferences.ActionOnWrongInvocationMode;
29 | import com.mousefeed.eclipse.preferences.PreferenceAccessor;
30 | import org.eclipse.jface.dialogs.Dialog;
31 | import org.eclipse.swt.SWT;
32 | import org.eclipse.swt.layout.FormLayout;
33 | import org.eclipse.swt.widgets.Combo;
34 | import org.eclipse.swt.widgets.Composite;
35 | import org.eclipse.swt.widgets.Control;
36 | import org.eclipse.swt.widgets.Label;
37 | import org.eclipse.swt.widgets.Shell;
38 |
39 | /**
40 | * The dialog to configure action invocation mode.
41 | *
42 | * @author Andriy Palamarchuk
43 | */
44 | public class ConfigureActionInvocationDialog extends Dialog {
45 | /**
46 | * Provides messages text.
47 | */
48 | private static final Messages MESSAGES =
49 | new Messages(ConfigureActionInvocationDialog.class);
50 |
51 | /**
52 | * The index of the value indicating using of the default on wrong
53 | * invocation mode handling.
54 | */
55 | private static final int DEFAULT_ON_WRONG_INVOCATION_MODE_IDX = 0;
56 |
57 | /**
58 | * The action description of the action to configure invocation mode for.
59 | */
60 | private final AbstractActionDesc actionDesc;
61 |
62 | /**
63 | * Setting what to do when user invokes an action using wrong invocation
64 | * mode.
65 | */
66 | private Combo onWrongInvocationModeCombo;
67 |
68 | /**
69 | * Provides access to the plugin preferences.
70 | */
71 | private final PreferenceAccessor preferences =
72 | PreferenceAccessor.getInstance();
73 |
74 | /**
75 | * The UI factory class.
76 | */
77 | private final OnWrongInvocationModeUI onWrongInvocationModeUI =
78 | new OnWrongInvocationModeUI();
79 |
80 | /**
81 | * The constructor. Creates the dialog.
82 | * @param parentShell the parent shell. Not null.
83 | * @param actionDesc the action description to create the dialog for.
84 | * Not null.
85 | */
86 | public ConfigureActionInvocationDialog(final Shell parentShell,
87 | final AbstractActionDesc actionDesc) {
88 | super(parentShell);
89 | notNull(parentShell);
90 | notNull(actionDesc);
91 | this.actionDesc = actionDesc;
92 | }
93 |
94 | // see base
95 | @Override
96 | protected Control createDialogArea(final Composite parent) {
97 | final Composite composite = new Composite(parent, SWT.NONE);
98 | composite.setLayout(new FormLayout());
99 | Control c;
100 | c = createActionNameLabel(composite, null);
101 |
102 | c = onWrongInvocationModeUI.createLabel(composite, c,
103 | MESSAGES.get("field.onWrongInvocationMode.label"));
104 | onWrongInvocationModeCombo =
105 | onWrongInvocationModeUI.createCombo(composite, c);
106 | onWrongInvocationModeCombo.add(getDefaultInvocationMode(), 0);
107 | updateOnWrongInvocationModeCombo(
108 | preferences.getOnWrongInvocationMode(actionDesc.getId()));
109 |
110 | applyDialogFont(composite);
111 | return composite;
112 | }
113 |
114 | // see base
115 | @Override
116 | protected void configureShell(final Shell shell) {
117 | super.configureShell(shell);
118 | shell.setText(MESSAGES.get("title", actionDesc.getLabel()));
119 | }
120 |
121 | /**
122 | * Creates a label for {@link #onWrongInvocationModeCombo}.
123 | */
124 | private Control createActionNameLabel(
125 | final Composite container, final Control above) {
126 | notNull(container);
127 | final Label label = new Label(container, SWT.NULL);
128 | final String text = MESSAGES.get(
129 | "field.actionName.label", actionDesc.getLabel());
130 | label.setText(text);
131 | placeUnder(label, above, STACKED_V_OFFSET);
132 | return label;
133 | }
134 |
135 | // see base
136 | @Override
137 | protected void okPressed() {
138 | final OnWrongInvocationMode mode = getSelectedOnWrongInvocationMode();
139 | if (mode == null) {
140 | preferences.removeOnWrongInvocaitonMode(actionDesc.getId());
141 | } else {
142 | final ActionOnWrongInvocationMode actionMode =
143 | new ActionOnWrongInvocationMode(actionDesc);
144 | actionMode.setOnWrongInvocationMode(
145 | getSelectedOnWrongInvocationMode());
146 | preferences.setOnWrongInvocationMode(actionMode);
147 | }
148 | super.okPressed();
149 | }
150 |
151 | /**
152 | * Set the name in the combo widget to the specified value.
153 | * @param mode the value to set the combo to. null means to use
154 | * global settings.
155 | */
156 | private void updateOnWrongInvocationModeCombo(final OnWrongInvocationMode mode) {
157 | onWrongInvocationModeCombo.setText(mode == null
158 | ? getDefaultInvocationMode()
159 | : mode.getLabel());
160 | }
161 |
162 | /**
163 | * The currently selected wrong invocation mode handling.
164 | * @return the wrong invocation mode handling. null if the
165 | * user selected the default handling.
166 | */
167 | private OnWrongInvocationMode getSelectedOnWrongInvocationMode() {
168 | final int i = onWrongInvocationModeCombo.getSelectionIndex();
169 | return i == DEFAULT_ON_WRONG_INVOCATION_MODE_IDX
170 | ? null : OnWrongInvocationMode.values()[i - 1];
171 | }
172 |
173 | /**
174 | * The text for the {@link OnWrongInvocationMode} value indicating to use
175 | * invocation handling as defined by preferences.
176 | * @return the default invocation handling option. Never null.
177 | */
178 | private String getDefaultInvocationMode() {
179 | return MESSAGES.get("field.onWrongInvocationMode.value.default");
180 | }
181 | }
182 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/commands/ConfigureActionInvocationHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.commands;
20 |
21 | import static org.apache.commons.lang.Validate.notNull;
22 |
23 | import com.mousefeed.client.Messages;
24 | import com.mousefeed.client.collector.AbstractActionDesc;
25 | import com.mousefeed.client.collector.Collector;
26 | import com.mousefeed.eclipse.Activator;
27 | import java.util.Map;
28 | import org.eclipse.core.commands.AbstractHandler;
29 | import org.eclipse.core.commands.ExecutionEvent;
30 | import org.eclipse.core.commands.ExecutionException;
31 | import org.eclipse.ui.IWorkbenchWindow;
32 | import org.eclipse.ui.commands.IElementUpdater;
33 | import org.eclipse.ui.handlers.HandlerUtil;
34 | import org.eclipse.ui.menus.UIElement;
35 |
36 | /**
37 | * Configures invocation mode for the last called action.
38 | * @author Andriy Palamarchuk
39 | */
40 | public class ConfigureActionInvocationHandler extends AbstractHandler
41 | implements IElementUpdater {
42 | /**
43 | * Provides messages text.
44 | */
45 | private static final Messages MESSAGES =
46 | new Messages(ConfigureActionInvocationHandler.class);
47 |
48 | /**
49 | * The user activity data collector.
50 | */
51 | private final Collector collector =
52 | Activator.getDefault().getCollector();
53 |
54 | /**
55 | * Default constructor does nothing.
56 | */
57 | public ConfigureActionInvocationHandler() {
58 | }
59 |
60 | // see base
61 | public Object execute(final ExecutionEvent event) throws ExecutionException {
62 | if (getLastAction() == null) {
63 | return null;
64 | }
65 | final IWorkbenchWindow window =
66 | HandlerUtil.getActiveWorkbenchWindowChecked(event);
67 | final ConfigureActionInvocationDialog dlg =
68 | new ConfigureActionInvocationDialog(
69 | window.getShell(), getLastAction());
70 | dlg.open();
71 | return null;
72 | }
73 |
74 |
75 | /**
76 | * Expected to be called after each detected user action.
77 | * @param element presents the Last Action Invocation menu item.
78 | * Not null.
79 | * @param parameters not used.
80 | */
81 | @SuppressWarnings("rawtypes")
82 | public void updateElement(final UIElement element, final Map parameters) {
83 | notNull(element);
84 | if (getLastAction() != null)
85 | element.setText(MESSAGES.get("menuItem.lastActionInvocation.label",
86 | getLastAction().getLabel()));
87 | }
88 |
89 | /**
90 | * The last action called by the user.
91 | * @return the last action. null if there was no action
92 | * called before since Eclipse started.
93 | */
94 | private AbstractActionDesc getLastAction() {
95 | return collector.getLastAction();
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/commands/OnWrongInvocationModeUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.commands;
20 |
21 | import static com.mousefeed.eclipse.Layout.STACKED_LABEL_V_OFFSET;
22 | import static com.mousefeed.eclipse.Layout.STACKED_V_OFFSET;
23 | import static com.mousefeed.eclipse.Layout.WHOLE_SIZE;
24 | import static com.mousefeed.eclipse.Layout.WINDOW_MARGIN;
25 | import static com.mousefeed.eclipse.Layout.placeUnder;
26 | import static org.apache.commons.lang.Validate.isTrue;
27 | import static org.apache.commons.lang.Validate.notNull;
28 |
29 | import com.mousefeed.client.OnWrongInvocationMode;
30 | import org.eclipse.swt.SWT;
31 | import org.eclipse.swt.layout.FormAttachment;
32 | import org.eclipse.swt.layout.FormData;
33 | import org.eclipse.swt.widgets.Combo;
34 | import org.eclipse.swt.widgets.Composite;
35 | import org.eclipse.swt.widgets.Control;
36 | import org.eclipse.swt.widgets.Label;
37 |
38 | /**
39 | * Helper class to generate on wrong invocation mode action handling UI -
40 | * a label and a dropdown.
41 | *
42 | * @author Andriy Palamarchuk
43 | */
44 | public class OnWrongInvocationModeUI {
45 |
46 | /**
47 | * Default constructor does nothing.
48 | */
49 | public OnWrongInvocationModeUI() {
50 | }
51 |
52 | /**
53 | * Creates the label.
54 | * @param container the container to create this control in.
55 | * Not null.
56 | * @param aboveControl the control above. null if this
57 | * is the topmost control in the container.
58 | * @param labelText the label text. Not null.
59 | * @return the label control. Never null.
60 | */
61 | public Label createLabel(final Composite container, final Control aboveControl,
62 | final String labelText) {
63 | notNull(container);
64 | notNull(labelText);
65 | final Label label = new Label(container, SWT.NULL);
66 | label.setText(labelText);
67 | placeUnder(label, aboveControl, STACKED_V_OFFSET);
68 | return label;
69 | }
70 |
71 | /**
72 | * Creates the on wrong invocation mode handling dropdown.
73 | * @param container the container to create this control in.
74 | * Not null.
75 | * @param aboveControl the control above. null if this
76 | * is the topmost control in the container.
77 | * @return the combo control. Never null.
78 | */
79 | public Combo createCombo(final Composite container, final Control aboveControl) {
80 | notNull(container);
81 | isTrue(aboveControl == null || aboveControl instanceof Label);
82 |
83 | final Combo combo = new Combo(container, SWT.READ_ONLY);
84 | combo.setItems(OnWrongInvocationMode.getLabels());
85 | final FormData formData =
86 | placeUnder(combo, aboveControl, STACKED_LABEL_V_OFFSET);
87 | formData.right = new FormAttachment(WHOLE_SIZE, -WINDOW_MARGIN);
88 | return combo;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/commands/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
24 |
25 | Provides MouseFeed command classes.
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
24 |
25 | Provides Eclipse-specific classes of the Eclipse MouseFeed plugin.
26 | No other classes except in this package should use Eclipse and SWT API.
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/ActionInvocationModeTableCellModifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.preferences;
20 |
21 |
22 | import static org.apache.commons.lang.Validate.notNull;
23 |
24 | import com.mousefeed.client.OnWrongInvocationMode;
25 | import com.mousefeed.eclipse.preferences.ActionInvocationModeControl.Column;
26 | import org.eclipse.jface.viewers.ICellModifier;
27 | import org.eclipse.jface.viewers.TableViewer;
28 | import org.eclipse.swt.widgets.Item;
29 |
30 | /**
31 | * Cell modifier for the {@link ActionInvocationModeControl} table.
32 | *
33 | * @author Andriy Palamarchuk
34 | */
35 | public class ActionInvocationModeTableCellModifier implements ICellModifier {
36 | /**
37 | * @see #ActionInvocationModeTableCellModifier(TableViewer)
38 | */
39 | private final TableViewer tableViewer;
40 |
41 | /**
42 | * Creates new table cell modifier.
43 | * @param tableViewer the table viewer backing the modifier table.
44 | * Not null.
45 | */
46 | public ActionInvocationModeTableCellModifier(final TableViewer tableViewer) {
47 | validateTableViewer(tableViewer);
48 | this.tableViewer = tableViewer;
49 | }
50 |
51 | /**
52 | * Validates table viewer constructor parameter.
53 | * @param viewer the object to validate.
54 | */
55 | void validateTableViewer(final TableViewer viewer) {
56 | notNull(viewer);
57 | }
58 |
59 | // see base
60 | public boolean canModify(final Object element, final String property) {
61 | // non-existing properties are not modifiable
62 | // do this instead of throwing an exception because other
63 | // methods don't throw an exception in this situation
64 | return property.equals(Column.MODE.name());
65 | }
66 |
67 | // see base
68 | public Object getValue(final Object element, final String property) {
69 | final ActionOnWrongInvocationMode mode =
70 | (ActionOnWrongInvocationMode) element;
71 | if (property.equals(Column.LABEL.name())) {
72 | return mode.getLabel();
73 | } else if (property.equals(Column.MODE.name())) {
74 | return mode.getOnWrongInvocationMode().ordinal();
75 | } else {
76 | // by the method contract
77 | return null;
78 | }
79 | }
80 |
81 | // see base
82 | public void modify(final Object element, final String property, final Object value) {
83 | final Object actionModeObject = element instanceof Item
84 | ? ((Item) element).getData()
85 | : element;
86 | final ActionOnWrongInvocationMode actionMode =
87 | (ActionOnWrongInvocationMode) actionModeObject;
88 | if (property.equals(Column.MODE.name())) {
89 | final OnWrongInvocationMode mode =
90 | OnWrongInvocationMode.values()[(Integer) value];
91 | actionMode.setOnWrongInvocationMode(mode);
92 | updateTableViewer(actionModeObject, property);
93 | } else {
94 | // by the method contract
95 | return;
96 | }
97 | }
98 |
99 | /**
100 | * Updates table viewer for the provided element and a property.
101 | * @param element the element to update. Assumed not null.
102 | * @param property the property to update. Assumed not null.
103 | */
104 | void updateTableViewer(final Object element, final String property) {
105 | tableViewer.update(element, new String[] {property});
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/ActionInvocationModeTableContentProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.preferences;
20 |
21 | import java.util.Collection;
22 | import org.eclipse.jface.viewers.IStructuredContentProvider;
23 | import org.eclipse.jface.viewers.Viewer;
24 |
25 | /**
26 | *
27 | * @author Andriy Palamarchuk
28 | */
29 | public class ActionInvocationModeTableContentProvider implements
30 | IStructuredContentProvider {
31 |
32 | /**
33 | * Default constructor does nothing.
34 | */
35 | public ActionInvocationModeTableContentProvider() {
36 | }
37 |
38 | public Object[] getElements(final Object inputElement) {
39 | return ((Collection>) inputElement).toArray();
40 | }
41 |
42 | /**
43 | * Does nothing.
44 | */
45 | public void dispose() {}
46 |
47 | // see base
48 | public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/ActionInvocationModeTableLabelProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.preferences;
20 |
21 | import com.mousefeed.eclipse.preferences.ActionInvocationModeControl.Column;
22 | import org.eclipse.jface.viewers.BaseLabelProvider;
23 | import org.eclipse.jface.viewers.ITableLabelProvider;
24 | import org.eclipse.swt.graphics.Image;
25 |
26 | /**
27 | * @author Andriy Palamarchuk
28 | */
29 | class ActionInvocationModeTableLabelProvider extends BaseLabelProvider
30 | implements ITableLabelProvider {
31 |
32 | /**
33 | * Default constructor does nothing.
34 | */
35 | public ActionInvocationModeTableLabelProvider() {
36 | }
37 |
38 | // see base
39 | public boolean isLabelProperty(final Object element, final String property) {
40 | if (property.equals(Column.LABEL.name())) {
41 | return false;
42 | } else if (property.equals(Column.MODE.name())) {
43 | return true;
44 | } else {
45 | throw new IllegalArgumentException(
46 | "Unrecognized property " + property);
47 | }
48 | }
49 |
50 | /**
51 | * Returns null.
52 | */
53 | public Image getColumnImage(final Object element, final int columnIndex) {
54 | return null;
55 | }
56 |
57 | // see base
58 | public String getColumnText(final Object element, final int columnIndex) {
59 | final ActionOnWrongInvocationMode mode =
60 | (ActionOnWrongInvocationMode) element;
61 | if (columnIndex == Column.LABEL.ordinal()) {
62 | return mode.getLabel();
63 | } else if (columnIndex == Column.MODE.ordinal()) {
64 | return mode.getOnWrongInvocationMode().getLabel();
65 | } else {
66 | throw new IllegalArgumentException(
67 | "Unrecognized column index: " + columnIndex);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/ActionOnWrongInvocationMode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.preferences;
20 |
21 | import static org.apache.commons.lang.StringUtils.isNotBlank;
22 | import static org.apache.commons.lang.Validate.isTrue;
23 | import static org.apache.commons.lang.Validate.notNull;
24 |
25 | import com.mousefeed.client.OnWrongInvocationMode;
26 | import com.mousefeed.client.collector.AbstractActionDesc;
27 | import java.io.Serializable;
28 | import java.util.Comparator;
29 |
30 | /**
31 | * Stores action-specific preferences for handling action invocation using
32 | * wrong mode.
33 | * Data stored in this class somewhat overlaps with {@link AbstractActionDesc}.
34 | *
35 | * @author Andriy Palamarchuk
36 | */
37 | public class ActionOnWrongInvocationMode implements Cloneable {
38 | /**
39 | * @see #getId()
40 | */
41 | private String id;
42 |
43 | /**
44 | * @see #getLabel()
45 | */
46 | private String label;
47 |
48 | /**
49 | * @see #getOnWrongInvocationMode()
50 | */
51 | private OnWrongInvocationMode onWrongInvocationMode;
52 |
53 | /**
54 | * Creates a new instance.
55 | */
56 | public ActionOnWrongInvocationMode() {
57 | }
58 |
59 | /**
60 | * Creates a new instance from the {@link AbstractActionDesc} instance. Copies all
61 | * the data.
62 | * @param actionDesc the instance to create this instance from.
63 | * Not null
64 | */
65 | public ActionOnWrongInvocationMode(final AbstractActionDesc actionDesc) {
66 | notNull(actionDesc);
67 | setId(actionDesc.getId());
68 | setLabel(actionDesc.getLabel());
69 | }
70 |
71 | // see base
72 | @Override
73 | public Object clone() throws CloneNotSupportedException {
74 | return super.clone();
75 | }
76 |
77 | /**
78 | * The action id. Used to identify this preference.
79 | * @return the id. Never null after initialization.
80 | */
81 | public String getId() {
82 | return id;
83 | }
84 |
85 | /**
86 | * @param id the id to set. Not null.
87 | * @see #getId()
88 | */
89 | public void setId(final String id) {
90 | isTrue(isNotBlank(id));
91 | this.id = id;
92 | }
93 |
94 | /**
95 | * The action label. Used for display purposes.
96 | * @return the label. Not null after initialized.
97 | */
98 | public String getLabel() {
99 | return label;
100 | }
101 |
102 | /**
103 | * @param label the label to set. Not blank.
104 | * @see #getLabel()
105 | */
106 | public void setLabel(final String label) {
107 | isTrue(isNotBlank(label));
108 | this.label = label;
109 | }
110 |
111 | /**
112 | * What to do on wrong invocation.
113 | * @return the value. Never null after initialized.
114 | */
115 | public OnWrongInvocationMode getOnWrongInvocationMode() {
116 | return onWrongInvocationMode;
117 | }
118 |
119 | /**
120 | * @param onWrongInvocationMode the new value. Not null.
121 | * @see #getOnWrongInvocationMode()
122 | */
123 | public void setOnWrongInvocationMode(
124 | final OnWrongInvocationMode onWrongInvocationMode) {
125 | notNull(onWrongInvocationMode);
126 | this.onWrongInvocationMode = onWrongInvocationMode;
127 | }
128 |
129 | /**
130 | * Compares these objects by label.
131 | */
132 | public static class LabelComparator implements
133 | Comparator, Serializable {
134 | /**
135 | * Serialization version id.
136 | */
137 | static final long serialVersionUID = 1;
138 |
139 | /**
140 | * Default constructor does nothing.
141 | */
142 | public LabelComparator() {
143 | }
144 |
145 | public int compare(final ActionOnWrongInvocationMode mode1,
146 | final ActionOnWrongInvocationMode mode2) {
147 | return mode1.getLabel().compareTo(mode2.getLabel());
148 | }
149 |
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/PreferenceConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007, Robert Wloch 2012.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.preferences;
20 |
21 | /**
22 | * Constant definitions for plug-in preferences.
23 | *
24 | * @author Andriy Palamarchuk
25 | * @author Robert Wloch
26 | */
27 | public final class PreferenceConstants {
28 |
29 | /**
30 | * Whether invocation control is enabled preference.
31 | * The preference indicates whether to help to learn the desired way to
32 | * invoke actions.
33 | */
34 | public static final String P_INVOCATION_CONTROL_ENABLED =
35 | "InvocationControlEnabled";
36 |
37 | /**
38 | * The default value for the setting {@link #P_INVOCATION_CONTROL_ENABLED}
39 | * setting.
40 | */
41 | public static final boolean INVOCATION_CONTROL_ENABLED_DEFAULT = true;
42 |
43 | /**
44 | * Whether keyboard shortcut configuration is enabled preference.
45 | * The preference indicates whether to show the Keys preference page
46 | * for often used actions without a shortcut.
47 | */
48 | public static final String P_CONFIGURE_KEYBOARD_SHORTCUT_ENABLED =
49 | "ConfigureKeyboardShortcutEnabled";
50 |
51 | /**
52 | * The default value for the setting {@link #P_CONFIGURE_KEYBOARD_SHORTCUT_ENABLED}
53 | * setting.
54 | */
55 | public static final boolean CONFIGURE_KEYBOARD_SHORTCUT_ENABLED_DEFAULT = true;
56 |
57 | /**
58 | * Threshold for action invocation counter above which keyboard shortcut
59 | * configuration is enabled preference.
60 | * The preference indicates whether to show the Keys preference page
61 | * for often used actions without a shortcut.
62 | */
63 | public static final String P_CONFIGURE_KEYBOARD_SHORTCUT_THRESHOLD =
64 | "ConfigureKeyboardShortcutThreshold";
65 |
66 | /**
67 | * The default value for the setting {@link #P_CONFIGURE_KEYBOARD_SHORTCUT_THRESHOLD}
68 | * setting.
69 | */
70 | public static final int CONFIGURE_KEYBOARD_SHORTCUT_THRESHOLD_DEFAULT = 2;
71 |
72 | /**
73 | * Indicates how to deal with actions called with wrong action invocation
74 | * mode if there is no specific handling defined.
75 | */
76 | public static final String P_DEFAULT_ON_WRONG_INVOCATION_MODE =
77 | "DefaultOnWrongInvocationMode";
78 |
79 | private PreferenceConstants() {
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/PreferenceInitializer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007, Robert Wloch 2012.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.preferences;
20 |
21 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
22 | import org.eclipse.jface.preference.IPreferenceStore;
23 |
24 | import com.mousefeed.client.OnWrongInvocationMode;
25 | import com.mousefeed.eclipse.Activator;
26 |
27 | /**
28 | * Initializes default preference values.
29 | *
30 | * @author Andriy Palamarchuk
31 | * @author Robert Wloch
32 | */
33 | public class PreferenceInitializer extends AbstractPreferenceInitializer {
34 |
35 | /**
36 | * Default constructor does nothing.
37 | */
38 | public PreferenceInitializer() {
39 | }
40 |
41 | /** {@inheritDoc} */
42 | @Override
43 | public void initializeDefaultPreferences() {
44 | final IPreferenceStore store =
45 | Activator.getDefault().getPreferenceStore();
46 | store.setDefault(
47 | PreferenceConstants.P_DEFAULT_ON_WRONG_INVOCATION_MODE,
48 | OnWrongInvocationMode.DEFAULT.name());
49 | store.setDefault(
50 | PreferenceConstants.P_INVOCATION_CONTROL_ENABLED,
51 | PreferenceConstants.INVOCATION_CONTROL_ENABLED_DEFAULT);
52 | store.setDefault(
53 | PreferenceConstants.P_CONFIGURE_KEYBOARD_SHORTCUT_ENABLED,
54 | PreferenceConstants.CONFIGURE_KEYBOARD_SHORTCUT_ENABLED_DEFAULT);
55 | store.setDefault(
56 | PreferenceConstants.P_CONFIGURE_KEYBOARD_SHORTCUT_THRESHOLD,
57 | PreferenceConstants.CONFIGURE_KEYBOARD_SHORTCUT_THRESHOLD_DEFAULT);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/PreferencePage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Heavy Lifting Software 2007.
3 | *
4 | * This file is part of MouseFeed.
5 | *
6 | * MouseFeed is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * MouseFeed is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with MouseFeed. If not, see .
18 | */
19 | package com.mousefeed.eclipse.preferences;
20 |
21 | import com.mousefeed.client.Messages;
22 | import com.mousefeed.eclipse.Activator;
23 | import org.eclipse.jface.preference.FieldEditorPreferencePage;
24 | import org.eclipse.ui.IWorkbench;
25 | import org.eclipse.ui.IWorkbenchPreferencePage;
26 |
27 | /**
28 | * Main MouseFeed preferences page.
29 | *
30 | * @author Andriy Palamarchuk
31 | */
32 | public class PreferencePage
33 | extends FieldEditorPreferencePage
34 | implements IWorkbenchPreferencePage {
35 |
36 | /**
37 | * Provides messages text.
38 | */
39 | private static final Messages MESSAGES = new Messages(PreferencePage.class);
40 |
41 | /**
42 | * Creates new preference page.
43 | */
44 | public PreferencePage() {
45 | super(GRID);
46 | setPreferenceStore(Activator.getDefault().getPreferenceStore());
47 | setDescription(MESSAGES.get("description"));
48 | }
49 |
50 | /**
51 | * Creates the field editors. Field editors are abstractions of
52 | * the common GUI blocks needed to manipulate various types
53 | * of preferences. Each field editor knows how to save and
54 | * restore itself.
55 | */
56 | @Override
57 | public void createFieldEditors() {
58 | }
59 |
60 | /**
61 | * Does not do anything.
62 | * @param workbench not used.
63 | */
64 | public void init(final IWorkbench workbench) {}
65 | }
--------------------------------------------------------------------------------
/com.mousefeed/src/com/mousefeed/eclipse/preferences/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
24 |
25 | Provides classes for managing the plugin references.
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/com.mousefeed/suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/com.mousefeed/toc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/com.mousefeed/tocconcepts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/com.mousefeed/tocgettingstarted.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/com.mousefeed/tocreference.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/com.mousefeed/toctasks.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mousefeed
5 | parent
6 | 2.0.3-SNAPSHOT
7 | Parent
8 | pom
9 |
10 |
11 | com.mousefeed
12 | com.mousefeed.test
13 | com.mousefeed.feature
14 | com.mousefeed.update-site
15 |
16 |
17 |
18 | 0.24.0
19 | UTF-8
20 |
21 |
22 |
23 |
24 | eclipse-juno
25 | p2
26 | http://download.eclipse.org/releases/juno
27 |
28 |
29 | eclipse-4.2
30 | p2
31 | http://download.eclipse.org/eclipse/updates/4.2
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | org.eclipse.tycho
40 | tycho-compiler-plugin
41 | ${tycho-version}
42 |
43 | UTF-8
44 | true
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | org.eclipse.tycho
53 | tycho-maven-plugin
54 | ${tycho-version}
55 | true
56 |
57 | 1.6
58 | 1.6
59 |
60 |
61 |
62 | org.eclipse.tycho
63 | target-platform-configuration
64 | ${tycho-version}
65 |
66 | p2
67 |
68 |
69 | linux
70 | gtk
71 | x86_64
72 |
73 |
74 | linux
75 | gtk
76 | x86
77 |
78 |
79 | win32
80 | win32
81 | x86
82 |
83 |
84 | win32
85 | win32
86 | x86_64
87 |
88 |
89 | macosx
90 | cocoa
91 | x86_64
92 |
93 |
96 |
97 |
98 |
99 |
100 | org.apache.maven.plugins
101 | maven-jarsigner-plugin
102 | 1.4
103 |
104 |
105 |
106 | org.eclipse.tycho
107 | tycho-surefire-plugin
108 | ${tycho-version}
109 |
110 | false
111 | true
112 | -enableassertions ${os-jvm-flags}
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | macosx-jvm-flags
121 |
122 | mac
123 |
124 |
125 | -XstartOnFirstThread
126 |
127 |
128 |
129 | sign
130 |
131 |
132 |
133 | org.apache.maven.plugins
134 | maven-jarsigner-plugin
135 |
136 |
137 | sign
138 |
139 | sign
140 |
141 |
142 |
143 | verify
144 |
145 | verify
146 |
147 |
148 |
149 |
150 | /home/heeckhau/workspace-xtext/sigasi.sigasi/com.sigasi.hdt.target/sigasiKeyStore
151 | ${sigasi.keystore.alias}
152 | ${sigasi.keystore.store.password}
153 | ${sigasi.keystore.key.password}
154 |
155 | -digestalg
156 | SHA1
157 | -sigalg
158 | SHA1withRSA
159 | -tsa
160 | https://timestamp.geotrust.com/tsa
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
--------------------------------------------------------------------------------
/setVersionNumber.sh:
--------------------------------------------------------------------------------
1 | NEW_VERSION=2.0.3.qualifier
2 | mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=${NEW_VERSION} -Dtycho.mode=maven
3 |
4 |
--------------------------------------------------------------------------------