Search in sources :

Example 11 with FileWrapper

use of com.kyj.fx.voeditor.visual.component.FileWrapper in project Gargoyle by callakrsos.

the class SystemLayoutViewController method deleteFileMenuItemOnAction.

/********************************
	 * 작성일 : 2016. 8. 29. 작성자 : KYJ
	 *
	 * 파일삭제.
	 *
	 * @param e
	 ********************************/
public void deleteFileMenuItemOnAction(ActionEvent e) {
    TreeItem<FileWrapper> selectedItem = treeProjectFile.getSelectionModel().getSelectedItem();
    if (selectedItem != null) {
        File file = selectedItem.getValue().getFile();
        if (file != null && file.exists()) {
            Optional<Pair<String, String>> showYesOrNoDialog = DialogUtil.showYesOrNoDialog("파일삭제.", file.getName() + " 정말 삭제하시겠습니까? \n[휴지통에 보관되지않음.]");
            showYesOrNoDialog.ifPresent(pair -> {
                if ("Y".equals(pair.getValue())) {
                    if (file.isDirectory())
                        FileUtil.deleteDir(file);
                    else
                        file.delete();
                    TreeItem<FileWrapper> root = selectedItem.getParent();
                    root.getChildren().remove(selectedItem);
                }
            });
        }
    }
}
Also used : FileWrapper(com.kyj.fx.voeditor.visual.component.FileWrapper) File(java.io.File) Pair(javafx.util.Pair)

Example 12 with FileWrapper

use of com.kyj.fx.voeditor.visual.component.FileWrapper in project Gargoyle by callakrsos.

the class SystemLayoutViewController method menuItemCodeAnalysisMenuItemOnAction.

/********************************
	 * 작성일 : 2016. 5. 29. 작성자 : KYJ
	 *
	 * TODO 자바 코드 분석기 테스트단계.
	 *
	 * @param e
	 ********************************/
public void menuItemCodeAnalysisMenuItemOnAction(ActionEvent e) {
    TreeItem<FileWrapper> selectedItem = treeProjectFile.getSelectionModel().getSelectedItem();
    if (selectedItem != null) {
        FileWrapper value = selectedItem.getValue();
        File sourceFile = value.getFile();
        // if(selectedItem instanceof JavaProjectMemberFileTreeItem)
        {
            if (value.isSVNConnected()) {
                File wcDbFile = value.getWcDbFile();
                if (wcDbFile != null && wcDbFile.exists()) {
                    SVNWcDbClient client;
                    try {
                        client = new SVNWcDbClient(wcDbFile);
                    // TODO 코드 완성시키기.
                    // new SVNFileHistoryComposite(
                    // JavaSVNManager.createNewInstance(client.getUrl())
                    // , sourceFile);
                    // new JavaSVNManager(new Properties(defaults))
                    } catch (Exception e1) {
                        LOGGER.error(ValueUtil.toString(e1));
                    }
                }
            }
        }
        if (sourceFile != null && sourceFile.exists()) {
            try {
                if (FileUtil.isJavaFile(sourceFile)) {
                    JavaProjectFileTreeItem javaProjectFileTreeItem = FileUtil.toJavaProjectFileTreeItem(selectedItem);
                    if (javaProjectFileTreeItem != null) {
                        Tab tab = new Tab(sourceFile.getName(), new CodeAnalysisJavaTextArea(sourceFile));
                        SpecResource resource = new SpecResource(javaProjectFileTreeItem.getValue().getFile(), sourceFile);
                        SpecTabPane newInstance = new SpecTabPane(resource, tab);
                        loadNewSystemTab(sourceFile.getName(), newInstance);
                    }
                } else {
                    DialogUtil.showMessageDialog("자바 파일이 아닙니다.");
                }
            } catch (Exception ex) {
                DialogUtil.showExceptionDailog(ex);
            }
        }
    }
}
Also used : Tab(javafx.scene.control.Tab) DockTab(com.kyj.fx.voeditor.visual.component.dock.tab.DockTab) SpecResource(com.kyj.fx.voeditor.visual.words.spec.auto.msword.ui.model.SpecResource) SpecTabPane(com.kyj.fx.voeditor.visual.words.spec.auto.msword.ui.tabs.SpecTabPane) FileWrapper(com.kyj.fx.voeditor.visual.component.FileWrapper) JavaProjectFileTreeItem(com.kyj.fx.voeditor.visual.component.JavaProjectFileTreeItem) CodeAnalysisJavaTextArea(com.kyj.fx.voeditor.visual.component.text.CodeAnalysisJavaTextArea) File(java.io.File) SVNWcDbClient(com.kyj.scm.manager.svn.java.SVNWcDbClient) IOException(java.io.IOException) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException)

Example 13 with FileWrapper

use of com.kyj.fx.voeditor.visual.component.FileWrapper in project Gargoyle by callakrsos.

the class SystemLayoutViewController method menuItemSCMGraphsOnAction.

/**
	 * SCM Graph분석 화면을 생성후 보여주는 처리를 함.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 7. 21.
	 * @param event
	 */
public void menuItemSCMGraphsOnAction(ActionEvent event) {
    TreeItem<FileWrapper> selectedItem = treeProjectFile.getSelectionModel().getSelectedItem();
    if (selectedItem != null) {
        FileWrapper value = selectedItem.getValue();
        if (value.isSVNConnected()) {
            File wcDbFile = value.getWcDbFile();
            if (wcDbFile.exists()) {
                try {
                    SVNWcDbClient client = new SVNWcDbClient(wcDbFile);
                    String rootUrl = client.getUrl();
                    LOGGER.debug("root URL : {}", rootUrl);
                    Properties properties = new Properties();
                    properties.put(JavaSVNManager.SVN_URL, rootUrl);
                    loadNewSystemTab("Scm Graph", FxUtil.createSVNGraph(properties));
                } catch (GargoyleException e) {
                    LOGGER.error(ValueUtil.toString(e));
                    DialogUtil.showExceptionDailog(e, e.getErrorCode().getCodeMessage());
                } catch (Exception e) {
                }
            }
        }
    }
}
Also used : FileWrapper(com.kyj.fx.voeditor.visual.component.FileWrapper) Properties(java.util.Properties) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) File(java.io.File) SVNWcDbClient(com.kyj.scm.manager.svn.java.SVNWcDbClient) IOException(java.io.IOException) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException)

Aggregations

FileWrapper (com.kyj.fx.voeditor.visual.component.FileWrapper)13 File (java.io.File)12 GargoyleException (com.kyj.fx.voeditor.visual.exceptions.GargoyleException)7 IOException (java.io.IOException)7 JavaProjectFileTreeItem (com.kyj.fx.voeditor.visual.component.JavaProjectFileTreeItem)3 JavaProjectMemberFileTreeItem (com.kyj.fx.voeditor.visual.component.JavaProjectMemberFileTreeItem)3 Pair (javafx.util.Pair)3 DockTab (com.kyj.fx.voeditor.visual.component.dock.tab.DockTab)2 FilePropertiesComposite (com.kyj.fx.voeditor.visual.component.file.FilePropertiesComposite)2 CodeAnalysisJavaTextArea (com.kyj.fx.voeditor.visual.component.text.CodeAnalysisJavaTextArea)2 SVNWcDbClient (com.kyj.scm.manager.svn.java.SVNWcDbClient)2 Path (java.nio.file.Path)2 Parent (javafx.scene.Parent)2 ImageViewPane (com.kyj.fx.voeditor.visual.component.ImageViewPane)1 PDFImageBasePane (com.kyj.fx.voeditor.visual.component.PDFImageBasePane)1 ProjectFileTreeItemCreator (com.kyj.fx.voeditor.visual.component.ProjectFileTreeItemCreator)1 ResultDialog (com.kyj.fx.voeditor.visual.component.ResultDialog)1 JavaProcessMonitor (com.kyj.fx.voeditor.visual.component.bci.view.JavaProcessMonitor)1 CaptureScreenComposite (com.kyj.fx.voeditor.visual.component.capture.CaptureScreenComposite)1 ReadOnlyConsole (com.kyj.fx.voeditor.visual.component.console.ReadOnlyConsole)1