Remove redundant block
Change-Id: I4269773c8bdd0626afbc3ec39aea0c94f7ffa9ed
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToNumberParser.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToNumberParser.java
index d8a3b71..b4ead19 100644
--- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToNumberParser.java
+++ b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToNumberParser.java
@@ -267,10 +267,8 @@
}
}
- /* if (bigDecimal != null) */{
- return max.compareTo(bigDecimal) >= 0
- && min.compareTo(bigDecimal) <= 0;
- }
+ /* if (bigDecimal != null) */return max.compareTo(bigDecimal) >= 0
+ && min.compareTo(bigDecimal) <= 0;
// throw new IllegalArgumentException(
// "Number of type [" + number.getClass().getName() + "] is not supported."); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/IDE.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/IDE.java
index 3fd0c87..6c162dd 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/IDE.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/IDE.java
@@ -849,9 +849,7 @@
IContentType contentType = null;
try (InputStream is = fileStore.openInputStream(EFS.NONE, null)) {
- {
- contentType = Platform.getContentTypeManager().findContentTypeFor(is, name);
- }
+ contentType = Platform.getContentTypeManager().findContentTypeFor(is, name);
} catch (CoreException ex) {
// continue without content type
} catch (IOException ex) {
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
index 1f93b93..25b75a9 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
@@ -377,79 +377,75 @@
protected void fillCoolBar(ICoolBarManager coolBar) {
IActionBarConfigurer2 actionBarConfigurer = (IActionBarConfigurer2) getActionBarConfigurer();
+
+ // File Group
coolBar.add(new GroupMarker(IIDEActionConstants.GROUP_FILE));
- { // File Group
- IToolBarManager fileToolBar = actionBarConfigurer.createToolBarManager();
- fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
- fileToolBar.add(newWizardDropDownAction);
- fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
- fileToolBar.add(new GroupMarker(
- IWorkbenchActionConstants.SAVE_GROUP));
- fileToolBar.add(saveAction);
- fileToolBar.add(saveAllAction);
- fileToolBar
- .add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
- fileToolBar.add(getPrintItem());
- fileToolBar
- .add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
+ IToolBarManager fileToolBar = actionBarConfigurer.createToolBarManager();
+ fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
+ fileToolBar.add(newWizardDropDownAction);
+ fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
+ fileToolBar.add(new GroupMarker(
+ IWorkbenchActionConstants.SAVE_GROUP));
+ fileToolBar.add(saveAction);
+ fileToolBar.add(saveAllAction);
+ fileToolBar
+ .add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
+ fileToolBar.add(getPrintItem());
+ fileToolBar
+ .add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
- fileToolBar
- .add(new Separator(IWorkbenchActionConstants.BUILD_GROUP));
- fileToolBar
- .add(new GroupMarker(IWorkbenchActionConstants.BUILD_EXT));
- fileToolBar.add(new Separator(
- IWorkbenchActionConstants.MB_ADDITIONS));
+ fileToolBar
+ .add(new Separator(IWorkbenchActionConstants.BUILD_GROUP));
+ fileToolBar
+ .add(new GroupMarker(IWorkbenchActionConstants.BUILD_EXT));
+ fileToolBar.add(new Separator(
+ IWorkbenchActionConstants.MB_ADDITIONS));
- // Add to the cool bar manager
- coolBar.add(actionBarConfigurer.createToolBarContributionItem(fileToolBar,
- IWorkbenchActionConstants.TOOLBAR_FILE));
- }
+ // Add to the cool bar manager
+ coolBar.add(actionBarConfigurer.createToolBarContributionItem(fileToolBar,
+ IWorkbenchActionConstants.TOOLBAR_FILE));
+ // Edit group
coolBar.add(new GroupMarker(IIDEActionConstants.GROUP_EDIT));
- { // Edit group
- IToolBarManager editToolBar = actionBarConfigurer.createToolBarManager();
- editToolBar.add(new Separator(IWorkbenchActionConstants.EDIT_GROUP));
- editToolBar.add(undoAction);
- editToolBar.add(redoAction);
+ IToolBarManager editToolBar = actionBarConfigurer.createToolBarManager();
+ editToolBar.add(new Separator(IWorkbenchActionConstants.EDIT_GROUP));
+ editToolBar.add(undoAction);
+ editToolBar.add(redoAction);
- // Add to the cool bar manager
- coolBar.add(actionBarConfigurer.createToolBarContributionItem(editToolBar,
- IWorkbenchActionConstants.TOOLBAR_EDIT));
- }
+ // Add to the cool bar manager
+ coolBar.add(actionBarConfigurer.createToolBarContributionItem(editToolBar,
+ IWorkbenchActionConstants.TOOLBAR_EDIT));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ // Navigate group
coolBar.add(new GroupMarker(IIDEActionConstants.GROUP_NAV));
- { // Navigate group
- IToolBarManager navToolBar = actionBarConfigurer.createToolBarManager();
- navToolBar.add(new Separator(
- IWorkbenchActionConstants.HISTORY_GROUP));
- navToolBar
- .add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
- navToolBar.add(backwardHistoryAction);
- navToolBar.add(forwardHistoryAction);
- navToolBar.add(new Separator(IWorkbenchActionConstants.PIN_GROUP));
- navToolBar.add(getPinEditorItem());
+ IToolBarManager navToolBar = actionBarConfigurer.createToolBarManager();
+ navToolBar.add(new Separator(
+ IWorkbenchActionConstants.HISTORY_GROUP));
+ navToolBar
+ .add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
+ navToolBar.add(backwardHistoryAction);
+ navToolBar.add(forwardHistoryAction);
+ navToolBar.add(new Separator(IWorkbenchActionConstants.PIN_GROUP));
+ navToolBar.add(getPinEditorItem());
- // Add to the cool bar manager
- coolBar.add(actionBarConfigurer.createToolBarContributionItem(navToolBar,
- IWorkbenchActionConstants.TOOLBAR_NAVIGATE));
- }
+ // Add to the cool bar manager
+ coolBar.add(actionBarConfigurer.createToolBarContributionItem(navToolBar,
+ IWorkbenchActionConstants.TOOLBAR_NAVIGATE));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));
- { // Help group
- IToolBarManager helpToolBar = actionBarConfigurer.createToolBarManager();
- helpToolBar.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));
-// helpToolBar.add(searchComboItem);
- // Add the group for applications to contribute
- helpToolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
- // Add to the cool bar manager
- coolBar.add(actionBarConfigurer.createToolBarContributionItem(helpToolBar,
- IWorkbenchActionConstants.TOOLBAR_HELP));
- }
+ // Help group
+ IToolBarManager helpToolBar = actionBarConfigurer.createToolBarManager();
+ helpToolBar.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));
+ // Add the group for applications to contribute
+ helpToolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
+ // Add to the cool bar manager
+ coolBar.add(actionBarConfigurer.createToolBarContributionItem(helpToolBar,
+ IWorkbenchActionConstants.TOOLBAR_HELP));
}
@@ -473,18 +469,16 @@
private MenuManager createFileMenu() {
MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
- {
- // create the New submenu, using the same id for it as the New action
- String newText = IDEWorkbenchMessages.Workbench_new;
- String newId = ActionFactory.NEW.getId();
- MenuManager newMenu = new MenuManager(newText, newId);
- newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$
- newMenu.add(new Separator(newId));
- this.newWizardMenu = new NewWizardMenu(getWindow());
- newMenu.add(this.newWizardMenu);
- newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(newMenu);
- }
+ // create the New submenu, using the same id for it as the New action
+ String newText = IDEWorkbenchMessages.Workbench_new;
+ String newId = ActionFactory.NEW.getId();
+ MenuManager newMenu = new MenuManager(newText, newId);
+ newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$
+ newMenu.add(new Separator(newId));
+ this.newWizardMenu = new NewWizardMenu(getWindow());
+ newMenu.add(this.newWizardMenu);
+ newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ menu.add(newMenu);
menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
@@ -596,15 +590,13 @@
menu.add(new Separator(IWorkbenchActionConstants.OPEN_EXT + i));
}
menu.add(new Separator(IWorkbenchActionConstants.SHOW_EXT));
- {
- MenuManager showInSubMenu = new MenuManager(
- IDEWorkbenchMessages.Workbench_showIn, "showIn"); //$NON-NLS-1$
- showInSubMenu.setActionDefinitionId(showInQuickMenu
- .getActionDefinitionId());
- showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN
- .create(getWindow()));
- menu.add(showInSubMenu);
- }
+ MenuManager showInSubMenu = new MenuManager(
+ IDEWorkbenchMessages.Workbench_showIn, "showIn"); //$NON-NLS-1$
+ showInSubMenu.setActionDefinitionId(showInQuickMenu
+ .getActionDefinitionId());
+ showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN
+ .create(getWindow()));
+ menu.add(showInSubMenu);
for (int i = 2; i < 5; ++i) {
menu.add(new Separator(IWorkbenchActionConstants.SHOW_EXT + i));
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java
index 409c009..cac0e90 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java
@@ -95,17 +95,15 @@
date.setLayoutData(data);
}
// signer
- {
- Label label = new Label(composite, SWT.NONE);
- label.setText(WorkbenchMessages.BundleSigningTray_Signing_Certificate);
- GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
- data.horizontalSpan = 2;
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.horizontalSpan = 2;
- certificate = new StyledText(composite, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP);
- certificate.setText(WorkbenchMessages.BundleSigningTray_Working);
- certificate.setLayoutData(data);
- }
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(WorkbenchMessages.BundleSigningTray_Signing_Certificate);
+ GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
+ data.horizontalSpan = 2;
+ data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.horizontalSpan = 2;
+ certificate = new StyledText(composite, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP);
+ certificate.setText(WorkbenchMessages.BundleSigningTray_Working);
+ certificate.setLayoutData(data);
Dialog.applyDialogFont(composite);
startJobs(); // start the jobs that will prime the content
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
index 0e1c955..85eabda 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
@@ -180,36 +180,32 @@
}
}
}
- {
- ColorDefinition[] colorDefinitions = themeRegistry.getColorsFor(currentTheme.getId());
- for (ColorDefinition colorDefinition : colorDefinitions) {
- if (!colorDefinition.isEditable()) {
+ ColorDefinition[] colorDefinitions = themeRegistry.getColorsFor(currentTheme.getId());
+ for (ColorDefinition colorDefinition : colorDefinitions) {
+ if (!colorDefinition.isEditable()) {
+ continue;
+ }
+ String catId = colorDefinition.getCategoryId();
+ if ((catId == null && categoryId == null)
+ || (catId != null && categoryId != null && categoryId.equals(catId))) {
+ if (colorDefinition.getDefaultsTo() != null && parentIsInSameCategory(colorDefinition)) {
continue;
}
- String catId = colorDefinition.getCategoryId();
- if ((catId == null && categoryId == null)
- || (catId != null && categoryId != null && categoryId.equals(catId))) {
- if (colorDefinition.getDefaultsTo() != null && parentIsInSameCategory(colorDefinition)) {
- continue;
- }
- list.add(colorDefinition);
- }
+ list.add(colorDefinition);
}
}
- {
- FontDefinition[] fontDefinitions = themeRegistry.getFontsFor(currentTheme.getId());
- for (FontDefinition fontDefinition : fontDefinitions) {
- if (!fontDefinition.isEditable()) {
+ FontDefinition[] fontDefinitions = themeRegistry.getFontsFor(currentTheme.getId());
+ for (FontDefinition fontDefinition : fontDefinitions) {
+ if (!fontDefinition.isEditable()) {
+ continue;
+ }
+ String catId = fontDefinition.getCategoryId();
+ if ((catId == null && categoryId == null)
+ || (catId != null && categoryId != null && categoryId.equals(catId))) {
+ if (fontDefinition.getDefaultsTo() != null && parentIsInSameCategory(fontDefinition)) {
continue;
}
- String catId = fontDefinition.getCategoryId();
- if ((catId == null && categoryId == null)
- || (catId != null && categoryId != null && categoryId.equals(catId))) {
- if (fontDefinition.getDefaultsTo() != null && parentIsInSameCategory(fontDefinition)) {
- continue;
- }
- list.add(fontDefinition);
- }
+ list.add(fontDefinition);
}
}
return list.toArray(new Object[list.size()]);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
index 4adad92..bcdc5eb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
@@ -334,27 +334,21 @@
}
// update the jface registries
- {
- ColorRegistry jfaceColors = JFaceResources.getColorRegistry();
- ColorRegistry themeColors = currentTheme.getColorRegistry();
- for (Object themeColorKey : themeColors.getKeySet()) {
- String key = (String) themeColorKey;
- jfaceColors.put(key, themeColors.getRGB(key));
- }
+ ColorRegistry jfaceColors = JFaceResources.getColorRegistry();
+ ColorRegistry themeColors = currentTheme.getColorRegistry();
+ for (Object themeColorKey : themeColors.getKeySet()) {
+ String key = (String) themeColorKey;
+ jfaceColors.put(key, themeColors.getRGB(key));
}
- {
- FontRegistry jfaceFonts = JFaceResources.getFontRegistry();
- FontRegistry themeFonts = currentTheme.getFontRegistry();
- for (Object themeFontKey : themeFonts.getKeySet()) {
- String key = (String) themeFontKey;
- jfaceFonts.put(key, themeFonts.getFontData(key));
- }
+ FontRegistry jfaceFonts = JFaceResources.getFontRegistry();
+ FontRegistry themeFonts = currentTheme.getFontRegistry();
+ for (Object themeFontKey : themeFonts.getKeySet()) {
+ String key = (String) themeFontKey;
+ jfaceFonts.put(key, themeFonts.getFontData(key));
}
- {
- if (oldTheme != null && eventBroker != null) {
- eventBroker.send(UIEvents.UILifeCycle.THEME_CHANGED, null);
- eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED, context.get(MApplication.class));
- }
+ if (oldTheme != null && eventBroker != null) {
+ eventBroker.send(UIEvents.UILifeCycle.THEME_CHANGED, null);
+ eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED, context.get(MApplication.class));
}
}
}
diff --git a/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest.java b/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest.java
index d1149bb..8be3a3b 100644
--- a/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest.java
+++ b/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest.java
@@ -85,63 +85,61 @@
// Create shell
shell = new Shell(Display.getCurrent());
- { // Initialize shell
- setOfRenamables = new WritableSet<>();
- list = new ListViewer(shell);
- ObservableSetContentProvider<RenamableItem> contentProvider = new ObservableSetContentProvider<>();
- list.setContentProvider(contentProvider);
- list.setLabelProvider(new ListeningLabelProvider<RenamableItem>(contentProvider.getKnownElements()) {
- RenamableItem.Listener listener = item -> fireChangeEvent(Collections.singleton(item));
+ // Initialize shell
+ setOfRenamables = new WritableSet<>();
- @Override
- public void updateLabel(ViewerLabel label, Object element) {
- if (element instanceof RenamableItem) {
- RenamableItem item = (RenamableItem) element;
+ list = new ListViewer(shell);
+ ObservableSetContentProvider<RenamableItem> contentProvider = new ObservableSetContentProvider<>();
+ list.setContentProvider(contentProvider);
+ list.setLabelProvider(new ListeningLabelProvider<RenamableItem>(contentProvider.getKnownElements()) {
+ RenamableItem.Listener listener = item -> fireChangeEvent(Collections.singleton(item));
- label.setText(item.getName());
- }
+ @Override
+ public void updateLabel(ViewerLabel label, Object element) {
+ if (element instanceof RenamableItem) {
+ RenamableItem item = (RenamableItem) element;
+
+ label.setText(item.getName());
}
-
- @Override
- protected void addListenerTo(RenamableItem next) {
- next.addListener(listener);
- }
-
- @Override
- protected void removeListenerFrom(RenamableItem next) {
- next.removeListener(listener);
- }
- });
- list.setInput(setOfRenamables);
-
- selectedRenamable = ViewerProperties.singleSelection(RenamableItem.class).observe(list);
-
- Composite buttonBar = new Composite(shell, SWT.NONE);
- { // Initialize buttonBar
- addButton = new Button(buttonBar, SWT.PUSH);
- addButton.setText("Add"); //$NON-NLS-1$
- addButton.addSelectionListener(buttonSelectionListener);
- removeButton = new Button(buttonBar, SWT.PUSH);
- removeButton.addSelectionListener(buttonSelectionListener);
- removeButton.setText("Remove"); //$NON-NLS-1$
- renameButton = new Button(buttonBar, SWT.PUSH);
- renameButton.addSelectionListener(buttonSelectionListener);
- renameButton.setText("Rename"); //$NON-NLS-1$
-
- selectedRenamable
- .addValueChangeListener(event -> {
- boolean shouldEnable = selectedRenamable.getValue() != null;
- removeButton.setEnabled(shouldEnable);
- renameButton.setEnabled(shouldEnable);
- });
- removeButton.setEnabled(false);
- renameButton.setEnabled(false);
-
- GridLayoutFactory.fillDefaults().generateLayout(buttonBar);
}
- }
+ @Override
+ protected void addListenerTo(RenamableItem next) {
+ next.addListener(listener);
+ }
+
+ @Override
+ protected void removeListenerFrom(RenamableItem next) {
+ next.removeListener(listener);
+ }
+ });
+ list.setInput(setOfRenamables);
+
+ selectedRenamable = ViewerProperties.singleSelection(RenamableItem.class).observe(list);
+
+ Composite buttonBar = new Composite(shell, SWT.NONE);
+ // Initialize buttonBar
+ addButton = new Button(buttonBar, SWT.PUSH);
+ addButton.setText("Add"); //$NON-NLS-1$
+ addButton.addSelectionListener(buttonSelectionListener);
+ removeButton = new Button(buttonBar, SWT.PUSH);
+ removeButton.addSelectionListener(buttonSelectionListener);
+ removeButton.setText("Remove"); //$NON-NLS-1$
+ renameButton = new Button(buttonBar, SWT.PUSH);
+ renameButton.addSelectionListener(buttonSelectionListener);
+ renameButton.setText("Rename"); //$NON-NLS-1$
+
+ selectedRenamable
+ .addValueChangeListener(event -> {
+ boolean shouldEnable = selectedRenamable.getValue() != null;
+ removeButton.setEnabled(shouldEnable);
+ renameButton.setEnabled(shouldEnable);
+ });
+ removeButton.setEnabled(false);
+ renameButton.setEnabled(false);
+
+ GridLayoutFactory.fillDefaults().generateLayout(buttonBar);
GridLayoutFactory.fillDefaults().numColumns(2).margins(
LayoutConstants.getMargins()).generateLayout(shell);
}
diff --git a/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest2.java b/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest2.java
index 46f0191..3e7181c 100644
--- a/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest2.java
+++ b/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/LabelProviderTest2.java
@@ -85,62 +85,60 @@
// Create shell
shell = new Shell(Display.getCurrent());
- { // Initialize shell
- listOfRenamables = new WritableList<>();
- list = new ListViewer(shell);
- ObservableListContentProvider<RenamableItem> contentProvider = new ObservableListContentProvider<>();
- list.setContentProvider(contentProvider);
- list.setLabelProvider(new ListeningLabelProvider<RenamableItem>(contentProvider.getKnownElements()) {
- RenamableItem.Listener listener = item -> fireChangeEvent(Collections.singleton(item));
+ // Initialize shell
+ listOfRenamables = new WritableList<>();
- @Override
- public void updateLabel(ViewerLabel label, Object element) {
- if (element instanceof RenamableItem) {
- RenamableItem item = (RenamableItem) element;
+ list = new ListViewer(shell);
+ ObservableListContentProvider<RenamableItem> contentProvider = new ObservableListContentProvider<>();
+ list.setContentProvider(contentProvider);
+ list.setLabelProvider(new ListeningLabelProvider<RenamableItem>(contentProvider.getKnownElements()) {
+ RenamableItem.Listener listener = item -> fireChangeEvent(Collections.singleton(item));
- label.setText(item.getName());
- }
+ @Override
+ public void updateLabel(ViewerLabel label, Object element) {
+ if (element instanceof RenamableItem) {
+ RenamableItem item = (RenamableItem) element;
+
+ label.setText(item.getName());
}
-
- @Override
- protected void addListenerTo(RenamableItem next) {
- next.addListener(listener);
- }
-
- @Override
- protected void removeListenerFrom(RenamableItem next) {
- next.removeListener(listener);
- }
- });
- list.setInput(listOfRenamables);
-
- selectedRenamable = ViewerProperties.singleSelection(RenamableItem.class).observe(list);
-
- Composite buttonBar = new Composite(shell, SWT.NONE);
- { // Initialize buttonBar
- addButton = new Button(buttonBar, SWT.PUSH);
- addButton.setText("Add"); //$NON-NLS-1$
- addButton.addSelectionListener(buttonSelectionListener);
- removeButton = new Button(buttonBar, SWT.PUSH);
- removeButton.addSelectionListener(buttonSelectionListener);
- removeButton.setText("Remove"); //$NON-NLS-1$
- renameButton = new Button(buttonBar, SWT.PUSH);
- renameButton.addSelectionListener(buttonSelectionListener);
- renameButton.setText("Rename"); //$NON-NLS-1$
-
- selectedRenamable.addValueChangeListener(event -> {
- boolean shouldEnable = selectedRenamable.getValue() != null;
- removeButton.setEnabled(shouldEnable);
- renameButton.setEnabled(shouldEnable);
- });
- removeButton.setEnabled(false);
- renameButton.setEnabled(false);
-
- GridLayoutFactory.fillDefaults().generateLayout(buttonBar);
}
- }
+ @Override
+ protected void addListenerTo(RenamableItem next) {
+ next.addListener(listener);
+ }
+
+ @Override
+ protected void removeListenerFrom(RenamableItem next) {
+ next.removeListener(listener);
+ }
+ });
+ list.setInput(listOfRenamables);
+
+ selectedRenamable = ViewerProperties.singleSelection(RenamableItem.class).observe(list);
+
+ Composite buttonBar = new Composite(shell, SWT.NONE);
+ // Initialize buttonBar]
+ addButton = new Button(buttonBar, SWT.PUSH);
+ addButton.setText("Add"); //$NON-NLS-1$
+ addButton.addSelectionListener(buttonSelectionListener);
+ removeButton = new Button(buttonBar, SWT.PUSH);
+ removeButton.addSelectionListener(buttonSelectionListener);
+ removeButton.setText("Remove"); //$NON-NLS-1$
+ renameButton = new Button(buttonBar, SWT.PUSH);
+ renameButton.addSelectionListener(buttonSelectionListener);
+ renameButton.setText("Rename"); //$NON-NLS-1$
+
+ selectedRenamable.addValueChangeListener(event -> {
+ boolean shouldEnable = selectedRenamable.getValue() != null;
+ removeButton.setEnabled(shouldEnable);
+ renameButton.setEnabled(shouldEnable);
+ });
+ removeButton.setEnabled(false);
+ renameButton.setEnabled(false);
+
+ GridLayoutFactory.fillDefaults().generateLayout(buttonBar);
GridLayoutFactory.fillDefaults().numColumns(2).margins(
LayoutConstants.getMargins()).generateLayout(shell);
}
diff --git a/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/StructuredContentProviderTest.java b/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/StructuredContentProviderTest.java
index caf880a..c4a825e 100644
--- a/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/StructuredContentProviderTest.java
+++ b/examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/contentprovider/test/StructuredContentProviderTest.java
@@ -116,67 +116,65 @@
createDataModel();
shell = new Shell(Display.getCurrent(), SWT.SHELL_TRIM);
- { // Initialize shell
- final Label someDoubles = new Label(shell, SWT.NONE);
- someDoubles.setText("A list of random Doubles"); //$NON-NLS-1$
- someDoubles.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL));
- Control addRemoveComposite = createInputControl(shell, inputSet);
+ // Initialize shell
+ final Label someDoubles = new Label(shell, SWT.NONE);
+ someDoubles.setText("A list of random Doubles"); //$NON-NLS-1$
+ someDoubles.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL));
- GridData addRemoveData = new GridData(GridData.FILL_BOTH);
- addRemoveData.minimumHeight = 1;
- addRemoveData.minimumWidth = 1;
+ Control addRemoveComposite = createInputControl(shell, inputSet);
- addRemoveComposite.setLayoutData(addRemoveData);
+ GridData addRemoveData = new GridData(GridData.FILL_BOTH);
+ addRemoveData.minimumHeight = 1;
+ addRemoveData.minimumWidth = 1;
- Group operation = new Group(shell, SWT.NONE);
- { // Initialize operation group
- operation.setText("Select transformation"); //$NON-NLS-1$
+ addRemoveComposite.setLayoutData(addRemoveData);
- createRadioButton(operation, currentFunction, "f(x) = x", //$NON-NLS-1$
- SomeMathFunction.OP_IDENTITY);
- createRadioButton(operation, currentFunction, "f(x) = 2 * x", //$NON-NLS-1$
- SomeMathFunction.OP_MULTIPLY);
- createRadioButton(operation, currentFunction,
- "f(x) = floor(x)", //$NON-NLS-1$
- SomeMathFunction.OP_ROUND);
+ Group operation = new Group(shell, SWT.NONE);
+ // Initialize operation group
+ operation.setText("Select transformation"); //$NON-NLS-1$
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- operation.setLayout(layout);
+ createRadioButton(operation, currentFunction, "f(x) = x", //$NON-NLS-1$
+ SomeMathFunction.OP_IDENTITY);
+ createRadioButton(operation, currentFunction, "f(x) = 2 * x", //$NON-NLS-1$
+ SomeMathFunction.OP_MULTIPLY);
+ createRadioButton(operation, currentFunction, "f(x) = floor(x)", //$NON-NLS-1$
+ SomeMathFunction.OP_ROUND);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ operation.setLayout(layout);
+ operation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL));
+
+ Control outputControl = createOutputComposite(shell);
+ GridData outputData = new GridData(GridData.FILL_BOTH);
+ outputData.minimumHeight = 1;
+ outputData.minimumWidth = 1;
+ outputData.widthHint = 300;
+ outputData.heightHint = 150;
+
+ outputControl.setLayoutData(outputData);
+
+ final Label sumLabel = new Label(shell, SWT.NONE);
+ new ControlUpdater(sumLabel) {
+ @Override
+ protected void updateControl() {
+ double sum = sumOfOutputSet.getValue();
+ int size = outputSet.size();
+
+ sumLabel.setText("The sum of the above " + size //$NON-NLS-1$
+ + " doubles is " + sum); //$NON-NLS-1$
}
- operation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL));
+ };
+ sumLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL));
- Control outputControl = createOutputComposite(shell);
- GridData outputData = new GridData(GridData.FILL_BOTH);
- outputData.minimumHeight = 1;
- outputData.minimumWidth = 1;
- outputData.widthHint = 300;
- outputData.heightHint = 150;
-
- outputControl.setLayoutData(outputData);
-
- final Label sumLabel = new Label(shell, SWT.NONE);
- new ControlUpdater(sumLabel) {
- @Override
- protected void updateControl() {
- double sum = sumOfOutputSet.getValue();
- int size = outputSet.size();
-
- sumLabel.setText("The sum of the above " + size //$NON-NLS-1$
- + " doubles is " + sum); //$NON-NLS-1$
- }
- };
- sumLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL));
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setLayout(layout);
- }
+ GridLayout shellLayout = new GridLayout();
+ layout.numColumns = 1;
+ shell.setLayout(shellLayout);
}
@@ -285,89 +283,83 @@
private Control createInputControl(Composite parent,
final WritableSet<Double> inputSet) {
Composite addRemoveComposite = new Composite(parent, SWT.NONE);
- { // Initialize addRemoveComposite
- ListViewer listOfInts = new ListViewer(addRemoveComposite,
- SWT.BORDER);
+ ListViewer listOfInts = new ListViewer(addRemoveComposite,
+ SWT.BORDER);
- listOfInts.setContentProvider(new ObservableSetContentProvider<>());
- listOfInts.setLabelProvider(new ViewerLabelProvider());
- listOfInts.setInput(inputSet);
+ listOfInts.setContentProvider(new ObservableSetContentProvider<>());
+ listOfInts.setLabelProvider(new ViewerLabelProvider());
+ listOfInts.setInput(inputSet);
- final IObservableValue<Double> selectedInt = ViewerProperties.singleSelection(Double.class)
- .observe(listOfInts);
+ final IObservableValue<Double> selectedInt = ViewerProperties.singleSelection(Double.class)
+ .observe(listOfInts);
- GridData listData = new GridData(GridData.FILL_BOTH);
- listData.minimumHeight = 1;
- listData.minimumWidth = 1;
- listData.widthHint = 150;
- listData.heightHint = 150;
- listOfInts.getControl().setLayoutData(listData);
+ GridData listData = new GridData(GridData.FILL_BOTH);
+ listData.minimumHeight = 1;
+ listData.minimumWidth = 1;
+ listData.widthHint = 150;
+ listData.heightHint = 150;
+ listOfInts.getControl().setLayoutData(listData);
- Composite buttonBar = new Composite(addRemoveComposite, SWT.NONE);
- { // Initialize button bar
+ Composite buttonBar = new Composite(addRemoveComposite, SWT.NONE);
+ Button add = new Button(buttonBar, SWT.PUSH);
+ add.setText("Add"); //$NON-NLS-1$
+ add.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ inputSet.add(random.nextDouble() * 100.0);
+ super.widgetSelected(e);
+ }
+ });
+ add.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL));
- Button add = new Button(buttonBar, SWT.PUSH);
- add.setText("Add"); //$NON-NLS-1$
- add.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- inputSet.add(random.nextDouble() * 100.0);
- super.widgetSelected(e);
- }
- });
- add.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ final Button remove = new Button(buttonBar, SWT.PUSH);
+ remove.setText("Remove"); //$NON-NLS-1$
+ // Enable the Remove button if and only if there is currently an
+ // element selected.
+ new ControlUpdater(remove) {
+ @Override
+ protected void updateControl() {
+ // This block demonstrates auto-listening.
+ // When updateControl is running, the framework
+ // remembers each
+ // updatable that gets touched. Since we're calling
+ // selectedInt.getValue()
+ // here, this updator will be flagged as dependant on
+ // selectedInt. This
+ // means that whenever selectedInt changes, this block
+ // of code will re-run
+ // itself.
+
+ // The result is that the remove button will recompute
+ // its enablement
+ // whenever the selection in the listbox changes, and it
+ // was not necessary
+ // to attach any listeners.
+ remove.setEnabled(selectedInt.getValue() != null);
+ }
+ };
+
+ remove.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ inputSet.remove(selectedInt.getValue());
+ super.widgetSelected(e);
+ }
+ });
+ remove.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_FILL));
- final Button remove = new Button(buttonBar, SWT.PUSH);
- remove.setText("Remove"); //$NON-NLS-1$
- // Enable the Remove button if and only if there is currently an
- // element selected.
- new ControlUpdater(remove) {
- @Override
- protected void updateControl() {
- // This block demonstrates auto-listening.
- // When updateControl is running, the framework
- // remembers each
- // updatable that gets touched. Since we're calling
- // selectedInt.getValue()
- // here, this updator will be flagged as dependant on
- // selectedInt. This
- // means that whenever selectedInt changes, this block
- // of code will re-run
- // itself.
+ GridLayout buttonLayout = new GridLayout();
+ buttonLayout.numColumns = 1;
+ buttonBar.setLayout(buttonLayout); // End button bar
+ buttonBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
- // The result is that the remove button will recompute
- // its enablement
- // whenever the selection in the listbox changes, and it
- // was not necessary
- // to attach any listeners.
- remove.setEnabled(selectedInt.getValue() != null);
- }
- };
-
- remove.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- inputSet.remove(selectedInt.getValue());
- super.widgetSelected(e);
- }
- });
- remove.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL));
-
- GridLayout buttonLayout = new GridLayout();
- buttonLayout.numColumns = 1;
- buttonBar.setLayout(buttonLayout);
-
- } // End button bar
- buttonBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_BEGINNING));
-
- GridLayout addRemoveLayout = new GridLayout();
- addRemoveLayout.numColumns = 2;
- addRemoveComposite.setLayout(addRemoveLayout);
- }
+ GridLayout addRemoveLayout = new GridLayout();
+ addRemoveLayout.numColumns = 2;
+ addRemoveComposite.setLayout(addRemoveLayout);
return addRemoveComposite;
}
diff --git a/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/layout/Snippet013GridLayoutFactory.java b/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/layout/Snippet013GridLayoutFactory.java
index e499d38..360b36d 100644
--- a/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/layout/Snippet013GridLayoutFactory.java
+++ b/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/layout/Snippet013GridLayoutFactory.java
@@ -35,29 +35,28 @@
public static Shell createShell1() {
Shell shell = new Shell(Display.getCurrent(), SWT.SHELL_TRIM);
- { // Populate the shell
- Label text = new Label(shell, SWT.WRAP);
- text
- .setText("This is a layout test. This text should wrap in the test. You could call it a text test.");
- GridDataFactory.generate(text, 2, 1);
- List theList = new List(shell, SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.BORDER);
+ // Populate the shell
+ Label text = new Label(shell, SWT.WRAP);
+ text
+ .setText("This is a layout test. This text should wrap in the test. You could call it a text test.");
+ GridDataFactory.generate(text, 2, 1);
- theList.add("Hello");
- theList.add("World");
- GridDataFactory.defaultsFor(theList).hint(300, 300)
- .applyTo(theList);
+ List theList = new List(shell, SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.BORDER);
- Composite buttonBar = new Composite(shell, SWT.NONE);
- { // Populate buttonBar
- Button add = new Button(buttonBar, SWT.PUSH);
- add.setText("Add");
- Button remove = new Button(buttonBar, SWT.PUSH);
- remove.setText("Remove");
- }
- GridLayoutFactory.fillDefaults().generateLayout(buttonBar);
- }
+ theList.add("Hello");
+ theList.add("World");
+ GridDataFactory.defaultsFor(theList).hint(300, 300)
+ .applyTo(theList);
+
+ Composite buttonBar = new Composite(shell, SWT.NONE);
+ // Populate buttonBar
+ Button add = new Button(buttonBar, SWT.PUSH);
+ add.setText("Add");
+ Button remove = new Button(buttonBar, SWT.PUSH);
+ remove.setText("Remove");
+ GridLayoutFactory.fillDefaults().generateLayout(buttonBar);
GridLayoutFactory.fillDefaults().numColumns(2).margins(
LayoutConstants.getMargins()).generateLayout(shell);
@@ -66,57 +65,52 @@
public static Shell createShell3() {
Shell shell = new Shell(Display.getCurrent(), SWT.SHELL_TRIM);
- { // Populate the shell
- Text text = new Text(shell, SWT.WRAP | SWT.BORDER);
- text
- .setText("This shell has asymmetric margins. The left, right, top, and bottom margins should be 0, 10, 40, and 80 pixels respectively");
+ // Populate the shell
+ Text text = new Text(shell, SWT.WRAP | SWT.BORDER);
+ text
+ .setText("This shell has asymmetric margins. The left, right, top, and bottom margins should be 0, 10, 40, and 80 pixels respectively");
- Rectangle margins = Geometry.createDiffRectangle(0, 10, 40, 80);
+ Rectangle margins = Geometry.createDiffRectangle(0, 10, 40, 80);
- GridLayoutFactory.fillDefaults().extendedMargins(margins)
- .generateLayout(shell);
-
- }
+ GridLayoutFactory.fillDefaults().extendedMargins(margins)
+ .generateLayout(shell);
return shell;
}
public static Shell createShell2() {
Shell shell = new Shell(Display.getCurrent(), SWT.SHELL_TRIM);
- { // Populate the shell
- Label text = new Label(shell, SWT.NONE);
- text.setText("Name:");
- new Text(shell, SWT.BORDER);
+ // Populate the shell
+ Label text = new Label(shell, SWT.NONE);
+ text.setText("Name:");
+ new Text(shell, SWT.BORDER);
- Label quest = new Label(shell, SWT.NONE);
- quest.setText("Quest:");
- CCombo combo = new CCombo(shell, SWT.BORDER);
- combo.add("I seek the holy grail");
- combo.add("What? I don't know that");
- combo.add("All your base are belong to us");
+ Label quest = new Label(shell, SWT.NONE);
+ quest.setText("Quest:");
+ CCombo combo = new CCombo(shell, SWT.BORDER);
+ combo.add("I seek the holy grail");
+ combo.add("What? I don't know that");
+ combo.add("All your base are belong to us");
- Label colour = new Label(shell, SWT.NONE);
- colour.setText("Color:");
- new Text(shell, SWT.BORDER);
+ Label colour = new Label(shell, SWT.NONE);
+ colour.setText("Color:");
+ new Text(shell, SWT.BORDER);
- Composite buttonBar = new Composite(shell, SWT.NONE);
- { // Populate buttonBar
- Button add = new Button(buttonBar, SWT.PUSH);
- add.setText("Okay");
- Button remove = new Button(buttonBar, SWT.PUSH);
- remove.setText("Cancel");
+ Composite buttonBar = new Composite(shell, SWT.NONE);
+ Button add = new Button(buttonBar, SWT.PUSH);
+ add.setText("Okay");
+ Button remove = new Button(buttonBar, SWT.PUSH);
+ remove.setText("Cancel");
- GridLayoutFactory.fillDefaults().numColumns(2).generateLayout(
- buttonBar);
- }
- GridDataFactory.fillDefaults().span(2, 1).align(SWT.RIGHT,
- SWT.BOTTOM).applyTo(buttonBar);
+ GridLayoutFactory.fillDefaults().numColumns(2).generateLayout(
+ buttonBar);
+ GridDataFactory.fillDefaults().span(2, 1).align(SWT.RIGHT,
+ SWT.BOTTOM).applyTo(buttonBar);
- GridLayoutFactory.fillDefaults().numColumns(2).margins(
- LayoutConstants.getMargins()).generateLayout(shell);
- }
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(
+ LayoutConstants.getMargins()).generateLayout(shell);
return shell;
}
diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java
index 8b345d5..793c2ca 100644
--- a/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java
+++ b/tests/org.eclipse.e4.ui.tests.css.swt/src/org/eclipse/e4/ui/tests/css/swt/CTabItemTest.java
@@ -122,23 +122,21 @@
folder.getItems();
assertEquals(0, folder.getSelectionIndex());
CTabItem item = folder.getItem(0);
- {
- FontData fontData = item.getFont().getFontData()[0];
- assertEquals("Verdana", fontData.getName());
- assertEquals(16, fontData.getHeight());
- assertEquals(SWT.NORMAL, fontData.getStyle());
+ FontData fontData = item.getFont().getFontData()[0];
+ assertEquals("Verdana", fontData.getName());
+ assertEquals(16, fontData.getHeight());
+ assertEquals(SWT.NORMAL, fontData.getStyle());
- // verify retrieval
- assertEquals("Verdana", engine.retrieveCSSProperty(item, "font-family", null));
- assertEquals("16", engine.retrieveCSSProperty(item, "font-size", null));
+ // verify retrieval
+ assertEquals("Verdana", engine.retrieveCSSProperty(item, "font-family", null));
+ assertEquals("16", engine.retrieveCSSProperty(item, "font-size", null));
- // make sure child controls are styled
- Control button = item.getControl();
- fontData = button.getFont().getFontData()[0];
- assertEquals("Verdana", fontData.getName());
- assertEquals(12, fontData.getHeight());
- assertEquals(SWT.NORMAL, fontData.getStyle());
- }
+ // make sure child controls are styled
+ Control button = item.getControl();
+ fontData = button.getFont().getFontData()[0];
+ assertEquals("Verdana", fontData.getName());
+ assertEquals(12, fontData.getHeight());
+ assertEquals(SWT.NORMAL, fontData.getStyle());
}
@Test
@@ -149,20 +147,18 @@
assertEquals(0, folder.getSelectionIndex());
CTabItem item = folder.getItem(0);
- {
- FontData fontData = item.getFont().getFontData()[0];
- assertEquals(SWT.BOLD, fontData.getStyle());
+ FontData fontData = item.getFont().getFontData()[0];
+ assertEquals(SWT.BOLD, fontData.getStyle());
- // verify retrieval
- assertEquals("bold",
- engine.retrieveCSSProperty(item,
- "font-weight", null));
+ // verify retrieval
+ assertEquals("bold",
+ engine.retrieveCSSProperty(item,
+ "font-weight", null));
- // make sure child controls are styled
- Control button = item.getControl();
- fontData = button.getFont().getFontData()[0];
- assertEquals(SWT.BOLD, fontData.getStyle());
- }
+ // make sure child controls are styled
+ Control button = item.getControl();
+ fontData = button.getFont().getFontData()[0];
+ assertEquals(SWT.BOLD, fontData.getStyle());
}
@Test
@@ -173,18 +169,16 @@
assertEquals(0, folder.getSelectionIndex());
CTabItem item = folder.getItem(0);
- {
- FontData fontData = item.getFont().getFontData()[0];
- assertEquals(SWT.ITALIC, fontData.getStyle());
+ FontData fontData = item.getFont().getFontData()[0];
+ assertEquals(SWT.ITALIC, fontData.getStyle());
- // verify retrieval
- assertEquals("italic", engine.retrieveCSSProperty(item, "font-style", null));
+ // verify retrieval
+ assertEquals("italic", engine.retrieveCSSProperty(item, "font-style", null));
- // make sure child controls are styled
- Control button = item.getControl();
- fontData = button.getFont().getFontData()[0];
- assertEquals(SWT.BOLD, fontData.getStyle());
- }
+ // make sure child controls are styled
+ Control button = item.getControl();
+ fontData = button.getFont().getFontData()[0];
+ assertEquals(SWT.BOLD, fontData.getStyle());
}
private void testSelectedFontBold(CTabFolder folder, int selectionIndex) {
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ModelAssemblerFragmentOrderingTests.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ModelAssemblerFragmentOrderingTests.java
index 8c78f6c..c66d410 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ModelAssemblerFragmentOrderingTests.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ModelAssemblerFragmentOrderingTests.java
@@ -2117,20 +2117,18 @@
Arrays.asList(menuitem000), "index:0", contributorName, contributorURI, false);
fragmentList.add(fragmentWrapper);
}
- {
- Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri5"));
- resourceSet.getResources().add(fragmentResource);
- final String contributorName = "menuitem001";
- final String contributorURI = fragmentResource.getURI().toString();
+ Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri5"));
+ resourceSet.getResources().add(fragmentResource);
+ final String contributorName = "menuitem001";
+ final String contributorURI = fragmentResource.getURI().toString();
- // the contributed elements
- MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
- fragmentResource.getContents().add((EObject) fragmentsContainer);
+ // the contributed elements
+ MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
+ fragmentResource.getContents().add((EObject) fragmentsContainer);
- ModelFragmentWrapper fragmentWrapper = createFragmentWrapper(fragmentsContainer, "children", "menu00",
- Arrays.asList(menuitem001), "index:10", contributorName, contributorURI, false);
- fragmentList.add(fragmentWrapper);
- }
+ ModelFragmentWrapper fragmentWrapper = createFragmentWrapper(fragmentsContainer, "children", "menu00",
+ Arrays.asList(menuitem001), "index:10", contributorName, contributorURI, false);
+ fragmentList.add(fragmentWrapper);
assembler.processFragmentWrappers(fragmentList);
@@ -2211,26 +2209,24 @@
fragmentsContainer.getImports().add(menu00);
}
- {
- Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri2"));
- resourceSet.getResources().add(fragmentResource);
- final String contributorName = "fragment2";
- final String contributorURI = fragmentResource.getURI().toString();
+ Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri2"));
+ resourceSet.getResources().add(fragmentResource);
+ final String contributorName = "fragment2";
+ final String contributorURI = fragmentResource.getURI().toString();
- // the contributed elements
- MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
- fragmentResource.getContents().add((EObject) fragmentsContainer);
+ // the contributed elements
+ MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
+ fragmentResource.getContents().add((EObject) fragmentsContainer);
- ModelFragmentWrapper fragmentWrapperMenu00 = createFragmentWrapper(fragmentsContainer, "children", "menu0",
- Arrays.asList(menu00), "index:1", contributorName, contributorURI, false);
- fragmentList.add(fragmentWrapperMenu00);
- ModelFragmentWrapper fragmentWrapperMenu02 = createFragmentWrapper(fragmentsContainer, "children", "menu0",
- Arrays.asList(menu02), "index:20", contributorName, contributorURI, false);
- fragmentList.add(fragmentWrapperMenu02);
- ModelFragmentWrapper fragmentWrapperMenuItem001 = createFragmentWrapper(fragmentsContainer, "children",
- "menu00", Arrays.asList(menuitem001), "index:3", contributorName, contributorURI, false);
- fragmentList.add(fragmentWrapperMenuItem001);
- }
+ ModelFragmentWrapper fragmentWrapperMenu00 = createFragmentWrapper(fragmentsContainer, "children", "menu0",
+ Arrays.asList(menu00), "index:1", contributorName, contributorURI, false);
+ fragmentList.add(fragmentWrapperMenu00);
+ ModelFragmentWrapper fragmentWrapperMenu02 = createFragmentWrapper(fragmentsContainer, "children", "menu0",
+ Arrays.asList(menu02), "index:20", contributorName, contributorURI, false);
+ fragmentList.add(fragmentWrapperMenu02);
+ ModelFragmentWrapper fragmentWrapperMenuItem001 = createFragmentWrapper(fragmentsContainer, "children",
+ "menu00", Arrays.asList(menuitem001), "index:3", contributorName, contributorURI, false);
+ fragmentList.add(fragmentWrapperMenuItem001);
assembler.processFragmentWrappers(fragmentList);
@@ -2301,20 +2297,18 @@
Arrays.asList(menu1), "index:10", contributorName, contributorURI, false);
fragmentList.add(fragmentWrapper);
}
- {
- Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri2"));
- resourceSet.getResources().add(fragmentResource);
- final String contributorName = "menu2";
- final String contributorURI = fragmentResource.getURI().toString();
+ Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri2"));
+ resourceSet.getResources().add(fragmentResource);
+ final String contributorName = "menu2";
+ final String contributorURI = fragmentResource.getURI().toString();
- // the contributed elements
- MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
- fragmentResource.getContents().add((EObject) fragmentsContainer);
+ // the contributed elements
+ MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
+ fragmentResource.getContents().add((EObject) fragmentsContainer);
- ModelFragmentWrapper fragmentWrapper = createFragmentWrapper(fragmentsContainer, "children", "menu1",
- Arrays.asList(menu2), "index:20", contributorName, contributorURI, false);
- fragmentList.add(fragmentWrapper);
- }
+ ModelFragmentWrapper fragmentWrapper = createFragmentWrapper(fragmentsContainer, "children", "menu1",
+ Arrays.asList(menu2), "index:20", contributorName, contributorURI, false);
+ fragmentList.add(fragmentWrapper);
assembler.processFragmentWrappers(fragmentList);
@@ -2381,20 +2375,18 @@
Arrays.asList(menu3), "index:0", contributorName, contributorURI, false);
fragmentList.add(fragmentWrapper);
}
- {
- Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri2"));
- resourceSet.getResources().add(fragmentResource);
- final String contributorName = "menu2";
- final String contributorURI = fragmentResource.getURI().toString();
+ Resource fragmentResource = factory.createResource(URI.createURI("fragmentvirtualuri2"));
+ resourceSet.getResources().add(fragmentResource);
+ final String contributorName = "menu2";
+ final String contributorURI = fragmentResource.getURI().toString();
- // the contributed elements
- MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
- fragmentResource.getContents().add((EObject) fragmentsContainer);
+ // the contributed elements
+ MModelFragments fragmentsContainer = MFragmentFactory.INSTANCE.createModelFragments();
+ fragmentResource.getContents().add((EObject) fragmentsContainer);
- ModelFragmentWrapper fragmentWrapper = createFragmentWrapper(fragmentsContainer, "children", "menu1",
- Arrays.asList(menu2), "index:20", contributorName, contributorURI, false);
- fragmentList.add(fragmentWrapper);
- }
+ ModelFragmentWrapper fragmentWrapper = createFragmentWrapper(fragmentsContainer, "children", "menu1",
+ Arrays.asList(menu2), "index:20", contributorName, contributorURI, false);
+ fragmentList.add(fragmentWrapper);
assembler.processFragmentWrappers(fragmentList);
@@ -2458,12 +2450,10 @@
Set<ModelFragmentWrapper> fragmentList2 = new TreeSet<>(new ModelFragmentComparator(application));
fragmentList2.addAll(fragmentList);
- {
- Iterator<ModelFragmentWrapper> iterator = fragmentList2.iterator();
- assertEquals(fragmentWrapper3, iterator.next());
- assertEquals(fragmentWrapper2, iterator.next());
- assertEquals(fragmentWrapper1, iterator.next());
- }
+ Iterator<ModelFragmentWrapper> iterator = fragmentList2.iterator();
+ assertEquals(fragmentWrapper3, iterator.next());
+ assertEquals(fragmentWrapper2, iterator.next());
+ assertEquals(fragmentWrapper1, iterator.next());
}
}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ConcurrentTableTestView.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ConcurrentTableTestView.java
index acc7573..ec36b5b 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ConcurrentTableTestView.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ConcurrentTableTestView.java
@@ -87,15 +87,13 @@
parent.setLayout(layout);
// Create the table
- {
- table = new TableViewer(parent, SWT.VIRTUAL);
- contentProvider = new DeferredContentProvider(comparator);
- table.setContentProvider(contentProvider);
+ table = new TableViewer(parent, SWT.VIRTUAL);
+ contentProvider = new DeferredContentProvider(comparator);
+ table.setContentProvider(contentProvider);
- GridData data = new GridData(GridData.FILL_BOTH);
- table.getControl().setLayoutData(data);
- table.setInput(model);
- }
+ GridData data = new GridData(GridData.FILL_BOTH);
+ table.getControl().setLayoutData(data);
+ table.setInput(model);
// Create the buttons
Composite buttonBar = new Composite(parent, SWT.NONE);
@@ -103,70 +101,66 @@
GridLayout buttonBarLayout = new GridLayout();
buttonBarLayout.numColumns = 1;
buttonBar.setLayout(buttonBarLayout);
- {
+ updateCount = new Label(buttonBar, SWT.NONE);
+ updateCount.setLayoutData(new GridData(GridData.FILL_BOTH));
- updateCount = new Label(buttonBar, SWT.NONE);
- updateCount.setLayoutData(new GridData(GridData.FILL_BOTH));
+ slowComparisons = new Button(buttonBar, SWT.CHECK);
+ slowComparisons.setLayoutData(new GridData(GridData.FILL_BOTH));
+ slowComparisons.setText("Slow comparisons");
+ slowComparisons.setSelection(enableSlowComparisons);
+ slowComparisons.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ enableSlowComparisons = slowComparisons.getSelection();
+ super.widgetSelected(e);
+ }
+ });
- slowComparisons = new Button(buttonBar, SWT.CHECK);
- slowComparisons.setLayoutData(new GridData(GridData.FILL_BOTH));
- slowComparisons.setText("Slow comparisons");
- slowComparisons.setSelection(enableSlowComparisons);
- slowComparisons.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- enableSlowComparisons = slowComparisons.getSelection();
- super.widgetSelected(e);
+ final Button limitSize = new Button(buttonBar, SWT.CHECK);
+ limitSize.setLayoutData(new GridData(GridData.FILL_BOTH));
+ limitSize.setText("Limit table size to 400");
+ limitSize.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (limitSize.getSelection()) {
+ contentProvider.setLimit(400);
+ } else {
+ contentProvider.setLimit(-1);
}
- });
+ super.widgetSelected(e);
+ }
+ });
- final Button limitSize = new Button(buttonBar, SWT.CHECK);
- limitSize.setLayoutData(new GridData(GridData.FILL_BOTH));
- limitSize.setText("Limit table size to 400");
- limitSize.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (limitSize.getSelection()) {
- contentProvider.setLimit(400);
- } else {
- contentProvider.setLimit(-1);
- }
- super.widgetSelected(e);
- }
- });
+ Button resetCountButton = new Button(buttonBar, SWT.PUSH);
+ resetCountButton.setLayoutData(new GridData(GridData.FILL_BOTH));
+ resetCountButton.setText("Reset comparison count");
+ resetCountButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ comparator.comparisons = 0;
+ scheduleComparisonUpdate();
+ }
+ });
- Button resetCountButton = new Button(buttonBar, SWT.PUSH);
- resetCountButton.setLayoutData(new GridData(GridData.FILL_BOTH));
- resetCountButton.setText("Reset comparison count");
- resetCountButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- comparator.comparisons = 0;
- scheduleComparisonUpdate();
- }
- });
+ Button testButton = new Button(buttonBar, SWT.PUSH);
+ testButton.setLayoutData(new GridData(GridData.FILL_BOTH));
+ testButton.setText("add 100000 elements");
+ testButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ addRandomElements(100000);
+ }
+ });
- Button testButton = new Button(buttonBar, SWT.PUSH);
- testButton.setLayoutData(new GridData(GridData.FILL_BOTH));
- testButton.setText("add 100000 elements");
- testButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- addRandomElements(100000);
- }
- });
-
- Button removeButton = new Button(buttonBar, SWT.PUSH);
- removeButton.setLayoutData(new GridData(GridData.FILL_BOTH));
- removeButton.setText("remove all");
- removeButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- clear();
- }
- });
-
- }
+ Button removeButton = new Button(buttonBar, SWT.PUSH);
+ removeButton.setLayoutData(new GridData(GridData.FILL_BOTH));
+ removeButton.setText("remove all");
+ removeButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ clear();
+ }
+ });
}
/**
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/layout/constraints/LayoutConstraintsView.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/layout/constraints/LayoutConstraintsView.java
index 22fb5ac..e02548e 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/layout/constraints/LayoutConstraintsView.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/layout/constraints/LayoutConstraintsView.java
@@ -58,53 +58,51 @@
control = parent;
Composite buttonBar = new Composite(parent, SWT.NONE);
- {
- GridDataFactory buttonData = GridDataFactory.fillDefaults().grab(true, false);
+ GridDataFactory buttonData = GridDataFactory.fillDefaults().grab(true, false);
- Button applyButton = new Button(buttonBar, SWT.PUSH);
- applyButton.setText("Apply");
- applyButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- applyPressed();
+ Button applyButton = new Button(buttonBar, SWT.PUSH);
+ applyButton.setText("Apply");
+ applyButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ applyPressed();
+ }
+ });
+ buttonData.applyTo(applyButton);
+
+ Button clearButton = new Button(buttonBar, SWT.PUSH);
+ clearButton.setText("Reset");
+ clearButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ minWidthText.setText("");
+ maxWidthText.setText("");
+ quantizedWidthText.setText("");
+ minHeightText.setText("");
+ maxHeightText.setText("");
+ quantizedHeightText.setText("");
+ fixedAreaText.setText("");
+ applyPressed();
+ }
+ });
+ buttonData.applyTo(clearButton);
+
+ Button newViewButton = new Button(buttonBar, SWT.PUSH);
+ newViewButton.setText("New View");
+ newViewButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ getSite().getPage().showView("org.eclipse.ui.tests.layout.constraints.LayoutConstraintsView",
+ "" + System.currentTimeMillis(), IWorkbenchPage.VIEW_ACTIVATE);
+ } catch (PartInitException e1) {
+ MessageDialog.openError(getSite().getShell(), "Error opening view", "Unable to open view.");
}
- });
- buttonData.applyTo(applyButton);
+ }
+ });
+ buttonData.applyTo(newViewButton);
- Button clearButton = new Button(buttonBar, SWT.PUSH);
- clearButton.setText("Reset");
- clearButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- minWidthText.setText("");
- maxWidthText.setText("");
- quantizedWidthText.setText("");
- minHeightText.setText("");
- maxHeightText.setText("");
- quantizedHeightText.setText("");
- fixedAreaText.setText("");
- applyPressed();
- }
- });
- buttonData.applyTo(clearButton);
-
- Button newViewButton = new Button(buttonBar, SWT.PUSH);
- newViewButton.setText("New View");
- newViewButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- getSite().getPage().showView("org.eclipse.ui.tests.layout.constraints.LayoutConstraintsView",
- "" + System.currentTimeMillis(), IWorkbenchPage.VIEW_ACTIVATE);
- } catch (PartInitException e1) {
- MessageDialog.openError(getSite().getShell(), "Error opening view", "Unable to open view.");
- }
- }
- });
- buttonData.applyTo(newViewButton);
-
- GridLayoutFactory.fillDefaults().equalWidth(true).numColumns(3).applyTo(buttonBar);
- }
+ GridLayoutFactory.fillDefaults().equalWidth(true).numColumns(3).applyTo(buttonBar);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(buttonBar);
new Label(parent, SWT.NONE).setText("Min Width");
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ExplicitlyBusyView.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ExplicitlyBusyView.java
index c3a2e51..9eacdf8 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ExplicitlyBusyView.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ExplicitlyBusyView.java
@@ -96,16 +96,14 @@
}
});
}
- {
- Button button = new Button(parent, SWT.PUSH);
- button.setText("Spawn Job");
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- new SomeJob("Some Job " + counter++).schedule();
- }
- });
- }
+ Button button = new Button(parent, SWT.PUSH);
+ button.setText("Spawn Job");
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ new SomeJob("Some Job " + counter++).schedule();
+ }
+ });
GridLayoutFactory.swtDefaults().applyTo(parent);
}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ViewWithSaveables.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ViewWithSaveables.java
index 932d03d..3fcdace 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ViewWithSaveables.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/ViewWithSaveables.java
@@ -121,35 +121,33 @@
}
};
}
- {
- final Button button = new Button(parent, SWT.CHECK);
- button.setText("dirty");
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- MySaveable saveable = (MySaveable) selection.getValue();
- saveable.setDirty(button.getSelection());
+ final Button button = new Button(parent, SWT.CHECK);
+ button.setText("dirty");
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ MySaveable saveable = (MySaveable) selection.getValue();
+ saveable.setDirty(button.getSelection());
+ }
+ });
+ new ControlUpdater(button) {
+ @Override
+ protected void updateControl() {
+ MySaveable saveable = (MySaveable) selection.getValue();
+ if (saveable == null) {
+ button.setEnabled(false);
+ button.setSelection(false);
+ } else {
+ button.setEnabled(true);
+ // we know that isDirty is implemented using a
+ // WritableValue,
+ // and thus a dependency on that writable value will
+ // result from
+ // calling isDirty().
+ button.setSelection(saveable.isDirty());
}
- });
- new ControlUpdater(button) {
- @Override
- protected void updateControl() {
- MySaveable saveable = (MySaveable) selection.getValue();
- if (saveable == null) {
- button.setEnabled(false);
- button.setSelection(false);
- } else {
- button.setEnabled(true);
- // we know that isDirty is implemented using a
- // WritableValue,
- // and thus a dependency on that writable value will
- // result from
- // calling isDirty().
- button.setSelection(saveable.isDirty());
- }
- }
- };
- }
+ }
+ };
getSite().setSelectionProvider(viewer);
dirty.addValueChangeListener(event -> firePropertyChange(ISaveablePart.PROP_DIRTY));
GridLayoutFactory.fillDefaults().numColumns(4).equalWidth(false)
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/themes/JFaceThemeTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/themes/JFaceThemeTest.java
index add4b66..fd4ad21 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/themes/JFaceThemeTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/themes/JFaceThemeTest.java
@@ -53,15 +53,13 @@
.getFontData(key));
}
}
- {
- ColorRegistry jfaceColors = JFaceResources.getColorRegistry();
- ColorRegistry themeColors = theme.getColorRegistry();
- assertTrue(jfaceColors.getKeySet().containsAll(
- themeColors.getKeySet()));
- for (Object element : themeColors.getKeySet()) {
- String key = (String) element;
- assertEquals(themeColors.getRGB(key), jfaceColors.getRGB(key));
- }
+ ColorRegistry jfaceColors = JFaceResources.getColorRegistry();
+ ColorRegistry themeColors = theme.getColorRegistry();
+ assertTrue(jfaceColors.getKeySet().containsAll(
+ themeColors.getKeySet()));
+ for (Object element : themeColors.getKeySet()) {
+ String key = (String) element;
+ assertEquals(themeColors.getRGB(key), jfaceColors.getRGB(key));
}
JFaceResources.getFontRegistry().removeListener(listener);
JFaceResources.getColorRegistry().removeListener(listener);