1 11 package org.eclipse.ui.internal.decorators; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.jface.viewers.IDecorationContext; 15 import org.eclipse.osgi.util.NLS; 16 import org.eclipse.ui.internal.WorkbenchMessages; 17 18 22 class DecorationReference { 23 Object element; 24 25 Object adaptedElement; 26 27 String undecoratedText; 28 29 boolean forceUpdate = false; 30 31 IDecorationContext[] contexts; 32 33 DecorationReference(Object object, Object adaptedObject, IDecorationContext context) { 34 this.contexts = new IDecorationContext[] { context} ; 35 Assert.isNotNull(object); 36 element = object; 37 this.adaptedElement = adaptedObject; 38 } 39 40 44 Object getAdaptedElement() { 45 return adaptedElement; 46 } 47 48 52 Object getElement() { 53 return element; 54 } 55 56 61 boolean shouldForceUpdate() { 62 return forceUpdate; 63 } 64 65 70 void setForceUpdate(boolean forceUpdate) { 71 this.forceUpdate = forceUpdate; 72 } 73 74 79 void setUndecoratedText(String text) { 80 undecoratedText = text; 81 } 82 83 87 String getSubTask() { 88 if (undecoratedText == null) { 89 return WorkbenchMessages.DecorationReference_EmptyReference; 90 } 91 return NLS.bind(WorkbenchMessages.DecorationScheduler_DecoratingSubtask, undecoratedText ); 92 } 93 94 99 IDecorationContext[] getContexts() { 100 return contexts; 101 } 102 103 void addContext(IDecorationContext context) { 104 IDecorationContext[] newContexts = new IDecorationContext[contexts.length + 1]; 105 System.arraycopy(contexts, 0, newContexts, 0, contexts.length); 106 newContexts[contexts.length] = context; 107 contexts = newContexts; 108 } 109 } 110 | Popular Tags |