diff options
author | Alexander Kurtakov | 2019-07-16 09:20:54 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-07-16 09:20:54 +0000 |
commit | 072ed9510ac277f407decf6d17b00ad6a2b54ac3 (patch) | |
tree | 3ab183ecf8b07c5f40515d9d3209dec7cec0ae2d /examples | |
parent | 2ba945f685ad7cf723e236b4e12ef9f74d759d25 (diff) | |
download | rt.equinox.p2-072ed9510ac277f407decf6d17b00ad6a2b54ac3.tar.gz rt.equinox.p2-072ed9510ac277f407decf6d17b00ad6a2b54ac3.tar.xz rt.equinox.p2-072ed9510ac277f407decf6d17b00ad6a2b54ac3.zip |
Strict warnings and fixes in examples sdknoautoupdates.
Change-Id: I8563b65853884747ea32276a025f5d3eb0ab43f6
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'examples')
11 files changed, 186 insertions, 187 deletions
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.settings/org.eclipse.jdt.core.prefs index da88dfa01..2650a19c3 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.settings/org.eclipse.jdt.core.prefs +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.settings/org.eclipse.jdt.core.prefs @@ -23,7 +23,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore 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 +34,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,8 +63,8 @@ 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.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled @@ -75,7 +75,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,10 +87,10 @@ 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.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Activator.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Activator.java index c23f9256d..2e85d904e 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Activator.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Activator.java @@ -14,26 +14,20 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + /** * The constructor */ public Activator() { } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); @@ -49,8 +43,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 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Application.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Application.java index 3279bab80..d2ae19587 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Application.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/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,19 +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() { - 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.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationActionBarAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationActionBarAdvisor.java index 0794fc426..1e515cfc4 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationActionBarAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/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 all update preferences - private IWorkbenchAction preferencesAction; - private OpenViewAction openViewAction; - private Action messagePopupAction; - - - 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); - - newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window); - register(newWindowAction); - - //XXX preferences action - preferencesAction = ActionFactory.PREFERENCES.create(window); - register(preferencesAction); - - 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 Window menu - MenuManager windowMenu = new MenuManager("&Window", IWorkbenchActionConstants.M_WINDOW); - MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); - - menuBar.add(fileMenu); - // XXX Window menu - menuBar.add(windowMenu); - // 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 Window menu - windowMenu.add(preferencesAction); - - // Help - // XXX add an additions group because this is what SDK UI expects - helpMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - helpMenu.add(new Separator()); - 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 all update preferences + private IWorkbenchAction preferencesAction; + private OpenViewAction openViewAction; + private Action messagePopupAction; + + 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); + + newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window); + register(newWindowAction); + + // XXX preferences action + preferencesAction = ActionFactory.PREFERENCES.create(window); + register(preferencesAction); + + 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 Window menu + MenuManager windowMenu = new MenuManager("&Window", IWorkbenchActionConstants.M_WINDOW); + MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); + + menuBar.add(fileMenu); + // XXX Window menu + menuBar.add(windowMenu); + // 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 Window menu + windowMenu.add(preferencesAction); + + // Help + // XXX add an additions group because this is what SDK UI expects + helpMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + helpMenu.add(new Separator()); + 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.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationWorkbenchAdvisor.java index 183ba01f2..c36ab894a 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationWorkbenchAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/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.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationWorkbenchWindowAdvisor.java index 94a996d07..f2a2c77af 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationWorkbenchWindowAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/ApplicationWorkbenchWindowAdvisor.java @@ -8,22 +8,24 @@ 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 We 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 We 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.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/MessagePopupAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/MessagePopupAction.java index 09cf1f900..c1d2104f3 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/MessagePopupAction.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/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.sdknoautoupdates.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.sdknoautoupdates.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.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/NavigationView.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/NavigationView.java index bab5548e0..cb9d4e726 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/NavigationView.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/NavigationView.java @@ -2,7 +2,6 @@ package org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates; import java.util.ArrayList; -import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TreeViewer; @@ -71,7 +70,7 @@ public class NavigationView extends ViewPart { } } - class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { + class ViewContentProvider implements ITreeContentProvider { @Override public void inputChanged(Viewer v, Object oldInput, Object newInput) { diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/OpenViewAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/OpenViewAction.java index e55917985..8a77b75f9 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/OpenViewAction.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/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.sdknoautoupdates.Activator.getImageDescriptor("/icons/sample2.gif")); + setImageDescriptor(org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates.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.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Perspective.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Perspective.java index dbe205e64..8b0167602 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Perspective.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/Perspective.java @@ -11,15 +11,16 @@ public class Perspective implements IPerspectiveFactory { */ public static final String ID = "org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates.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.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/View.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/View.java index ec39948c7..44f45db2e 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/View.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/src/org/eclipse/equinox/p2/examples/rcp/sdknoautoupdates/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.sdknoautoupdates.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() { } } |