Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2007-01-09 21:38:11 +0000
committerChris Goldthorpe2007-01-09 21:38:11 +0000
commit155c745a7f3e2e57bba955c50ec8a61ad6701d16 (patch)
tree45d13c04b317069ac89fc46b0611fefd8effc20c /org.eclipse.ui.cheatsheets/src/org
parent4f42bc4e8cf99d0fe3730de55c1d6b33a2bc3a35 (diff)
downloadeclipse.platform.ua-155c745a7f3e2e57bba955c50ec8a61ad6701d16.tar.gz
eclipse.platform.ua-155c745a7f3e2e57bba955c50ec8a61ad6701d16.tar.xz
eclipse.platform.ua-155c745a7f3e2e57bba955c50ec8a61ad6701d16.zip
Bug 152842 - [CheatSheet] cheat sheet item doesn't display correctly when leaving dialog tray
Diffstat (limited to 'org.eclipse.ui.cheatsheets/src/org')
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java21
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java28
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java5
4 files changed, 36 insertions, 20 deletions
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
index 47855ed93..0a88c5569 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
@@ -311,21 +311,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
return;
}
-
- Label subitemLabel = null;
- if (list != null) {
- for (Iterator iter = list.iterator(); iter.hasNext() && subitemLabel == null ;) {
- SubItemCompositeHolder holder = sich = (SubItemCompositeHolder)iter.next();
- if (!holder.isCompleted() && !holder.isSkipped()) {
- subitemLabel = holder.getSubitemLabel();
- }
- }
- }
- if (subitemLabel != null) {
- FormToolkit.ensureVisible(subitemLabel);
- } else {
- FormToolkit.ensureVisible(currentItem.getMainItemComposite());
- }
+ setFocus();
saveCurrentSheet();
}
@@ -500,7 +486,6 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
// fireManagerItemEvent(ICheatSheetItemEvent.ITEM_ACTIVATED, items[0]);
}
- FormToolkit.ensureVisible(currentItem.getMainItemComposite());
return true;
} catch(Exception e) {
// An exception while restoring the saved state data usually only occurs if
@@ -906,7 +891,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after layout() call: "); //$NON-NLS-1$ //$NON-NLS-2$
if (currentItem != null && !currentItem.isCompleted())
- currentItem.getMainItemComposite().setFocus();
+ currentItem.setFocus();
CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() at end of method: "); //$NON-NLS-1$ //$NON-NLS-2$
return true;
}
@@ -1167,7 +1152,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
public void setFocus() {
//need this to have current item selected. (Assumes that when you reactivate the view you will work with current item.)
if (currentItem != null) {
- currentItem.getMainItemComposite().setFocus();
+ currentItem.setFocus();
} else {
getControl().setFocus();
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
index 6bb06c608..59ed7a0e1 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
@@ -29,6 +29,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
@@ -534,7 +535,7 @@ public class CoreItem extends ViewItem {
SubItemCompositeHolder s = (SubItemCompositeHolder)l.get(j);
if(s.isCompleted() || s.isSkipped())
s.getCheckDoneLabel().setVisible(false); //setImage(null);
- if(s.startButton != null) {
+ if(s.getStartButton() != null) {
s.getStartButton().setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_START));
s.getStartButton().setToolTipText(Messages.PERFORM_TASK_TOOLTIP);
}
@@ -643,5 +644,30 @@ public class CoreItem extends ViewItem {
refresh(buttonComposite);
}
}
+
+ protected void setFocus() {
+ ArrayList list = getListOfSubItemCompositeHolders();
+ Label subitemLabel = null;
+ SubItemCompositeHolder holder = null;
+ if (list != null) {
+ for (Iterator iter = list.iterator(); iter.hasNext() && subitemLabel == null ;) {
+ holder = (SubItemCompositeHolder)iter.next();
+ if (!holder.isCompleted() && !holder.isSkipped()) {
+ subitemLabel = holder.getSubitemLabel();
+ }
+ }
+ }
+ if (subitemLabel != null) {
+ FormToolkit.ensureVisible(subitemLabel);
+ if (holder.getStartButton() != null) {
+ holder.getStartButton().setFocus();
+ } else if (holder.getCompleteButton() != null) {
+ holder.getCompleteButton().setFocus();
+ }
+ } else {
+ FormToolkit.ensureVisible(getMainItemComposite());
+ super.setFocus();
+ }
+ }
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java
index de945c46d..f32059c43 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java
@@ -20,7 +20,7 @@ public class SubItemCompositeHolder {
private Label checkDoneLabel;
private boolean skipped;
private boolean completed;
- protected ImageHyperlink startButton;
+ private ImageHyperlink startButton;
private String thisValue;
private SubItem subItem;
private Control skipButton;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
index d155dd267..2e57e41ce 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
@@ -404,7 +404,12 @@ public abstract class ViewItem {
setButtonsVisible(true);
setExpanded();
setBold(true);
+ setFocus();
+ }
+
+ protected void setFocus() {
mainItemComposite.setFocus();
+ FormToolkit.ensureVisible(getMainItemComposite());
}
/*package*/

Back to the top