Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 47534 Details for
Bug 152927
[Decorators] ArrayOutOfBoundsException in DecorationBuilder.java
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch with test suites
152927.txt (text/plain), 8.80 KB, created by
Tod Creasey
on 2006-08-08 11:35:18 EDT
(
hide
)
Description:
Patch with test suites
Filename:
MIME Type:
Creator:
Tod Creasey
Created:
2006-08-08 11:35:18 EDT
Size:
8.80 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/decorators/DecoratorsTestSuite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/decorators/DecoratorsTestSuite.java,v >retrieving revision 1.5 >diff -u -r1.5 DecoratorsTestSuite.java >--- Eclipse UI Tests/org/eclipse/ui/tests/decorators/DecoratorsTestSuite.java 4 Aug 2005 17:37:19 -0000 1.5 >+++ Eclipse UI Tests/org/eclipse/ui/tests/decorators/DecoratorsTestSuite.java 8 Aug 2006 15:37:53 -0000 >@@ -30,6 +30,7 @@ > addTest(new TestSuite(ExceptionDecoratorTestCase.class)); > addTest(new TestSuite(DecoratorTestCase.class)); > addTest(new TestSuite(LightweightDecoratorTestCase.class)); >+ addTest(new TestSuite(BadIndexDecoratorTestCase.class)); > // addTest(new TestSuite(DecoratorTreeTest.class)); > // addTest(new TestSuite(DecoratorTableTest.class)); > // addTest(new TestSuite(DecoratorTableTreeTest.class)); >Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/plugin.xml,v >retrieving revision 1.191 >diff -u -r1.191 plugin.xml >--- plugin.xml 28 Jun 2006 19:23:13 -0000 1.191 >+++ plugin.xml 8 Aug 2006 15:37:53 -0000 >@@ -1548,6 +1548,18 @@ > A test decorator for resource mappings > </description> > </decorator> >+ <decorator >+ adaptable="true" >+ class="org.eclipse.ui.tests.decorators.BadIndexDecorator" >+ id="org.eclipse.ui.tests.decorators.badIndexDecorator" >+ label="Bad Index Decorator" >+ lightweight="true"> >+ <enablement> >+ <objectClass >+ name="org.eclipse.core.resources.IResource"> >+ </objectClass> >+ </enablement> >+ </decorator> > > </extension> > <!-- Working set tests --> >Index: Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecoratorTestCase.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecoratorTestCase.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecoratorTestCase.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecoratorTestCase.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,65 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.tests.decorators; >+ >+import org.eclipse.ui.internal.WorkbenchPlugin; >+import org.eclipse.ui.internal.decorators.DecoratorDefinition; >+ >+/** >+ * @since 3.2 >+ * >+ */ >+public class BadIndexDecoratorTestCase extends DecoratorEnablementTestCase { >+ >+ /** >+ * @param testName >+ */ >+ public BadIndexDecoratorTestCase(String testName) { >+ super(testName); >+ } >+ >+ /** >+ * Sets up the hierarchy. >+ */ >+ protected void doSetUp() throws Exception { >+ super.doSetUp(); >+ createTestFile(); >+ showNav(); >+ >+ WorkbenchPlugin.getDefault().getDecoratorManager().addListener(this); >+ >+ DecoratorDefinition[] definitions = WorkbenchPlugin.getDefault() >+ .getDecoratorManager().getAllDecoratorDefinitions(); >+ for (int i = 0; i < definitions.length; i++) { >+ if (definitions[i].getId().equals( >+ "org.eclipse.ui.tests.decorators.badIndexDecorator")) >+ definition = definitions[i]; >+ } >+ } >+ >+ /** >+ * Turn off an on the bad index decorator without >+ * generating an exception. >+ */ >+ public void testNoException() { >+ >+ updated = false; >+ getDecoratorManager().clearCaches(); >+ definition.setEnabled(true); >+ getDecoratorManager().updateForEnablementChange(); >+ definition.setEnabled(false); >+ getDecoratorManager().updateForEnablementChange(); >+ updated = false; >+ >+ } >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecorator.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecorator.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/decorators/BadIndexDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,94 @@ >+package org.eclipse.ui.tests.decorators; >+ >+import java.net.MalformedURLException; >+import java.net.URL; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.Set; >+ >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.viewers.IDecoration; >+import org.eclipse.jface.viewers.ILabelProviderListener; >+import org.eclipse.jface.viewers.ILightweightLabelDecorator; >+import org.eclipse.jface.viewers.LabelProviderChangedEvent; >+import org.eclipse.ui.tests.TestPlugin; >+ >+public class BadIndexDecorator implements ILightweightLabelDecorator { >+ >+ private Set listeners = new HashSet(); >+ >+ private ImageDescriptor descriptor; >+ >+ >+ /* >+ * @see IBaseLabelProvider#addListener(ILabelProviderListener) >+ */ >+ public void addListener(ILabelProviderListener listener) { >+ listeners.add(listener); >+ } >+ >+ /* >+ * @see IBaseLabelProvider#dispose() >+ */ >+ public void dispose() { >+ listeners = new HashSet(); >+ } >+ >+ /* >+ * @see IBaseLabelProvider#isLabelProperty(Object, String) >+ */ >+ public boolean isLabelProperty(Object element, String property) { >+ return false; >+ } >+ >+ /* >+ * @see IBaseLabelProvider#removeListener(ILabelProviderListener) >+ */ >+ public void removeListener(ILabelProviderListener listener) { >+ listeners.remove(listener); >+ } >+ >+ /** >+ * Refresh the listeners to update the decorators for >+ * element. >+ */ >+ >+ public void refreshListeners(Object element) { >+ Iterator iterator = listeners.iterator(); >+ while (iterator.hasNext()) { >+ LabelProviderChangedEvent event = new LabelProviderChangedEvent( >+ this, element); >+ ((ILabelProviderListener) iterator.next()) >+ .labelProviderChanged(event); >+ } >+ } >+ >+ /** >+ * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#getOverlay(java.lang.Object) >+ */ >+ public ImageDescriptor getOverlay(Object element) { >+ Assert.isTrue(element instanceof IResource); >+ if (descriptor == null) { >+ URL source = TestPlugin.getDefault().getDescriptor() >+ .getInstallURL(); >+ try { >+ descriptor = ImageDescriptor.createFromURL(new URL(source, >+ "icons/binary_co.gif")); >+ } catch (MalformedURLException exception) { >+ return null; >+ } >+ } >+ return descriptor; >+ >+ } >+ >+ /** >+ * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) >+ */ >+ public void decorate(Object element, IDecoration decoration) { >+ decoration.addOverlay(getOverlay(element), 17); >+ } >+ >+} >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java,v >retrieving revision 1.18 >diff -u -r1.18 DecorationBuilder.java >--- Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java 8 May 2006 20:55:51 -0000 1.18 >+++ Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java 8 Aug 2006 15:37:55 -0000 >@@ -86,7 +86,7 @@ > * @see org.eclipse.jface.viewers.IDecoration#addOverlay(org.eclipse.jface.resource.ImageDescriptor) > */ > public void addOverlay(ImageDescriptor overlay, int quadrant) { >- if (quadrant >= 0 && quadrant <= DECORATOR_ARRAY_SIZE) { >+ if (quadrant >= 0 && quadrant < DECORATOR_ARRAY_SIZE) { > if (descriptors[quadrant] == null) { > descriptors[quadrant] = overlay; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 152927
: 47534