Changeset 15084
- Timestamp:
- 07/03/08 13:03:27 (2 months ago)
- Location:
- lang/java/sabotter/trunk
- Files:
-
- 3 added
- 4 modified
-
plugin.xml (modified) (1 diff)
-
src/jp/xet/eclipse/sabotter/preferences/MiniblogServicePreferencePage.java (added)
-
src/jp/xet/eclipse/sabotter/preferences/SabotterPreferencePage.java (modified) (18 diffs)
-
src/jp/xet/eclipse/sabotter/preferences/TwitterPreferencePage.java (added)
-
src/jp/xet/eclipse/sabotter/preferences/WassrPreferencePage.java (added)
-
src/jp/xet/eclipse/sabotter/preferences/messages.properties (modified) (1 diff)
-
src/jp/xet/eclipse/sabotter/preferences/messages_ja.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/java/sabotter/trunk/plugin.xml
r15071 r15084 67 67 id="jp.xet.sabotter.preference" 68 68 name="%SabotterPreferencePage.name"/> 69 <page 70 class="jp.xet.eclipse.sabotter.preferences.TwitterPreferencePage" 71 id="jp.xet.sabotter.preference.twitter" 72 category="jp.xet.sabotter.preference" 73 name="Twitter"/> 74 <page 75 class="jp.xet.eclipse.sabotter.preferences.WassrPreferencePage" 76 id="jp.xet.sabotter.preference.wassr" 77 category="jp.xet.sabotter.preference" 78 name="Wassr"/> 69 79 </extension> 70 80 <extension -
lang/java/sabotter/trunk/src/jp/xet/eclipse/sabotter/preferences/SabotterPreferencePage.java
r14773 r15084 2 2 3 3 import jp.xet.eclipse.sabotter.SabotterPlugin; 4 import jp.xet.eclipse.sabotter.helper.TextSelectionOnFocusAdapter;5 6 4 import org.eclipse.jface.preference.IPreferenceStore; 7 5 import org.eclipse.jface.preference.PreferencePage; … … 9 7 import org.eclipse.swt.events.SelectionAdapter; 10 8 import org.eclipse.swt.events.SelectionEvent; 11 import org.eclipse.swt.events.SelectionListener;12 9 import org.eclipse.swt.layout.GridData; 13 10 import org.eclipse.swt.layout.GridLayout; … … 19 16 import org.eclipse.swt.widgets.Label; 20 17 import org.eclipse.swt.widgets.Scale; 21 import org.eclipse.swt.widgets.Spinner;22 import org.eclipse.swt.widgets.Text;23 18 import org.eclipse.ui.IWorkbench; 24 19 import org.eclipse.ui.IWorkbenchPreferencePage; … … 31 26 public class SabotterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { 32 27 33 private Text txtUsername;34 35 private Text txtPassword;36 37 28 private Combo cmbImage; 38 29 … … 41 32 private Combo cmbFocusMove; 42 33 34 private Combo cmbBaloonDispayType; 35 43 36 private Scale sclMaxEntries; 44 37 … … 50 43 51 44 private Button radExternalBrowser; 52 53 private Spinner spnAPILimitRate;54 55 private Spinner spnTimeLineInterval;56 57 private Spinner spnRepliesInterval;58 59 private Spinner spnDirectMessagesInterval;60 61 private SelectionListener intervalListener = new SelectionListener() {62 63 public void widgetDefaultSelected(SelectionEvent e) {64 widgetSelected(e);65 }66 67 public void widgetSelected(SelectionEvent e) {68 int limit = spnAPILimitRate.getSelection();69 int f = spnTimeLineInterval.getSelection();70 int r = spnRepliesInterval.getSelection();71 int d = spnDirectMessagesInterval.getSelection();72 if (valid(limit, f, r, d)) {73 return;74 }75 Spinner fixed = (Spinner) e.getSource();76 while (valid(limit, f, r, d) == false) {77 if (fixed.equals(spnAPILimitRate)) {78 if (f < r && f < d) {79 f++;80 } else if (r < d) {81 r++;82 } else {83 d++;84 }85 } else if (fixed.equals(spnTimeLineInterval)) {86 if (60 / f >= limit) {87 f++;88 } else if (r < d) {89 r++;90 } else {91 d++;92 }93 } else if (fixed.equals(spnRepliesInterval)) {94 if (60 / r >= limit) {95 r++;96 } else if (f < d) {97 f++;98 } else {99 d++;100 }101 } else if (fixed.equals(spnDirectMessagesInterval)) {102 if (60 / d >= limit) {103 d++;104 } else if (f < r) {105 f++;106 } else {107 r++;108 }109 } else {110 System.err.println("!!");111 }112 }113 114 spnAPILimitRate.setSelection(limit);115 spnTimeLineInterval.setSelection(f);116 spnRepliesInterval.setSelection(r);117 spnDirectMessagesInterval.setSelection(d);118 }119 120 private boolean valid(int limit, int... values) {121 return limit > calcRate(values);122 }123 124 private double calcRate(int[] intervals) {125 double result = 0;126 for (int interval : intervals) {127 result += 60 / interval;128 }129 return result;130 }131 };132 133 private Combo cmbBaloonDispayType;134 45 135 46 … … 145 56 composite.setLayout(new GridLayout(1, true)); 146 57 147 Group account = new Group(composite, SWT.NONE);148 account.setText(Messages.group_account);149 account.setLayout(new GridLayout(2, false));150 account.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));151 152 Label label = new Label(account, SWT.NONE);153 label.setText(Messages.label_username);154 155 txtUsername = new Text(account, SWT.BORDER);156 txtUsername.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));157 txtUsername.addFocusListener(new TextSelectionOnFocusAdapter(txtUsername));158 159 label = new Label(account, SWT.NONE);160 label.setText(Messages.label_password);161 162 txtPassword = new Text(account, SWT.PASSWORD | SWT.BORDER);163 txtPassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));164 txtPassword.addFocusListener(new TextSelectionOnFocusAdapter(txtPassword));165 166 58 Group browser = new Group(composite, SWT.NONE); 167 59 browser.setText(Messages.group_browser); … … 175 67 radExternalBrowser.setText(Messages.radio_use_external_browser); 176 68 177 Group interval = new Group(composite, SWT.NONE);178 interval.setText(Messages.group_access_interval);179 interval.setLayout(new GridLayout(3, false));180 interval.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));181 182 label = new Label(interval, SWT.NONE);183 label.setText(Messages.label_api_limit_rate);184 spnAPILimitRate = new Spinner(interval, SWT.BORDER);185 spnAPILimitRate.setMinimum(10);186 spnAPILimitRate.setMaximum(99);187 spnAPILimitRate.setIncrement(1);188 label = new Label(interval, SWT.NONE);189 label.setText(Messages.label_times_per_hour);190 191 label = new Label(interval, SWT.NONE);192 label.setText(Messages.label_friend_timeline);193 spnTimeLineInterval = new Spinner(interval, SWT.BORDER);194 spnTimeLineInterval.setMinimum(1);195 spnAPILimitRate.setMaximum(99);196 spnAPILimitRate.setIncrement(1);197 label = new Label(interval, SWT.NONE);198 label.setText(Messages.label_min);199 200 label = new Label(interval, SWT.NONE);201 label.setText(Messages.label_replies);202 spnRepliesInterval = new Spinner(interval, SWT.BORDER);203 spnRepliesInterval.setMinimum(1);204 spnAPILimitRate.setMaximum(99);205 spnAPILimitRate.setIncrement(1);206 label = new Label(interval, SWT.NONE);207 label.setText(Messages.label_min);208 209 label = new Label(interval, SWT.NONE);210 label.setText(Messages.label_direct_messages);211 spnDirectMessagesInterval = new Spinner(interval, SWT.BORDER);212 spnDirectMessagesInterval.setMinimum(1);213 spnAPILimitRate.setMaximum(99);214 spnAPILimitRate.setIncrement(1);215 label = new Label(interval, SWT.NONE);216 label.setText(Messages.label_min);217 218 69 Group other = new Group(composite, SWT.NONE); 219 70 other.setText(Messages.group_other); … … 221 72 other.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 222 73 223 label = new Label(other, SWT.NONE); 224 label.setText(Messages.label_image); 74 new Label(other, SWT.NONE).setText(Messages.label_image); 225 75 226 76 cmbImage = new Combo(other, SWT.BORDER | SWT.READ_ONLY); … … 232 82 } 233 83 234 label = new Label(other, SWT.NONE); 235 label.setText(Messages.label_name); 84 new Label(other, SWT.NONE).setText(Messages.label_name); 236 85 237 86 cmbName = new Combo(other, SWT.BORDER | SWT.READ_ONLY); … … 243 92 } 244 93 245 label = new Label(other, SWT.NONE); 246 label.setText(Messages.label_focus_move); 94 new Label(other, SWT.NONE).setText(Messages.label_focus_move); 247 95 248 96 cmbFocusMove = new Combo(other, SWT.BORDER | SWT.READ_ONLY); … … 254 102 } 255 103 256 label = new Label(other, SWT.NONE); 257 label.setText(Messages.label_balloon_notice); 104 new Label(other, SWT.NONE).setText(Messages.label_balloon_notice); 258 105 259 106 cmbBaloonDispayType = new Combo(other, SWT.BORDER | SWT.READ_ONLY); … … 265 112 } 266 113 267 label = new Label(other, SWT.NONE); 268 label.setText(Messages.label_max_entries); 114 new Label(other, SWT.NONE).setText(Messages.label_max_entries); 269 115 270 116 sclMaxEntries = new Scale(other, SWT.HORIZONTAL); … … 332 178 private void setCurrentValueToControls() { 333 179 IPreferenceStore ps = SabotterPlugin.getDefault().getPreferenceStore(); 334 txtUsername.setText(ps.getString(PreferenceKeys.USERNAME));335 txtPassword.setText(ps.getString(PreferenceKeys.PASSWORD));336 337 180 int value = ps.getInt(PreferenceKeys.IMAGE_PROCESS_TYPE); 338 181 cmbImage.setText(ImageProcessType.getImageProcessType(value).getDisplayName()); … … 356 199 radInternalBrowser.setSelection(ps.getBoolean(PreferenceKeys.INTERNAL_BROWSER) == true); 357 200 radExternalBrowser.setSelection(ps.getBoolean(PreferenceKeys.INTERNAL_BROWSER) == false); 358 359 spnAPILimitRate.setSelection(ps.getInt(PreferenceKeys.API_LIMIT_RATE));360 spnAPILimitRate.addSelectionListener(intervalListener);361 spnTimeLineInterval.setSelection(ps.getInt(PreferenceKeys.INTERVAL_FRIEND_TIMELINE));362 spnTimeLineInterval.addSelectionListener(intervalListener);363 spnRepliesInterval.setSelection(ps.getInt(PreferenceKeys.INTERVAL_REPLIES));364 spnRepliesInterval.addSelectionListener(intervalListener);365 spnDirectMessagesInterval.setSelection(ps.getInt(PreferenceKeys.INTERVAL_DIRECT_MESSAGES));366 spnDirectMessagesInterval.addSelectionListener(intervalListener);367 201 } 368 202 369 203 private void loadDefaultValues() { 370 204 IPreferenceStore ps = SabotterPlugin.getDefault().getPreferenceStore(); 371 ps.setValue(PreferenceKeys.USERNAME, SabotterPreferenceInitializer.DEF_USERNAME);372 ps.setValue(PreferenceKeys.PASSWORD, SabotterPreferenceInitializer.DEF_PASSWORD);373 205 ps.setValue(PreferenceKeys.IMAGE_PROCESS_TYPE, ImageProcessType.SIZE16.getId()); 374 206 ps.setValue(PreferenceKeys.NAME_TYPE, NameDisplayType.NAME.getId()); … … 377 209 ps.setValue(PreferenceKeys.UNREAD_MANAGEMENT, true); 378 210 ps.setValue(PreferenceKeys.INTERNAL_BROWSER, true); 379 ps.setValue(PreferenceKeys.API_LIMIT_RATE, 30);380 ps.setValue(PreferenceKeys.INTERVAL_FRIEND_TIMELINE, 5);381 ps.setValue(PreferenceKeys.INTERVAL_REPLIES, 12);382 ps.setValue(PreferenceKeys.INTERVAL_DIRECT_MESSAGES, 20);383 211 ps.setValue(PreferenceKeys.BALOON_DISPLAY_TYPE, BaloonDispayType.ALL.toString()); 384 212 } … … 386 214 private void storeValues() { 387 215 IPreferenceStore ps = SabotterPlugin.getDefault().getPreferenceStore(); 388 ps.setValue(PreferenceKeys.USERNAME, txtUsername.getText());389 ps.setValue(PreferenceKeys.PASSWORD, txtPassword.getText());390 216 391 217 String text = cmbImage.getText(); … … 409 235 boolean useInternalBrowser = radInternalBrowser.getSelection(); 410 236 ps.setValue(PreferenceKeys.INTERNAL_BROWSER, useInternalBrowser); 411 412 int apiLimitRate = spnAPILimitRate.getSelection();413 ps.setValue(PreferenceKeys.API_LIMIT_RATE, apiLimitRate);414 415 int timeLineInterval = spnTimeLineInterval.getSelection();416 ps.setValue(PreferenceKeys.INTERVAL_FRIEND_TIMELINE, timeLineInterval);417 418 int replyInterval = spnRepliesInterval.getSelection();419 ps.setValue(PreferenceKeys.INTERVAL_REPLIES, replyInterval);420 421 int dmInterval = spnDirectMessagesInterval.getSelection();422 ps.setValue(PreferenceKeys.INTERVAL_DIRECT_MESSAGES, dmInterval);423 237 } 424 238 -
lang/java/sabotter/trunk/src/jp/xet/eclipse/sabotter/preferences/messages.properties
r14743 r15084 16 16 17 17 ### SabotterPreferencePage 18 group_account = Twitter account18 group_account = Account 19 19 label_username = Username 20 20 label_password = Password -
lang/java/sabotter/trunk/src/jp/xet/eclipse/sabotter/preferences/messages_ja.properties
r14743 r15084 16 16 17 17 ### SabotterPreferencePage 18 group_account = Twitter\u30a2\u30ab\u30a6\u30f3\u30c818 group_account = \u30a2\u30ab\u30a6\u30f3\u30c8 19 19 label_username = \u30e6\u30fc\u30b6\u540d 20 20 label_password = \u30d1\u30b9\u30ef\u30fc\u30c9
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)