Java Code Examples for org.openide.util.Lookup#EMPTY

The following examples show how to use org.openide.util.Lookup#EMPTY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Lookups.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a lookup that contains an array of objects specified via the
 * parameter. The resulting lookup is fixed in the following sense: it
 * contains only fixed set of objects passed in by the array parameter.
 * Its contents never changes so registering listeners on such lookup
 * does not have any observable effect (the listeners are never called).
 *
 * @param objectsToLookup list of objects to include
 * @return Fully initialized lookup object ready to use
 * @throws NullPointerException if the supplied argument is null
 * @since 2.21
 *
 */
public static Lookup fixed(Object... objectsToLookup) {
    if (objectsToLookup == null) {
        throw new NullPointerException();
    }

    if (objectsToLookup.length == 0) {
        return Lookup.EMPTY;
    }

    if (objectsToLookup.length == 1) {
        return singleton(objectsToLookup[0]);
    }

    return new SimpleLookup(Arrays.asList(objectsToLookup));
}
 
Example 2
Source File: CookieMessage.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Create new message with structured detail.
 * @param message Localized message.
 * @param level Message level.
 * @param details Lookup holding structured details.
 */        
public CookieMessage(String message, int level, Lookup details) {
    if (message == null) throw new NullPointerException();
    if (level < INFORMATIONAL_LEVEL || level > FATAL_ERROR_LEVEL)
        throw new IllegalArgumentException();

    this.message = message;
    this.level = level;
    this.details = details == null ? Lookup.EMPTY : details;
}
 
Example 3
Source File: WebBrowserPane.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Lookup associated with this browser pane.
 */
public Lookup getLookup() {
    if ( impl == null ){
        return Lookup.EMPTY;
    }
    return impl.getLookup();
}
 
Example 4
Source File: CssStylesPanelProviderImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Returns context (to pass to action provider) for the specified file object.
 * 
 * @param fileObject file object for which the context should be returned.
 * @return context for the specified file object.
 */
private static Lookup contextForFileObject(FileObject fileObject) {
    Lookup context;
    if (fileObject == null) {
        context = Lookup.EMPTY;
    } else {
        try {
            DataObject dob = DataObject.find(fileObject);
            context = Lookups.fixed(fileObject, dob);
        } catch (DataObjectNotFoundException donfex) {
            context = Lookups.singleton(fileObject);
        }
    }
    return context;
}
 
Example 5
Source File: CodeAnalysis.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void open(WarningDescription wd) {
    Node[] n = TopComponent.getRegistry().getActivatedNodes();
    final Lookup context = n.length > 0 ? n[0].getLookup():Lookup.EMPTY;
    RunAnalysis.showDialogAndRunAnalysis(
            new ProxyLookup(Utilities.actionsGlobalContext(), 
                    context), DialogState.from(wd));
}
 
Example 6
Source File: TestProjectSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Lookup getLookup() {
    if ( lookup == null ) {
        return Lookup.EMPTY;
    }
    else {
        return lookup;
    }
}
 
Example 7
Source File: ShowExecutionPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Node createPhaseNode(Pair<String, List<ExecutionEventObject.Tree>> key) {
    Children childs;
    if (showOnlyErrors) {
        boolean atLeastOne = false;
        for (ExecutionEventObject.Tree ch : key.second()) {
            ExecutionEventObject end = ch.getEndEvent();
            if (end != null) {
                if (ExecutionEvent.Type.ProjectFailed.equals(end.type)
                        || ExecutionEvent.Type.MojoFailed.equals(end.type)
                        || ExecutionEvent.Type.ForkedProjectFailed.equals(end.type)
                        || ExecutionEvent.Type.ForkFailed.equals(end.type)) {
                    atLeastOne = true;
                    break;
                }
            }
        }
        if (atLeastOne) {
            childs = createChildren(key.second());
        } else {
            childs = Children.LEAF;
        }
    } else {
        childs = createChildren(key.second());
    }
    AbstractNode nd = new AbstractNode(childs, Lookup.EMPTY);
    nd.setName(key.first());
    nd.setDisplayName(key.first());
    nd.setIconBaseWithExtension(ICON_PHASE);
    return nd;
}
 
Example 8
Source File: ApplyPatternAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    Node[] n = TopComponent.getRegistry().getActivatedNodes();
    final Lookup context = n.length > 0 ? n[0].getLookup():Lookup.EMPTY;
    Utilities.invokeAfterScanFinished(new Runnable() {
        @Override
        public void run() {
            InspectAndRefactorUI.openRefactoringUI(context);
        }
    }, Bundle.CTL_ApplyPatternAction());
}
 
Example 9
Source File: CloneableEditorNeverendingLoadingTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp () {
    support = new CES (this, Lookup.EMPTY);
    RUNNING = this;
}
 
Example 10
Source File: IOProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Lookup getIOLookup(Object io) {
    return Lookup.EMPTY;
}
 
Example 11
Source File: GoalsNavigationPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Lookup getLookup() {
    return Lookup.EMPTY;
}
 
Example 12
Source File: RepositoryRegistryTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Lookup getLookup() {
    return Lookup.EMPTY;
}
 
Example 13
Source File: AbstractSceneExplorerNode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AbstractSceneExplorerNode(DataObject dataObject) {
    super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent())));
    this.dataObject = dataObject;
    lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
}
 
Example 14
Source File: AbstractRefactoringElement.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Lookup getLookup() {
    return Lookup.EMPTY;
}
 
Example 15
Source File: MultiViewFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Lookup getLookup() {
    return Lookup.EMPTY;
}
 
Example 16
Source File: CloneableEditorUserQuestionAsyncTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected @Override void setUp() {
    MockLookup.setInstances(new DD());
    support = new CES(this, Lookup.EMPTY);
}
 
Example 17
Source File: FileOwnerQuery.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Lookup getLookup() {
    return Lookup.EMPTY;
}
 
Example 18
Source File: EmptyScanningScope.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Lookup getLookup() {
    return Lookup.EMPTY;
}
 
Example 19
Source File: HookConnector.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Lookup getLookup() {
    return Lookup.EMPTY;
}
 
Example 20
Source File: ReloadTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected @Override void setUp() {
    support = new CES (this, Lookup.EMPTY);
    Log.enable("", Level.ALL);
    err = Logger.getLogger(getName());
}