diff options
author | Alexander Kurtakov | 2019-07-16 08:36:23 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-07-16 08:36:23 +0000 |
commit | 2ffa7cad3950315197320313ce60b4d91293a7a9 (patch) | |
tree | 27937f25db2f3fb039972731cb605fb9397e6d9c | |
parent | cf6cb54248d076dea55f5833d0d4aed913831aca (diff) | |
download | rt.equinox.p2-2ffa7cad3950315197320313ce60b4d91293a7a9.tar.gz rt.equinox.p2-2ffa7cad3950315197320313ce60b4d91293a7a9.tar.xz rt.equinox.p2-2ffa7cad3950315197320313ce60b4d91293a7a9.zip |
Stricter warnings and fix them in examples.rcp.prestartupdate.
Change-Id: Iefad47a77c731ad67d7592e4e4718b3b767129a2
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
10 files changed, 148 insertions, 153 deletions
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.settings/org.eclipse.jdt.core.prefs index da88dfa01..d13aff825 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.settings/org.eclipse.jdt.core.prefs +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.settings/org.eclipse.jdt.core.prefs @@ -21,9 +21,9 @@ 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.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,10 +63,10 @@ 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.reportMethodCanBeStatic=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 +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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Activator.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Activator.java index a57019862..2b80ad851 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Activator.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Activator.java @@ -14,22 +14,24 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + // XXX Shared instance of bundle context static BundleContext bundleContext; - + /** * The constructor */ public Activator() { } + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; bundleContext = context; } - + + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); @@ -45,8 +47,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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Application.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Application.java index 7d17206d5..be1499a68 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Application.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Application.java @@ -10,10 +10,8 @@ import org.eclipse.ui.PlatformUI; * This class controls all aspects of the application's execution */ 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 { @@ -26,24 +24,17 @@ public class Application implements IApplication { display.dispose(); } } - /* - * (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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationActionBarAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationActionBarAdvisor.java index 68f0ad7c4..f07f136b0 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationActionBarAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationActionBarAdvisor.java @@ -18,74 +18,76 @@ 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; - private OpenViewAction openViewAction; - private Action 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; + 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. + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + } - exitAction = ActionFactory.QUIT.create(window); - register(exitAction); - - aboutAction = ActionFactory.ABOUT.create(window); - register(aboutAction); - - 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); - MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); - - menuBar.add(fileMenu); - // 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); - - // 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); - } + @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); + + 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); + MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); + + menuBar.add(fileMenu); + // 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); + + // 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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java index 64ddfc625..e27e4a2e0 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchAdvisor.java @@ -10,17 +10,12 @@ import org.eclipse.ui.application.WorkbenchWindowAdvisor; */ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { - public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor( - IWorkbenchWindowConfigurer configurer) { + @Override + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { return new ApplicationWorkbenchWindowAdvisor(configurer); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.application.WorkbenchAdvisor#preStartup() - */ - + @Override public String getInitialWindowPerspectiveId() { return Perspective.ID; } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/MessagePopupAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/MessagePopupAction.java index 2eb2ca93d..1957c8689 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/MessagePopupAction.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/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.prestartupdate.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.prestartupdate.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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/NavigationView.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/NavigationView.java index 1b912b4c1..16eccc2af 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/NavigationView.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/NavigationView.java @@ -2,7 +2,6 @@ package org.eclipse.equinox.p2.examples.rcp.prestartupdate; 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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/OpenViewAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/OpenViewAction.java index b741fa946..d1b5ab0fe 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/OpenViewAction.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/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.prestartupdate.Activator.getImageDescriptor("/icons/sample2.gif")); + setImageDescriptor( + org.eclipse.equinox.p2.examples.rcp.prestartupdate.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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Perspective.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Perspective.java index 244eca03c..b46a28383 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Perspective.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/Perspective.java @@ -11,15 +11,16 @@ public class Perspective implements IPerspectiveFactory { */ public static final String ID = "org.eclipse.equinox.p2.examples.rcp.prestartupdate.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.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/View.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/View.java index 38be31690..338460bb9 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/View.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/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.prestartupdate.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() { } } |