diff options
author | Alexander Kurtakov | 2016-04-09 06:04:44 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2016-04-09 06:04:44 +0000 |
commit | 88793d1ac69180ba3e43342e995edebab72d236e (patch) | |
tree | 3050b16a8e4086fa98259b1dabba1ce1ace069bc | |
parent | 87502bc98ec1c89e8adba4df7aa86d3e12dd4a06 (diff) | |
download | eclipse.platform.ua-88793d1ac69180ba3e43342e995edebab72d236e.tar.gz eclipse.platform.ua-88793d1ac69180ba3e43342e995edebab72d236e.tar.xz eclipse.platform.ua-88793d1ac69180ba3e43342e995edebab72d236e.zip |
Bug 491265 - Generify org.eclipse.ui.intro*
* Fix remaining warnings in o.e.ui.intro.universal.
* Enable more compiler warnings to make them visible in workbench.
* Add missing Override annotations.
Change-Id: Ide01e15c99735134ae47cf7754001b577d36c28b
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
16 files changed, 137 insertions, 55 deletions
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java index a558fff4c..b8d33f6c6 100644 --- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java +++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java @@ -108,8 +108,8 @@ public class ContentDetectorTest { assertFalse(detector.isNewContentAvailable()); // Make the first extension appear new helper.saveExtensionCount(extensionCount - 1); - Set<?> contributors = helper.getContributors(); - String firstContribution = (String) contributors.iterator().next(); + Set<String> contributors = helper.getContributors(); + String firstContribution = contributors.iterator().next(); String copyOfFirstContribution = "" + firstContribution; contributors.remove(firstContribution); helper.saveContributors(contributors); diff --git a/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs index 940d8eeb5..9447df6d6 100644 --- a/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,13 @@ 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.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 @@ -10,53 +19,88 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate 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.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=ignore 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.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error +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=ignore +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.rawTypeReference=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=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled 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.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore 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/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java index 277f89487..9a404f434 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java @@ -178,6 +178,7 @@ public class CustomizationContentsArea { return nameNoMnemonic; } + @Override public boolean equals(Object obj) { if (obj == this) return true; @@ -190,6 +191,7 @@ public class CustomizationContentsArea { return false; } + @Override public String toString() { return name; } @@ -197,6 +199,7 @@ public class CustomizationContentsArea { class TableContentProvider implements IStructuredContentProvider { + @Override public Object[] getElements(Object inputElement) { if (inputElement == ROOT_PAGE_TABLE) return ROOT_PAGE_TABLE; @@ -209,9 +212,11 @@ public class CustomizationContentsArea { return new Object[0]; } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } @@ -225,6 +230,7 @@ public class CustomizationContentsArea { this.viewer = viewer; } + @Override public void dragStart(DragSourceEvent event) { IStructuredSelection ssel = (IStructuredSelection) viewer.getSelection(); if (ssel.size() > 0) { @@ -234,17 +240,19 @@ public class CustomizationContentsArea { } }; + @Override public void dragSetData(DragSourceEvent event) { IStructuredSelection ssel = (IStructuredSelection) viewer.getSelection(); BaseData[] array = new BaseData[ssel.size()]; int i = 0; - for (Iterator iter = ssel.iterator(); iter.hasNext();) { - array[i++] = (BaseData) iter.next(); + for (Iterator<BaseData> iter = ssel.iterator(); iter.hasNext();) { + array[i++] = iter.next(); } event.data = array; sel = array; } + @Override public void dragFinished(DragSourceEvent event) { if (event.detail == DND.DROP_MOVE) { GroupData gd = (GroupData) viewer.getInput(); @@ -268,6 +276,7 @@ public class CustomizationContentsArea { super(viewer); } + @Override public boolean performDrop(Object data) { BaseData target = (BaseData) getCurrentTarget(); int loc = getCurrentLocation(); @@ -311,6 +320,7 @@ public class CustomizationContentsArea { return -1; } + @Override public boolean validateDrop(Object target, int operation, TransferData transferType) { return ExtensionDataTransfer.getInstance().isSupportedType(transferType); } @@ -318,6 +328,7 @@ public class CustomizationContentsArea { class TableLabelProvider extends LabelProvider implements ITableLabelProvider { + @Override public String getText(Object obj) { if (obj instanceof RootPage) { return ((RootPage) obj).getNameNoMnemonic(); @@ -339,6 +350,7 @@ public class CustomizationContentsArea { return super.getText(obj); } + @Override public Image getImage(Object obj) { if (obj instanceof ExtensionData) { ExtensionData ed = (ExtensionData) obj; @@ -359,12 +371,14 @@ public class CustomizationContentsArea { return null; } + @Override public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 0) return getImage(element); return null; } + @Override public String getColumnText(Object element, int columnIndex) { if (columnIndex == 1 || element instanceof IntroTheme || element instanceof RootPage) return getText(element); @@ -429,6 +443,7 @@ public class CustomizationContentsArea { tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); tabFolder.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { TabItem[] selection = tabFolder.getSelection(); onTabChange(selection[0]); @@ -445,6 +460,7 @@ public class CustomizationContentsArea { serialize.setText(Messages.WelcomeCustomizationPreferencePage_serialize); serialize.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { doSerializeState(); } @@ -657,9 +673,9 @@ public class CustomizationContentsArea { } public void dispose() { - Iterator iter = themeList.iterator(); + Iterator<IntroTheme> iter = themeList.iterator(); while (iter.hasNext()) { - ((IntroTheme)iter.next()).dispose(); + iter.next().dispose(); } extensionImage.dispose(); ihighImage.dispose(); @@ -672,7 +688,7 @@ public class CustomizationContentsArea { private void updateIntroThemeFromData() { if (introThemeId != null) { for (int i = 0; i < themeList.size(); i++) { - IntroTheme theme = (IntroTheme) themeList.get(i); + IntroTheme theme = themeList.get(i); if (theme.getId().equals(introThemeId)) { introTheme = theme; break; @@ -713,6 +729,7 @@ public class CustomizationContentsArea { public boolean performOk() { saveData(); BusyIndicator.showWhile(shell.getDisplay(), new Runnable() { + @Override public void run() { restartIntro(); } @@ -781,7 +798,7 @@ public class CustomizationContentsArea { for (int i = 0; i < introRootPages.size(); i++) { if (i > 0) sbuf.append(","); //$NON-NLS-1$ - sbuf.append((String) introRootPages.get(i)); + sbuf.append(introRootPages.get(i)); } String key = pid + "_" + INTRO_ROOT_PAGES; //$NON-NLS-1$ uprefs.put(key, sbuf.toString()); @@ -858,6 +875,7 @@ public class CustomizationContentsArea { themes.setContentProvider(contentProvider); themes.setLabelProvider(labelProvider); themes.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent e) { Object sel = ((StructuredSelection) e.getSelection()).getFirstElement(); introTheme = (IntroTheme) sel; @@ -875,6 +893,7 @@ public class CustomizationContentsArea { themePreview.setLayoutData(gd); themePreview.addPaintListener(new PaintListener() { + @Override public void paintControl(PaintEvent e) { if (introTheme == null) return; @@ -897,6 +916,7 @@ public class CustomizationContentsArea { // Filter empty pages ViewerFilter[] rootPageFilters = new ViewerFilter[] { new ViewerFilter() { + @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof RootPage) { @@ -914,6 +934,7 @@ public class CustomizationContentsArea { rootPages.getControl().setLayoutData(gd); rootPages.addCheckStateListener(new ICheckStateListener() { + @Override public void checkStateChanged(CheckStateChangedEvent event) { RootPage page = (RootPage) event.getElement(); boolean checked = event.getChecked(); @@ -976,7 +997,7 @@ public class CustomizationContentsArea { private boolean getRootPageSelected(String id) { for (int i = 0; i < introRootPages.size(); i++) { - String cid = (String) introRootPages.get(i); + String cid = introRootPages.get(i); if (cid.equals(id)) return true; } @@ -994,6 +1015,7 @@ public class CustomizationContentsArea { manager.setRemoveAllWhenShown(true); manager.addMenuListener(new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager manager) { fillPopupMenu(manager, viewer); } @@ -1021,10 +1043,12 @@ public class CustomizationContentsArea { IUniversalIntroConstants.P_NAME }); viewer.setCellModifier(new ICellModifier() { + @Override public boolean canModify(Object element, String property) { return property.equals(IUniversalIntroConstants.P_IMPORTANCE); } + @Override public Object getValue(Object element, String property) { if (element instanceof ExtensionData) { ExtensionData ed = (ExtensionData) element; @@ -1034,6 +1058,7 @@ public class CustomizationContentsArea { return null; } + @Override public void modify(Object element, String property, Object value) { Integer ivalue = (Integer) value; TableItem item = (TableItem) element; @@ -1055,6 +1080,7 @@ public class CustomizationContentsArea { manager.add(new Separator()); Action addSeparator = new Action(Messages.WelcomeCustomizationPreferencePage_addSeparator) { + @Override public void run() { doAddSeparator(viewer); } @@ -1066,12 +1092,14 @@ public class CustomizationContentsArea { if (ssel.size() == 1 && viewer != available) { Action upAction = new Action(Messages.WelcomeCustomizationPreferencePage_up) { + @Override public void run() { doMove(viewer, true); } }; Action downAction = new Action(Messages.WelcomeCustomizationPreferencePage_down) { + @Override public void run() { doMove(viewer, false); } @@ -1096,7 +1124,7 @@ public class CustomizationContentsArea { boolean addDeleteSeparator=false; - for (Iterator iter=ssel.iterator(); iter.hasNext();) { + for (Iterator<?> iter=ssel.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof SeparatorData) addDeleteSeparator=true; @@ -1107,6 +1135,7 @@ public class CustomizationContentsArea { } if (addDeleteSeparator) { Action deleteSeparator = new Action(Messages.WelcomeCustomizationPreferencePage_removeSeparator) { + @Override public void run() { doRemoveSeparators(viewer); } @@ -1122,6 +1151,7 @@ public class CustomizationContentsArea { return; Action action = new Action(name) { + @Override public void run() { doMoveTo(source, target); } @@ -1154,8 +1184,8 @@ public class CustomizationContentsArea { private void doRemoveSeparators(Viewer viewer) { StructuredSelection ssel = ((StructuredSelection) viewer.getSelection()); GroupData gd = (GroupData) viewer.getInput(); - for (Iterator iter=ssel.iterator(); iter.hasNext();) { - SeparatorData sdata = (SeparatorData)iter.next(); + for (Iterator<SeparatorData> iter=ssel.iterator(); iter.hasNext();) { + SeparatorData sdata = iter.next(); gd.remove(sdata); } viewer.refresh(); diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java index cf865ad7c..7d9f46ed8 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java @@ -36,6 +36,7 @@ public class CustomizationDialog extends TrayDialog { this.pageId = pageId; } + @Override protected Control createDialogArea(Composite parent) { CustomizationContentsArea contents = getContentsArea(); contents.setShell(getShell()); @@ -46,6 +47,7 @@ public class CustomizationDialog extends TrayDialog { return outerContainer; } + @Override protected void okPressed() { if (getContentsArea().performOk()) { getContentsArea().dispose(); @@ -53,12 +55,14 @@ public class CustomizationDialog extends TrayDialog { super.okPressed(); } + @Override protected void cancelPressed() { getContentsArea().dispose(); super.cancelPressed(); } - protected void configureShell(Shell newShell) { + @Override + protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.WelcomeCustomizationPreferencePage_Customize); newShell.setImage(ImageUtil.createImage("full/elcl16/configure.gif")); //$NON-NLS-1$); diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizeAction.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizeAction.java index a57c3b845..fd2c69a90 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizeAction.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizeAction.java @@ -24,6 +24,7 @@ public class CustomizeAction extends Action { this.site = site; } + @Override public void run() { String pageId = IntroPlugin.getDefault().getIntroModelRoot().getCurrentPageId(); run(pageId); diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionData.java index 413f8cea5..75cba9e7f 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionData.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionData.java @@ -109,10 +109,12 @@ public class ExtensionData extends BaseData { return IMPORTANCE_TABLE[fImportance]; } + @Override public String toString() { return name != null ? name : id; } + @Override public void write(PrintWriter writer, String indent) { writer.print(indent); writer.print("<extension id=\"" + id + "\""); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionDataTransfer.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionDataTransfer.java index af1b4d856..101178b34 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionDataTransfer.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/ExtensionDataTransfer.java @@ -31,14 +31,17 @@ public class ExtensionDataTransfer extends ByteArrayTransfer { return _instance; } + @Override protected String[] getTypeNames() { return new String[] { MYTYPENAME }; } + @Override protected int[] getTypeIds() { return new int[] { MYTYPEID }; } + @Override public void javaToNative(Object object, TransferData transferData) { if (!checkMyType(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); @@ -70,6 +73,7 @@ public class ExtensionDataTransfer extends ByteArrayTransfer { } } + @Override public Object nativeToJava(TransferData transferData) { if (isSupportedType(transferData)) { byte[] buffer = (byte[]) super.nativeToJava(transferData); @@ -129,6 +133,7 @@ public class ExtensionDataTransfer extends ByteArrayTransfer { return true; } + @Override protected boolean validate(Object object) { return checkMyType(object); } diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java index 1a90e3589..00b42aa49 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java @@ -52,7 +52,7 @@ public class IntroData { } public PageData getPage(String pageId) { - return (PageData)pages.get(pageId); + return pages.get(pageId); } public boolean isActive() { @@ -132,7 +132,7 @@ public class IntroData { if (path.charAt(path.length()-1)!='@') return; String pageId = path.substring(0, at); - PageData pd = (PageData)pages.get(pageId); + PageData pd = pages.get(pageId); if (pd==null) { pd = new PageData(pageId); pages.put(pageId, pd); diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/SeparatorData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/SeparatorData.java index 872841cc8..8e4eb2772 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/SeparatorData.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/SeparatorData.java @@ -21,6 +21,7 @@ public class SeparatorData extends BaseData { this.id = id; } + @Override public void write(PrintWriter writer, String indent) { writer.print(indent); writer.print("<separator id=\""); //$NON-NLS-1$ diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java index 4e9b13506..941eaa2fc 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java @@ -54,6 +54,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements loadData(); } + @Override public String getVariable(String variableName) { if (variableName.equals(HIGH_CONTRAST)) { boolean highContrast = ImageUtil.isHighContrast(); @@ -100,6 +101,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements * * @see org.eclipse.ui.intro.config.IntroConfigurer#getMixinStyle(java.lang.String) */ + @Override public String getMixinStyle(String pageId, String extensionId) { // if active product has a preference, use it if (primaryIntroData != null) { @@ -208,6 +210,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements return value; } + @Override public IntroElement[] getGroupChildren(String pageId, String groupId) { // root-like pages have more details on the page and action links boolean rootLike = pageId.equals(ID_ROOT) || isStartPage(pageId) || pageId.equals(ID_STANDBY); @@ -224,6 +227,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements return new IntroElement[0]; } + @Override public IntroElement[] getLaunchBarShortcuts() { ArrayList<IntroElement> links = new ArrayList<>(); String ids = getVariable(VAR_INTRO_ROOT_PAGES); @@ -240,7 +244,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements } private IntroElement[] getRootPageLinks(boolean standby) { - ArrayList<IntroElement> links = new ArrayList<IntroElement>(); + ArrayList<IntroElement> links = new ArrayList<>(); String ids = getVariable(VAR_INTRO_ROOT_PAGES); if (ids != null) { StringTokenizer stok = new StringTokenizer(ids, ","); //$NON-NLS-1$ @@ -274,7 +278,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements } private IntroElement[] getNavLinks(String pageId) { - ArrayList<IntroElement> links = new ArrayList<IntroElement>(); + ArrayList<IntroElement> links = new ArrayList<>(); String ids = getVariable(VAR_INTRO_ROOT_PAGES); /* * In high contrast mode the workbench link must be generated in the nav links @@ -500,7 +504,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements } } // load all other installed (but not running) products' intro data - List<IntroData> result = new ArrayList<IntroData>(); + List<IntroData> result = new ArrayList<>(); Properties[] prefs = ProductPreferences.getProductPreferences(false); for (int i=0;i<prefs.length;++i) { String key = UniversalIntroPlugin.PLUGIN_ID + '/' + VAR_INTRO_DATA; @@ -519,7 +523,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements } private IntroElement[] getContent(String pageId, String groupId) { - List<IntroElement> result = new ArrayList<IntroElement>(); + List<IntroElement> result = new ArrayList<>(); if (!ContentDetector.getNewContributors().isEmpty()) { // Add a new content fallback anchor IntroElement fallback = new IntroElement("anchor"); //$NON-NLS-1$ @@ -554,10 +558,9 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements } } - @SuppressWarnings("unchecked") List<IntroElement>[] secondaryAnchors = secondaryAnchorsList.toArray(new List[secondaryAnchorsList.size()]); if (sequenceResolver == null) { - sequenceResolver = new SequenceResolver<IntroElement>(); + sequenceResolver = new SequenceResolver<>(); } return sequenceResolver.getSequence(primaryAnchors, secondaryAnchors); } @@ -565,13 +568,14 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements private List<IntroElement> getAnchors(IntroData data, String pageId, String groupId) { PageData pdata = data.getPage(pageId); if (pdata != null) { - List<IntroElement> anchors = new ArrayList<IntroElement>(); + List<IntroElement> anchors = new ArrayList<>(); pdata.addAnchors(anchors, groupId); return anchors; } return null; } + @Override public String resolvePath(String extensionId, String path) { boolean extensionRelativePath = false; IPath ipath = new Path(path); @@ -666,6 +670,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements return false; } + @Override public void init(IIntroSite site, Map<String, String> themeProperties) { super.init(site, themeProperties); Action customizeAction = new CustomizeAction(site); diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java index 1794a442b..bfc6a360c 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java @@ -113,12 +113,8 @@ public class UniversalIntroPlugin extends AbstractUIPlugin { } - /* - * (non-Javadoc) - * - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { + @Override + public void start(BundleContext context) throws Exception { super.start(context); inst = this; if (Log.logInfo) @@ -126,12 +122,8 @@ public class UniversalIntroPlugin extends AbstractUIPlugin { } - /* - * (non-Javadoc) - * - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { + @Override + public void stop(BundleContext context) throws Exception { resetVolatileImageRegistry(); super.stop(context); } diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java index b5e45a8ba..4fb16219a 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java @@ -43,29 +43,35 @@ public class WelcomeCustomizationPreferencePage extends PreferencePage implement return contentsArea; } + @Override protected Control createContents(Composite parent) { getContentsArea().setShell(getShell()); return getContentsArea().createContents(parent); } + @Override public void dispose() { getContentsArea().dispose(); super.dispose(); } + @Override public boolean performOk() { return getContentsArea().performOk(); } + @Override protected void performDefaults() { getContentsArea().performDefaults(); } + @Override public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { } + @Override public void init(IWorkbench workbench) { } diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java index d5fe11496..90bb6f63f 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java @@ -77,11 +77,11 @@ public class ContentDetectHelper { return extensionCount.intValue(); } - public void saveContributors(Set contributors) { + public void saveContributors(Set<String> contributors) { XMLMemento writeMemento = XMLMemento.createWriteRoot(ROOT); - for (Iterator iter = contributors.iterator(); iter.hasNext();) { + for (Iterator<String> iter = contributors.iterator(); iter.hasNext();) { IMemento childMemento = writeMemento.createChild(CONTRIBUTOR); - childMemento.putString(NAME, (String)iter.next()); + childMemento.putString(NAME, iter.next()); } saveMemento(writeMemento, EXTENSION_NAMES_XML); } diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java index 2cf157259..bd239ca66 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java @@ -20,12 +20,13 @@ import org.eclipse.ui.intro.IntroContentDetector; public class ContentDetector extends IntroContentDetector { - private static Set newContributors; + private static Set<String> newContributors; private static boolean detectorCalled = false; public ContentDetector() { } + @Override public boolean isNewContentAvailable() { try { detectorCalled = true; @@ -57,7 +58,7 @@ public class ContentDetector extends IntroContentDetector { } catch (Exception e) { return false; } - newContributors = new HashSet(); + newContributors = new HashSet<>(); return false; } @@ -65,7 +66,7 @@ public class ContentDetector extends IntroContentDetector { * @return The set of the ids of config extensions which are new since the last time * intro was opened. May be null if there are no contributors. */ - public static Set getNewContributors() { + public static Set<String> getNewContributors() { if (!detectorCalled) { detectorCalled = true; new ContentDetector().isNewContentAvailable(); diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java index bb7f564a5..65a6f4c46 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java @@ -62,7 +62,7 @@ public class BundleUtil { * @return */ public static String getBundleHeader(Bundle bundle, String key) { - return (String) bundle.getHeaders().get(key); + return bundle.getHeaders().get(key); } diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/intro/universal/ExtensionFactory.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/intro/universal/ExtensionFactory.java index c58f8a406..631d34c2c 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/intro/universal/ExtensionFactory.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/intro/universal/ExtensionFactory.java @@ -46,11 +46,7 @@ public class ExtensionFactory implements IExecutableExtensionFactory, IExecutabl private String propertyName; private static final String WELCOME_CUSTOMIZATION_PREFERENCE_PAGE = "welcomeCustomization"; //$NON-NLS-1$ - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.IExecutableExtensionFactory#create() - */ + @Override public Object create() throws CoreException { if (WELCOME_CUSTOMIZATION_PREFERENCE_PAGE.equals(id)) return configure(new WelcomeCustomizationPreferencePage()); @@ -66,12 +62,7 @@ public class ExtensionFactory implements IExecutableExtensionFactory, IExecutabl return obj; } - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, - * java.lang.String, java.lang.Object) - */ + @Override public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { if (data instanceof String) |