當前位置: 首頁>>代碼示例>>Java>>正文


Java DataObject.move方法代碼示例

本文整理匯總了Java中org.openide.loaders.DataObject.move方法的典型用法代碼示例。如果您正苦於以下問題:Java DataObject.move方法的具體用法?Java DataObject.move怎麽用?Java DataObject.move使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.loaders.DataObject的用法示例。


在下文中一共展示了DataObject.move方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testContextLookupIsConsistentAfterMove

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@RandomlyFails
public void testContextLookupIsConsistentAfterMove() throws Exception {              
    ConsistencyCheckProvider.setCalled(0);
    // Prepare the data object (to initialize the lookup)
    FileObject fo = fs.getRoot().createData("test2", "txt");
    DataObject data = DataObject.find(fo);
    EditorCookie ec = data.getCookie(EditorCookie.class);

    // now move it (the lookup should update itself)
    FileObject fld = fs.getRoot().createFolder("folder1");
    DataFolder df = DataFolder.findFolder(fld);
    data.move(df);

    // now open the editor (invoke AnnotationProviders)
    // and check the lookup
    ec.open();
    assertEquals("Consistent lookup content", data.getPrimaryFile(),ConsistencyCheckProvider.getInLkp());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:AnnotationProviderTest.java

示例2: testContextLookupFiresDuringMove

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@RandomlyFails
public void testContextLookupFiresDuringMove() throws Exception {              
    // Prepare the data object (to initialize the lookup)
    FileObject fo = fs.getRoot().createData("test3", "txt");
    DataObject data = DataObject.find(fo);
    EditorCookie ec = data.getCookie(EditorCookie.class);

    // open the editor and check the lookup before move
    ec.open();
    assertEquals("Lookup content consistent before move", data.getPrimaryFile(),ConsistencyCheckProvider.getInLkp());

    forceGC ();
    
    // now move the file
    ConsistencyCheckProvider.setCalled(0);
    FileObject fld = fs.getRoot().createFolder("folder1");
    DataFolder df = DataFolder.findFolder(fld);
    data.move(df);

    forceGC ();
    
    // check the result
    assertEquals("Lookup fires one change during move", 1, ConsistencyCheckProvider.changes);
    assertEquals("Lookup content consistent after move", data.getPrimaryFile(),ConsistencyCheckProvider.getInLkp());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:AnnotationProviderTest.java

示例3: testMove

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/** Test updating document property Document.TitleProperty when dataobject is moved */
public void testMove () throws IOException {
    FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.obj");
    FileUtil.createFolder(FileUtil.getConfigRoot(), "newFolder");

    DataObject obj = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.obj"));
    DataFolder dFolder = (DataFolder) DataObject.find(FileUtil.getConfigFile("newFolder"));

    assertEquals( MyDataObject.class, obj.getClass());
    assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader );

    EditorCookie ec = obj.getCookie(EditorCookie.class);

    StyledDocument doc = ec.openDocument();

    String val = (String) doc.getProperty(Document.TitleProperty);
    assertTrue("Test property value", val.startsWith("someFolder/someFile.obj"));

    obj.move(dFolder);

    val = (String) doc.getProperty(Document.TitleProperty);
    assertTrue("Test property value", val.startsWith("newFolder/someFile.obj"));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:DocumentTitlePropertyTest.java

示例4: paste

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public Transferable paste() throws IOException {
    if (targetFolder != null) {
        for (Iterator iterator = sourceDataObjects.iterator(); iterator.hasNext();) {
            DataObject dataObject = (DataObject) iterator.next();
            boolean isValid = dataObject != null && dataObject.isValid();
            
            if (isValid && pasteOperation == LoaderTransfer.CLIPBOARD_COPY) {
                dataObject.createShadow(targetFolder);
            } 
            
            if (isValid && pasteOperation == LoaderTransfer.CLIPBOARD_CUT) {
                dataObject.move(targetFolder);
            }
                                
        }                
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:ActionPasteType.java

示例5: testDOMove154813

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public void testDOMove154813() throws IOException {
    FileObject file = createFileObject("test1/empty.txt", "", "\n");
    DataObject dfile = DataObject.find(file);
    Document doc = createDocument("text/x-testtesttest", "");
    doc.putProperty(Document.StreamDescriptionProperty, dfile);
    Source source = Source.create(doc);
    assertNotNull("No Source for " + doc, source);
    FileObject wd = file.getParent().getParent();
    FileObject nueParent = wd.getFileObject("test2");

    if (nueParent == null) {
        nueParent = wd.createFolder("test2");
    }

    dfile.move(DataFolder.findFolder(nueParent));
    source = Source.create(doc);
    assertNotNull("No Source for " + doc, source);
    assertEquals("Correct FileObject", dfile.getPrimaryFile(), source.getFileObject());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:SourceTest.java

示例6: testModifiedMove

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public void testModifiedMove() throws Exception {
    FileObject root = FileUtil.toFileObject(getWorkDir());
    FileObject data = FileUtil.createData(root, "someFolder/someFile.obj");
    
    DataObject obj = DataObject.find(data);
    assertEquals( MyDataObject.class, obj.getClass());
    assertEquals(MyLoader.class, obj.getLoader().getClass());
    
    EditorCookie ec = obj.getLookup().lookup(EditorCookie.class);
    assertNotNull("Editor cookie found", ec);
    ec.open();
    JEditorPane[] arr = openedPanes(ec);
    assertEquals("One pane is opened", 1, arr.length);
            
    StyledDocument doc = ec.openDocument();
    doc.insertString(0, "Ahoj", null);
    assertTrue("Modified", obj.isModified());
    Thread.sleep(100);
    
    FileObject newFolder = FileUtil.createFolder(root, "otherFolder");
    DataFolder df = DataFolder.findFolder(newFolder);
    
    obj.move(df);
    
    assertEquals(newFolder, obj.getPrimaryFile().getParent());
    
    assertEquals("Still one editor", 1, openedPanes(ec).length);
    DD.assertNoCalls();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:DataEditorSupportMoveTest.java

示例7: moveButton

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/**
 * Move toolbar button to a new position.
 */
private boolean moveButton( DataObject ob, int dropIndex, boolean dropBefore ) throws IOException {
    //find out which button is currently under the drag cursor
    DataObject objUnderCursor = getDataObjectUnderDropCursor( dropIndex-1, dropBefore );

    if( sourceToolbar != currentToolbar ) {
        //move button to the new toolbar
        ob.move(getBackingFolder(currentToolbar));
    }

    reorderButtons( ob, objUnderCursor );
    //else we're dragging a button to an empty toolbar
    return true;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:DnDSupport.java

示例8: moveDO

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
private void moveDO(File from, File to) throws DataObjectNotFoundException, IOException {
    DataObject daoFrom = DataObject.find(FileUtil.toFileObject(from));
    DataObject daoTarget = DataObject.find(FileUtil.toFileObject(to.getParentFile()));
    daoFrom.move((DataFolder) daoTarget);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:FilesystemInterceptorTest.java

示例9: moveDO

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
private void moveDO(File from, File to) throws DataObjectNotFoundException, IOException {
    DataObject daoFrom = DataObject.find(FileUtil.toFileObject(from));    
    DataObject daoTarget = DataObject.find(FileUtil.toFileObject(to.getParentFile()));    
    daoFrom.move((DataFolder) daoTarget);    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:InteceptorTest.java

示例10: moveDO

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
private void moveDO (File from, File to) throws DataObjectNotFoundException, IOException {
    DataObject daoFrom = DataObject.find(FileUtil.toFileObject(from));
    DataObject daoTarget = DataObject.find(FileUtil.toFileObject(to.getParentFile()));
    daoFrom.move((DataFolder) daoTarget);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:InterceptorTest.java


注:本文中的org.openide.loaders.DataObject.move方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。