当前位置: 首页>>代码示例>>Java>>正文


Java UndoRedo.Manager方法代码示例

本文整理汇总了Java中org.openide.awt.UndoRedo.Manager方法的典型用法代码示例。如果您正苦于以下问题:Java UndoRedo.Manager方法的具体用法?Java UndoRedo.Manager怎么用?Java UndoRedo.Manager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.awt.UndoRedo的用法示例。


在下文中一共展示了UndoRedo.Manager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUndoRedo

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
/**
     * Gets the undo redo manager.
     * @return the manager
     */
    protected final synchronized UndoRedo.Manager getUndoRedo() {
        CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this);
        if (redirect != null) {
            return redirect.getUndoRedo();
        }
        
        if (undoRedo == null) {
            UndoRedo.Manager mgr = createUndoRedoManager();
//            if (!(mgr instanceof UndoRedoManager)) {
//                ERR.info("createUndoRedoManager(): ignoring created instance of class " + // NOI18N
//                        mgr.getClass() + " since CloneableEditorSupport requires instance of " + // NOI18N"
//                        UndoRedoManager.class.getName() + "\n"); // NOI18N
//                mgr = new UndoRedoManager(this);
//            }
            undoRedo = mgr;
        }

        return undoRedo;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:CloneableEditorSupport.java

示例2: copyActivePlacemark

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
void copyActivePlacemark() {
    Guardian.assertNotNull("product", product);
    Placemark activePlacemark = getSelectedPlacemark();
    Guardian.assertNotNull("activePlacemark", activePlacemark);
    Placemark newPlacemark = Placemark.createPointPlacemark(activePlacemark.getDescriptor(),
                                                            "copy_of_" + activePlacemark.getName(),
                                                            activePlacemark.getLabel(),
                                                            activePlacemark.getDescription(),
                                                            activePlacemark.getPixelPos(),
                                                            activePlacemark.getGeoPos(),
                                                            activePlacemark.getProduct().getSceneGeoCoding());
    newPlacemark.setStyleCss(activePlacemark.getStyleCss());
    if (PlacemarkDialog.showEditPlacemarkDialog(
            SwingUtilities.getWindowAncestor(this), product, newPlacemark, placemarkDescriptor)) {
        makePlacemarkNameUnique(newPlacemark);
        UndoRedo.Manager undoManager = SnapApp.getDefault().getUndoManager(product);
        if (undoManager != null) {
            undoManager.addEdit(UndoablePlacemarkActionFactory.createUndoablePlacemarkCopying(product, newPlacemark, placemarkDescriptor));
        }
        updateUIState();
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:23,代码来源:PlacemarkManagerTopComponent.java

示例3: removeSelectedPins

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
void removeSelectedPins() {
    final List<Placemark> placemarks = getSelectedPlacemarks();
    for (Placemark placemark : placemarks) {
        getPlacemarkGroup(product).remove(placemark);
    }
    int selectedRow = placemarkTable.getSelectedRow();
    if (selectedRow >= getPlacemarkGroup(product).getNodeCount()) {
        selectedRow = getPlacemarkGroup(product).getNodeCount() - 1;
    }
    if (selectedRow >= 0) {
        placemarkTable.getSelectionModel().setSelectionInterval(selectedRow, selectedRow);
    }
    UndoRedo.Manager undoManager = SnapApp.getDefault().getUndoManager(product);
    if (undoManager != null) {
        undoManager.addEdit(UndoablePlacemarkActionFactory.createUndoablePlacemarkRemoval(product, placemarks, placemarkDescriptor));
    }
    updateUIState();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:19,代码来源:PlacemarkManagerTopComponent.java

示例4: createDefaultVectorDataNode

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public static VectorDataNode createDefaultVectorDataNode(Product product, String name, String description) {
    CoordinateReferenceSystem modelCrs = product.getSceneCRS();
    SimpleFeatureType type = PlainFeatureFactory.createDefaultFeatureType(modelCrs);
    VectorDataNode vectorDataNode = new VectorDataNode(name, type);
    vectorDataNode.setDescription(description);
    product.getVectorDataGroup().add(vectorDataNode);
    vectorDataNode.getPlacemarkGroup();
    String oldLayerId = selectVectorDataLayer(vectorDataNode);

    UndoRedo.Manager undoManager = SnapApp.getDefault().getUndoManager(product);
    if (undoManager != null) {
        undoManager.addEdit(new UndoableVectorDataNodeInsertion(product, vectorDataNode, oldLayerId));
    }

    return vectorDataNode;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:CreateVectorDataNodeAction.java

示例5: getUndoRedo

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
@Override
public UndoRedo getUndoRedo() {
    if (undoRedo == null) {
        undoRedo = new UndoRedo.Manager();
    }
    return undoRedo;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EmptyViewDescription.java

示例6: getUndoRedoManager

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public UndoRedo.Manager getUndoRedoManager() {
//        if (undoRedoManager == null) {
//            undoRedoManager = new UndoRedoManager();
//            undoRedoManager.setLimit(50);
//        }
        return undoRedoManager;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:FormModel.java

示例7: testUndoRedoEdits

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public void testUndoRedoEdits() throws Exception {
    Document doc = support.openDocument();
    doc.insertString(0, "a", null);
    UndoRedo.Manager ur = support.getUndoRedo();
    MyEdit myEdit = NbDocument.getEditToBeUndoneOfType(support, MyEdit.class);
    assertNotNull("Expected valid myEdit", myEdit);
    ur.undo();
    myEdit = NbDocument.getEditToBeRedoneOfType(support, MyEdit.class);
    assertNotNull("Expected valid myEdit", myEdit);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:EditToBeUndoneRedoneTest.java

示例8: getUndoRedo

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
private UndoRedo.Manager getUndoRedo(EditorCookie cookie) {
    // TODO: working around #96543 
    try {
        Method method = CloneableEditorSupport.class.getDeclaredMethod("getUndoRedo"); // NOI18N
        method.setAccessible(true);
        return (UndoRedo.Manager) method.invoke(cookie);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:EditableDiffView.java

示例9: testUndoDeliversChangesWithTooManyEdits

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public void testUndoDeliversChangesWithTooManyEdits() {
    UndoRedo.Manager man = new UndoRedo.Manager() {
        @Override
        public boolean canUndo() {
            if (super.canUndo()) {
                undoableEditHappened(new UndoableEditEvent(UndoRedoActionTest.this, new MyEdit(true)));
            }
            return super.canUndo();
        }
    };
    doUndoRedoTest(man, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:UndoRedoActionTest.java

示例10: doUndoRedoTest

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
private void doUndoRedoTest(UndoRedo.Manager man, boolean testCounts) {
    me = new MyEdit();
    man.undoableEditHappened(new UndoableEditEvent(this, me));
    assertTrue("Can undo", man.canUndo());
    this.ur = man;
    
    InstanceContent ic = new InstanceContent();
    AbstractLookup lkp = new AbstractLookup(ic);
    Action u = undoAction(lkp);
    Action r = redoAction(lkp);

    assertFalse("Not enabled", u.isEnabled());
    assertFalse("Not enabledR", r.isEnabled());
    MyEdit lu = new MyEdit();
    MyEdit lr = new MyEdit();
    u.addPropertyChangeListener(lu);
    r.addPropertyChangeListener(lr);

    ic.add(this);

    assertTrue("Action is enabled", u.isEnabled());
    assertEquals("One change", 1, lu.cnt);
    assertEquals("No redo change", 0, lr.cnt);
    assertEquals("Undo presentation", "&Undo My Undo", u.getValue(Action.NAME));

    u.actionPerformed(new ActionEvent(this, 0, ""));
    if (testCounts) {
        assertEquals("my edit undone", 1, me.undo);

        assertFalse("No more undo", man.canUndo());
        assertTrue("But redo", man.canRedo());
        assertEquals("Another undo change", 2, lu.cnt);
        assertEquals("New redo change", 1, lr.cnt);
        assertTrue("Redo action enabled", r.isEnabled());
        assertEquals("Redo presentation correct", "&Redo My Redo", r.getValue(Action.NAME));
    }

    r.actionPerformed(new ActionEvent(this, 0, ""));
    assertFalse("Redo action no longer enabled", r.isEnabled());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:UndoRedoActionTest.java

示例11: getUndoRedoManager

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
private UndoRedo.Manager getUndoRedoManager() {
    if (undoRedoManager == null) {
        undoRedoManager = new UndoRedo.Manager();
        undoRedoManager.setLimit(UNDOREDO_LIMIT);
    }

    return undoRedoManager;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:9,代码来源:DiagramScene.java

示例12: Map2DTopComponent

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
/**
 * Creates new form Map2DTopComponent
 */
public Map2DTopComponent() {
    super();
    initComponents();

    setIcon(ICON.getImage());
    this.setFocusable(true);
    undo = new UndoRedo.Manager();
    undo.setLimit(20); // limit to 20 rollback operations
}
 
开发者ID:chhh,项目名称:batmass,代码行数:13,代码来源:Map2DTopComponent.java

示例13: getUndoRedoManager

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public UndoRedo.Manager getUndoRedoManager()
{
    if (undoRedoManager == null)
    {
        undoRedoManager = new UndoRedoManager();
        undoRedoManager.setLimit(300);
    }
    return undoRedoManager;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:10,代码来源:JRTXVisualView.java

示例14: getUndoRedoManager

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public UndoRedo.Manager getUndoRedoManager()
{
    if (undoRedoManager == null)
    {
        undoRedoManager = new UndoRedoManager();           
        undoRedoManager.setLimit(300);     
    }
    return undoRedoManager;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:10,代码来源:JrxmlVisualView.java

示例15: addUndoableEdit

import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public void addUndoableEdit(UndoableEdit edit, boolean aggregate)
{
    notifyReportChange();
    if (aggregate || forceAggregateUndo)
    {
        if (lastUndoableEdit != null &&
             lastUndoableEdit instanceof AggregatedUndoableEdit &&
             System.currentTimeMillis() - lastUndoableEditTime < 100)
         {
             ((AggregatedUndoableEdit)lastUndoableEdit).concatenate(edit);
             lastUndoableEditTime = System.currentTimeMillis();
             return;
         }
    }
    lastUndoableEditTime = System.currentTimeMillis();
    lastUndoableEdit = edit;
    if (getActiveVisualView() != null)
    {
        getActiveVisualView().getUndoRedoManager().undoableEditHappened(new UndoableEditEvent(this, edit));
    }
    else
    {
        // Check if the current lookup contains an undo manager...
        UndoRedo.Manager manager = Lookup.getDefault().lookup(UndoRedo.Manager.class);
        if (manager != null)
        {
            manager.undoableEditHappened(new UndoableEditEvent(this, edit));
        }
    }
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:31,代码来源:IReportManager.java


注:本文中的org.openide.awt.UndoRedo.Manager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。