Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,18 @@ private void updateEnableState(boolean enabled) {
boolean first = disabledStates.isEmpty();
for (int i = 0; i < children.length; i++) {
Control child = children[i];
if (child == masterButton)
if (child == masterButton) {
continue;
}
if (!enabled) {
disabledStates.put(child, Boolean.valueOf(child.isEnabled()));
child.setEnabled(false);
} else {
Boolean savedState = disabledStates.get(child);
if (!first)
if (!first) {
child.setEnabled(savedState != null ? savedState
.booleanValue() : true);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ public void setInitializationData(IConfigurationElement config,
if (data != null && data instanceof Hashtable) {
url = ((Hashtable<String, String>) data).get("url"); //$NON-NLS-1$
}
if (url == null || url.length() == 0)
if (url == null || url.length() == 0) {
url = config.getAttribute("url"); //$NON-NLS-1$
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = Display.getCurrent().getActiveShell();
if (shell != null && !shell.isDisposed()) {
Object shellData = shell.getData();
if (shellData instanceof TrayDialog) {
TrayDialog trayDialog = (TrayDialog)shellData;
if (shellData instanceof TrayDialog trayDialog) {
if (trayDialog.getTray() instanceof HelpTray) {
trayDialog.closeTray();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ public synchronized void close() {
}
if (shell != null) {
shell.close();
if (!shell.isDisposed())
if (!shell.isDisposed()) {
shell.dispose();
}
shell = null;
}
} catch (Throwable ex) {
Expand Down Expand Up @@ -296,8 +297,9 @@ private Control createLink(Composite parent, IHelpResource topic) {

private Control createLinksArea(Composite parent) {
IHelpResource[] relatedTopics = context.getRelatedTopics();
if (relatedTopics == null)
if (relatedTopics == null) {
return null;
}
// Create control
Composite composite = new Composite(parent, SWT.NONE);
initAccessible(composite);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ private static HelpView getHelpView() {
private static void setIntroStandby() {
IIntroManager introMng = PlatformUI.getWorkbench().getIntroManager();
IIntroPart intro = introMng.getIntro();
if (intro != null && !introMng.isIntroStandby(intro))
if (intro != null && !introMng.isIntroStandby(intro)) {
introMng.setIntroStandby(intro, true);
}
}

private void warnNoOpenPerspective(IWorkbenchWindow window) {
Expand Down Expand Up @@ -307,8 +308,9 @@ public void displayContext(IContext context, int x, int y) {
}

void displayContext(IContext context, int x, int y, boolean noInfopop) {
if (context == null)
if (context == null) {
return;
}
boolean winfopop = Platform.getPreferencesService().getBoolean
(HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_WINDOW_INFOPOP, false, null);
boolean dinfopop = Platform.getPreferencesService().getBoolean
Expand All @@ -328,12 +330,13 @@ void displayContext(IContext context, int x, int y, boolean noInfopop) {
IWorkbenchPart activePart = page.getActivePart();
Control c = window.getShell().getDisplay().getFocusControl();
IContextProvider adapter = activePart.getAdapter(IContextProvider.class);
if (adapter != null)
if (adapter != null) {
context = adapter
.getContext(c); /*
* If the context help has no description text and exactly one
* topic, go straight to the topic and skip context help.
*/
}
Objects.requireNonNull(context, "context must not be null when displaying help content"); //$NON-NLS-1$
String contextText = context.getText();
IHelpResource[] topics = context.getRelatedTopics();
Expand Down Expand Up @@ -472,8 +475,9 @@ private boolean useExternalBrowser(String url) {
if (!Constants.OS_WIN32.equalsIgnoreCase(Platform.getOS())) {
Display display = Display.getCurrent();
if (display != null) {
if (insideModalParent(display))
if (insideModalParent(display)) {
return true;
}
}
}

Expand All @@ -494,8 +498,9 @@ private boolean insideModalParent(Display display) {

public static boolean isDisplayModal(Shell activeShell) {
while (activeShell != null) {
if ((activeShell.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0)
if ((activeShell.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0) {
return true;
}
activeShell = (Shell) activeShell.getParent();
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ public ActivityDescriptor() {

private void load() {
IConfigurationElement [] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.help.base.activitySupport");//$NON-NLS-1$
if (elements.length==1 && elements[0].getName().equals("support")) //$NON-NLS-1$
if (elements.length==1 && elements[0].getName().equals("support")) { //$NON-NLS-1$
config = elements[0];
else if (elements.length>0) {
} else if (elements.length>0) {
IProduct product = Platform.getProduct();
if (product==null) return;
if (product==null) {
return;
}
String productId = product.getId();
for (int i=0; i<elements.length; i++) {
IConfigurationElement element = elements[i];
Expand All @@ -82,11 +84,13 @@ private IConfigurationElement getChild(String name) {
return children.length==1?children[0]:null;
}
public String getShowAllMessage() {
if (config==null)
if (config==null) {
return null;
}
IConfigurationElement child = getChild("showAllMessage"); //$NON-NLS-1$
if (child!=null)
if (child!=null) {
return child.getValue();
}
return null;
}
public boolean needsLiveHelp(boolean embedded) {
Expand All @@ -108,9 +112,9 @@ public String getDocumentMessage(boolean embedded) {
buffer.append(getActivityEditorValue(pluginId, className, embedded));
buffer.append(value.substring(loc+15));
documentMessage = buffer.toString();
}
else
} else {
documentMessage = value;
}
}
}
return documentMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ public class HelpUIEventLoop {
*/
public static void run() {
try {
if (display == null)
if (display == null) {
display = Display.getCurrent();
if (display == null)
}
if (display == null) {
display = new Display();
}
} finally {
started = true;
}
Expand All @@ -61,11 +63,12 @@ public static void run() {

public static void wakeup() {
Display d = display;
if (d != null)
if (d != null) {
try {
d.wake();
} catch (Exception e) {
}
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ public void start(BundleContext context) throws Exception {
DEBUG_INFOPOP = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/infopop")); //$NON-NLS-1$ //$NON-NLS-2$
}

if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH)
if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH) {
// UI may get activated during standalone
BaseHelpSystem.setDefaultErrorUtil(new ErrorUtil());
}

if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH) {
// This is workbench scenario. Set activity support of base help to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public static ImageDescriptor getImageDescriptor(String bundleId, String name) {
ImageDescriptor desc = registry.getDescriptor(name);
if (desc==null) {
Bundle bundle = Platform.getBundle(bundleId);
if (bundle==null) return null;
if (bundle==null) {
return null;
}
URL url = FileLocator.find(bundle, IPath.fromOSString(name), null);
desc = ImageDescriptor.createFromURL(url);
registry.put(name, desc);
Expand All @@ -89,7 +91,9 @@ public static ImageDescriptor getIconImageDescriptor(String bundleId, String pat
ImageDescriptor desc = registry.getDescriptor(key);
if (desc==null) {
Bundle bundle = Platform.getBundle(bundleId);
if (bundle == null) return null;
if (bundle == null) {
return null;
}
URL url = FileLocator.find(bundle, IPath.fromOSString(path), null);
desc = ImageDescriptor.createFromURL(url);
registry.put(key, desc);
Expand Down Expand Up @@ -158,12 +162,15 @@ private static void initializeTocIcons(){
String contributorID = iconElem.getContributor().getName();

for (int k=0; k < attrs.length; k++){
if(attrs[k].equals(OPEN_ICON_PATH))
if(attrs[k].equals(OPEN_ICON_PATH)) {
HelpUIResources.getIconImageDescriptor(contributorID, iconElem.getAttribute(OPEN_ICON_PATH), iconElem.getAttribute(TOC_ICON_ID) + OPEN);
if(attrs[k].equals(CLOSED_ICON_PATH))
}
if(attrs[k].equals(CLOSED_ICON_PATH)) {
HelpUIResources.getIconImageDescriptor(contributorID, iconElem.getAttribute(CLOSED_ICON_PATH), iconElem.getAttribute(TOC_ICON_ID) + CLOSED);
if(attrs[k].equals(LEAF_ICON_PATH))
}
if(attrs[k].equals(LEAF_ICON_PATH)) {
HelpUIResources.getIconImageDescriptor(contributorID, iconElem.getAttribute(LEAF_ICON_PATH), iconElem.getAttribute(TOC_ICON_ID) + LEAF);
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,43 +103,54 @@ public void mouseDoubleClick(MouseEvent e) {

@Override
public void mouseDown(MouseEvent e) {
if (e.button == 1)
if (e.button == 1) {
return;
}
lastLink = (Control) e.widget;
}

@Override
public void mouseEnter(MouseEvent e) {
Control control = (Control) e.widget;

if (isHyperlinkCursorUsed())
if (isHyperlinkCursorUsed()) {
control.setCursor(hyperlinkCursor);
if (activeBackground != null)
}
if (activeBackground != null) {
control.setBackground(activeBackground);
if (activeForeground != null)
}
if (activeForeground != null) {
control.setForeground(activeForeground);
if (hyperlinkUnderlineMode == UNDERLINE_ROLLOVER)
}
if (hyperlinkUnderlineMode == UNDERLINE_ROLLOVER) {
underline(control, true);
}
IHyperlinkListener action = getLinkListener(control);
if (action != null)
if (action != null) {
action.linkEntered(control);
}
}

@Override
public void mouseExit(MouseEvent e) {
Control control = (Control) e.widget;

if (isHyperlinkCursorUsed())
if (isHyperlinkCursorUsed()) {
control.setCursor(null);
if (hyperlinkUnderlineMode == UNDERLINE_ROLLOVER)
}
if (hyperlinkUnderlineMode == UNDERLINE_ROLLOVER) {
underline(control, false);
if (background != null)
}
if (background != null) {
control.setBackground(background);
if (foreground != null)
}
if (foreground != null) {
control.setForeground(foreground);
}
IHyperlinkListener action = getLinkListener(control);
if (action != null)
if (action != null) {
action.linkExited(control);
}
}

@Override
Expand All @@ -148,24 +159,27 @@ public void mouseHover(MouseEvent e) {

@Override
public void mouseUp(MouseEvent e) {
if (e.button != 1)
if (e.button != 1) {
return;
}
IHyperlinkListener action = getLinkListener((Control) e.widget);

if (action != null) {
Control c = (Control) e.widget;
c.setCursor(busyCursor);
action.linkActivated(c);
if (!c.isDisposed())
if (!c.isDisposed()) {
c.setCursor(isHyperlinkCursorUsed() ? hyperlinkCursor : null);
}
}
}

@Override
public void paintControl(PaintEvent e) {
Control control = (Control) e.widget;
if (hyperlinkUnderlineMode == UNDERLINE_ALWAYS)
if (hyperlinkUnderlineMode == UNDERLINE_ALWAYS) {
HyperlinkHandler.underline(control, true);
}
}
/**
* @param control
Expand All @@ -174,22 +188,26 @@ public void paintControl(PaintEvent e) {
* org.eclipse.help.ui.internal.IHyperlinkListener
*/
public void registerHyperlink(Control control, IHyperlinkListener listener) {
if (background != null)
if (background != null) {
control.setBackground(background);
if (foreground != null)
}
if (foreground != null) {
control.setForeground(foreground);
}
control.addMouseListener(this);
control.addMouseTrackListener(this);
control.addListener(SWT.DefaultSelection, this);

if (hyperlinkUnderlineMode == UNDERLINE_ALWAYS)
if (hyperlinkUnderlineMode == UNDERLINE_ALWAYS) {
control.addPaintListener(this);
}
hyperlinkListeners.put(control, listener);
removeDisposedLinks();
}
public IHyperlinkListener getLinkListener(Control c) {
if (c instanceof Label)
if (c instanceof Label) {
c = c.getParent();
}
return hyperlinkListeners.get(c);
}

Expand Down Expand Up @@ -257,8 +275,9 @@ public void setHyperlinkUnderlineMode(int newHyperlinkUnderlineMode) {
*/
public static void underline(Control control, boolean inside) {

if (control instanceof HyperlinkLabel)
if (control instanceof HyperlinkLabel) {
control = ((HyperlinkLabel) control).getLabel();
}

Composite parent = control.getParent();
Rectangle bounds = control.getBounds();
Expand Down
Loading
Loading