diff options
author | Alexander Kurtakov | 2019-07-16 08:27:56 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-07-16 08:27:56 +0000 |
commit | f89247f28aa8cdeaffa29e40a2187b788f118e88 (patch) | |
tree | 78138a1870d3eea4d197f7858b1452ccc75585f1 | |
parent | 4e49da3ba9a9f4a8edb89c72aa402e3757d5cd48 (diff) | |
download | rt.equinox.p2-f89247f28aa8cdeaffa29e40a2187b788f118e88.tar.gz rt.equinox.p2-f89247f28aa8cdeaffa29e40a2187b788f118e88.tar.xz rt.equinox.p2-f89247f28aa8cdeaffa29e40a2187b788f118e88.zip |
Stricter warnings and fix them in examples.rcp.cloud.
Change-Id: Idaa2fca217ec414bce6bcb3249aa9d2d8124542c
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
12 files changed, 206 insertions, 198 deletions
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.core.prefs index da88dfa01..a73900fa8 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.core.prefs +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.core.prefs @@ -9,8 +9,13 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error @@ -21,9 +26,10 @@ org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore @@ -34,14 +40,14 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore @@ -63,10 +69,11 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -75,7 +82,7 @@ org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore @@ -87,7 +94,7 @@ org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled @@ -104,4 +111,5 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java index b207685ce..b0556bed1 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java @@ -4,7 +4,6 @@ import org.eclipse.equinox.p2.examples.rcp.cloud.p2.CloudPolicy; import org.eclipse.equinox.p2.ui.Policy; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; @@ -19,18 +18,18 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + ServiceRegistration<Policy> policyRegistration; CloudPolicy policy; IPropertyChangeListener preferenceListener; - - + /** * The constructor */ public Activator() { } + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -41,15 +40,12 @@ public class Activator extends AbstractUIPlugin { private IPropertyChangeListener getPreferenceListener() { if (preferenceListener == null) { - preferenceListener = new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - policy.updateForPreferences(); - } - }; + preferenceListener = event -> policy.updateForPreferences(); } return preferenceListener; } + @Override public void stop(BundleContext context) throws Exception { plugin = null; // XXX unregister the UI policy @@ -58,7 +54,7 @@ public class Activator extends AbstractUIPlugin { getPreferenceStore().removePropertyChangeListener(preferenceListener); preferenceListener = null; super.stop(context); - + } /** @@ -71,8 +67,8 @@ public class Activator extends AbstractUIPlugin { } /** - * Returns an image descriptor for the image file at the given - * plug-in relative path + * Returns an image descriptor for the image file at the given plug-in relative + * path * * @param path the path * @return the image descriptor @@ -80,7 +76,7 @@ public class Activator extends AbstractUIPlugin { public static ImageDescriptor getImageDescriptor(String path) { return imageDescriptorFromPlugin(PLUGIN_ID, path); } - + private void registerP2Policy(BundleContext context) { policy = new CloudPolicy(); policy.updateForPreferences(); diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Application.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Application.java index 463ec52e2..feb9901ae 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Application.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Application.java @@ -11,9 +11,7 @@ import org.eclipse.ui.PlatformUI; */ public class Application implements IApplication { - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) - */ + @Override public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { @@ -27,20 +25,15 @@ public class Application implements IApplication { } } - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#stop() - */ + @Override public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) return; final Display display = workbench.getDisplay(); - display.syncExec(new Runnable() { - @Override - public void run() { - if (!display.isDisposed()) - workbench.close(); - } + display.syncExec(() -> { + if (!display.isDisposed()) + workbench.close(); }); } } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationActionBarAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationActionBarAdvisor.java index 8064f403c..db33963f5 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationActionBarAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationActionBarAdvisor.java @@ -18,91 +18,93 @@ import org.eclipse.ui.application.ActionBarAdvisor; import org.eclipse.ui.application.IActionBarConfigurer; /** - * An action bar advisor is responsible for creating, adding, and disposing of the - * actions added to a workbench window. Each window will be populated with + * An action bar advisor is responsible for creating, adding, and disposing of + * the actions added to a workbench window. Each window will be populated with * new actions. */ public class ApplicationActionBarAdvisor extends ActionBarAdvisor { - // Actions - important to allocate these only in makeActions, and then use them - // in the fill methods. This ensures that the actions aren't recreated - // when fillActionBars is called with FILL_PROXY. - private IWorkbenchAction exitAction; - private IWorkbenchAction aboutAction; - private IWorkbenchAction newWindowAction; - // XXX we want to show preferences - private IWorkbenchAction preferencesAction; - private OpenViewAction openViewAction; - private Action messagePopupAction; - - public static final String M_TOOLS = "tools"; - - - public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { - super(configurer); - } - - protected void makeActions(final IWorkbenchWindow window) { - // Creates the actions and registers them. - // Registering is needed to ensure that key bindings work. - // The corresponding commands keybindings are defined in the plugin.xml file. - // Registering also provides automatic disposal of the actions when - // the window is closed. - - exitAction = ActionFactory.QUIT.create(window); - register(exitAction); - - aboutAction = ActionFactory.ABOUT.create(window); - register(aboutAction); - - // XXX we want to show auto update preferences - preferencesAction = ActionFactory.PREFERENCES.create(window); - register(preferencesAction); - - newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window); - register(newWindowAction); - - openViewAction = new OpenViewAction(window, "Open Another Message View", View.ID); - register(openViewAction); - - messagePopupAction = new MessagePopupAction("Open Message", window); - register(messagePopupAction); - } - - protected void fillMenuBar(IMenuManager menuBar) { - MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); - // XXX add a tools menu - MenuManager toolsMenu = new MenuManager("&Tools", M_TOOLS); - MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); - - menuBar.add(fileMenu); - menuBar.add(toolsMenu); - // Add a group marker indicating where action set menus will appear. - menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - menuBar.add(helpMenu); - - // File - fileMenu.add(newWindowAction); - fileMenu.add(new Separator()); - fileMenu.add(messagePopupAction); - fileMenu.add(openViewAction); - fileMenu.add(new Separator()); - fileMenu.add(exitAction); - - // XXX add preferences to tools - toolsMenu.add(preferencesAction); - // XXX add a group for new other tools contributions - toolsMenu.add(new Separator()); - toolsMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - - // Help - helpMenu.add(aboutAction); - } - - protected void fillCoolBar(ICoolBarManager coolBar) { - IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT); - coolBar.add(new ToolBarContributionItem(toolbar, "main")); - toolbar.add(openViewAction); - toolbar.add(messagePopupAction); - } + // Actions - important to allocate these only in makeActions, and then use them + // in the fill methods. This ensures that the actions aren't recreated + // when fillActionBars is called with FILL_PROXY. + private IWorkbenchAction exitAction; + private IWorkbenchAction aboutAction; + private IWorkbenchAction newWindowAction; + // XXX we want to show preferences + private IWorkbenchAction preferencesAction; + private OpenViewAction openViewAction; + private Action messagePopupAction; + + public static final String M_TOOLS = "tools"; + + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + } + + @Override + protected void makeActions(final IWorkbenchWindow window) { + // Creates the actions and registers them. + // Registering is needed to ensure that key bindings work. + // The corresponding commands keybindings are defined in the plugin.xml file. + // Registering also provides automatic disposal of the actions when + // the window is closed. + + exitAction = ActionFactory.QUIT.create(window); + register(exitAction); + + aboutAction = ActionFactory.ABOUT.create(window); + register(aboutAction); + + // XXX we want to show auto update preferences + preferencesAction = ActionFactory.PREFERENCES.create(window); + register(preferencesAction); + + newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window); + register(newWindowAction); + + openViewAction = new OpenViewAction(window, "Open Another Message View", View.ID); + register(openViewAction); + + messagePopupAction = new MessagePopupAction("Open Message", window); + register(messagePopupAction); + } + + @Override + protected void fillMenuBar(IMenuManager menuBar) { + MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); + // XXX add a tools menu + MenuManager toolsMenu = new MenuManager("&Tools", M_TOOLS); + MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); + + menuBar.add(fileMenu); + menuBar.add(toolsMenu); + // Add a group marker indicating where action set menus will appear. + menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + menuBar.add(helpMenu); + + // File + fileMenu.add(newWindowAction); + fileMenu.add(new Separator()); + fileMenu.add(messagePopupAction); + fileMenu.add(openViewAction); + fileMenu.add(new Separator()); + fileMenu.add(exitAction); + + // XXX add preferences to tools + toolsMenu.add(preferencesAction); + // XXX add a group for new other tools contributions + toolsMenu.add(new Separator()); + toolsMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + + // Help + helpMenu.add(aboutAction); + } + + @Override + protected void fillCoolBar(ICoolBarManager coolBar) { + IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT); + coolBar.add(new ToolBarContributionItem(toolbar, "main")); + toolbar.add(openViewAction); + toolbar.add(messagePopupAction); + } } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchAdvisor.java index 717a4fa7c..893d9979e 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchAdvisor.java @@ -5,17 +5,19 @@ import org.eclipse.ui.application.WorkbenchAdvisor; import org.eclipse.ui.application.WorkbenchWindowAdvisor; /** - * This workbench advisor creates the window advisor, and specifies - * the perspective id for the initial window. + * This workbench advisor creates the window advisor, and specifies the + * perspective id for the initial window. */ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { - - public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { - return new ApplicationWorkbenchWindowAdvisor(configurer); - } + @Override + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + return new ApplicationWorkbenchWindowAdvisor(configurer); + } + + @Override public String getInitialWindowPerspectiveId() { return Perspective.ID; - } - + } + } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchWindowAdvisor.java index a71e1b3f2..fc30c6228 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchWindowAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchWindowAdvisor.java @@ -8,23 +8,25 @@ import org.eclipse.ui.application.WorkbenchWindowAdvisor; public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { - public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { - super(configurer); - } + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } - public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { - return new ApplicationActionBarAdvisor(configurer); - } - - public void preWindowOpen() { - IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); - configurer.setInitialSize(new Point(600, 400)); - configurer.setShowCoolBar(true); - // XXX Set the status line and progress indicator so that update - // information can be shown there - configurer.setShowStatusLine(true); + @Override + public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + @Override + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + configurer.setInitialSize(new Point(600, 400)); + configurer.setShowCoolBar(true); + // XXX Set the status line and progress indicator so that update + // information can be shown there + configurer.setShowStatusLine(true); configurer.setShowProgressIndicator(true); - } - + } + } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/MessagePopupAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/MessagePopupAction.java index 85324bae0..347a11660 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/MessagePopupAction.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/MessagePopupAction.java @@ -4,22 +4,23 @@ import org.eclipse.jface.action.Action; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.IWorkbenchWindow; - public class MessagePopupAction extends Action { - private final IWorkbenchWindow window; + private final IWorkbenchWindow window; - MessagePopupAction(String text, IWorkbenchWindow window) { - super(text); - this.window = window; - // The id is used to refer to the action in a menu or toolbar - setId(ICommandIds.CMD_OPEN_MESSAGE); - // Associate the action with a pre-defined command, to allow key bindings. - setActionDefinitionId(ICommandIds.CMD_OPEN_MESSAGE); - setImageDescriptor(org.eclipse.equinox.p2.examples.rcp.cloud.Activator.getImageDescriptor("/icons/sample3.gif")); - } + MessagePopupAction(String text, IWorkbenchWindow window) { + super(text); + this.window = window; + // The id is used to refer to the action in a menu or toolbar + setId(ICommandIds.CMD_OPEN_MESSAGE); + // Associate the action with a pre-defined command, to allow key bindings. + setActionDefinitionId(ICommandIds.CMD_OPEN_MESSAGE); + setImageDescriptor( + org.eclipse.equinox.p2.examples.rcp.cloud.Activator.getImageDescriptor("/icons/sample3.gif")); + } - public void run() { - MessageDialog.openInformation(window.getShell(), "Open", "Open Message Dialog!"); - } + @Override + public void run() { + MessageDialog.openInformation(window.getShell(), "Open", "Open Message Dialog!"); + } }
\ No newline at end of file diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/OpenViewAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/OpenViewAction.java index 317e07342..3c732aebd 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/OpenViewAction.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/OpenViewAction.java @@ -6,26 +6,27 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; - public class OpenViewAction extends Action { - + private final IWorkbenchWindow window; private int instanceNum = 0; private final String viewId; - + public OpenViewAction(IWorkbenchWindow window, String label, String viewId) { this.window = window; this.viewId = viewId; - setText(label); - // The id is used to refer to the action in a menu or toolbar + setText(label); + // The id is used to refer to the action in a menu or toolbar setId(ICommandIds.CMD_OPEN); - // Associate the action with a pre-defined command, to allow key bindings. + // Associate the action with a pre-defined command, to allow key bindings. setActionDefinitionId(ICommandIds.CMD_OPEN); - setImageDescriptor(org.eclipse.equinox.p2.examples.rcp.cloud.Activator.getImageDescriptor("/icons/sample2.gif")); + setImageDescriptor( + org.eclipse.equinox.p2.examples.rcp.cloud.Activator.getImageDescriptor("/icons/sample2.gif")); } - + + @Override public void run() { - if(window != null) { + if (window != null) { try { window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE); } catch (PartInitException e) { diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Perspective.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Perspective.java index 63299ce7e..caaf4ff75 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Perspective.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Perspective.java @@ -11,15 +11,16 @@ public class Perspective implements IPerspectiveFactory { */ public static final String ID = "org.eclipse.equinox.p2.examples.rcp.cloud.perspective"; + @Override public void createInitialLayout(IPageLayout layout) { String editorArea = layout.getEditorArea(); layout.setEditorAreaVisible(false); - - layout.addStandaloneView(NavigationView.ID, false, IPageLayout.LEFT, 0.25f, editorArea); + + layout.addStandaloneView(NavigationView.ID, false, IPageLayout.LEFT, 0.25f, editorArea); IFolderLayout folder = layout.createFolder("messages", IPageLayout.TOP, 0.5f, editorArea); folder.addPlaceholder(View.ID + ":*"); folder.addView(View.ID); - + layout.getViewLayout(NavigationView.ID).setCloseable(false); } } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/View.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/View.java index d215e5b2c..ce90d6440 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/View.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/View.java @@ -17,7 +17,8 @@ import org.eclipse.ui.part.ViewPart; public class View extends ViewPart { public static final String ID = "org.eclipse.equinox.p2.examples.rcp.cloud.view"; - + + @Override public void createPartControl(Composite parent) { Composite top = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); @@ -26,34 +27,37 @@ public class View extends ViewPart { top.setLayout(layout); // top banner Composite banner = new Composite(top, SWT.NONE); - banner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false)); + banner.setLayoutData( + new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false)); layout = new GridLayout(); layout.marginHeight = 5; layout.marginWidth = 10; layout.numColumns = 2; banner.setLayout(layout); - + // setup bold font - Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); - + Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); + Label l = new Label(banner, SWT.WRAP); l.setText("Subject:"); l.setFont(boldFont); l = new Label(banner, SWT.WRAP); l.setText("This is a message about the cool Eclipse RCP!"); - + l = new Label(banner, SWT.WRAP); l.setText("From:"); l.setFont(boldFont); - + final Link link = new Link(banner, SWT.NONE); link.setText("<a>nicole@mail.org</a>"); - link.addSelectionListener(new SelectionAdapter() { + link.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { - MessageDialog.openInformation(getSite().getShell(), "Not Implemented", "Imagine the address book or a new message being created now."); - } + MessageDialog.openInformation(getSite().getShell(), "Not Implemented", + "Imagine the address book or a new message being created now."); + } }); - + l = new Label(banner, SWT.WRAP); l.setText("Date:"); l.setFont(boldFont); @@ -61,17 +65,16 @@ public class View extends ViewPart { l.setText("10:34 am"); // message contents Text text = new Text(top, SWT.MULTI | SWT.WRAP); - text.setText("This RCP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\n"+ - "- add a top-level menu and toolbar with actions\n"+ - "- add keybindings to actions\n" + - "- create views that can't be closed and\n"+ - " multiple instances of the same view\n"+ - "- perspectives with placeholders for new views\n"+ - "- use the default about dialog\n"+ - "- create a product definition\n"); + text.setText( + "This RCP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\n" + + "- add a top-level menu and toolbar with actions\n" + "- add keybindings to actions\n" + + "- create views that can't be closed and\n" + " multiple instances of the same view\n" + + "- perspectives with placeholders for new views\n" + "- use the default about dialog\n" + + "- create a product definition\n"); text.setLayoutData(new GridData(GridData.FILL_BOTH)); } + @Override public void setFocus() { } } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java index 766fbd888..290c765d9 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -25,8 +25,9 @@ import org.osgi.service.prefs.Preferences; */ public class PreferenceInitializer extends AbstractPreferenceInitializer { + @Override public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID); //$NON-NLS-1$ + Preferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID); // default values node.putBoolean(PreferenceConstants.REPOSITORIES_VISIBLE, false); node.putBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY, true); diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreloadingRepositoryHandler.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreloadingRepositoryHandler.java index 6cd63e25a..5a039b53a 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreloadingRepositoryHandler.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreloadingRepositoryHandler.java @@ -24,9 +24,9 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; /** - * PreloadingRepositoryHandler provides background loading of - * repositories before executing the provisioning handler. - * + * PreloadingRepositoryHandler provides background loading of repositories + * before executing the provisioning handler. + * * @since 3.5 */ abstract class PreloadingRepositoryHandler extends AbstractHandler { @@ -41,6 +41,7 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { /** * Execute the command. */ + @Override public Object execute(ExecutionEvent event) { doExecuteAndLoad(); return null; @@ -48,21 +49,17 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { void doExecuteAndLoad() { if (preloadRepositories()) { - //cancel any load that is already running + // cancel any load that is already running Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY); final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()); setLoadJobProperties(loadJob); if (waitForPreload()) { loadJob.addJobChangeListener(new JobChangeAdapter() { + @Override public void done(IJobChangeEvent event) { if (PlatformUI.isWorkbenchRunning()) if (event.getResult().isOK()) { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - doExecute(loadJob); - } - }); + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> doExecute(loadJob)); } } }); @@ -100,6 +97,7 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { /** * Return a shell appropriate for parenting dialogs of this handler. + * * @return a Shell */ protected Shell getShell() { |