Java 类java.beans.PropertyVetoException 实例源码

项目:buffer-slayer    文件:AbstractBatchJdbcTemplateBenchmark.java   
@Setup
public void setup() throws PropertyVetoException {
  dataSource = new DriverManagerDataSource();
  dataSource.setDriverClassName("com.mysql.jdbc.Driver");
  dataSource.setUrl(propertyOr("jdbcUrl", "jdbc:mysql://127.0.0.1:3306?useSSL=false"));
  dataSource.setUsername(propertyOr("username", "root"));
  dataSource.setPassword(propertyOr("password", "root"));

  JdbcTemplate delegate = new JdbcTemplate(dataSource);
  delegate.setDataSource(dataSource);

  proxy = new SenderProxy(new JdbcTemplateSender(delegate));
  proxy.onMessages(updated -> counter.addAndGet(updated.size()));

  reporter = reporter(proxy);
  batch = new BatchJdbcTemplate(delegate, reporter);
  batch.setDataSource(dataSource);

  unbatch = new JdbcTemplate(dataSource);
  unbatch.setDataSource(dataSource);
  unbatch.update(CREATE_DATABASE);
  unbatch.update(DROP_TABLE);
  unbatch.update(CREATE_TABLE);
}
项目:incubator-netbeans    文件:BaseCaretTest.java   
public static void prepareTest(String[] additionalLayers, Object[] additionalLookupContent) throws IOException, SAXException, PropertyVetoException {
    Collection<URL> allUrls = new ArrayList<URL>();
    for (String u : additionalLayers) {
        if (u.charAt(0) == '/') {
            u = u.substring(1);
        }
        for (Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(u); en.hasMoreElements(); ) {
            allUrls.add(en.nextElement());
        }
    }
    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(allUrls.toArray(new URL[allUrls.size()]));

    Repository repository = new Repository(system);
    Object[] lookupContent = new Object[additionalLookupContent.length + 1];

    System.arraycopy(additionalLookupContent, 0, lookupContent, 1, additionalLookupContent.length);

    lookupContent[0] = repository;

    setLookup(lookupContent, BaseCaretTest.class.getClassLoader());
}
项目:incubator-netbeans    文件:GuardedSectionManagerTest.java   
public void testRenameInteriorSection() throws BadLocationException, PropertyVetoException {
    System.out.println("-- testRenameInteriorSection -------------");

    editor.doc.insertString(0, "aaa", null);
    InteriorSection is1 = guards.createInteriorSection(editor.doc.createPosition(1), "is1");
    assertEquals("name", "is1", is1.getName());
    is1.setName("isNewName");
    assertTrue("valid", is1.isValid());
    assertEquals("new name", "isNewName", is1.getName());
    // set the same name
    is1.setName("isNewName");

    InteriorSection is2 = guards.createInteriorSection(
            editor.doc.createPosition(is1.getEndPosition().getOffset() + 1),
            "is2");

    // rename to existing name
    try {
        is1.setName("is2");
        fail("accepted already existing name");
    } catch (PropertyVetoException ex) {
        assertTrue("valid", is1.isValid());
        assertEquals("name", "isNewName", is1.getName());
    }
}
项目:openjdk-jdk10    文件:KeyboardFocusManager.java   
/**
 * Sets the active Window. Only a Frame or a Dialog can be the active
 * Window. The native windowing system may denote the active Window or its
 * children with special decorations, such as a highlighted title bar. The
 * active Window is always either the focused Window, or the first Frame or
 * Dialog that is an owner of the focused Window.
 * <p>
 * This method does not actually change the active Window as far as the
 * native windowing system is concerned. It merely stores the value to be
 * subsequently returned by {@code getActiveWindow()}. Use
 * {@code Component.requestFocus()} or
 * {@code Component.requestFocusInWindow()} to change the active
 * Window, subject to platform limitations.
 *
 * @param activeWindow the active Window
 * @see #getActiveWindow
 * @see #getGlobalActiveWindow
 * @see Component#requestFocus()
 * @see Component#requestFocusInWindow()
 * @throws SecurityException if this KeyboardFocusManager is not the
 *         current KeyboardFocusManager for the calling thread's context
 *         and if the calling thread does not have "replaceKeyboardFocusManager"
 *         permission
 */
protected void setGlobalActiveWindow(Window activeWindow)
    throws SecurityException
{
    Window oldActiveWindow;
    synchronized (KeyboardFocusManager.class) {
        checkKFMSecurity();

        oldActiveWindow = getActiveWindow();
        if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
            focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow);
        }

        try {
            fireVetoableChange("activeWindow", oldActiveWindow,
                               activeWindow);
        } catch (PropertyVetoException e) {
            // rejected
            return;
        }

        KeyboardFocusManager.activeWindow = activeWindow;
    }

    firePropertyChange("activeWindow", oldActiveWindow, activeWindow);
}
项目:incubator-netbeans    文件:OutlineView.java   
/**
 * Called when selection in tree is changed.
 */
private void callSelectionChanged (Node[] nodes) {
    manager.removePropertyChangeListener (wlpc);
    manager.removeVetoableChangeListener (wlvc);
    try {
        manager.setSelectedNodes(nodes);
    } catch (PropertyVetoException e) {
        synchronizeSelectedNodes(false);
    } finally {
        // to be sure not to add them twice!
        manager.removePropertyChangeListener (wlpc);
        manager.removeVetoableChangeListener (wlvc);
        manager.addPropertyChangeListener (wlpc);
        manager.addVetoableChangeListener (wlvc);
    }
}
项目:incubator-netbeans    文件:PhadhailViews.java   
private static Component nodeBasedView(Node root) {
    Node root2;
    if (Children.MUTEX == Mutex.EVENT) {
        // #35833 branch.
        root2 = root;
    } else {
        root2 = new EQReplannedNode(root);
    }
    ExpPanel p = new ExpPanel();
    p.setLayout(new BorderLayout());
    JComponent tree = new BeanTreeView();
    p.add(tree, BorderLayout.CENTER);
    p.getExplorerManager().setRootContext(root2);
    try {
        p.getExplorerManager().setSelectedNodes(new Node[] {root2});
    } catch (PropertyVetoException pve) {
        pve.printStackTrace();
    }
    Object key = "org.openide.actions.PopupAction";
    KeyStroke ks = KeyStroke.getKeyStroke("shift F10");
    tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, key);
    return p;
}
项目:incubator-netbeans    文件:WindowBuilders.java   
protected JInternalFrame createInstanceImpl() {
    JInternalFrame frame = new JInternalFrame(title, resizable, closable, maximizable, iconable) {
        protected JRootPane createRootPane() {
            return _rootPane == null ? null : _rootPane.createInstance();
        }
        public void addNotify() {
            try {
                // Doesn't seem to work correctly
                setClosed(_isClosed);
                setMaximum(_isMaximum);
                setIcon(_isIcon);
                setSelected(_isSelected);
            } catch (PropertyVetoException ex) {}
        }
    };
    return frame;
}
项目:incubator-netbeans    文件:XMLFileSystem.java   
/** Initializes the root of FS.
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    //ois.defaultReadObject ();
    ObjectInputStream.GetField fields = ois.readFields();
    URL[] urls = (URL[]) fields.get("urlsToXml", null); // NOI18N

    if (urls == null) {
        urls = new URL[1];
        urls[0] = (URL) fields.get("uriId", null); // NOI18N
        if (urls[0] == null) {
            throw new IOException("missing uriId"); // NOI18N
        }
    }

    try {
        setXmlUrls(urls);
    } catch (PropertyVetoException ex) {
        IOException x = new IOException(ex.getMessage());
        ExternalUtil.copyAnnotation(x, ex);
        throw x;
    }
}
项目:jdk8u-jdk    文件:JInternalFrame.java   
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
项目:lembredio    文件:TelaInicial.java   
/**
 * Creates new form TelaInicial
 */


public TelaInicial() throws PropertyVetoException, IOException {
    initComponents();
    this.setLocationRelativeTo(null);
    jDesktopPane3.add(obj);
    obj.setMaximizable(true);
    obj.setMaximum(true);
    obj.setVisible(true);
    getContentPane().setBackground(Color.WHITE);

    File file = new File("CADASTRADOS.txt");
   if(!file.exists()){
    file.createNewFile();// TODO code application logic here
   }
   File dir = new File("CadastroRemedios");
   if(!dir.exists()){
       dir.mkdir();
   }
    //this.setExtendedState(MAXIMIZED_BOTH);
    //jDesktopPane3.setExtendedState(MAXIMIZED_BOTH);
   //obj.setLocation(jDesktopPane3.getSize().width/2 - obj.getSize().width/2,jDesktopPane3.getSize().height/2 - obj.getSize().height/2);

}
项目:NBANDROID-V2    文件:SdksCustomizer.java   
private static void expandAllNodes(BeanTreeView btv, Node node, ExplorerManager mgr, AndroidSdk platform) {
    btv.expandNode(node);
    Children ch = node.getChildren();
    if (ch == Children.LEAF) {
        if (platform != null && platform.equals(node.getLookup().lookup(AndroidSdk.class))) {
            try {
                mgr.setSelectedNodes(new Node[]{node});
            } catch (PropertyVetoException e) {
                //Ignore it
            }
        }
        return;
    }
    Node nodes[] = ch.getNodes(true);
    for (int i = 0; i < nodes.length; i++) {
        expandAllNodes(btv, nodes[i], mgr, platform);
    }

}
项目:otus_java_2017_06    文件:Main.java   
public static void main(String[] args) throws PropertyVetoException, SQLException, InterruptedException {
    //DataSourceFactory factory = new C3P0DataSourceFactory();
    //DataSourceFactory factory = new DBCPDataSourceFactory();
    DataSourceFactory factory = new HikariCPDataSourceFactory();

    Connection connection = factory.get().getConnection();
    System.out.println("DatabaseProductName: " + connection.getMetaData().getDatabaseProductName());

    Connection connection2 = factory.get().getConnection();
    System.out.println("DriverName: " + connection2.getMetaData().getDriverName());

    Connection connection3 = factory.get().getConnection();
    System.out.println("URL: " + connection3.getMetaData().getURL());

    hold();
}
项目:incubator-netbeans    文件:JarFileSystem.java   
/** Initializes the root of FS.
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    ois.defaultReadObject();
    closeSync = new Object();
    strongCache = null;
    softCache = new SoftReference<Cache>(null);
    aliveCount = 0;

    try {
        setJarFile(root);
    } catch (PropertyVetoException ex) {
        throw new IOException(ex.getMessage());
    } catch (IOException iex) {
        ExternalUtil.log(iex.getLocalizedMessage());
    }
}
项目:incubator-netbeans    文件:URLMapperTest.java   
public void testPlusInName() throws IOException, PropertyVetoException {
    clearWorkDir();
    File plus = new File(getWorkDir(), "plus+plus");
    plus.createNewFile();
    LocalFileSystem lfs = new LocalFileSystem();
    lfs.setRootDirectory(getWorkDir());
    Repository.getDefault().addFileSystem(lfs);

    URL uPlus = BaseUtilities.toURI(plus).toURL();
    FileObject fo = URLMapper.findFileObject(uPlus);
    assertNotNull("File object found", fo);
    assertEquals("plus+plus", fo.getNameExt());

    URL back = URLMapper.findURL(fo, URLMapper.EXTERNAL);
    assertTrue("plus+plus is there", back.getPath().endsWith("plus+plus"));
}
项目:JavaStudy    文件:MineC3P0DataSource.java   
public MineC3P0DataSource(boolean autoregister) {
    super(autoregister);
    this.dmds = new DriverManagerDataSource();
    this.wcpds = new WrapperConnectionPoolDataSource();
    this.wcpds.setNestedDataSource(this.dmds);

    try {
        this.setConnectionPoolDataSource(this.wcpds);
    } catch (PropertyVetoException var3) {
        logger.log(MLevel.WARNING, "Hunh??? This can\'t happen. We haven\'t set up any listeners to veto the property change yet!", var3);
        throw new RuntimeException("Hunh??? This can\'t happen. We haven\'t set up any listeners to veto the property change yet! " + var3);
    }

    this.setUpPropertyEvents();
}
项目:spanner-jdbc    文件:CloudSpannerIT.java   
private void performJdbcTests() throws Exception
{
    // Get a JDBC connection
    try (Connection connection = createConnection())
    {
        connection.setAutoCommit(false);
        // Test connection pooling
        ConnectionPoolingTester poolingTester = new ConnectionPoolingTester();
        poolingTester.testPooling((CloudSpannerConnection) connection);

        // Test Table DDL statements
        TableDDLTester tableDDLTester = new TableDDLTester(connection);
        tableDDLTester.runCreateTests();
        // Test DML statements
        DMLTester dmlTester = new DMLTester(connection);
        dmlTester.runDMLTests();
        // Test meta data functions
        MetaDataTester metaDataTester = new MetaDataTester(connection);
        metaDataTester.runMetaDataTests();
        // Test transaction functions
        TransactionTester txTester = new TransactionTester(connection);
        txTester.runTransactionTests();
        // Test select statements
        SelectStatementsTester selectTester = new SelectStatementsTester(connection);
        selectTester.runSelectTests();
        // Test XA transactions
        XATester xaTester = new XATester();
        xaTester.testXA(projectId, instanceId, DATABASE_ID, credentialsPath);

        // Test drop statements
        tableDDLTester.runDropTests();
    }
    catch (SQLException | PropertyVetoException e)
    {
        log.log(Level.WARNING, "Error during JDBC tests", e);
        throw e;
    }
}
项目:jdk8u-jdk    文件:KeyboardFocusManager.java   
/**
 * Sets the focused Window. The focused Window is the Window that is or
 * contains the focus owner. The operation will be cancelled if the
 * specified Window to focus is not a focusable Window.
 * <p>
 * This method does not actually change the focused Window as far as the
 * native windowing system is concerned. It merely stores the value to be
 * subsequently returned by <code>getFocusedWindow()</code>. Use
 * <code>Component.requestFocus()</code> or
 * <code>Component.requestFocusInWindow()</code> to change the focused
 * Window, subject to platform limitations.
 *
 * @param focusedWindow the focused Window
 * @see #getFocusedWindow
 * @see #getGlobalFocusedWindow
 * @see Component#requestFocus()
 * @see Component#requestFocusInWindow()
 * @see Window#isFocusableWindow
 * @throws SecurityException if this KeyboardFocusManager is not the
 *         current KeyboardFocusManager for the calling thread's context
 *         and if the calling thread does not have "replaceKeyboardFocusManager"
 *         permission
 * @beaninfo
 *       bound: true
 */
protected void setGlobalFocusedWindow(Window focusedWindow)
    throws SecurityException
{
    Window oldFocusedWindow = null;
    boolean shouldFire = false;

    if (focusedWindow == null || focusedWindow.isFocusableWindow()) {
        synchronized (KeyboardFocusManager.class) {
            checkKFMSecurity();

            oldFocusedWindow = getFocusedWindow();

            try {
                fireVetoableChange("focusedWindow", oldFocusedWindow,
                                   focusedWindow);
            } catch (PropertyVetoException e) {
                // rejected
                return;
            }

            KeyboardFocusManager.focusedWindow = focusedWindow;
            shouldFire = true;
        }
    }

    if (shouldFire) {
        firePropertyChange("focusedWindow", oldFocusedWindow,
                           focusedWindow);
    }
}
项目:adept    文件:C3p0DataSourceConfig.java   
/**
 * 通过基础配置信息构建DBCP数据源信息.
 * @param driver 数据库连接的JDBC驱动
 * @param url 数据库连接的url
 * @param user 数据库连接的用户名
 * @param password 数据库连接的密码
 */
public ComboPooledDataSource buildDataSource(String driver, String url, String user, String password) {
    ComboPooledDataSource dataSource = new ComboPooledDataSource();
    try {
        dataSource.setDriverClass(driver);
    } catch (PropertyVetoException e) {
        log.error("设置C3P0数据源的DriverClass出错!", e);
    }
    dataSource.setJdbcUrl(url);
    dataSource.setUser(user);
    dataSource.setPassword(password);
    return dataSource;
}
项目:incubator-netbeans    文件:AbstractSearchResultsPanel.java   
private void shift(int direction) {

        Node next = findShiftNode(direction, getOutlineView(), true);
        if (next != null) {
            try {
                getExplorerManager().setSelectedNodes(new Node[]{next});
                onDetailShift(next);
            } catch (PropertyVetoException pve) {
                Exceptions.printStackTrace(pve);
            }
        }
    }
项目:jdk8u-jdk    文件:WindowsDesktopManager.java   
public void activateFrame(JInternalFrame f) {
    JInternalFrame currentFrame = currentFrameRef != null ?
        currentFrameRef.get() : null;
    try {
        super.activateFrame(f);
        if (currentFrame != null && f != currentFrame) {
            // If the current frame is maximized, transfer that
            // attribute to the frame being activated.
            if (currentFrame.isMaximum() &&
                (f.getClientProperty("JInternalFrame.frameType") !=
                "optionDialog") ) {
                //Special case.  If key binding was used to select next
                //frame instead of minimizing the icon via the minimize
                //icon.
                if (!currentFrame.isIcon()) {
                    currentFrame.setMaximum(false);
                    if (f.isMaximizable()) {
                        if (!f.isMaximum()) {
                            f.setMaximum(true);
                        } else if (f.isMaximum() && f.isIcon()) {
                            f.setIcon(false);
                        } else {
                            f.setMaximum(false);
                        }
                    }
                }
            }
            if (currentFrame.isSelected()) {
                currentFrame.setSelected(false);
            }
        }

        if (!f.isSelected()) {
            f.setSelected(true);
        }
    } catch (PropertyVetoException e) {}
    if (f != currentFrame) {
        currentFrameRef = new WeakReference<JInternalFrame>(f);
    }
}
项目:openjdk-jdk10    文件:WindowsDesktopManager.java   
public void activateFrame(JInternalFrame f) {
    JInternalFrame currentFrame = currentFrameRef != null ?
        currentFrameRef.get() : null;
    try {
        super.activateFrame(f);
        if (currentFrame != null && f != currentFrame) {
            // If the current frame is maximized, transfer that
            // attribute to the frame being activated.
            if (!currentFrame.isClosed() && currentFrame.isMaximum() &&
                (f.getClientProperty("JInternalFrame.frameType") !=
                "optionDialog") ) {
                //Special case.  If key binding was used to select next
                //frame instead of minimizing the icon via the minimize
                //icon.
                if (!currentFrame.isIcon()) {
                    currentFrame.setMaximum(false);
                    if (f.isMaximizable()) {
                        if (!f.isMaximum()) {
                            f.setMaximum(true);
                        } else if (f.isMaximum() && f.isIcon()) {
                            f.setIcon(false);
                        } else {
                            f.setMaximum(false);
                        }
                    }
                }
            }
            if (currentFrame.isSelected()) {
                currentFrame.setSelected(false);
            }
        }

        if (!f.isSelected()) {
            f.setSelected(true);
        }
    } catch (PropertyVetoException e) {}
    if (f != currentFrame) {
        currentFrameRef = new WeakReference<JInternalFrame>(f);
    }
}
项目:incubator-netbeans    文件:HistoryFileView.java   
private void setSelection(final Node[] nodes) {
SwingUtilities.invokeLater(new Runnable() {
@Override
    public void run() {
        try {
            tablePanel.getExplorerManager().setSelectedNodes(nodes);
        } catch (PropertyVetoException ex) {
            // ignore
        }
    }
});                                             
}
项目:incubator-netbeans    文件:IDEInitializer.java   
public MyFileSystem (FileSystem[] fileSystems) {
    super (fileSystems);
    try {
        setSystemName ("TestFS");
    } catch (PropertyVetoException ex) {
        ex.printStackTrace();
    }
}
项目:incubator-netbeans    文件:StringEditor.java   
@Override
public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
    super.vetoableChange(ev);
    if (PropertyEnv.PROP_STATE.equals(ev.getPropertyName())
        && resourcePanel == null && noI18nCheckbox  != null)
    {   // no resourcing, just internationalizing
        // mark the property excluded if the NOI18N checkbox is checked
        ResourceSupport.setExcludedProperty(property, noI18nCheckbox.isSelected());
    }
}
项目:openjdk-jdk10    文件:KeyboardFocusManager.java   
/**
 * Sets the permanent focus owner. The operation will be cancelled if the
 * Component is not focusable. The permanent focus owner is defined as the
 * last Component in an application to receive a permanent FOCUS_GAINED
 * event. The focus owner and permanent focus owner are equivalent unless
 * a temporary focus change is currently in effect. In such a situation,
 * the permanent focus owner will again be the focus owner when the
 * temporary focus change ends.
 * <p>
 * This method does not actually set the focus to the specified Component.
 * It merely stores the value to be subsequently returned by
 * {@code getPermanentFocusOwner()}. Use
 * {@code Component.requestFocus()} or
 * {@code Component.requestFocusInWindow()} to change the focus owner,
 * subject to platform limitations.
 *
 * @param permanentFocusOwner the permanent focus owner
 * @see #getPermanentFocusOwner
 * @see #getGlobalPermanentFocusOwner
 * @see Component#requestFocus()
 * @see Component#requestFocusInWindow()
 * @see Component#isFocusable
 * @throws SecurityException if this KeyboardFocusManager is not the
 *         current KeyboardFocusManager for the calling thread's context
 *         and if the calling thread does not have "replaceKeyboardFocusManager"
 *         permission
 */
protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner)
    throws SecurityException
{
    Component oldPermanentFocusOwner = null;
    boolean shouldFire = false;

    if (permanentFocusOwner == null || permanentFocusOwner.isFocusable()) {
        synchronized (KeyboardFocusManager.class) {
            checkKFMSecurity();

            oldPermanentFocusOwner = getPermanentFocusOwner();

            try {
                fireVetoableChange("permanentFocusOwner",
                                   oldPermanentFocusOwner,
                                   permanentFocusOwner);
            } catch (PropertyVetoException e) {
                // rejected
                return;
            }

            KeyboardFocusManager.permanentFocusOwner = permanentFocusOwner;

            KeyboardFocusManager.
                setMostRecentFocusOwner(permanentFocusOwner);

            shouldFire = true;
        }
    }

    if (shouldFire) {
        firePropertyChange("permanentFocusOwner", oldPermanentFocusOwner,
                           permanentFocusOwner);
    }
}
项目:intellij-deps-ini4j    文件:AbstractBeanInvocationHandler.java   
protected synchronized void fireVetoableChange(String property, Object oldValue, Object newValue) throws PropertyVetoException
{
    if (_vcSupport != null)
    {
        _vcSupport.fireVetoableChange(property, oldValue, newValue);
    }
}
项目:incubator-netbeans    文件:UnitUtilities.java   
public static void prepareTest(String[] additionalLayers, Object[] additionalLookupContent) throws IOException, SAXException, PropertyVetoException {
    URL[] layers = new URL[additionalLayers.length + 1];

    layers[0] = Utilities.class.getResource("/org/netbeans/modules/editor/errorstripe/resources/layer.xml");

    for (int cntr = 0; cntr < additionalLayers.length; cntr++) {
        layers[cntr + 1] = Utilities.class.getResource(additionalLayers[cntr]);
    }

    for (int cntr = 0; cntr < layers.length; cntr++) {
        if (layers[cntr] == null) {
            throw new IllegalStateException("layers[" + cntr + "]=null");
        }
    }

    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(layers);

    Repository repository = new Repository(system);
    Object[] lookupContent = new Object[additionalLookupContent.length + 1];

    System.arraycopy(additionalLookupContent, 0, lookupContent, 1, additionalLookupContent.length);

    lookupContent[0] = repository;

    DEFAULT_LOOKUP.setLookup(lookupContent, UnitUtilities.class.getClassLoader());
}
项目:JDigitalSimulator    文件:Guitilities.java   
public static void selectFrame(final JInternalFrame frame) {
    SwingUtilities.invokeLater(new Runnable(){
        @Override public void run() {
            frame.requestFocusInWindow();
            try { frame.setSelected(true); }    catch (PropertyVetoException e) {}
            frame.toFront();
        }
    });
}
项目:incubator-netbeans    文件:JavaComponentInfo.java   
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
    synchronized (valueLock) {
        if (value == null) {
            value = valueCalculating;
            debugger.getRequestProcessor().post(new Runnable() {
                @Override
                public void run() {
                    try {
                        RemoteServices.runOnStoppedThread(t, new Runnable() {
                            @Override
                            public void run() {
                                boolean[] isEditablePtr = new boolean[] { false };
                                Type[] typePtr = new Type[] { null };
                                String v = getValueLazy(isEditablePtr, typePtr);
                                synchronized (valueLock) {
                                    value = v;
                                    valueIsEditable = isEditablePtr[0];
                                    valueType = typePtr[0];
                                }
                                ci.firePropertyChange(propertyName, null, v);
                            }
                        }, sType);
                    } catch (PropertyVetoException ex) {
                        value = ex.getLocalizedMessage();
                    }
                }
            });
        }
        return value;
    }
}
项目:incubator-netbeans    文件:DocumentViewPanel.java   
/**
 * Select corresponding node in the document view tree upon change of the
 * rule editor's content.
 *
 * A. The RuleNode holds instances of Rule-s from the model instance which
 * was created as setContext(file) was called on the view panel. B. The
 * 'rule' argument here is from an up-to-date model.
 *
 */
private void setSelectedRule(RuleHandle handle) {
    try {
        Node foundRuleNode = findLocation(manager.getRootContext(), handle);
        Node[] toSelect = foundRuleNode != null ? new Node[]{foundRuleNode} : new Node[0];
        manager.setSelectedNodes(toSelect);
    } catch (PropertyVetoException ex) {
        //no-op
    }
}
项目:jdk8u-jdk    文件:TestMethods.java   
public static void main(String[] args) throws PropertyVetoException {
    Object source = new Object();
    new TestMethods(source).fireVetoableChange(new PropertyChangeEvent(source, NAME, null, null));
    new TestMethods(source).fireVetoableChange(NAME, null, null);
    new TestMethods(source).fireVetoableChange(NAME, 0, 1);
    new TestMethods(source).fireVetoableChange(NAME, true, false);
}
项目:openjdk-jdk10    文件:TestPopupMenu.java   
private void createAndShowUI() throws Exception {
    frame = new JFrame();
    frame.setTitle("Test Frame");
    frame.setSize(800, 600);

    JDesktopPane pane = new JDesktopPane();
    TestInternalFrameWPopup testInternalFrame1 = new TestInternalFrameWPopup();
    pane.add(testInternalFrame1);

    testInternalFrame1.setVisible(true);
    JScrollPane scrollPane = new JScrollPane(pane);
    frame.getContentPane().add(scrollPane);
    testInternalFrame1.setMaximum(true);
    frame.getRootPane().registerKeyboardAction(e -> {
        TestInternalFrame testInternalFrame2 = new TestInternalFrame();
        pane.add(testInternalFrame2);
        try {
            testInternalFrame2.setMaximum(true);
        } catch (PropertyVetoException ex) {
            throw new RuntimeException(ex);
        }
        testInternalFrame2.setVisible(true);
    }, KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_MASK),
                             JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    frame.setVisible(true);
}
项目:incubator-netbeans    文件:MergeDialogComponent.java   
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
    // Add your handling code here:
    synchronized (this) {
        try {
            fireVetoableChange(PROP_ALL_CANCELLED, null, null);
        } catch (PropertyVetoException pvex) {}
        try {
            internallyClosing = true;
            close();
        } finally {
            internallyClosing = false;
        }
    }
}
项目:incubator-netbeans    文件:PropertiesEditorSupport.java   
/** Called from the <code>EnvironmentListener</code>.
 * The components are going to be closed anyway and in case of
 * modified document its asked before if to save the change. */
private void fileRemoved() {
    LOG.finer("Environment.fileRemoved() ... ");                //NOI18N
    try {
        fireVetoableChange(PROP_VALID, Boolean.TRUE, Boolean.FALSE);
    } catch(PropertyVetoException pve) {
        // Ignore it and close anyway. File doesn't exist anymore.
    }

    firePropertyChange(PROP_VALID, Boolean.TRUE, Boolean.FALSE);
}
项目:incubator-netbeans    文件:OpenSupport.java   
/** Accepts vetoable changes and fires them to own listeners.
*/
public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
    fireVetoableChange (
        ev.getPropertyName (),
        ev.getOldValue (),
        ev.getNewValue ()
    );
}
项目:openjdk-jdk10    文件:bug6647340.java   
private void setIcon(boolean b) {
    try {
        jif.setIcon(b);
    } catch (PropertyVetoException e) {
        e.printStackTrace();
    }
}
项目:incubator-netbeans    文件:MultiFileSystem3Test.java   
/**
 * 
 * @param testName name of test 
 * @return  array of FileSystems that should be tested in test named: "testName" */
protected FileSystem[] createFileSystem (String testName, String[] resources) throws IOException {        
        FileSystem lfs = TestUtilHid.createLocalFileSystem("mfs3"+testName, resources);
        FileSystem xfs = TestUtilHid.createXMLFileSystem(testName, resources);
        FileSystem mfs = new MultiFileSystem(lfs, xfs);
        try {
            mfs.setSystemName("mfs3test");
        } catch (PropertyVetoException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        }
    return new FileSystem[] {mfs,lfs,xfs};
}
项目:incubator-netbeans    文件:AttrTest.java   
/** it mounts LocalFileSystem in temorary directory
     */
    private void preprocess() throws IOException,PropertyVetoException {
//        fileSystemFile.mkdir();
        clearWorkDir();
        fileSystemDir = new File(getWorkDir(), "testAtt123rDir");
        if(fileSystemDir.mkdir() == false || fileSystemDir.isDirectory() == false) {
            throw new IOException (fileSystemDir.toString() + " is not directory");
        }
        fileSystem = new LocalFileSystem();
        fileSystem.setRootDirectory(fileSystemDir);
    }
项目:incubator-netbeans    文件:DocumentsDlg.java   
private void updateNodes() {
    //Create nodes for TopComponents, sort them using their own comparator
    List<TopComponent> tcList = getOpenedDocuments();
    TopComponent activeTC = TopComponent.getRegistry().getActivated();
    TopComponentNode[] tcNodes = new TopComponentNode[tcList.size()];
    TopComponentNode toSelect = null;
    for (int i = 0; i < tcNodes.length; i++) {
        TopComponent tc = tcList.get(i);
        tcNodes[i] = new TopComponentNode(tc);
        if( tc == activeTC ) {
            toSelect = tcNodes[i];
        }
    }
    if( radioOrderByName.isSelected() ) {
        Arrays.sort(tcNodes);
    }

    Children.Array nodeArray = new Children.Array();
    nodeArray.add(tcNodes);
    Node root = new AbstractNode(nodeArray);
    explorer.setRootContext(root);
    // set focus to documents list
    listView.requestFocus();
    // select the active editor tab or the first item if possible
    if (tcNodes.length > 0) {
        try {
            if( null == toSelect ) 
                toSelect = tcNodes[0];
            explorer.setSelectedNodes(new Node[] {toSelect} );
        } catch (PropertyVetoException exc) {
            // do nothing, what should I do?
        }
    }
}
项目:OpenJSharp    文件:SynthInternalFrameTitlePane.java   
protected void assembleSystemMenu() {
    systemPopupMenu = new JPopupMenuUIResource();
    addSystemMenuItems(systemPopupMenu);
    enableActions();
    menuButton = createNoFocusButton();
    updateMenuIcon();
    menuButton.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            try {
                frame.setSelected(true);
            } catch(PropertyVetoException pve) {
            }
            showSystemMenu();
        }
    });
    JPopupMenu p = frame.getComponentPopupMenu();
    if (p == null || p instanceof UIResource) {
        frame.setComponentPopupMenu(systemPopupMenu);
    }
    if (frame.getDesktopIcon() != null) {
        p = frame.getDesktopIcon().getComponentPopupMenu();
        if (p == null || p instanceof UIResource) {
            frame.getDesktopIcon().setComponentPopupMenu(systemPopupMenu);
        }
    }
    setInheritsPopupMenu(true);
}