-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close view using bot | create buttons and add them
- Loading branch information
Showing
2 changed files
with
22 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,35 +46,32 @@ public synchronized void createPartControl(Composite parent) { | |
browser = new Browser(parent, SWT.NONE); | ||
resetBrowser(); | ||
browser.addProgressListener(new PitUiUpdatePublisher(browser)); | ||
IActionBars actionBars = getViewSite().getActionBars(); | ||
IToolBarManager toolBar = actionBars.getToolBarManager(); | ||
// create back button | ||
final Action backButtonAction = new Action(BACK_BUTTON_TEXT) { | ||
toolBar.add(new Action(BACK_BUTTON_TEXT) { | ||
@Override | ||
public void run() { | ||
browser.back(); | ||
} | ||
}; | ||
}); | ||
// create home button for navigation | ||
final Action homeButtonAction = new Action(HOME_BUTTON_TEXT) { | ||
toolBar.add(new Action(HOME_BUTTON_TEXT) { | ||
@Override | ||
public void run() { | ||
if (homeUrlString != null) { | ||
// only set url, if an home is set otherwise NPE | ||
browser.setUrl(homeUrlString); | ||
} | ||
} | ||
}; | ||
}); | ||
// create forward button | ||
final Action forwardButtonAction = new Action(FORWARD_BUTTON_TEXT) { | ||
toolBar.add(new Action(FORWARD_BUTTON_TEXT) { | ||
@Override | ||
public void run() { | ||
browser.forward(); | ||
} | ||
}; | ||
IActionBars actionBars = getViewSite().getActionBars(); | ||
IToolBarManager toolBar = actionBars.getToolBarManager(); | ||
toolBar.add(backButtonAction); | ||
toolBar.add(homeButtonAction); | ||
toolBar.add(forwardButtonAction); | ||
}); | ||
actionBars.updateActionBars(); | ||
} catch (SWTError e) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
MessageBox messageBox = new MessageBox(parent.getShell(), SWT.ICON_ERROR | SWT.OK); | ||
|
@@ -96,7 +93,7 @@ private void resetBrowser() { | |
|
||
@Override | ||
public void setFocus() { | ||
if (browser != null && !browser.isDisposed()) { | ||
if (!browser.isDisposed()) { | ||
This comment has been minimized.
Sorry, something went wrong.
LorenzoBettini
Collaborator
|
||
browser.setFocus(); | ||
} | ||
} | ||
|
@@ -110,12 +107,4 @@ public synchronized void update(File result) { | |
browser.setUrl(homeUrlString); | ||
} | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
if (browser != null && !browser.isDisposed()) { | ||
browser.dispose(); | ||
} | ||
super.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you merge with master (maybe you'll get a conflict), you'll see that the error handling is now delegated to
org.pitest.pitclipse.ui.utils.PitclipseUiUtils