Made formatting uniform - commit for SampleERCP
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 19 May 2019 17:59:20 +0000 (19:59 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 19 May 2019 17:59:20 +0000 (19:59 +0200)
SampleERCP/.settings/org.eclipse.jdt.core.prefs
SampleERCP/.settings/org.eclipse.jdt.ui.prefs
SampleERCP/src/sampleercp/handlers/AboutHandler.java
SampleERCP/src/sampleercp/handlers/OpenHandler.java
SampleERCP/src/sampleercp/handlers/QuitHandler.java
SampleERCP/src/sampleercp/handlers/SaveHandler.java
SampleERCP/src/sampleercp/parts/SamplePart.java
SampleERCP/src/sampleercp/splashhandlers/ExtensibleSplashHandler.java

index d25d26d..3570d97 100644 (file)
@@ -31,7 +31,7 @@ org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16\r
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80\r
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0\r
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49\r
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16\r
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16\r
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0\r
 org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16\r
@@ -66,21 +66,21 @@ org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
 org.eclipse.jdt.core.formatter.blank_lines_before_package=0\r
 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1\r
 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1\r
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line\r
 org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line\r
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line\r
 org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true\r
 org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false\r
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true\r
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false\r
 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false\r
 org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true\r
 org.eclipse.jdt.core.formatter.comment.format_block_comments=true\r
@@ -94,7 +94,7 @@ org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
 org.eclipse.jdt.core.formatter.comment.indent_tag_description=false\r
 org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert\r
 org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert\r
-org.eclipse.jdt.core.formatter.comment.line_length=80\r
+org.eclipse.jdt.core.formatter.comment.line_length=140\r
 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true\r
 org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true\r
 org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false\r
@@ -127,10 +127,10 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert\r
 org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert\r
 org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert\r
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert\r
 org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert\r
 org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert\r
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert\r
 org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert\r
 org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert\r
 org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert\r
@@ -331,7 +331,7 @@ org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
 org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false\r
 org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false\r
 org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never\r
-org.eclipse.jdt.core.formatter.lineSplit=120\r
+org.eclipse.jdt.core.formatter.lineSplit=140\r
 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false\r
 org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false\r
 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0\r
index 8f56b5b..ef4a491 100644 (file)
@@ -1,4 +1,4 @@
 eclipse.preferences.version=1\r
-formatter_profile=_Eclipse ajusted\r
+formatter_profile=_ERA-MI\r
 formatter_settings_version=16\r
 org.eclipse.jdt.ui.text.custom_code_templates=\r
index 002d74e..210cd1f 100644 (file)
@@ -1,12 +1,14 @@
-package sampleercp.handlers;
-
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-public class AboutHandler {
-       @Execute
-       public void execute(Shell shell) {
-               MessageDialog.openInformation(shell, "About", "Sample RCP4");
-       }
-}
+package sampleercp.handlers;\r
+\r
+import org.eclipse.e4.core.di.annotations.Execute;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+public class AboutHandler\r
+{\r
+       @Execute\r
+       public void execute(Shell shell)\r
+       {\r
+               MessageDialog.openInformation(shell, "About", "Sample RCP4");\r
+       }\r
+}\r
index 5cc2203..8f78854 100644 (file)
@@ -1,14 +1,16 @@
-package sampleercp.handlers;
-
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-
-public class OpenHandler {
-
-       @Execute
-       public void execute(Shell shell) {
-               FileDialog dialog = new FileDialog(shell);
-               dialog.open();
-       }
-}
+package sampleercp.handlers;\r
+\r
+import org.eclipse.e4.core.di.annotations.Execute;\r
+import org.eclipse.swt.widgets.FileDialog;\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+public class OpenHandler\r
+{\r
+\r
+       @Execute\r
+       public void execute(Shell shell)\r
+       {\r
+               FileDialog dialog = new FileDialog(shell);\r
+               dialog.open();\r
+       }\r
+}\r
index 4f9d978..79ad7a5 100644 (file)
@@ -1,15 +1,18 @@
-package sampleercp.handlers;
-
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.ui.workbench.IWorkbench;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-public class QuitHandler {
-       @Execute
-       public void execute(IWorkbench workbench, Shell shell) {
-               if (MessageDialog.openConfirm(shell, "Confirmation", "Do you want to exit?")) {
-                       workbench.close();
-               }
-       }
-}
+package sampleercp.handlers;\r
+\r
+import org.eclipse.e4.core.di.annotations.Execute;\r
+import org.eclipse.e4.ui.workbench.IWorkbench;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+public class QuitHandler\r
+{\r
+       @Execute\r
+       public void execute(IWorkbench workbench, Shell shell)\r
+       {\r
+               if (MessageDialog.openConfirm(shell, "Confirmation", "Do you want to exit?"))\r
+               {\r
+                       workbench.close();\r
+               }\r
+       }\r
+}\r
index de086e0..35f3e79 100644 (file)
@@ -1,21 +1,25 @@
-package sampleercp.handlers;
-
-import org.eclipse.e4.core.di.annotations.CanExecute;
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.ui.workbench.modeling.EPartService;
-
-public class SaveHandler {
-
-       @CanExecute
-       public boolean canExecute(EPartService partService) {
-               if (partService != null) {
-                       return !partService.getDirtyParts().isEmpty();
-               }
-               return false;
-       }
-
-       @Execute
-       public void execute(EPartService partService) {
-               partService.saveAll(false);
-       }
+package sampleercp.handlers;\r
+\r
+import org.eclipse.e4.core.di.annotations.CanExecute;\r
+import org.eclipse.e4.core.di.annotations.Execute;\r
+import org.eclipse.e4.ui.workbench.modeling.EPartService;\r
+\r
+public class SaveHandler\r
+{\r
+\r
+       @CanExecute\r
+       public boolean canExecute(EPartService partService)\r
+       {\r
+               if (partService != null)\r
+               {\r
+                       return !partService.getDirtyParts().isEmpty();\r
+               }\r
+               return false;\r
+       }\r
+\r
+       @Execute\r
+       public void execute(EPartService partService)\r
+       {\r
+               partService.saveAll(false);\r
+       }\r
 }
\ No newline at end of file
index d31046f..3361834 100644 (file)
@@ -1,56 +1,61 @@
-package sampleercp.parts;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-import org.eclipse.e4.ui.di.Focus;
-import org.eclipse.e4.ui.di.Persist;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-public class SamplePart {
-
-       private TableViewer tableViewer;
-
-       @Inject
-       private MPart part;
-
-       @PostConstruct
-       public void createComposite(Composite parent) {
-               parent.setLayout(new GridLayout(1, false));
-
-               Text txtInput = new Text(parent, SWT.BORDER);
-               txtInput.setMessage("Enter text to mark part as dirty");
-               txtInput.addModifyListener(e -> part.setDirty(true));
-               txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-               tableViewer = new TableViewer(parent);
-
-               tableViewer.setContentProvider(ArrayContentProvider.getInstance());
-               tableViewer.setInput(createInitialDataModel());
-               tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
-       }
-
-       @Focus
-       public void setFocus() {
-               tableViewer.getTable().setFocus();
-       }
-
-       @Persist
-       public void save() {
-               part.setDirty(false);
-       }
-
-       private static List<String> createInitialDataModel() {
-               return Arrays.asList("Sample item 1", "Sample item 2", "Sample item 3", "Sample item 4", "Sample item 5");
-       }
+package sampleercp.parts;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import javax.annotation.PostConstruct;\r
+import javax.inject.Inject;\r
+\r
+import org.eclipse.e4.ui.di.Focus;\r
+import org.eclipse.e4.ui.di.Persist;\r
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;\r
+import org.eclipse.jface.viewers.ArrayContentProvider;\r
+import org.eclipse.jface.viewers.TableViewer;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Text;\r
+\r
+public class SamplePart\r
+{\r
+\r
+       private TableViewer tableViewer;\r
+\r
+       @Inject\r
+       private MPart part;\r
+\r
+       @PostConstruct\r
+       public void createComposite(Composite parent)\r
+       {\r
+               parent.setLayout(new GridLayout(1, false));\r
+\r
+               Text txtInput = new Text(parent, SWT.BORDER);\r
+               txtInput.setMessage("Enter text to mark part as dirty");\r
+               txtInput.addModifyListener(e -> part.setDirty(true));\r
+               txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));\r
+\r
+               tableViewer = new TableViewer(parent);\r
+\r
+               tableViewer.setContentProvider(ArrayContentProvider.getInstance());\r
+               tableViewer.setInput(createInitialDataModel());\r
+               tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));\r
+       }\r
+\r
+       @Focus\r
+       public void setFocus()\r
+       {\r
+               tableViewer.getTable().setFocus();\r
+       }\r
+\r
+       @Persist\r
+       public void save()\r
+       {\r
+               part.setDirty(false);\r
+       }\r
+\r
+       private static List<String> createInitialDataModel()\r
+       {\r
+               return Arrays.asList("Sample item 1", "Sample item 2", "Sample item 3", "Sample item 4", "Sample item 5");\r
+       }\r
 }
\ No newline at end of file
index 9390d12..8285e43 100644 (file)
-package sampleercp.splashhandlers;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.splash.AbstractSplashHandler;
-
-/**
- * @since 3.3
- *
- */
-public class ExtensibleSplashHandler extends AbstractSplashHandler {
-
-       private ArrayList<Image> fImageList;
-
-       private ArrayList<String> fTooltipList;
-
-       private static final String F_SPLASH_EXTENSION_ID = "Sample.splashExtension"; // NON-NLS-1
-
-       private static final String F_ELEMENT_ICON = "icon"; // NON-NLS-1
-
-       private static final String F_ELEMENT_TOOLTIP = "tooltip"; // NON-NLS-1
-
-       private static final String F_DEFAULT_TOOLTIP = "Image"; // NON-NLS-1
-
-       private static final int F_IMAGE_WIDTH = 50;
-
-       private static final int F_IMAGE_HEIGHT = 50;
-
-       private static final int F_SPLASH_SCREEN_BEVEL = 5;
-
-       private Composite fIconPanel;
-
-       /**
-        * 
-        */
-       public ExtensibleSplashHandler() {
-               fImageList = new ArrayList<>();
-               fTooltipList = new ArrayList<>();
-               fIconPanel = null;
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see
-        * org.eclipse.ui.splash.AbstractSplashHandler#init(org.eclipse.swt.widgets.
-        * Shell)
-        */
-       @Override
-       public void init(Shell splash) {
-               // Store the shell
-               super.init(splash);
-               // Configure the shell layout
-               configureUISplash();
-               // Load all splash extensions
-               loadSplashExtensions();
-               // If no splash extensions were loaded abort the splash handler
-               if (!hasSplashExtensions()) {
-                       return;
-               }
-               // Create UI
-               createUI();
-               // Configure the image panel bounds
-               configureUICompositeIconPanelBounds();
-               // Enter event loop and prevent the RCP application from
-               // loading until all work is done
-               doEventLoop();
-       }
-
-       /**
-        * @return
-        */
-       private boolean hasSplashExtensions() {
-               return !fImageList.isEmpty();
-       }
-
-       /**
-        * 
-        */
-       private void createUI() {
-               // Create the icon panel
-               createUICompositeIconPanel();
-               // Create the images
-               createUIImages();
-       }
-
-       /**
-        * 
-        */
-       private void createUIImages() {
-               Iterator<Image> imageIterator = fImageList.iterator();
-               Iterator<String> tooltipIterator = fTooltipList.iterator();
-               int i = 1;
-               int columnCount = ((GridLayout) fIconPanel.getLayout()).numColumns;
-               // Create all the images
-               // Abort if we run out of columns (left-over images will not fit within
-               // the usable splash screen width)
-               while (imageIterator.hasNext() && (i <= columnCount)) {
-                       Image image = imageIterator.next();
-                       String tooltip = tooltipIterator.next();
-                       // Create the image using a label widget
-                       createUILabel(image, tooltip);
-                       i++;
-               }
-       }
-
-       /**
-        * @param image
-        * @param tooltip
-        */
-       private void createUILabel(Image image, String tooltip) {
-               // Create the label (no text)
-               Label label = new Label(fIconPanel, SWT.NONE);
-               label.setImage(image);
-               label.setToolTipText(tooltip);
-       }
-
-       /**
-        * 
-        */
-       private void createUICompositeIconPanel() {
-               Shell splash = getSplash();
-               // Create the composite
-               fIconPanel = new Composite(splash, SWT.NONE);
-               // Determine the maximum number of columns that can fit on the splash
-               // screen. One 50x50 image per column.
-               int maxColumnCount = getUsableSplashScreenWidth() / F_IMAGE_WIDTH;
-               // Limit size to the maximum number of columns if the number of images
-               // exceed this amount; otherwise, use the exact number of columns
-               // required.
-               int actualColumnCount = Math.min(fImageList.size(), maxColumnCount);
-               // Configure the layout
-               GridLayout layout = new GridLayout(actualColumnCount, true);
-               layout.horizontalSpacing = 0;
-               layout.verticalSpacing = 0;
-               layout.marginHeight = 0;
-               layout.marginWidth = 0;
-               fIconPanel.setLayout(layout);
-       }
-
-       /**
-        * 
-        */
-       private void configureUICompositeIconPanelBounds() {
-               // Determine the size of the panel and position it at the bottom-right
-               // of the splash screen.
-               Point panelSize = fIconPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-
-               int xCoord = getSplash().getSize().x - F_SPLASH_SCREEN_BEVEL - panelSize.x;
-               int yCoord = getSplash().getSize().y - F_SPLASH_SCREEN_BEVEL - panelSize.y;
-               int xWidth = panelSize.x;
-               int yWidth = panelSize.y;
-
-               fIconPanel.setBounds(xCoord, yCoord, xWidth, yWidth);
-       }
-
-       /**
-        * @return
-        */
-       private int getUsableSplashScreenWidth() {
-               // Splash screen width minus two graphic border bevel widths
-               return getSplash().getSize().x - (F_SPLASH_SCREEN_BEVEL * 2);
-       }
-
-       /**
-        * 
-        */
-       private void loadSplashExtensions() {
-               // Get all splash handler extensions
-               IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(F_SPLASH_EXTENSION_ID)
-                               .getExtensions();
-               // Process all splash handler extensions
-               for (int i = 0; i < extensions.length; i++) {
-                       processSplashExtension(extensions[i]);
-               }
-       }
-
-       /**
-        * @param extension
-        */
-       private void processSplashExtension(IExtension extension) {
-               // Get all splash handler configuration elements
-               IConfigurationElement[] elements = extension.getConfigurationElements();
-               // Process all splash handler configuration elements
-               for (int j = 0; j < elements.length; j++) {
-                       processSplashElements(elements[j]);
-               }
-       }
-
-       /**
-        * @param configurationElement
-        */
-       private void processSplashElements(IConfigurationElement configurationElement) {
-               // Attribute: icon
-               processSplashElementIcon(configurationElement);
-               // Attribute: tooltip
-               processSplashElementTooltip(configurationElement);
-       }
-
-       /**
-        * @param configurationElement
-        */
-       private void processSplashElementTooltip(IConfigurationElement configurationElement) {
-               // Get attribute tooltip
-               String tooltip = configurationElement.getAttribute(F_ELEMENT_TOOLTIP);
-               // If a tooltip is not defined, give it a default
-               if ((tooltip == null) || (tooltip.length() == 0)) {
-                       fTooltipList.add(F_DEFAULT_TOOLTIP);
-               } else {
-                       fTooltipList.add(tooltip);
-               }
-       }
-
-       /**
-        * @param configurationElement
-        */
-       private void processSplashElementIcon(IConfigurationElement configurationElement) {
-               // Get attribute icon
-               String iconImageFilePath = configurationElement.getAttribute(F_ELEMENT_ICON);
-               // Abort if an icon attribute was not specified
-               if ((iconImageFilePath == null) || (iconImageFilePath.length() == 0)) {
-                       return;
-               }
-               // Create a corresponding image descriptor
-               ImageDescriptor descriptor = AbstractUIPlugin
-                               .imageDescriptorFromPlugin(configurationElement.getNamespaceIdentifier(), iconImageFilePath);
-               // Abort if no corresponding image was found
-               if (descriptor == null) {
-                       return;
-               }
-               // Create the image
-               Image image = descriptor.createImage();
-               // Abort if image creation failed
-               if (image == null) {
-                       return;
-               }
-               // Abort if the image does not have dimensions of 50x50
-               if ((image.getBounds().width != F_IMAGE_WIDTH) || (image.getBounds().height != F_IMAGE_HEIGHT)) {
-                       // Dipose of the image
-                       image.dispose();
-                       return;
-               }
-               // Store the image and tooltip
-               fImageList.add(image);
-       }
-
-       /**
-        * 
-        */
-       private void configureUISplash() {
-               // Configure layout
-               GridLayout layout = new GridLayout(1, true);
-               getSplash().setLayout(layout);
-               // Force shell to inherit the splash background
-               getSplash().setBackgroundMode(SWT.INHERIT_DEFAULT);
-       }
-
-       /**
-        * 
-        */
-       private void doEventLoop() {
-               Shell splash = getSplash();
-               if (!splash.getDisplay().readAndDispatch()) {
-                       splash.getDisplay().sleep();
-               }
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.ui.splash.AbstractSplashHandler#dispose()
-        */
-       @Override
-       public void dispose() {
-               super.dispose();
-               // Check to see if any images were defined
-               if ((fImageList == null) || fImageList.isEmpty()) {
-                       return;
-               }
-               // Dispose of all the images
-               Iterator<Image> iterator = fImageList.iterator();
-               while (iterator.hasNext()) {
-                       Image image = iterator.next();
-                       image.dispose();
-               }
-       }
-}
+package sampleercp.splashhandlers;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Iterator;\r
+\r
+import org.eclipse.core.runtime.IConfigurationElement;\r
+import org.eclipse.core.runtime.IExtension;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.ui.plugin.AbstractUIPlugin;\r
+import org.eclipse.ui.splash.AbstractSplashHandler;\r
+\r
+/**\r
+ * @since 3.3\r
+ *\r
+ */\r
+public class ExtensibleSplashHandler extends AbstractSplashHandler\r
+{\r
+\r
+       private ArrayList<Image> fImageList;\r
+\r
+       private ArrayList<String> fTooltipList;\r
+\r
+       private static final String F_SPLASH_EXTENSION_ID = "Sample.splashExtension"; // NON-NLS-1\r
+\r
+       private static final String F_ELEMENT_ICON = "icon"; // NON-NLS-1\r
+\r
+       private static final String F_ELEMENT_TOOLTIP = "tooltip"; // NON-NLS-1\r
+\r
+       private static final String F_DEFAULT_TOOLTIP = "Image"; // NON-NLS-1\r
+\r
+       private static final int F_IMAGE_WIDTH = 50;\r
+\r
+       private static final int F_IMAGE_HEIGHT = 50;\r
+\r
+       private static final int F_SPLASH_SCREEN_BEVEL = 5;\r
+\r
+       private Composite fIconPanel;\r
+\r
+       /**\r
+        * \r
+        */\r
+       public ExtensibleSplashHandler()\r
+       {\r
+               fImageList = new ArrayList<>();\r
+               fTooltipList = new ArrayList<>();\r
+               fIconPanel = null;\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see org.eclipse.ui.splash.AbstractSplashHandler#init(org.eclipse.swt.widgets. Shell)\r
+        */\r
+       @Override\r
+       public void init(Shell splash)\r
+       {\r
+               // Store the shell\r
+               super.init(splash);\r
+               // Configure the shell layout\r
+               configureUISplash();\r
+               // Load all splash extensions\r
+               loadSplashExtensions();\r
+               // If no splash extensions were loaded abort the splash handler\r
+               if (!hasSplashExtensions())\r
+               {\r
+                       return;\r
+               }\r
+               // Create UI\r
+               createUI();\r
+               // Configure the image panel bounds\r
+               configureUICompositeIconPanelBounds();\r
+               // Enter event loop and prevent the RCP application from\r
+               // loading until all work is done\r
+               doEventLoop();\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       private boolean hasSplashExtensions()\r
+       {\r
+               return !fImageList.isEmpty();\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       private void createUI()\r
+       {\r
+               // Create the icon panel\r
+               createUICompositeIconPanel();\r
+               // Create the images\r
+               createUIImages();\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       private void createUIImages()\r
+       {\r
+               Iterator<Image> imageIterator = fImageList.iterator();\r
+               Iterator<String> tooltipIterator = fTooltipList.iterator();\r
+               int i = 1;\r
+               int columnCount = ((GridLayout) fIconPanel.getLayout()).numColumns;\r
+               // Create all the images\r
+               // Abort if we run out of columns (left-over images will not fit within\r
+               // the usable splash screen width)\r
+               while (imageIterator.hasNext() && (i <= columnCount))\r
+               {\r
+                       Image image = imageIterator.next();\r
+                       String tooltip = tooltipIterator.next();\r
+                       // Create the image using a label widget\r
+                       createUILabel(image, tooltip);\r
+                       i++;\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @param image\r
+        * @param tooltip\r
+        */\r
+       private void createUILabel(Image image, String tooltip)\r
+       {\r
+               // Create the label (no text)\r
+               Label label = new Label(fIconPanel, SWT.NONE);\r
+               label.setImage(image);\r
+               label.setToolTipText(tooltip);\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       private void createUICompositeIconPanel()\r
+       {\r
+               Shell splash = getSplash();\r
+               // Create the composite\r
+               fIconPanel = new Composite(splash, SWT.NONE);\r
+               // Determine the maximum number of columns that can fit on the splash\r
+               // screen. One 50x50 image per column.\r
+               int maxColumnCount = getUsableSplashScreenWidth() / F_IMAGE_WIDTH;\r
+               // Limit size to the maximum number of columns if the number of images\r
+               // exceed this amount; otherwise, use the exact number of columns\r
+               // required.\r
+               int actualColumnCount = Math.min(fImageList.size(), maxColumnCount);\r
+               // Configure the layout\r
+               GridLayout layout = new GridLayout(actualColumnCount, true);\r
+               layout.horizontalSpacing = 0;\r
+               layout.verticalSpacing = 0;\r
+               layout.marginHeight = 0;\r
+               layout.marginWidth = 0;\r
+               fIconPanel.setLayout(layout);\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       private void configureUICompositeIconPanelBounds()\r
+       {\r
+               // Determine the size of the panel and position it at the bottom-right\r
+               // of the splash screen.\r
+               Point panelSize = fIconPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);\r
+\r
+               int xCoord = getSplash().getSize().x - F_SPLASH_SCREEN_BEVEL - panelSize.x;\r
+               int yCoord = getSplash().getSize().y - F_SPLASH_SCREEN_BEVEL - panelSize.y;\r
+               int xWidth = panelSize.x;\r
+               int yWidth = panelSize.y;\r
+\r
+               fIconPanel.setBounds(xCoord, yCoord, xWidth, yWidth);\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       private int getUsableSplashScreenWidth()\r
+       {\r
+               // Splash screen width minus two graphic border bevel widths\r
+               return getSplash().getSize().x - (F_SPLASH_SCREEN_BEVEL * 2);\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       private void loadSplashExtensions()\r
+       {\r
+               // Get all splash handler extensions\r
+               IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(F_SPLASH_EXTENSION_ID).getExtensions();\r
+               // Process all splash handler extensions\r
+               for (int i = 0; i < extensions.length; i++)\r
+               {\r
+                       processSplashExtension(extensions[i]);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @param extension\r
+        */\r
+       private void processSplashExtension(IExtension extension)\r
+       {\r
+               // Get all splash handler configuration elements\r
+               IConfigurationElement[] elements = extension.getConfigurationElements();\r
+               // Process all splash handler configuration elements\r
+               for (int j = 0; j < elements.length; j++)\r
+               {\r
+                       processSplashElements(elements[j]);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @param configurationElement\r
+        */\r
+       private void processSplashElements(IConfigurationElement configurationElement)\r
+       {\r
+               // Attribute: icon\r
+               processSplashElementIcon(configurationElement);\r
+               // Attribute: tooltip\r
+               processSplashElementTooltip(configurationElement);\r
+       }\r
+\r
+       /**\r
+        * @param configurationElement\r
+        */\r
+       private void processSplashElementTooltip(IConfigurationElement configurationElement)\r
+       {\r
+               // Get attribute tooltip\r
+               String tooltip = configurationElement.getAttribute(F_ELEMENT_TOOLTIP);\r
+               // If a tooltip is not defined, give it a default\r
+               if ((tooltip == null) || (tooltip.length() == 0))\r
+               {\r
+                       fTooltipList.add(F_DEFAULT_TOOLTIP);\r
+               } else\r
+               {\r
+                       fTooltipList.add(tooltip);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @param configurationElement\r
+        */\r
+       private void processSplashElementIcon(IConfigurationElement configurationElement)\r
+       {\r
+               // Get attribute icon\r
+               String iconImageFilePath = configurationElement.getAttribute(F_ELEMENT_ICON);\r
+               // Abort if an icon attribute was not specified\r
+               if ((iconImageFilePath == null) || (iconImageFilePath.length() == 0))\r
+               {\r
+                       return;\r
+               }\r
+               // Create a corresponding image descriptor\r
+               ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(configurationElement.getNamespaceIdentifier(),\r
+                               iconImageFilePath);\r
+               // Abort if no corresponding image was found\r
+               if (descriptor == null)\r
+               {\r
+                       return;\r
+               }\r
+               // Create the image\r
+               Image image = descriptor.createImage();\r
+               // Abort if image creation failed\r
+               if (image == null)\r
+               {\r
+                       return;\r
+               }\r
+               // Abort if the image does not have dimensions of 50x50\r
+               if ((image.getBounds().width != F_IMAGE_WIDTH) || (image.getBounds().height != F_IMAGE_HEIGHT))\r
+               {\r
+                       // Dipose of the image\r
+                       image.dispose();\r
+                       return;\r
+               }\r
+               // Store the image and tooltip\r
+               fImageList.add(image);\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       private void configureUISplash()\r
+       {\r
+               // Configure layout\r
+               GridLayout layout = new GridLayout(1, true);\r
+               getSplash().setLayout(layout);\r
+               // Force shell to inherit the splash background\r
+               getSplash().setBackgroundMode(SWT.INHERIT_DEFAULT);\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       private void doEventLoop()\r
+       {\r
+               Shell splash = getSplash();\r
+               if (!splash.getDisplay().readAndDispatch())\r
+               {\r
+                       splash.getDisplay().sleep();\r
+               }\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see org.eclipse.ui.splash.AbstractSplashHandler#dispose()\r
+        */\r
+       @Override\r
+       public void dispose()\r
+       {\r
+               super.dispose();\r
+               // Check to see if any images were defined\r
+               if ((fImageList == null) || fImageList.isEmpty())\r
+               {\r
+                       return;\r
+               }\r
+               // Dispose of all the images\r
+               Iterator<Image> iterator = fImageList.iterator();\r
+               while (iterator.hasNext())\r
+               {\r
+                       Image image = iterator.next();\r
+                       image.dispose();\r
+               }\r
+       }\r
+}\r