Skip to content

Commit

Permalink
Fix #8045.
Browse files Browse the repository at this point in the history
Former-commit-id: 17df9ad5c70fa56a1d5a845a0fd34a37553a876b
  • Loading branch information
dkocher committed Jun 20, 2014
1 parent 247911e commit 8e38a0a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
9 changes: 8 additions & 1 deletion source/ch/cyberduck/ui/cocoa/InfoController.java
Expand Up @@ -1371,7 +1371,14 @@ private enum InfoToolbarItem {

@Override
protected void initializePanel(final String identifier) {
switch(InfoToolbarItem.valueOf(identifier)) {
InfoToolbarItem item;
try {
item = InfoToolbarItem.valueOf(identifier);
}
catch(IllegalArgumentException e) {
item = InfoToolbarItem.info;
}
switch(item) {
case info:
this.initGeneral();
this.initPermissions();
Expand Down
23 changes: 21 additions & 2 deletions source/ch/cyberduck/ui/cocoa/PreferencesController.java
Expand Up @@ -19,7 +19,19 @@
* dkocher@cyberduck.ch
*/

import ch.cyberduck.core.*;
import ch.cyberduck.core.AbstractCollectionListener;
import ch.cyberduck.core.BookmarkCollection;
import ch.cyberduck.core.BookmarkNameProvider;
import ch.cyberduck.core.CollectionListener;
import ch.cyberduck.core.Host;
import ch.cyberduck.core.Local;
import ch.cyberduck.core.LocalFactory;
import ch.cyberduck.core.LocaleFactory;
import ch.cyberduck.core.Permission;
import ch.cyberduck.core.Preferences;
import ch.cyberduck.core.Protocol;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.Scheme;
import ch.cyberduck.core.editor.EditorFactory;
import ch.cyberduck.core.formatter.SizeFormatterFactory;
import ch.cyberduck.core.local.Application;
Expand Down Expand Up @@ -211,7 +223,14 @@ private enum PreferencesToolbarItem {

@Override
protected void initializePanel(final String identifier) {
switch(PreferencesToolbarItem.valueOf(identifier)) {
PreferencesToolbarItem item;
try {
item = PreferencesToolbarItem.valueOf(identifier);
}
catch(IllegalArgumentException e) {
item = PreferencesToolbarItem.general;
}
switch(item) {
case general:
break;
case browser:
Expand Down
5 changes: 3 additions & 2 deletions source/ch/cyberduck/ui/cocoa/ToolbarWindowController.java
Expand Up @@ -101,7 +101,7 @@ public void awakeFromNib() {
window.setToolbar(toolbar);

// Change selection to last selected item in preferences
this.setSelectedPanel(Preferences.instance().getInteger(this.getToolbarName() + ".selected"));
this.setSelectedPanel(Preferences.instance().getInteger(String.format("%s.selected", this.getToolbarName())));
this.setTitle(this.getTitle(tabView.selectedTabViewItem()));

super.awakeFromNib();
Expand Down Expand Up @@ -266,7 +266,8 @@ private double toolbarHeightForWindow(NSWindow window) {
public void tabView_didSelectTabViewItem(NSTabView view, NSTabViewItem item) {
this.setTitle(this.getTitle(item));
this.resize();
Preferences.instance().setProperty(String.format("%s.selected", this.getToolbarName()), view.indexOfTabViewItem(item));
Preferences.instance().setProperty(String.format("%s.selected",
this.getToolbarName()), view.indexOfTabViewItem(item));
}

protected void setTitle(final String title) {
Expand Down

0 comments on commit 8e38a0a

Please sign in to comment.