1 11 package org.eclipse.ui.internal.registry; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IConfigurationElement; 15 import org.eclipse.core.runtime.IStatus; 16 import org.eclipse.core.runtime.Status; 17 import org.eclipse.ui.IPageLayout; 18 import org.eclipse.ui.views.IStickyViewDescriptor; 19 20 23 public class StickyViewDescriptor implements IStickyViewDescriptor { 24 25 private IConfigurationElement configurationElement; 26 27 private String id; 28 29 32 public static final String STICKY_FOLDER_RIGHT = "stickyFolderRight"; 34 37 public static final String STICKY_FOLDER_LEFT = "stickyFolderLeft"; 39 42 public static final String STICKY_FOLDER_TOP = "stickyFolderTop"; 44 47 public static final String STICKY_FOLDER_BOTTOM = "stickyFolderBottom"; 49 53 public StickyViewDescriptor(IConfigurationElement element) 54 throws CoreException { 55 this.configurationElement = element; 56 id = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID); 57 if (id == null) { 58 throw new CoreException(new Status(IStatus.ERROR, element 59 .getNamespace(), 0, 60 "Invalid extension (missing id) ", null)); } 62 } 63 64 69 public IConfigurationElement getConfigurationElement() { 70 return configurationElement; 71 } 72 73 76 public int getLocation() { 77 int direction = IPageLayout.RIGHT; 78 79 String location = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_LOCATION); 80 if (location != null) { 81 if (location.equalsIgnoreCase("left")) { direction = IPageLayout.LEFT; 83 } else if (location.equalsIgnoreCase("top")) { direction = IPageLayout.TOP; 85 } else if (location.equalsIgnoreCase("bottom")) { direction = IPageLayout.BOTTOM; 87 } 89 } 90 return direction; 91 } 92 93 96 public String getId() { 97 return id; 98 } 99 100 103 public boolean isCloseable() { 104 boolean closeable = true; 105 String closeableString = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLOSEABLE); 106 if (closeableString != null) { 107 closeable = !closeableString.equals("false"); } 109 return closeable; 110 } 111 112 115 public boolean isMoveable() { 116 boolean moveable = true; 117 String moveableString = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_MOVEABLE); 118 if (moveableString != null) { 119 moveable = !moveableString.equals("false"); } 121 return moveable; 122 } 123 } 124 | Popular Tags |