Lines 15-20
Link Here
|
15 |
import java.util.Map; |
15 |
import java.util.Map; |
16 |
|
16 |
|
17 |
import org.eclipse.core.runtime.Assert; |
17 |
import org.eclipse.core.runtime.Assert; |
|
|
18 |
import org.eclipse.core.runtime.IConfigurationElement; |
19 |
import org.eclipse.core.runtime.IExtension; |
20 |
import org.eclipse.core.runtime.IExtensionPoint; |
21 |
import org.eclipse.core.runtime.Platform; |
18 |
import org.eclipse.jface.resource.ImageDescriptor; |
22 |
import org.eclipse.jface.resource.ImageDescriptor; |
19 |
import org.eclipse.jface.resource.ImageRegistry; |
23 |
import org.eclipse.jface.resource.ImageRegistry; |
20 |
import org.eclipse.swt.SWT; |
24 |
import org.eclipse.swt.SWT; |
Lines 595-603
Link Here
|
595 |
imageRegistry = new ImageRegistry(); |
599 |
imageRegistry = new ImageRegistry(); |
596 |
descriptors = new HashMap(); |
600 |
descriptors = new HashMap(); |
597 |
declareImages(); |
601 |
declareImages(); |
|
|
602 |
loadFromRegistry(); |
598 |
} |
603 |
} |
599 |
|
604 |
|
600 |
/** |
605 |
private static void loadFromRegistry() { |
|
|
606 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui.sharedImages"); //$NON-NLS-1$ |
607 |
IExtension[] extensions = extensionPoint.getExtensions(); |
608 |
for (int i = 0; i < extensions.length; i++) { |
609 |
IConfigurationElement[] categories = extensions[i].getConfigurationElements(); |
610 |
for (int j = 0; j < categories.length; j++) { |
611 |
if(categories[j].getName().equals("category")) { //$NON-NLS-1$ |
612 |
String categoryId = categories[j].getAttribute("id"); //$NON-NLS-1$ |
613 |
IConfigurationElement[] constants = categories[j].getChildren(); |
614 |
for (int k = 0; k < constants.length; k++) { |
615 |
String name = constants[k].getAttribute("name"); //$NON-NLS-1$ |
616 |
try { |
617 |
URL url = new URL(constants[k].getAttribute("value")); //$NON-NLS-1$ |
618 |
ImageDescriptor desc = ImageDescriptor.createFromURL(url); |
619 |
declareImage("org.eclipse.ui.sharedImages/images/"+categoryId+'/'+name, desc, true); //$NON-NLS-1$ |
620 |
} catch (Exception e) { |
621 |
// log here... |
622 |
} |
623 |
} |
624 |
} |
625 |
} |
626 |
} |
627 |
} |
628 |
|
629 |
/** |
601 |
* Disposes and clears the workbench images. |
630 |
* Disposes and clears the workbench images. |
602 |
* Called when the workbench is shutting down. |
631 |
* Called when the workbench is shutting down. |
603 |
* |
632 |
* |