Package org.openide.util

Examples of org.openide.util.Lookup


        fullScreenButton.setBorder(BorderFactory.createEmptyBorder());
        fullScreenButton.setPreferredSize(new Dimension(logoWidth, logoHeight));
        fullScreenButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                Lookup lookup = Lookups.forPath("org-gephi-desktop-tools/Actions/ToggleFullScreenAction");
                for (Action a : lookup.lookupAll(Action.class)) {
                    a.actionPerformed(null);
                }
            }
        });
        c.add(fullScreenButton, BorderLayout.CENTER);
View Full Code Here


        if (config == null) {
            LOGGER.log(Level.WARNING, "Not found wp-config.php");
            return;
        }
        try {
            Lookup lookup = config.getLookup();
            EditorCookie ec = lookup.lookup(EditorCookie.class);
            if (ec == null) {
                return;
            }
            final StyledDocument docment = ec.openDocument();
            if (docment == null) {
View Full Code Here

                FileObject fo = sfs.findResource("Projects/Actions")// NOI18N
                if (fo != null) {
                    DataObject dobj = DataObject.find(fo);
                    FolderLookup actionRegistry = new FolderLookup((DataFolder)dobj);
                    Lookup.Template query = new Lookup.Template(Object.class);
                    Lookup lookup = actionRegistry.getLookup();
                    Iterator it = lookup.lookup(query).allInstances().iterator();
                    if (it.hasNext()) {
                        nodeActions.add(null);
                    }
                    while (it.hasNext()) {
                        Object next = it.next();
View Full Code Here

    private static TextMarkupLookup getHighlightLookup(BlackboardArtifact artifact, Content content) {
        if (artifact.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
            return null;
        }
        Lookup lookup = Lookup.getDefault();
        TextMarkupLookup highlightFactory = lookup.lookup(TextMarkupLookup.class);
        try {
            List<BlackboardAttribute> attributes = artifact.getAttributes();
            String keyword = null;
            String regexp = null;
            for (BlackboardAttribute att : attributes) {
View Full Code Here

        if (selectedNode == null) {
            return;
        }
               
        // Make sure the node is of the correct type.
        Lookup lookup = selectedNode.getLookup();
        Content content = lookup.lookup(Content.class);
        if (content == null) {
            return;
        }
       
        startNewTask(new SelectedNodeChangedTask(selectedNode));
View Full Code Here

       
        @Override
        protected ViewUpdate doInBackground() {  
            // Get the lookup for the node for access to its underlying content and
            // blackboard artifact, if any.
            Lookup lookup = selectedNode.getLookup();
           
            // Get the content.
            Content content = lookup.lookup(Content.class);
            if (content == null) {
                return new ViewUpdate(getArtifactContentStrings().size(), currentPage, ERROR_TEXT);
            }
           
            // Get all of the blackboard artifacts associated with the content. These are what this
            // viewer displays.
            ArrayList<BlackboardArtifact> artifacts;
            try {
                artifacts = content.getAllArtifacts();
            }
            catch (TskException ex) {
                logger.log(Level.WARNING, "Couldn't get artifacts", ex); //NON-NLS
                return new ViewUpdate(getArtifactContentStrings().size(), currentPage, ERROR_TEXT);
            }
           
            if (isCancelled()) {
                return null;
            }
           
            // Build the new artifact strings cache.
            ArrayList<ArtifactStringContent> artifactStrings = new ArrayList<>();
            for (BlackboardArtifact artifact : artifacts) {
                artifactStrings.add(new ArtifactStringContent(artifact));
            }

            // If the node has an underlying blackboard artifact, show it. If not,
            // show the first artifact.
            int index = 0;
            BlackboardArtifact artifact = lookup.lookup(BlackboardArtifact.class);
            if (artifact != null) {
                index = artifacts.indexOf(artifact);
                if (index == -1) {
                    index = 0;
                } else {
View Full Code Here

        if ((selectedNode == null) || (!isSupported(selectedNode))) {
            resetComponent();
            return;
        }

        Lookup lookup = selectedNode.getLookup();
        Content content = lookup.lookup(Content.class);
        if (content != null) {
            this.setDataView(content, 0);
            return;
        } else {
            StringContent scontent = selectedNode.getLookup().lookup(StringContent.class);
View Full Code Here

    public static void renameProject(Project p, Object caller) {
        if (p == null) {
            return;
        }
        ContextAwareAction action = (ContextAwareAction) CommonProjectActions.renameProjectAction();
        Lookup ctx = Lookups.singleton(p);
        Action ctxAction = action.createContextAwareInstance(ctx);
        ctxAction.actionPerformed(new ActionEvent(caller, 0, "")); // NOI18N
    }
View Full Code Here

    }

    // see http://netbeans-org.1045718.n5.nabble.com/Lookup-current-active-Project-td3036983.html
    public Project getCurrentProject() {

        Lookup lookup = Utilities.actionsGlobalContext();

        for (Project p : lookup.lookupAll(Project.class)) {
            return p;
        }

        for (DataObject dObj : lookup.lookupAll(DataObject.class)) {
            FileObject fObj = dObj.getPrimaryFile();
            Project p = FileOwnerQuery.getOwner(fObj);
            if (p != null) {
                return p;
            }
View Full Code Here

TOP

Related Classes of org.openide.util.Lookup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.