Skip to content
Open
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
2 changes: 1 addition & 1 deletion apitools/org.eclipse.pde.api.tools.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.api.tools.ui; singleton:=true
Bundle-Version: 1.4.200.qualifier
Bundle-Version: 1.4.300.qualifier
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@
import org.eclipse.pde.api.tools.ui.internal.IApiToolsHelpContextIds;
import org.eclipse.pde.api.tools.ui.internal.SWTFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;

/**
Expand Down Expand Up @@ -85,6 +91,9 @@ public class ApiErrorsWarningsPreferencePage extends PreferencePage implements I
ApiErrorsWarningsConfigurationBlock block = null;
private Link link = null;

private Image expandImage;
private Image collapseImage;

/**
* Since {@link #applyData(Object)} can be called before createContents,
* store the data
Expand All @@ -98,6 +107,33 @@ public ApiErrorsWarningsPreferencePage() {
super(PreferenceMessages.ApiErrorsWarningsPreferencePage_0);
}

private void expandCollapseItems(Composite parent, boolean expandPage) {
for (Control control : parent.getChildren()) {
if (control instanceof ExpandableComposite page) {
page.setExpanded(expandPage);
Control child = page.getClient();
if (child != null && !child.isDisposed()) {
child.setVisible(expandPage);
}
} else if (control instanceof Composite) {
expandCollapseItems((Composite) control, expandPage);
}
}
parent.layout(true, true);
ScrolledComposite composite = getScrolledComposite(parent);
if (composite != null) {
composite.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}

private ScrolledComposite getScrolledComposite(Composite comp) {
Composite currentComposite = comp;
while (currentComposite != null && !(currentComposite instanceof ScrolledComposite)) {
currentComposite = currentComposite.getParent();
}
return (ScrolledComposite) currentComposite;
}

@Override
protected Control createContents(Composite parent) {
Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0);
Expand Down Expand Up @@ -127,9 +163,38 @@ protected Control createContents(Composite parent) {
new String[] { IApiToolsConstants.ID_ERRORS_WARNINGS_PROP_PAGE }, data).open();
}
}));

ToolBar buttonbar = new ToolBar(comp, SWT.FLAT | SWT.RIGHT);
buttonbar.setLayoutData(new GridData(SWT.END, SWT.CENTER, true,
false));
ToolItem expandItems = new ToolItem(buttonbar, SWT.PUSH);
expandImage = AbstractUIPlugin
.imageDescriptorFromPlugin("org.eclipse.pde.api.tools.ui", "icons/full/elcl16/expandall.svg") //$NON-NLS-1$ //$NON-NLS-2$
.createImage();
expandItems.setImage(expandImage);
expandItems.setToolTipText(PreferenceMessages.PREFERENCE_EXPAND_ALL);

ToolItem collapseItems = new ToolItem(buttonbar, SWT.PUSH);
collapseImage = AbstractUIPlugin
.imageDescriptorFromPlugin("org.eclipse.pde.api.tools.ui", "icons/full/elcl16/collapseall.svg") //$NON-NLS-1$ //$NON-NLS-2$
.createImage();
collapseItems.setImage(collapseImage);
collapseItems.setToolTipText(PreferenceMessages.PREFERENCE_COLLAPSE_ALL);

block = new ApiErrorsWarningsConfigurationBlock(null, (IWorkbenchPreferenceContainer) getContainer());
block.createControl(comp);

expandItems.addListener(SWT.Selection, e -> expandCollapseItems(comp, true));
collapseItems.addListener(SWT.Selection, e -> expandCollapseItems(comp, false));
comp.addDisposeListener(e -> {
if (!expandImage.isDisposed() && expandImage != null) {
expandImage.dispose();
}
if (!collapseImage.isDisposed() && collapseImage != null) {
collapseImage.dispose();
}
});

// Initialize with data map in case applyData was called before
// createContents
applyData(fPageData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ public class PreferenceMessages extends NLS {
public static String CONSTRUCTOR_CHANGED_DECREASE_ACCESS;
public static String CONSTRUCTOR_REMOVED_TYPE_PARAMETER;

public static String PREFERENCE_COLLAPSE_ALL;
public static String PREFERENCE_EXPAND_ALL;

public static String TYPE_PARAMETER_ADDED_CLASS_BOUND;
public static String TYPE_PARAMETER_ADDED_INTERFACE_BOUND;
public static String TYPE_PARAMETER_CHANGED_CLASS_BOUND;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ CONSTRUCTOR_CHANGED_VARARGS_TO_ARRAY=Converted variable argument type to array t
CONSTRUCTOR_CHANGED_DECREASE_ACCESS=The visibility has been reduced:
CONSTRUCTOR_REMOVED_TYPE_PARAMETER=A type parameter has been removed:

PREFERENCE_COLLAPSE_ALL= Collapse all preferences
PREFERENCE_EXPAND_ALL= Expand all preferences

TYPE_PARAMETER_ADDED_CLASS_BOUND=A class bound has been added:
TYPE_PARAMETER_ADDED_INTERFACE_BOUND=An interface bound has been added:
TYPE_PARAMETER_CHANGED_CLASS_BOUND=A class bound has been modified:
Expand Down
Loading