diff options
author | Alexander Kurtakov | 2019-01-23 09:44:40 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-01-23 09:44:40 +0000 |
commit | 702d3dca2901bbd644987c51f5773b5ba8b77a2c (patch) | |
tree | cbbdaf925147cf561d3759173126d822c8a4fe53 /examples | |
parent | 13ee74b9633488c1c7b8935d701b5a86488b28ec (diff) | |
download | rt.equinox.p2-702d3dca2901bbd644987c51f5773b5ba8b77a2c.tar.gz rt.equinox.p2-702d3dca2901bbd644987c51f5773b5ba8b77a2c.tar.xz rt.equinox.p2-702d3dca2901bbd644987c51f5773b5ba8b77a2c.zip |
Update examples to Java 1.8 BREE.
Fix warnings and enable save actions.
Change-Id: Ie43dbea77185ac66cce56735bbfd5a8aa6363b63
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'examples')
31 files changed, 964 insertions, 310 deletions
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.classpath b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.classpath +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> 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 8f8669add..0c68a61dc 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 @@ -1,8 +1,7 @@ -#Thu Mar 12 11:04:59 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=jsr14 -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF index 145fad6c5..a188e6d41 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF @@ -26,5 +26,5 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.apache.httpcomponents.httpclient;bundle-version="4.2.0", org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="1.0.300" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.cloud 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 2b8b21591..766fbd888 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -25,11 +25,8 @@ import org.osgi.service.prefs.Preferences; */ public class PreferenceInitializer extends AbstractPreferenceInitializer { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ public void initializeDefaultPreferences() { - Preferences node = new DefaultScope().getNode(Activator.PLUGIN_ID); //$NON-NLS-1$ + Preferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID); //$NON-NLS-1$ // 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.discovery/.classpath b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.classpath index 3450ccb12..91d82eedf 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.classpath +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> <accessrules> <accessrule kind="accessible" pattern="**/internal/**/discovery/**"/> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.settings/org.eclipse.jdt.core.prefs index 8f8669add..e3d35e847 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.settings/org.eclipse.jdt.core.prefs +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,113 @@ -#Thu Mar 12 11:04:59 PDT 2009 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +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.targetPlatform=jsr14 -org.eclipse.jdt.core.compiler.compliance=1.5 +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 +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +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.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +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.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.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +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.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +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.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +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.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +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.discovery/.settings/org.eclipse.jdt.ui.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..b42c32887 --- /dev/null +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=true +sp_cleanup.convert_to_enhanced_for_loop=true +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF index f635f10f2..f22b6adce 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF @@ -29,4 +29,5 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.apache.httpcomponents.httpclient;bundle-version="4.2.0", org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.cloud diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java index c0589471a..202871060 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java @@ -18,7 +18,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - ServiceRegistration policyRegistration; + ServiceRegistration<Policy> policyRegistration; /** * The constructor @@ -26,10 +26,6 @@ public class Activator extends AbstractUIPlugin { public Activator() { } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -37,10 +33,6 @@ public class Activator extends AbstractUIPlugin { registerP2Policy(context); } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ public void stop(BundleContext context) throws Exception { plugin = null; // XXX unregister the UI policy @@ -71,6 +63,6 @@ public class Activator extends AbstractUIPlugin { } private void registerP2Policy(BundleContext context) { - policyRegistration = context.registerService(Policy.class.getName(), new CloudPolicy(), null); + policyRegistration = context.registerService(Policy.class, new CloudPolicy(), null); } } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/NavigationView.java b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/NavigationView.java index c58a55812..bd5538cca 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/NavigationView.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/src/org/eclipse/equinox/p2/examples/rcp/cloud/NavigationView.java @@ -17,124 +17,142 @@ import org.eclipse.ui.part.ViewPart; public class NavigationView extends ViewPart { public static final String ID = "org.eclipse.equinox.p2.examples.rcp.cloud.navigationView"; private TreeViewer viewer; - + class TreeObject { private String name; private TreeParent parent; - + public TreeObject(String name) { this.name = name; } + public String getName() { return name; } + public void setParent(TreeParent parent) { this.parent = parent; } + public TreeParent getParent() { return parent; } + + @Override public String toString() { return getName(); } } - + class TreeParent extends TreeObject { - private ArrayList children; + private ArrayList<TreeObject> children; + public TreeParent(String name) { super(name); - children = new ArrayList(); + children = new ArrayList<>(); } + public void addChild(TreeObject child) { children.add(child); child.setParent(this); } + public void removeChild(TreeObject child) { children.remove(child); child.setParent(null); } + public TreeObject[] getChildren() { - return (TreeObject[]) children.toArray(new TreeObject[children.size()]); + return children.toArray(new TreeObject[children.size()]); } + public boolean hasChildren() { - return children.size()>0; + return children.size() > 0; } } - class ViewContentProvider implements IStructuredContentProvider, - ITreeContentProvider { + class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { - public void inputChanged(Viewer v, Object oldInput, Object newInput) { + @Override + public void inputChanged(Viewer v, Object oldInput, Object newInput) { } - + + @Override public void dispose() { } - + + @Override public Object[] getElements(Object parent) { return getChildren(parent); } - + + @Override public Object getParent(Object child) { if (child instanceof TreeObject) { - return ((TreeObject)child).getParent(); + return ((TreeObject) child).getParent(); } return null; } - + + @Override public Object[] getChildren(Object parent) { if (parent instanceof TreeParent) { - return ((TreeParent)parent).getChildren(); + return ((TreeParent) parent).getChildren(); } return new Object[0]; } - public boolean hasChildren(Object parent) { + @Override + public boolean hasChildren(Object parent) { if (parent instanceof TreeParent) - return ((TreeParent)parent).hasChildren(); + return ((TreeParent) parent).hasChildren(); return false; } } - + class ViewLabelProvider extends LabelProvider { + @Override public String getText(Object obj) { return obj.toString(); } + + @Override public Image getImage(Object obj) { String imageKey = ISharedImages.IMG_OBJ_ELEMENT; if (obj instanceof TreeParent) - imageKey = ISharedImages.IMG_OBJ_FOLDER; + imageKey = ISharedImages.IMG_OBJ_FOLDER; return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); } } - /** - * We will set up a dummy model to initialize tree heararchy. In real - * code, you will connect to a real model and expose its hierarchy. - */ - private TreeObject createDummyModel() { - TreeObject to1 = new TreeObject("Inbox"); - TreeObject to2 = new TreeObject("Drafts"); - TreeObject to3 = new TreeObject("Sent"); - TreeParent p1 = new TreeParent("me@this.com"); - p1.addChild(to1); - p1.addChild(to2); - p1.addChild(to3); - - TreeObject to4 = new TreeObject("Inbox"); - TreeParent p2 = new TreeParent("other@aol.com"); - p2.addChild(to4); - - TreeParent root = new TreeParent(""); - root.addChild(p1); - root.addChild(p2); - return root; - } + /** + * We will set up a dummy model to initialize tree heararchy. In real code, you + * will connect to a real model and expose its hierarchy. + */ + private TreeObject createDummyModel() { + TreeObject to1 = new TreeObject("Inbox"); + TreeObject to2 = new TreeObject("Drafts"); + TreeObject to3 = new TreeObject("Sent"); + TreeParent p1 = new TreeParent("me@this.com"); + p1.addChild(to1); + p1.addChild(to2); + p1.addChild(to3); + + TreeObject to4 = new TreeObject("Inbox"); + TreeParent p2 = new TreeParent("other@aol.com"); + p2.addChild(to4); + + TreeParent root = new TreeParent(""); + root.addChild(p1); + root.addChild(p2); + return root; + } /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ + * This is a callback that will allow us to create the viewer and initialize it. + */ + @Override public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setContentProvider(new ViewContentProvider()); @@ -145,6 +163,7 @@ public class NavigationView extends ViewPart { /** * Passing the focus request to the viewer's control. */ + @Override public void setFocus() { viewer.getControl().setFocus(); } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.classpath b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.classpath +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> 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 92bb3f369..da88dfa01 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 @@ -1,8 +1,107 @@ -#Mon Mar 16 12:12:08 PDT 2009 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +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.targetPlatform=jsr14 -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +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.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +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.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.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +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.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +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.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +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.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +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.source=1.8 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.settings/org.eclipse.jdt.ui.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..b42c32887 --- /dev/null +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=true +sp_cleanup.convert_to_enhanced_for_loop=true +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF index 3415e93dd..6a9b38e83 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF @@ -15,5 +15,5 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ecf.provider.filetransfer;bundle-version="3.0.0", org.apache.httpcomponents.httpclient;bundle-version="4.2.0", org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="1.0.300" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.prestartupdate 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 c005f61f7..a57019862 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 @@ -2,10 +2,7 @@ package org.eclipse.equinox.p2.examples.rcp.prestartupdate; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; /** * The activator class controls the plug-in life cycle @@ -21,48 +18,18 @@ public class Activator extends AbstractUIPlugin { // XXX Shared instance of bundle context static BundleContext bundleContext; - // XXX services for starting bundles - private static PackageAdmin packageAdmin = null; - private static ServiceReference packageAdminRef = null; - /** * The constructor */ public Activator() { } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; bundleContext = context; - - packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class.getName()); - packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminRef); } - private static Bundle getBundle(String symbolicName) { - if (packageAdmin == null) - return null; - Bundle[] bundles = packageAdmin.getBundles(symbolicName, null); - if (bundles == null) - return null; - // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; - } - } - return null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java index 0896291f3..b592b72ca 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/ApplicationWorkbenchWindowAdvisor.java @@ -2,7 +2,6 @@ package org.eclipse.equinox.p2.examples.rcp.prestartupdate; import java.lang.reflect.InvocationTargetException; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; @@ -21,24 +20,19 @@ import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchWindowAdvisor; public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { - + private static final String JUSTUPDATED = "justUpdated"; - public ApplicationWorkbenchWindowAdvisor( - IWorkbenchWindowConfigurer configurer) { + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { super(configurer); } - public ActionBarAdvisor createActionBarAdvisor( - IActionBarConfigurer configurer) { + @Override + public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { return new ApplicationActionBarAdvisor(configurer); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen() - */ + @Override public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setInitialSize(new Point(600, 400)); @@ -46,19 +40,13 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { configurer.setShowStatusLine(false); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowOpen() - */ + @Override public void postWindowOpen() { - final IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper - .getService(Activator.bundleContext, - IProvisioningAgent.SERVICE_NAME); + final IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(Activator.bundleContext, + IProvisioningAgent.SERVICE_NAME); if (agent == null) { - LogHelper - .log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "No provisioning agent found. This application is not set up for updates.")); + LogHelper.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + "No provisioning agent found. This application is not set up for updates.")); } // XXX if we're restarting after updating, don't check again. final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore(); @@ -70,24 +58,16 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { // XXX check for updates before starting up. // If an update is performed, restart. Otherwise log // the status. - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - IStatus updateStatus = P2Util.checkForUpdates(agent, monitor); - if (updateStatus.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { - PlatformUI.getWorkbench().getDisplay() - .asyncExec(new Runnable() { - public void run() { - MessageDialog.openInformation(null, - "Updates", "No updates were found"); - } - }); - } else if (updateStatus.getSeverity() != IStatus.ERROR) { - prefStore.setValue(JUSTUPDATED, true); - PlatformUI.getWorkbench().restart(); - } else { - LogHelper.log(updateStatus); - } + IRunnableWithProgress runnable = monitor -> { + IStatus updateStatus = P2Util.checkForUpdates(agent, monitor); + if (updateStatus.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { + PlatformUI.getWorkbench().getDisplay() + .asyncExec(() -> MessageDialog.openInformation(null, "Updates", "No updates were found")); + } else if (updateStatus.getSeverity() != IStatus.ERROR) { + prefStore.setValue(JUSTUPDATED, true); + PlatformUI.getWorkbench().restart(); + } else { + LogHelper.log(updateStatus); } }; try { 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 77f69a28d..1b912b4c1 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 @@ -17,124 +17,142 @@ import org.eclipse.ui.part.ViewPart; public class NavigationView extends ViewPart { public static final String ID = "org.eclipse.equinox.p2.examples.rcp.prestartupdate.navigationView"; private TreeViewer viewer; - + class TreeObject { private String name; private TreeParent parent; - + public TreeObject(String name) { this.name = name; } + public String getName() { return name; } + public void setParent(TreeParent parent) { this.parent = parent; } + public TreeParent getParent() { return parent; } + + @Override public String toString() { return getName(); } } - + class TreeParent extends TreeObject { - private ArrayList children; + private ArrayList<TreeObject> children; + public TreeParent(String name) { super(name); - children = new ArrayList(); + children = new ArrayList<>(); } + public void addChild(TreeObject child) { children.add(child); child.setParent(this); } + public void removeChild(TreeObject child) { children.remove(child); child.setParent(null); } + public TreeObject[] getChildren() { - return (TreeObject[]) children.toArray(new TreeObject[children.size()]); + return children.toArray(new TreeObject[children.size()]); } + public boolean hasChildren() { - return children.size()>0; + return children.size() > 0; } } - class ViewContentProvider implements IStructuredContentProvider, - ITreeContentProvider { + class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { - public void inputChanged(Viewer v, Object oldInput, Object newInput) { + @Override + public void inputChanged(Viewer v, Object oldInput, Object newInput) { } - + + @Override public void dispose() { } - + + @Override public Object[] getElements(Object parent) { return getChildren(parent); } - + + @Override public Object getParent(Object child) { if (child instanceof TreeObject) { - return ((TreeObject)child).getParent(); + return ((TreeObject) child).getParent(); } return null; } - + + @Override public Object[] getChildren(Object parent) { if (parent instanceof TreeParent) { - return ((TreeParent)parent).getChildren(); + return ((TreeParent) parent).getChildren(); } return new Object[0]; } - public boolean hasChildren(Object parent) { + @Override + public boolean hasChildren(Object parent) { if (parent instanceof TreeParent) - return ((TreeParent)parent).hasChildren(); + return ((TreeParent) parent).hasChildren(); return false; } } - + class ViewLabelProvider extends LabelProvider { + @Override public String getText(Object obj) { return obj.toString(); } + + @Override public Image getImage(Object obj) { String imageKey = ISharedImages.IMG_OBJ_ELEMENT; if (obj instanceof TreeParent) - imageKey = ISharedImages.IMG_OBJ_FOLDER; + imageKey = ISharedImages.IMG_OBJ_FOLDER; return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); } } - /** - * We will set up a dummy model to initialize tree heararchy. In real - * code, you will connect to a real model and expose its hierarchy. - */ - private TreeObject createDummyModel() { - TreeObject to1 = new TreeObject("Inbox"); - TreeObject to2 = new TreeObject("Drafts"); - TreeObject to3 = new TreeObject("Sent"); - TreeParent p1 = new TreeParent("me@this.com"); - p1.addChild(to1); - p1.addChild(to2); - p1.addChild(to3); - - TreeObject to4 = new TreeObject("Inbox"); - TreeParent p2 = new TreeParent("other@aol.com"); - p2.addChild(to4); - - TreeParent root = new TreeParent(""); - root.addChild(p1); - root.addChild(p2); - return root; - } + /** + * We will set up a dummy model to initialize tree heararchy. In real code, you + * will connect to a real model and expose its hierarchy. + */ + private TreeObject createDummyModel() { + TreeObject to1 = new TreeObject("Inbox"); + TreeObject to2 = new TreeObject("Drafts"); + TreeObject to3 = new TreeObject("Sent"); + TreeParent p1 = new TreeParent("me@this.com"); + p1.addChild(to1); + p1.addChild(to2); + p1.addChild(to3); + + TreeObject to4 = new TreeObject("Inbox"); + TreeParent p2 = new TreeParent("other@aol.com"); + p2.addChild(to4); + + TreeParent root = new TreeParent(""); + root.addChild(p1); + root.addChild(p2); + return root; + } /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ + * This is a callback that will allow us to create the viewer and initialize it. + */ + @Override public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setContentProvider(new ViewContentProvider()); @@ -145,6 +163,7 @@ public class NavigationView extends ViewPart { /** * Passing the focus request to the viewer's control. */ + @Override public void setFocus() { viewer.getControl().setFocus(); } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.classpath b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.classpath +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.settings/org.eclipse.jdt.core.prefs index 1be1d28ec..da88dfa01 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.settings/org.eclipse.jdt.core.prefs +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,107 @@ -#Mon Mar 16 12:11:08 PDT 2009 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +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.targetPlatform=jsr14 -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +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.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +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.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.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +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.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +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.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +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.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +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.source=1.8 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.settings/org.eclipse.jdt.ui.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..b42c32887 --- /dev/null +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=true +sp_cleanup.convert_to_enhanced_for_loop=true +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF index 41688435b..45d4a950e 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF @@ -25,6 +25,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.apache.httpcomponents.httpclient;bundle-version="4.2.0", org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="1.0.300" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Service-Component: OSGI-INF/policy_component.xml Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/NavigationView.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/NavigationView.java index 87949a3bc..0c34bd423 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/NavigationView.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/NavigationView.java @@ -17,124 +17,142 @@ import org.eclipse.ui.part.ViewPart; public class NavigationView extends ViewPart { public static final String ID = "org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.navigationView"; private TreeViewer viewer; - + class TreeObject { private String name; private TreeParent parent; - + public TreeObject(String name) { this.name = name; } + public String getName() { return name; } + public void setParent(TreeParent parent) { this.parent = parent; } + public TreeParent getParent() { return parent; } + + @Override public String toString() { return getName(); } } - + class TreeParent extends TreeObject { - private ArrayList children; + private ArrayList<TreeObject> children; + public TreeParent(String name) { super(name); - children = new ArrayList(); + children = new ArrayList<>(); } + public void addChild(TreeObject child) { children.add(child); child.setParent(this); } + public void removeChild(TreeObject child) { children.remove(child); child.setParent(null); } + public TreeObject[] getChildren() { - return (TreeObject[]) children.toArray(new TreeObject[children.size()]); + return children.toArray(new TreeObject[children.size()]); } + public boolean hasChildren() { - return children.size()>0; + return children.size() > 0; } } - class ViewContentProvider implements IStructuredContentProvider, - ITreeContentProvider { + class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { - public void inputChanged(Viewer v, Object oldInput, Object newInput) { + @Override + public void inputChanged(Viewer v, Object oldInput, Object newInput) { } - + + @Override public void dispose() { } - + + @Override public Object[] getElements(Object parent) { return getChildren(parent); } - + + @Override public Object getParent(Object child) { if (child instanceof TreeObject) { - return ((TreeObject)child).getParent(); + return ((TreeObject) child).getParent(); } return null; } - + + @Override public Object[] getChildren(Object parent) { if (parent instanceof TreeParent) { - return ((TreeParent)parent).getChildren(); + return ((TreeParent) parent).getChildren(); } return new Object[0]; } - public boolean hasChildren(Object parent) { + @Override + public boolean hasChildren(Object parent) { if (parent instanceof TreeParent) - return ((TreeParent)parent).hasChildren(); + return ((TreeParent) parent).hasChildren(); return false; } } - + class ViewLabelProvider extends LabelProvider { + @Override public String getText(Object obj) { return obj.toString(); } + + @Override public Image getImage(Object obj) { String imageKey = ISharedImages.IMG_OBJ_ELEMENT; if (obj instanceof TreeParent) - imageKey = ISharedImages.IMG_OBJ_FOLDER; + imageKey = ISharedImages.IMG_OBJ_FOLDER; return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); } } - /** - * We will set up a dummy model to initialize tree heararchy. In real - * code, you will connect to a real model and expose its hierarchy. - */ - private TreeObject createDummyModel() { - TreeObject to1 = new TreeObject("Inbox"); - TreeObject to2 = new TreeObject("Drafts"); - TreeObject to3 = new TreeObject("Sent"); - TreeParent p1 = new TreeParent("me@this.com"); - p1.addChild(to1); - p1.addChild(to2); - p1.addChild(to3); - - TreeObject to4 = new TreeObject("Inbox"); - TreeParent p2 = new TreeParent("other@aol.com"); - p2.addChild(to4); - - TreeParent root = new TreeParent(""); - root.addChild(p1); - root.addChild(p2); - return root; - } + /** + * We will set up a dummy model to initialize tree heararchy. In real code, you + * will connect to a real model and expose its hierarchy. + */ + private TreeObject createDummyModel() { + TreeObject to1 = new TreeObject("Inbox"); + TreeObject to2 = new TreeObject("Drafts"); + TreeObject to3 = new TreeObject("Sent"); + TreeParent p1 = new TreeParent("me@this.com"); + p1.addChild(to1); + p1.addChild(to2); + p1.addChild(to3); + + TreeObject to4 = new TreeObject("Inbox"); + TreeParent p2 = new TreeParent("other@aol.com"); + p2.addChild(to4); + + TreeParent root = new TreeParent(""); + root.addChild(p1); + root.addChild(p2); + return root; + } /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ + * This is a callback that will allow us to create the viewer and initialize it. + */ + @Override public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setContentProvider(new ViewContentProvider()); @@ -145,6 +163,7 @@ public class NavigationView extends ViewPart { /** * Passing the focus request to the viewer's control. */ + @Override public void setFocus() { viewer.getControl().setFocus(); } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/PreferenceInitializer.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/PreferenceInitializer.java index 1f71d6857..c36a8dc5a 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/PreferenceInitializer.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/PreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -23,11 +23,9 @@ import org.osgi.service.prefs.Preferences; */ public class PreferenceInitializer extends AbstractPreferenceInitializer { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ + @Override public void initializeDefaultPreferences() { - Preferences node = new DefaultScope().getNode("org.eclipse.equinox.p2.ui.sdk"); //$NON-NLS-1$ + Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.equinox.p2.ui.sdk"); //$NON-NLS-1$ node.putBoolean(PreferenceConstants.PREF_SHOW_LATEST_VERSION, true); node.put(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, MessageDialogWithToggle.PROMPT); } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.classpath b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.classpath +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> 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 1fe1140c0..da88dfa01 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 @@ -1,8 +1,107 @@ -#Mon Mar 16 11:53:51 PDT 2009 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +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.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +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.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +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.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.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +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.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +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.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +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.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +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.source=1.8 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.settings/org.eclipse.jdt.ui.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..b42c32887 --- /dev/null +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=true +sp_cleanup.convert_to_enhanced_for_loop=true +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF index d426fc476..19aa52967 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF @@ -23,5 +23,5 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="1.0.300", org.eclipse.equinox.p2.ui.sdk;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates 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 8eeaa6ece..bab5548e0 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 @@ -17,124 +17,142 @@ import org.eclipse.ui.part.ViewPart; public class NavigationView extends ViewPart { public static final String ID = "org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates.navigationView"; private TreeViewer viewer; - + class TreeObject { private String name; private TreeParent parent; - + public TreeObject(String name) { this.name = name; } + public String getName() { return name; } + public void setParent(TreeParent parent) { this.parent = parent; } + public TreeParent getParent() { return parent; } + + @Override public String toString() { return getName(); } } - + class TreeParent extends TreeObject { - private ArrayList children; + private ArrayList<TreeObject> children; + public TreeParent(String name) { super(name); - children = new ArrayList(); + children = new ArrayList<>(); } + public void addChild(TreeObject child) { children.add(child); child.setParent(this); } + public void removeChild(TreeObject child) { children.remove(child); child.setParent(null); } + public TreeObject[] getChildren() { - return (TreeObject[]) children.toArray(new TreeObject[children.size()]); + return children.toArray(new TreeObject[children.size()]); } + public boolean hasChildren() { - return children.size()>0; + return children.size() > 0; } } - class ViewContentProvider implements IStructuredContentProvider, - ITreeContentProvider { + class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { - public void inputChanged(Viewer v, Object oldInput, Object newInput) { + @Override + public void inputChanged(Viewer v, Object oldInput, Object newInput) { } - + + @Override public void dispose() { } - + + @Override public Object[] getElements(Object parent) { return getChildren(parent); } - + + @Override public Object getParent(Object child) { if (child instanceof TreeObject) { - return ((TreeObject)child).getParent(); + return ((TreeObject) child).getParent(); } return null; } - + + @Override public Object[] getChildren(Object parent) { if (parent instanceof TreeParent) { - return ((TreeParent)parent).getChildren(); + return ((TreeParent) parent).getChildren(); } return new Object[0]; } - public boolean hasChildren(Object parent) { + @Override + public boolean hasChildren(Object parent) { if (parent instanceof TreeParent) - return ((TreeParent)parent).hasChildren(); + return ((TreeParent) parent).hasChildren(); return false; } } - + class ViewLabelProvider extends LabelProvider { + @Override public String getText(Object obj) { return obj.toString(); } + + @Override public Image getImage(Object obj) { String imageKey = ISharedImages.IMG_OBJ_ELEMENT; if (obj instanceof TreeParent) - imageKey = ISharedImages.IMG_OBJ_FOLDER; + imageKey = ISharedImages.IMG_OBJ_FOLDER; return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); } } - /** - * We will set up a dummy model to initialize tree heararchy. In real - * code, you will connect to a real model and expose its hierarchy. - */ - private TreeObject createDummyModel() { - TreeObject to1 = new TreeObject("Inbox"); - TreeObject to2 = new TreeObject("Drafts"); - TreeObject to3 = new TreeObject("Sent"); - TreeParent p1 = new TreeParent("me@this.com"); - p1.addChild(to1); - p1.addChild(to2); - p1.addChild(to3); - - TreeObject to4 = new TreeObject("Inbox"); - TreeParent p2 = new TreeParent("other@aol.com"); - p2.addChild(to4); - - TreeParent root = new TreeParent(""); - root.addChild(p1); - root.addChild(p2); - return root; - } + /** + * We will set up a dummy model to initialize tree heararchy. In real code, you + * will connect to a real model and expose its hierarchy. + */ + private TreeObject createDummyModel() { + TreeObject to1 = new TreeObject("Inbox"); + TreeObject to2 = new TreeObject("Drafts"); + TreeObject to3 = new TreeObject("Sent"); + TreeParent p1 = new TreeParent("me@this.com"); + p1.addChild(to1); + p1.addChild(to2); + p1.addChild(to3); + + TreeObject to4 = new TreeObject("Inbox"); + TreeParent p2 = new TreeParent("other@aol.com"); + p2.addChild(to4); + + TreeParent root = new TreeParent(""); + root.addChild(p1); + root.addChild(p2); + return root; + } /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ + * This is a callback that will allow us to create the viewer and initialize it. + */ + @Override public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setContentProvider(new ViewContentProvider()); @@ -145,6 +163,7 @@ public class NavigationView extends ViewPart { /** * Passing the focus request to the viewer's control. */ + @Override public void setFocus() { viewer.getControl().setFocus(); } diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.classpath b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.classpath +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.settings/org.eclipse.jdt.core.prefs index 0168ffa74..0c68a61dc 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.settings/org.eclipse.jdt.core.prefs +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,7 @@ -#Mon Mar 16 11:26:17 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF index ec1b78ac2..d5a05916c 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF @@ -4,7 +4,6 @@ Bundle-Name: RCP Mail (SDK UI) Bundle-SymbolicName: org.eclipse.equinox.p2.examples.rcp.sdkui; singleton:=true Bundle-Version: 1.1.0.qualifier Bundle-Activator: org.eclipse.equinox.p2.examples.rcp.sdkui.Activator -Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.equinox.p2.ui;bundle-version="2.0.0", @@ -25,5 +24,5 @@ Require-Bundle: org.eclipse.ui, org.apache.httpcomponents.httpclient;bundle-version="4.2.0", org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="1.0.300" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.sdkui |