diff options
author | Mazen Faraj | 2004-05-25 19:05:08 +0000 |
---|---|---|
committer | Mazen Faraj | 2004-05-25 19:05:08 +0000 |
commit | e2d8818cdc2049da7e342a5e82ed15e62ed9291b (patch) | |
tree | 441362b18a83f9f467acd793a3b251ed166adce3 /org.eclipse.ui.intro | |
parent | 32b869c72468d9f43d9ca52c88cb7aa16a2f38bb (diff) | |
download | eclipse.platform.ua-e2d8818cdc2049da7e342a5e82ed15e62ed9291b.tar.gz eclipse.platform.ua-e2d8818cdc2049da7e342a5e82ed15e62ed9291b.tar.xz eclipse.platform.ua-e2d8818cdc2049da7e342a5e82ed15e62ed9291b.zip |
swt navigation fixes
Diffstat (limited to 'org.eclipse.ui.intro')
19 files changed, 60 insertions, 57 deletions
diff --git a/org.eclipse.ui.intro/icons/backward_nav.gif b/org.eclipse.ui.intro/icons/backward_nav.gif Binary files differdeleted file mode 100644 index 61ca64e1e..000000000 --- a/org.eclipse.ui.intro/icons/backward_nav.gif +++ /dev/null diff --git a/org.eclipse.ui.intro/icons/blank.gif b/org.eclipse.ui.intro/icons/blank.gif Binary files differdeleted file mode 100644 index 1d11fa9ad..000000000 --- a/org.eclipse.ui.intro/icons/blank.gif +++ /dev/null diff --git a/org.eclipse.ui.intro/icons/bpel_16.gif b/org.eclipse.ui.intro/icons/bpel_16.gif Binary files differdeleted file mode 100644 index fb028f9d3..000000000 --- a/org.eclipse.ui.intro/icons/bpel_16.gif +++ /dev/null diff --git a/org.eclipse.ui.intro/icons/full/dlcl16/backward_nav.gif b/org.eclipse.ui.intro/icons/full/dlcl16/backward_nav.gif Binary files differnew file mode 100644 index 000000000..2972ff5c3 --- /dev/null +++ b/org.eclipse.ui.intro/icons/full/dlcl16/backward_nav.gif diff --git a/org.eclipse.ui.intro/icons/full/dlcl16/forward_nav.gif b/org.eclipse.ui.intro/icons/full/dlcl16/forward_nav.gif Binary files differnew file mode 100644 index 000000000..319fe8da1 --- /dev/null +++ b/org.eclipse.ui.intro/icons/full/dlcl16/forward_nav.gif diff --git a/org.eclipse.ui.intro/icons/full/dlcl16/home_nav.gif b/org.eclipse.ui.intro/icons/full/dlcl16/home_nav.gif Binary files differnew file mode 100644 index 000000000..819e85be8 --- /dev/null +++ b/org.eclipse.ui.intro/icons/full/dlcl16/home_nav.gif diff --git a/org.eclipse.ui.intro/icons/full/elcl16/backward_nav.gif b/org.eclipse.ui.intro/icons/full/elcl16/backward_nav.gif Binary files differnew file mode 100644 index 000000000..4fb415010 --- /dev/null +++ b/org.eclipse.ui.intro/icons/full/elcl16/backward_nav.gif diff --git a/org.eclipse.ui.intro/icons/forward_nav.gif b/org.eclipse.ui.intro/icons/full/elcl16/forward_nav.gif Binary files differindex 1d3bafb31..1d3bafb31 100644 --- a/org.eclipse.ui.intro/icons/forward_nav.gif +++ b/org.eclipse.ui.intro/icons/full/elcl16/forward_nav.gif diff --git a/org.eclipse.ui.intro/icons/home_nav.gif b/org.eclipse.ui.intro/icons/full/elcl16/home_nav.gif Binary files differindex 4472e8ce5..4472e8ce5 100644 --- a/org.eclipse.ui.intro/icons/home_nav.gif +++ b/org.eclipse.ui.intro/icons/full/elcl16/home_nav.gif diff --git a/org.eclipse.ui.intro/icons/overview_64.gif b/org.eclipse.ui.intro/icons/overview_64.gif Binary files differdeleted file mode 100644 index 35a535073..000000000 --- a/org.eclipse.ui.intro/icons/overview_64.gif +++ /dev/null diff --git a/org.eclipse.ui.intro/icons/overview_96.gif b/org.eclipse.ui.intro/icons/overview_96.gif Binary files differdeleted file mode 100644 index 06c9dbda4..000000000 --- a/org.eclipse.ui.intro/icons/overview_96.gif +++ /dev/null diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java index 32568fc66..87f43c922 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java @@ -43,10 +43,6 @@ public abstract class AbstractIntroPartImplementation { private int navigationLocation = 0; - // state flag indicating if we got here due to a navigation event (ie: an - // event triggered from the toolbar actions. - private boolean navigation = false; - private Action viewIntroModelAction = new Action() { { @@ -111,13 +107,6 @@ public abstract class AbstractIntroPartImplementation { * @param pageId */ public void updateHistory(String location) { - if (navigation) { - // if we got here due to a navigation event. reset state, and do - // nothing. - navigation = false; - return; - } - // quick exit. if (!history.isEmpty() && getCurrentLocation().equals(location)) // resetting the same location is useless. @@ -186,9 +175,7 @@ public abstract class AbstractIntroPartImplementation { ++navigationLocation; } - protected void setNavigationState(boolean state) { - navigation = state; - } + private boolean badNavigationLocation(int navigationLocation) { if (navigationLocation < 0 | navigationLocation >= history.size()) diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java index 62fa713bb..7dd64ead4 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java @@ -389,6 +389,11 @@ public class IntroPartPresentation extends AbstractIntroElement { implementation.standbyStateChanged(standby); } + public void updateHistory(String location) { + if (implementation != null) + implementation.updateHistory(location); + } + /** * Called when the IntroPart is disposed. Forwards the call to the * implementation class. diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURL.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURL.java index 3c836dd75..1e1bd06eb 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURL.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURL.java @@ -269,9 +269,6 @@ public class IntroURL implements IIntroURL { } private boolean showMessage(String message) { - - // REVISIT: some of the actions run UI code yet they are in - // model package. if (message == null) return false; else { @@ -295,7 +292,12 @@ public class IntroURL implements IIntroURL { // listener event to the UI. If setting the page in the model fails (ie: // the page was not found in the model), return false. IntroModelRoot modelRoot = IntroPlugin.getDefault().getIntroModelRoot(); - return modelRoot.setCurrentPageId(pageId); + boolean success = modelRoot.setCurrentPageId(pageId); + if (success) { + modelRoot.getPresentation().updateHistory(pageId); + return true; + } else + return false; } /** diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java index c9e60c3bf..f44b6fc4a 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java @@ -106,8 +106,6 @@ public class StandbyPart implements IIntroConstants { public void init(IIntroPart introPart, IMemento memento) { this.introPart = introPart; - // make sure to load the child of the standbyPart memento. - //this.memento = getMemento(memento, MEMENTO_STANDBY_CONTENT_PART_TAG); this.memento = memento; } @@ -130,7 +128,7 @@ public class StandbyPart implements IIntroConstants { container.setLayout(new StandbyLayout()); // return hyper link. - ImageUtil.registerImage(ImageUtil.BACK, "home_nav.gif"); //$NON-NLS-1$ + ImageUtil.registerImage(ImageUtil.BACK, "full/elcl16/home_nav.gif"); returnLink = toolkit.createImageHyperlink(container, SWT.WRAP); returnLink.setImage(ImageUtil.getImage(ImageUtil.BACK)); returnLink.addHyperlinkListener(new HyperlinkAdapter() { diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java index 84833ec19..f53887c61 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java @@ -39,7 +39,9 @@ public class BrowserIntroPartImplementation extends setToolTipText(IntroPlugin .getString("Browser.backwardButton_tooltip")); //$NON-NLS-1$ setImageDescriptor(ImageUtil - .createImageDescriptor("backward_nav.gif")); //$NON-NLS-1$ + .createImageDescriptor("full/elcl16/backward_nav.gif")); //$NON-NLS-1$ + setDisabledImageDescriptor(ImageUtil + .createImageDescriptor("full/dlcl16/backward_nav.gif")); } public void run() { @@ -48,8 +50,6 @@ public class BrowserIntroPartImplementation extends if (canNavigateBackward()) { navigateBackward(); if (isURL(getCurrentLocation())) { - // indicate navigation. - setNavigationState(true); browser.setUrl(getCurrentLocation()); } else // we need to regen HTML. Set current page, and this @@ -70,7 +70,9 @@ public class BrowserIntroPartImplementation extends setToolTipText(IntroPlugin .getString("Browser.forwardButton_tooltip")); //$NON-NLS-1$ setImageDescriptor(ImageUtil - .createImageDescriptor("forward_nav.gif")); //$NON-NLS-1$ + .createImageDescriptor("full/elcl16/forward_nav.gif")); //$NON-NLS-1$ + setDisabledImageDescriptor(ImageUtil + .createImageDescriptor("full/dlcl16/forward_nav.gif")); } public void run() { @@ -79,9 +81,6 @@ public class BrowserIntroPartImplementation extends if (canNavigateForward()) { navigateForward(); if (isURL(getCurrentLocation())) { - // Note: browser.forward() will not work here. - // indicate navigation. - setNavigationState(true); browser.setUrl(getCurrentLocation()); } else // we need to regen HTML. Set current page, and this @@ -100,8 +99,11 @@ public class BrowserIntroPartImplementation extends private Action homeAction = new Action() { { - setToolTipText(IntroPlugin.getString("Browser.homeButton_tooltip")); //$NON-NLS-1$ - setImageDescriptor(ImageUtil.createImageDescriptor("home_nav.gif")); //$NON-NLS-1$ + setToolTipText(IntroPlugin.getString("Browser.homeButton_tooltip")); + setImageDescriptor(ImageUtil + .createImageDescriptor("full/elcl16/home_nav.gif")); + setDisabledImageDescriptor(ImageUtil + .createImageDescriptor("full/dlcl16/home_nav.gif")); } public void run() { @@ -145,14 +147,16 @@ public class BrowserIntroPartImplementation extends // with history. browser.addLocationListener(urlListener); + // add a location listener that will clear a flagf at the end of any + // navigation to a page. This is used in conjuntion with the location + // listener to filter out redundant navigations die to frames. browser.addProgressListener(new ProgressListener() { public void changed(ProgressEvent event) { - browser.setData("navigation", "true"); } public void completed(ProgressEvent event) { - browser.setData("navigation", null); + browser.setData("frameNavigation", null); } }); diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java index e21c0bf1c..a995c13b1 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java @@ -21,10 +21,6 @@ public class BrowserIntroPartLocationListener implements LocationListener { private AbstractIntroPartImplementation implementation; - // flag used to filter out mutiple URL navigation events in one URL due to - // frames. - private int redundantNavigation = 0; - /** * Takes the implementation as an input. */ @@ -39,8 +35,6 @@ public class BrowserIntroPartLocationListener implements LocationListener { * @see org.eclipse.swt.browser.LocationListener#changed(org.eclipse.swt.browser.LocationEvent) */ public void changed(LocationEvent event) { - // note: navigations fired due to a setText do not fire closing changed. - redundantNavigation--; } /** @@ -59,22 +53,22 @@ public class BrowserIntroPartLocationListener implements LocationListener { // execute the action embedded in the IntroURL IntroURL introURL = parser.getIntroURL(); introURL.execute(); - // if action is a show page, update UI history. - if (introURL.getAction().equals(IntroURL.SHOW_PAGE)) - implementation.updateHistory(introURL - .getParameter(IntroURL.KEY_ID)); return; } if (parser.hasProtocol()) { - // Update the history even with real URLs. If this listener gets - // called due to a navigation, the navigation state controls the - // update. Note that if we have multiple embedded URL navigations - // due to frames, the redundantNavigation flag filters them out. - if (redundantNavigation == 0) + // Update the history even with real URLs. Note that if we have + // multiple embedded URL navigations due to frames, the + // frameNavigation flag filters them. This flag is set here, and is + // cleared by a progress listener, when all the frame navigation is + // completed. + Browser browser = (Browser) event.getSource(); + if (browser.getData("frameNavigation") == null) { + browser.setData("frameNavigation", "true"); implementation.updateHistory(url); + } } - redundantNavigation++; + //redundantNavigation++; return; } diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java index deaa17801..5b92e4f93 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java @@ -54,7 +54,9 @@ public class FormIntroPartImplementation extends setToolTipText(IntroPlugin .getString("Browser.backwardButton_tooltip")); //$NON-NLS-1$ setImageDescriptor(ImageUtil - .createImageDescriptor("backward_nav.gif")); //$NON-NLS-1$ + .createImageDescriptor("full/elcl16/backward_nav.gif")); //$NON-NLS-1$ + setDisabledImageDescriptor(ImageUtil + .createImageDescriptor("full/dlcl16/backward_nav.gif")); } public void run() { @@ -80,7 +82,9 @@ public class FormIntroPartImplementation extends setToolTipText(IntroPlugin .getString("Browser.forwardButton_tooltip")); //$NON-NLS-1$ setImageDescriptor(ImageUtil - .createImageDescriptor("forward_nav.gif")); //$NON-NLS-1$ + .createImageDescriptor("full/elcl16/forward_nav.gif")); //$NON-NLS-1$ + setDisabledImageDescriptor(ImageUtil + .createImageDescriptor("full/dlcl16/forward_nav.gif")); } public void run() { @@ -93,10 +97,8 @@ public class FormIntroPartImplementation extends else // Set current page, and this will triger regen. getModelRoot().setCurrentPageId(getCurrentLocation()); - } } - updateNavigationActionsState(); } }; @@ -105,8 +107,11 @@ public class FormIntroPartImplementation extends private Action homeAction = new Action() { { - setToolTipText(IntroPlugin.getString("Browser.homeButton_tooltip")); //$NON-NLS-1$ - setImageDescriptor(ImageUtil.createImageDescriptor("home_nav.gif")); //$NON-NLS-1$ + setToolTipText(IntroPlugin.getString("Browser.homeButton_tooltip")); + setImageDescriptor(ImageUtil + .createImageDescriptor("full/elcl16/home_nav.gif")); + setDisabledImageDescriptor(ImageUtil + .createImageDescriptor("full/dlcl16/home_nav.gif")); } public void run() { @@ -146,8 +151,8 @@ public class FormIntroPartImplementation extends /* - * create static UI forms Intro. For this, we only kaunch the url of the - * root page. + * createyet3agaian static UI forms Intro. For this, we only kaunch the url + * of the root page. */ private void handleStaticIntro() { String rootPageUrl = getModelRoot().getHomePage().getUrl(); @@ -225,7 +230,9 @@ public class FormIntroPartImplementation extends PageForm pageForm = new PageForm(toolkit, model, form); pageForm.createPartControl(pageBook, sharedStyleManager); - // now determine which page to show. + // now determine which page to show. Show it and ad it to history. + // if the cached page is a URL ignore it. We do not want to launch a + // browser on startup. String cachedPage = getCachedCurrentPage(); if (cachedPage != null & !isURL(cachedPage)) model.setCurrentPageId(cachedPage); @@ -243,6 +250,7 @@ public class FormIntroPartImplementation extends // then show the page pageBook.showPage(PageForm.PAGE_FORM_ID); } + updateHistory(pageToShow.getId()); } return pageBook; @@ -268,11 +276,14 @@ public class FormIntroPartImplementation extends // If page ID was not set properly. exit. return; + // avoid flicker. + mainPageBook.setRedraw(false); // if we are showing a regular intro page, or if the Home Page has a // regular page layout, set the page id to the static PageForm id. if (!mainPageBook.hasPage(pageId)) pageId = PageForm.PAGE_FORM_ID; mainPageBook.showPage(pageId); + mainPageBook.setRedraw(true); } } diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java index 6d2490b74..7bccbc700 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java @@ -202,7 +202,9 @@ public class PageForm implements IIntroConstants, IPropertyListener { categoryForm .createPartControl(categoryPageBook, sharedStyleManager); } + categoryPageBook.setRedraw(false); categoryPageBook.showPage(pageID); + categoryPageBook.setRedraw(true); // Get cached page subtitle from control data. Composite page = (Composite) categoryPageBook.getCurrentPage(); |