1 19 20 package org.netbeans.modules.editor.impl; 21 22 import java.util.ResourceBundle ; 23 import java.awt.*; 24 import java.util.List ; 25 import java.util.List ; 26 import org.openide.util.NbBundle; 27 import javax.swing.*; 28 import javax.swing.text.JTextComponent ; 29 import org.netbeans.modules.editor.NbEditorUtilities; 30 import org.netbeans.spi.editor.EditorImplementationProvider; 31 import org.openide.windows.TopComponent; 32 33 37 public final class NbEditorImplementationProvider implements EditorImplementationProvider { 38 39 private static final Action [] NO_ACTIONS = new Action[0]; 40 41 public NbEditorImplementationProvider() { 42 43 } 44 45 46 public ResourceBundle getResourceBundle(String localizer) { 47 return NbBundle.getBundle(localizer); 48 } 49 50 public Action[] getGlyphGutterActions(JTextComponent target) { 51 String mimeType = NbEditorUtilities.getMimeType(target); 52 if (mimeType != null) { 53 List actions = GlyphGutterActionsProvider.getGlyphGutterActions(mimeType); 54 return (Action []) actions.toArray(new Action [actions.size()]); 55 } else { 56 return NO_ACTIONS; 57 } 58 } 59 60 public boolean activateComponent(JTextComponent c) { 61 Container container = SwingUtilities.getAncestorOfClass(TopComponent.class, c); 62 if (container != null) { 63 ((TopComponent)container).requestActive(); 64 return true; 65 } 66 return false; 67 } 68 } 69 | Popular Tags |