Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 package org.apache.cayenne.modeler.util;
Menu that contains a list of previously used files. It is built from CayenneModeler preferences by calling rebuildFromPreferences.
 public class RecentFileMenu extends JMenu implements RecentFileListListener {
Constructor for RecentFileMenu.
     public RecentFileMenu(String s) {

     public FileMenuItem add(FileMenuItem menuItem) {
         return (FileMenuItemsuper.add(menuItem);

Rebuilds internal menu items list with the files stored in CayenneModeler preferences.
     public void rebuildFromPreferences() {
         ModelerPreferences pref = ModelerPreferences.getPreferences();
         Vector<?> arr = pref.getVector(.);
         while (arr.size() > .) {
             arr.remove(arr.size() - 1);
         // read menus
         Component[] comps = getMenuComponents();
         int curSize = comps.length;
         int prefSize = arr.size();
         for (int i = 0; i < prefSizei++) {
             String name = (Stringarr.get(i);
             if (i < curSize) {
                 // update existing one
                 FileMenuItem item = (FileMenuItemcomps[i];
             else {
                 // add a new one
                 FileMenuItem item = new FileMenuItem(name);
         // remove any hanging items
         for (int i = curSize - 1; i >= prefSizei--) {
     protected Action findAction() {
         return Application.getInstance().getAction(OpenProjectAction.getActionName());
     public void recentFileListChanged() {
         setEnabled(getMenuComponentCount() > 0);
New to GrepCode? Check out our FAQ X