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
@@ -1,18 +1,20 @@
/*******************************************************************************
* Copyright (c) 2011 Google, Inc.
* Copyright (c) 2011, 2022 Google, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Google, Inc. - initial API and implementation
* Marcel du Preez - Hiding/showing of buttons depending on WB Basic preference
*******************************************************************************/
package org.eclipse.wb.internal.core.editor.errors;

import org.eclipse.wb.core.branding.BrandingUtils;
import org.eclipse.wb.core.branding.IBrandingDescription;
import org.eclipse.wb.core.controls.BrowserComposite;
import org.eclipse.wb.core.editor.constants.IEditorPreferenceConstants;
import org.eclipse.wb.internal.core.DesignerPlugin;
import org.eclipse.wb.internal.core.EnvironmentUtils;
import org.eclipse.wb.internal.core.editor.Messages;
Expand All @@ -23,9 +25,8 @@
import org.eclipse.wb.internal.core.utils.ui.GridLayoutFactory;
import org.eclipse.wb.internal.core.utils.ui.SwtResourceManager;

import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
Expand All @@ -50,6 +51,7 @@ public abstract class ExceptionComposite extends Composite {
private BrowserComposite m_browserComposite;
private Image m_screenshotImage;
private int m_sourcePosition;
private final boolean wbBasic;

////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -58,6 +60,10 @@ public abstract class ExceptionComposite extends Composite {
////////////////////////////////////////////////////////////////////////////
public ExceptionComposite(Composite parent, int style) {
super(parent, style);
wbBasic = InstanceScope.INSTANCE.getNode(
IEditorPreferenceConstants.WB_BASIC_UI_PREFERENCE_NODE).getBoolean(
IEditorPreferenceConstants.WB_BASIC_UI,
true);
// create GUI elements
GridLayoutFactory.create(this);
{
Expand All @@ -72,9 +78,10 @@ public ExceptionComposite(Composite parent, int style) {
{
Link label = new Link(titleComposite, SWT.WRAP | SWT.NO_FOCUS);
GridDataFactory.create(label).alignHL().grabH().alignVM();
label.setText(MessageFormat.format(
Messages.ExceptionComposite_message,
BrandingUtils.getBranding().getProductName()));
label.setText(
MessageFormat.format(
Messages.ExceptionComposite_message,
BrandingUtils.getBranding().getProductName()));
label.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
Expand Down Expand Up @@ -104,9 +111,10 @@ public void widgetSelected(SelectionEvent event) {
Button contactSupportButton = new Button(buttonsComposite, SWT.NONE);
GridDataFactory.create(contactSupportButton).fillH();
contactSupportButton.setText(Messages.ExceptionComposite_reportButton);
contactSupportButton.setImage(EnvironmentUtils.IS_MAC
? null
: DesignerPlugin.getImage("actions/errors/support32.png"));
contactSupportButton.setImage(
EnvironmentUtils.IS_MAC
? null
: DesignerPlugin.getImage("actions/errors/support32.png"));
contactSupportButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Expand All @@ -115,20 +123,23 @@ public void widgetSelected(SelectionEvent e) {
dialog.open();
}
});
contactSupportButton.setVisible(!wbBasic);
}
{
Button refreshButton = new Button(buttonsComposite, SWT.NONE);
GridDataFactory.create(refreshButton).fillH();
refreshButton.setText(Messages.ExceptionComposite_reparseButton);
refreshButton.setImage(EnvironmentUtils.IS_MAC
? null
: DesignerPlugin.getImage("actions/errors/refresh32.png"));
refreshButton.setImage(
EnvironmentUtils.IS_MAC
? null
: DesignerPlugin.getImage("actions/errors/refresh32.png"));
refreshButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doRefresh();
}
});
refreshButton.setVisible(!wbBasic);
}
{
m_switchButton = new Button(buttonsComposite, SWT.NONE);
Expand All @@ -140,14 +151,13 @@ public void widgetSelected(SelectionEvent ev) {
doShowSource(m_sourcePosition);
}
});
m_switchButton.setVisible(!wbBasic);
}
}
// dispose
addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (m_screenshotImage != null) {
m_screenshotImage.dispose();
}
addDisposeListener(e -> {
if (m_screenshotImage != null) {
m_screenshotImage.dispose();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/*******************************************************************************
* Copyright (c) 2011 Google, Inc.
* Copyright (c) 2011, 2022 Google, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Google, Inc. - initial API and implementation
* Marcel du Preez - - Hiding/showing of buttons depending on WB Basic preference
*******************************************************************************/
package org.eclipse.wb.internal.core.editor.errors;

import org.eclipse.wb.core.controls.BrowserComposite;
import org.eclipse.wb.core.editor.constants.IEditorPreferenceConstants;
import org.eclipse.wb.internal.core.DesignerPlugin;
import org.eclipse.wb.internal.core.EnvironmentUtils;
import org.eclipse.wb.internal.core.editor.Messages;
Expand All @@ -19,6 +21,7 @@
import org.eclipse.wb.internal.core.utils.ui.GridLayoutFactory;
import org.eclipse.wb.internal.core.utils.ui.SwtResourceManager;

import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
Expand All @@ -39,6 +42,7 @@ public abstract class WarningComposite extends Composite {
private final BrowserComposite m_browser;
private final Label m_titleLabel;
private int m_sourcePosition;
private final boolean wbBasic;

////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -47,6 +51,10 @@ public abstract class WarningComposite extends Composite {
////////////////////////////////////////////////////////////////////////////
public WarningComposite(Composite parent, int style) {
super(parent, style);
wbBasic = InstanceScope.INSTANCE.getNode(
IEditorPreferenceConstants.WB_BASIC_UI_PREFERENCE_NODE).getBoolean(
IEditorPreferenceConstants.WB_BASIC_UI,
true);
GridLayoutFactory.create(this);
{
Composite titleComposite = new Composite(this, SWT.NONE);
Expand All @@ -58,10 +66,8 @@ public WarningComposite(Composite parent, int style) {
}
{
m_titleLabel = new Label(titleComposite, SWT.NONE);
m_titleLabel.setFont(SwtResourceManager.getFont(
getFont().getFontData()[0].getName(),
14,
SWT.BOLD));
m_titleLabel.setFont(
SwtResourceManager.getFont(getFont().getFontData()[0].getName(), 14, SWT.BOLD));
}
}
{
Expand All @@ -84,15 +90,15 @@ protected void createButtons(Composite buttonsComposite) {
Button refreshButton = new Button(buttonsComposite, SWT.NONE);
GridDataFactory.create(refreshButton).fillH();
refreshButton.setText(Messages.WarningComposite_refreshButton);
refreshButton.setImage(EnvironmentUtils.IS_MAC
? null
: DesignerPlugin.getImage("actions/errors/refresh32.png"));
refreshButton.setImage(
EnvironmentUtils.IS_MAC ? null : DesignerPlugin.getImage("actions/errors/refresh32.png"));
refreshButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doRefresh();
}
});
refreshButton.setVisible(!wbBasic);
}
{
m_switchButton = new Button(buttonsComposite, SWT.NONE);
Expand All @@ -104,6 +110,7 @@ public void widgetSelected(SelectionEvent e) {
doShowSource(m_sourcePosition);
}
});
m_switchButton.setVisible(!wbBasic);
}
}

Expand Down