java.beans.Customizer Java Examples

The following examples show how to use java.beans.Customizer. 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: J2SEPlatformCustomizer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initComponents () {
    this.getAccessibleContext().setAccessibleName (NbBundle.getMessage(J2SEPlatformCustomizer.class,"AN_J2SEPlatformCustomizer"));
    this.getAccessibleContext().setAccessibleDescription (NbBundle.getMessage(J2SEPlatformCustomizer.class,"AD_J2SEPlatformCustomizer"));
    this.addTab(NbBundle.getMessage(J2SEPlatformCustomizer.class,"TXT_Classes"), createPathTab(CLASSPATH));
    this.addTab(NbBundle.getMessage(J2SEPlatformCustomizer.class,"TXT_Sources"), createPathTab(SOURCES));
    this.addTab(NbBundle.getMessage(J2SEPlatformCustomizer.class,"TXT_Javadoc"), createPathTab(JAVADOC));
    final Lookup lkp = Lookups.forPath(CUSTOMIZERS_PATH);
    final boolean isDefaultPlatform = platform instanceof DefaultPlatformImpl;
    for (Lookup.Item<? extends Customizer> li : lkp.lookupResult(Customizer.class).allItems()) {
        final Customizer c = li.getInstance();
        if (!(c instanceof Component)) {
            continue;
        }
        String name = li.getId();
        final FileObject fo = FileUtil.getConfigFile(String.format("%s.instance",name));    //NOI18N
        if (fo != null) {
            try {
                name = fo.getFileSystem().getDecorator().annotateName(fo.getName(), Collections.<FileObject>singleton(fo));
            } catch (FileStateInvalidException ex) {
                name = fo.getName();
            }
            if (isDefaultPlatform &&
                fo.getAttribute(SUPPORTS_DEFAULT_PLATFORM) == Boolean.FALSE) {
                continue;
            }
        }
        c.setObject(platform);
        this.addTab(name, (Component)c);
    }
}
 
Example #2
Source File: J2SELibraryTypeProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Customizer getCustomizer(String volumeType) {
    if (VOLUME_TYPES[0].equals(volumeType)||
        VOLUME_TYPES[1].equals(volumeType)||
        VOLUME_TYPES[2].equals(volumeType)) {
        return new J2SEVolumeCustomizer (volumeType);
    }
    else {
        return null;
    }
}
 
Example #3
Source File: CurrentThreadAnnotationListener.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void remove(JPDAThread t) {
    ((Customizer) t).removePropertyChangeListener(this);
    //System.err.println("AllThreadsAnnotator("+Integer.toHexString(debugger.hashCode())+").remove("+t+")");
    synchronized (this) {
        Object annotation = threadAnnotations.remove(t);
        if (annotation != null) {
            threadsToAnnotate.remove(t);
            annotationsToRemove.add(annotation);
            task.schedule(ANNOTATION_SCHEDULE_TIME);
        }
    }
}
 
Example #4
Source File: CurrentThreadAnnotationListener.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent evt) {
    synchronized (this) {
        if (!active) {
            ((Customizer) evt.getSource()).removePropertyChangeListener(this);
            return ;
        }
    }
    JPDAThread t = (JPDAThread) evt.getSource();
    annotate(t);
}
 
Example #5
Source File: BreakpointCustomizeAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Customizer getCustomizer(Breakpoint b) {
    Class cc = getCustomizerClass(b);
    if (cc == null) return null;
    try {
        Customizer c = (Customizer) cc.newInstance();
        c.setObject(b);
        return c;
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
        return null;
    }
}
 
Example #6
Source File: DebuggingTreeModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void destroyThreadStateListeners() {
    synchronized (threadStateListeners) {
        for (Map.Entry<JPDAThread, ThreadStateListener> entry : threadStateListeners.entrySet()) {
            PropertyChangeListener pcl = entry.getValue().getThreadPropertyChangeListener();
            ((Customizer) entry.getKey()).removePropertyChangeListener(pcl);
        }
        threadStateListeners.clear();
    }
}
 
Example #7
Source File: LocalsTreeModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Object[] getChildren (Object o, int from, int to) 
throws UnknownTypeException {
    Object[] ch = getChildrenImpl(o, from, to);
    for (int i = 0; i < ch.length; i++) {
        if (ch[i] instanceof Customizer) {
            ((Customizer) ch[i]).addPropertyChangeListener(this);
        }
    }
    return ch;
}
 
Example #8
Source File: ServerLibraryTypeProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Customizer getCustomizer(String volumeType) {
    // avoid user confusion
    if (VOLUME_CLASSPATH.equals(volumeType) || VOLUME_JAVADOC.equals(volumeType)
            || VOLUME_SOURCE.equals(volumeType)) {
        return new ServerVolumeCustomizer(volumeType);
    }
    return null;
}
 
Example #9
Source File: DeadlockDetectorImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
DeadlockDetectorImpl(JPDADebugger debugger) {
    debugger.addPropertyChangeListener(this);
    List<JPDAThread> threads = debugger.getThreadsCollector().getAllThreads();
    for (JPDAThread thread : threads) {
        ((Customizer) thread).addPropertyChangeListener(WeakListeners.propertyChange(this, thread));
        if (thread.isSuspended()) {
            synchronized (suspendedThreads) {
                suspendedThreads.add(thread);
            }
        }
    }
}
 
Example #10
Source File: Lookup.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private synchronized void setUp() {
    clear();
    List<? extends T> list1 = l1.lookup(folder, service);
    List<? extends T> list2 = l2.lookup(folder, service);
    if (list1 instanceof PositionedList || list2 instanceof PositionedList) {
        List<PositionedElement> positioned = new ArrayList<PositionedElement>();
        List<T> others = new ArrayList<T>();
        boolean hp1 = false;
        if (list1 instanceof PositionedList) {
            PositionedList<? extends T> ml1 = (PositionedList<? extends T>) list1;
            if (ml1.hasPositions()) {
                fillElements(ml1, positioned, others);
                hp1 = true;
            }
        }
        boolean hp2 = false;
        if (list2 instanceof PositionedList) {
            PositionedList<? extends T> ml2 = (PositionedList<? extends T>) list2;
            if (ml2.hasPositions()) {
                fillElements(ml2, positioned, others);
                hp2 = true;
            }
        }
        if (hp1 && hp2) { // merge
            if (!positioned.isEmpty()) {
                Collections.sort(positioned);
                Set<String> hiddenClassNames = new HashSet<String>();
                addHiddenClassNames(list1, hiddenClassNames);
                addHiddenClassNames(list2, hiddenClassNames);
                List<T> sorted = new LookupList<T>(hiddenClassNames);
                for (PositionedElement<T> pe : positioned) {
                    sorted.add(pe.element);
                }
                positionedElements = positioned;
                list1 = sorted;
            } else {
                list1 = Collections.emptyList();
            }
            list2 = others;
        } else if (hp1) {
            positionedElements = positioned;
        } else if (hp2) {
            positionedElements = positioned;
            List<? extends T> switchList = list1;
            list1 = list2;
            list2 = switchList;
        }
    }
    addAll (list1);
    addAll (list2);
    sublist1 = (list1 instanceof Customizer) ? (Customizer) list1 : null;
    sublist2 = (list2 instanceof Customizer) ? (Customizer) list2 : null;
}
 
Example #11
Source File: ViewModelListener.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static void addAsCustomizers(List<Customizer> modelListCustomizerLists, Object[] modelLists) {
    for (int i = 0; i < modelLists.length; i++) {
        modelListCustomizerLists.add((Customizer) modelLists[i]);
    }
}
 
Example #12
Source File: LibrariesCustomizer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void selectLibrary (Node[] nodes) {
    int tabCount = this.properties.getTabCount();
    for (int i=0; i<tabCount; i++) {
        this.properties.removeTabAt(0);
    }
    this.libraryName.setEnabled(false);
    this.libraryName.setText("");   //NOI18N
    this.jLabel1.setVisible(false);
    this.libraryName.setVisible(false);
    this.properties.setVisible(false);
    this.deleteButton.setEnabled(false);
    if (nodes.length != 1) {
        return;
    }
    LibraryImplementation impl = nodes[0].getLookup().lookup(LibraryImplementation.class);
    if (impl == null) {
        return;
    }
    this.jLabel1.setVisible(true);
    this.libraryName.setVisible(true);
    this.properties.setVisible(true);
    boolean editable = model.isLibraryEditable (impl);
    this.libraryName.setEnabled(editable && LibrariesSupport.supportsDisplayName(impl));
    this.deleteButton.setEnabled(editable);
    this.libraryName.setText (LibrariesSupport.getLocalizedName(impl));
    LibraryTypeProvider provider = nodes[0].getLookup().lookup(LibraryTypeProvider.class);
    if (provider == null) {
        return;
    }
    LibraryCustomizerContextWrapper customizerContext;
    LibraryStorageArea area = nodes[0].getLookup().lookup(LibraryStorageArea.class);
    if (area != LibraryStorageArea.GLOBAL) {
        customizerContext = new LibraryCustomizerContextWrapper(impl, area);
        File f = Utilities.toFile(URI.create(area.getLocation().toExternalForm()));
        this.libraryLocation.setText(f.getPath());
    } else {
        customizerContext = new LibraryCustomizerContextWrapper(impl, null);
        this.libraryLocation.setText(LABEL_Global_Libraries());
    }

    String[] volumeTypes = provider.getSupportedVolumeTypes();
    for (int i=0; i< volumeTypes.length; i++) {
        Customizer c = provider.getCustomizer (volumeTypes[i]);
        if (c instanceof JComponent) {
            c.setObject (customizerContext);
            JComponent component = (JComponent) c;
            component.setEnabled (editable);
            String tabName = component.getName();
            if (tabName == null) {
                tabName = volumeTypes[i];
            }
            this.properties.addTab(tabName, component);
        }
    }        
}
 
Example #13
Source File: J2eeLibraryTypeProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Currently returns <code>null</code>.
 */
public Customizer getCustomizer(String volumeType) {
    return null;
}
 
Example #14
Source File: J2SEProjectGeneratorTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Customizer getCustomizer(String volumeType) {
    return null;
}
 
Example #15
Source File: JSWatchVar.java    From netbeans with Apache License 2.0 4 votes vote down vote up
JSWatchVar(JPDADebugger debugger, JPDAWatch watch) {
    this.debugger = debugger;
    this.watch = watch;
    //((Refreshable) watch).isCurrent();
    ((Customizer) watch).addPropertyChangeListener(this);
}
 
Example #16
Source File: CPExtenderTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public @Override Customizer getCustomizer(String volumeType) {
    return null;
}
 
Example #17
Source File: DebuggingTreeModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ThreadStateListener(JPDAThread t) {
    this.tr = new WeakReference(t);
    this.propertyChangeListener = WeakListeners.propertyChange(this, t);
    ((Customizer) t).addPropertyChangeListener(propertyChangeListener);
}
 
Example #18
Source File: DebuggingNodeModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ThreadStateUpdater(JPDAThread t) {
    this.tr = new WeakReference(t);
    ((Customizer) t).addPropertyChangeListener(WeakListeners.propertyChange(this, t));
}
 
Example #19
Source File: CurrentThreadAnnotationListener.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void add(JPDAThread t) {
    ((Customizer) t).addPropertyChangeListener(this);
    //System.err.println("AllThreadsAnnotator("+Integer.toHexString(debugger.hashCode())+").add("+t+")");
    annotate(t);
}
 
Example #20
Source File: LibraryTypeProvider.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Returns customizer for given volume's type, or null if the volume is not customizable.
 * The <code>LibraryCustomizerContext</code> instance is passed
 * to the customizer's setObject method.
 * The customized object describes the library created by this
 * provider, but the customizer cannot assume that the customized
 * object is of the same type as the object created by {@link #createLibrary}.
 * @param volumeType a type of volume listed in {@link #getSupportedVolumeTypes}
 * @return a customizer (must extend {@link javax.swing.JComponent}) or null if such
 *  customizer doesn't exist.
 */
public Customizer getCustomizer (String volumeType);