Search in sources :

Example 1 with RuntimeException

use of com.sun.star.uno.RuntimeException in project Gargoyle by callakrsos.

the class LogViewController method start.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2017. 1. 11.
	 */
public void start() {
    if (isRunning.get())
        throw new RuntimeException("Already started. ");
    Thread thread = new Thread(() -> {
        isStared.set(true);
        watchFile();
    });
    thread.setDaemon(true);
    thread.start();
}
Also used : RuntimeException(com.sun.star.uno.RuntimeException)

Example 2 with RuntimeException

use of com.sun.star.uno.RuntimeException in project Gargoyle by callakrsos.

the class PagedCodeAreaHelper method init.

/* (non-Javadoc)
	 * @see com.kyj.fx.voeditor.visual.component.text.CodeAreaHelper#init()
	 */
@Override
protected void init() {
    if (codeArea == null)
        throw new RuntimeException("TextView is null ");
    defaultSelectionHandler = new CodeAreaDefaultSelectionHandler(codeArea);
    this.codeArea.setOnMouseClicked(defaultSelectionHandler);
    this.codeMoveDeligator = new CodeAreaMoveLineHelper(codeArea);
    this.dragDropHelper = new CodeAreaFileDragDropHelper(codeArea);
    this.findAndReplaceHelper = new PagedCodeAreaFindAndReplaceHelper(bigTextView);
    contextMenu = codeArea.getContextMenu();
    if (contextMenu == null) {
        contextMenu = new ContextMenu();
        codeArea.setContextMenu(contextMenu);
    }
    createMenus();
}
Also used : RuntimeException(com.sun.star.uno.RuntimeException) ContextMenu(javafx.scene.control.ContextMenu)

Example 3 with RuntimeException

use of com.sun.star.uno.RuntimeException in project Gargoyle by callakrsos.

the class GitTest method importProject.

/**
	 * 프로젝트 import 예제 기능 이상없음.
	 * @작성자 : KYJ
	 * @작성일 : 2017. 2. 15.
	 * @throws IOException
	 * @throws InvalidRemoteException
	 * @throws TransportException
	 * @throws GitAPIException
	 */
@Test
public void importProject() throws IOException, InvalidRemoteException, TransportException, GitAPIException {
    if (true)
        throw new RuntimeException("if you want test, plz remove this line.");
    CloneCommand cloneRepository = Git.cloneRepository();
    File directory = new File("GitCheckoutDir");
    directory.mkdirs();
    cloneRepository.setDirectory(directory);
    //코드를 다운받을지 유무
    cloneRepository.setNoCheckout(true);
    cloneRepository.setURI("https://github.com/callakrsos/Gargoyle");
    cloneRepository.setCredentialsProvider(usernamePasswordCredentials);
    Git call = cloneRepository.call();
    System.out.println(call);
}
Also used : CloneCommand(org.eclipse.jgit.api.CloneCommand) RuntimeException(com.sun.star.uno.RuntimeException) Git(org.eclipse.jgit.api.Git) File(java.io.File) Test(org.junit.Test)

Example 4 with RuntimeException

use of com.sun.star.uno.RuntimeException in project Gargoyle by callakrsos.

the class DateUtil method toCalendar.

public static final Calendar toCalendar(Date date) {
    if (date == null)
        throw new RuntimeException("date is null.");
    Calendar cal = GregorianCalendar.getInstance();
    cal.setTime(date);
    return cal;
}
Also used : RuntimeException(com.sun.star.uno.RuntimeException) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar)

Example 5 with RuntimeException

use of com.sun.star.uno.RuntimeException in project Gargoyle by callakrsos.

the class SVNCat method cat.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 6. 13.
	 * @param path
	 * @param revision
	 * @param encoding
	 * @param exceptionHandler
	 * @return
	 */
public String cat(String path, String revision, String encoding, Consumer<Exception> exceptionHandler) {
    String result = "";
    SVNProperties fileProperties = new SVNProperties();
    try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
        /*
			 * Checks up if the specified path really corresponds to a file. If
			 * doesn't the program exits. SVNNodeKind is that one who says what
			 * is located at a path in a revision. -1 means the latest revision.
			 */
        String _path = path;
        try {
            _path = URLDecoder.decode(_path, "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }
        SVNRepository repository = getRepository();
        SVNNodeKind nodeKind = repository.checkPath(_path, -1);
        if (nodeKind == SVNNodeKind.NONE) {
            if (exceptionHandler != null) {
                exceptionHandler.accept(new RuntimeException("There is no entry at '" + getUrl() + "'."));
            } else
                throw new RuntimeException("There is no entry at '" + getUrl() + "'.");
        } else if (nodeKind == SVNNodeKind.DIR) {
            if (exceptionHandler != null) {
                exceptionHandler.accept(new RuntimeException("The entry at '" + getUrl() + "' is a directory while a file was expected."));
            } else
                throw new RuntimeException("The entry at '" + getUrl() + "' is a directory while a file was expected.");
        }
        /*
			 * Gets the contents and properties of the file located at filePath
			 * in the repository at the latest revision (which is meant by a
			 * negative revision number).
			 */
        long parseLong = -1;
        try {
            parseLong = Long.parseLong(revision);
        } catch (NumberFormatException e) {
        }
        repository.getFile(_path, parseLong, fileProperties, baos);
        /*
			 * Here the SVNProperty class is used to get the value of the
			 * svn:mime-type property (if any). SVNProperty is used to
			 * facilitate the work with versioned properties.
			 */
        String mimeType = fileProperties.getStringValue(SVNProperty.MIME_TYPE);
        /*
			 * SVNProperty.isTextMimeType(..) method checks up the value of the
			 * mime-type file property and says if the file is a text (true) or
			 * not (false).
			 */
        boolean isTextType = SVNProperty.isTextMimeType(mimeType);
        Iterator<String> iterator = fileProperties.nameSet().iterator();
        /*
			 * Displays file properties.
			 */
        while (iterator.hasNext()) {
            String propertyName = iterator.next();
            String propertyValue = fileProperties.getStringValue(propertyName);
            LOGGER.debug("File property: " + propertyName + "=" + propertyValue);
        }
        /*
			 * Displays the file contents in the console if the file is a text.
			 */
        if (isTextType) {
            //				try (StringOutputStream out = new StringOutputStream()) {
            //					baos.writeTo(out);
            // out.getString();
            result = baos.toString(encoding);
        //				}
        } else /*
			 * 2017.2.28
			 * binay type은 무거운 데이터를 읽어들일수있는 가능성때문에 여기서 제외시켜놓겠음.
			 */
        if (SVNProperty.isBinaryMimeType(mimeType)) {
            //baos.toString(encoding);
            result = mimeType + " is not support.";
        } else {
            LOGGER.debug("File contents can not be displayed in the console since the mime-type property says that it's not a kind of a text file.");
        }
    } catch (Exception e) {
        LOGGER.error(ValueUtil.toString(e));
        if (exceptionHandler != null)
            exceptionHandler.accept(e);
    }
    return result;
}
Also used : SVNNodeKind(org.tmatesoft.svn.core.SVNNodeKind) RuntimeException(com.sun.star.uno.RuntimeException) SVNProperties(org.tmatesoft.svn.core.SVNProperties) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository) ByteArrayOutputStream(java.io.ByteArrayOutputStream) RuntimeException(com.sun.star.uno.RuntimeException) IOException(java.io.IOException)

Aggregations

RuntimeException (com.sun.star.uno.RuntimeException)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 ContextMenu (javafx.scene.control.ContextMenu)1 CloneCommand (org.eclipse.jgit.api.CloneCommand)1 Git (org.eclipse.jgit.api.Git)1 Test (org.junit.Test)1 SVNNodeKind (org.tmatesoft.svn.core.SVNNodeKind)1 SVNProperties (org.tmatesoft.svn.core.SVNProperties)1 SVNRepository (org.tmatesoft.svn.core.io.SVNRepository)1