Package net.andydvorak.intellij.lessc.state

Examples of net.andydvorak.intellij.lessc.state.LessProfile


        this.project = project;
        this.lessManager = LessManager.getInstance(project);

        this.lessProfile = lessProfile;
        this.currentLessProfileUiState = new LessProfile(lessProfile.getId(), lessProfile);

        this.lessProfileId = lessProfile.getId();
        this.lessProfileName = lessProfile.getName();
        this.lessProfilesPanel = lessProfilesPanel;
View Full Code Here


        // have null input fields.
        if (this.lessDirTextField == null) {
            return lessProfile;
        }

        final LessProfile profile = new LessProfile(lessProfileId, lessProfile);
        profile.setLessDirPath(this.lessDirTextField.getText());
        profile.setIncludePattern(this.includePatternTextField.getText());
        profile.setExcludePattern(this.excludePatternTextField.getText());
        profile.setCssDirectories(new ArrayList<CssDirectory>(cssDirectories));
        profile.setCompileAutomatically(this.compileAutomaticallyOnSaveCheckBox.isSelected());
        profile.setCompressOutput(this.compressCssCheckbox.isSelected());
        return profile;
    }
View Full Code Here

        initTree();
    }

    protected boolean wasObjectStored(final Object o) {
        if (o == null || LessProfile.class != o.getClass()) return false;
        final LessProfile profile = (LessProfile) o;
        return lessManager.getProfileMap().containsKey(profile.getId());
    }
View Full Code Here

        // Check for duplicate profile names
        for (int i = 0; i < myRoot.getChildCount(); i++) {
            final MyNode node = (MyNode) myRoot.getChildAt(i);
            final LessProfileConfigurableForm form = (LessProfileConfigurableForm) node.getConfigurable();
            final LessProfile profile = form.getCurrentState();
            final String name = profile.getName();
            final String dirPath = profile.getLessDirPath();

            if (StringUtils.isBlank(name)) {
                selectNodeInTree(name);
                throw new ConfigurationException(UIBundle.message("blank.less.profile.name"));
            }

            if (names.contains(name)) {
                selectNodeInTree(name);
                throw new ConfigurationException(UIBundle.message("duplicate.less.profile.name", name));
            }

            if (StringUtils.isBlank(dirPath)) {
                selectNodeInTree(name);
                throw new ConfigurationException(UIBundle.message("blank.less.profile.source.dir"));
            }

            if (!profile.getLessDir().exists()) {
                if (!confirmWarning(UIBundle.message("nonexistent.less.profile.source.dir.title"),
                                    UIBundle.message("nonexistent.less.profile.source.dir.prompt", dirPath))) {
                    selectNodeInTree(name);
                    throw new ConfigurationException(UIBundle.message("nonexistent.less.profile.source.dir.error", dirPath));
                }
            }

            if (profile.getCssDirectories().isEmpty()) {
                selectNodeInTree(name);
                throw new ConfigurationException(UIBundle.message("no.less.profile.css.dirs"));
            }

            for (final CssDirectory cssDirectory : profile.getCssDirectories()) {
                if (!new File(cssDirectory.getPath()).exists()) {
                    if (!confirmWarning(UIBundle.message("nonexistent.less.profile.css.dir.title"),
                                        UIBundle.message("nonexistent.less.profile.css.dir.prompt", dirPath))) {
                        selectNodeInTree(name);
                        throw new ConfigurationException(UIBundle.message("nonexistent.less.profile.css.dir.error", dirPath));
View Full Code Here

            }

            public void actionPerformed(final AnActionEvent event) {
                final String name = askForProfileName(addPromptTitle, "");
                if (name == null) return;
                final LessProfile lessProfile = new LessProfile(getNextId(), name);
                addProfileNode(lessProfile);
            }
        });

        result.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));

        final String copyText = UIBundle.message("action.copy.less.profile.text");
        final String copyDescription = UIBundle.message("action.copy.less.profile.description");
        final String copyPromptTitle = UIBundle.message("action.copy.less.profile.prompt.title");

        result.add(new AnAction(copyText, copyDescription, PlatformIcons.COPY_ICON) {
            {
                registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.CTRL_MASK)), myTree);
            }
            public void actionPerformed(final AnActionEvent event) {
                final String profileName = askForProfileName(copyPromptTitle, "");
                if (profileName == null) return;
                final LessProfile clone = new LessProfile(getNextId(), (LessProfile) getSelectedObject());
                clone.setName(profileName);
                addProfileNode(clone);
            }

            public void update(final AnActionEvent event) {
                super.update(event);
View Full Code Here

    private void reloadTree() {
        myRoot.removeAllChildren();
        profileForms.clear();
        final Collection<LessProfile> profiles = lessManager.getProfiles();
        for (final LessProfile profile : profiles) {
            final LessProfile clone = new LessProfile(profile.getId(), profile);
            final LessProfileConfigurableForm profileForm = new LessProfileConfigurableForm(project, clone, this, TREE_UPDATER);
            profileForms.add(profileForm);
            addNode(new MyNode(profileForm), myRoot);
        }
        isInitialized.set(true);
View Full Code Here

    private Map<Integer, LessProfile> getUIProfileMap() {
        final Map<Integer, LessProfile> profiles = new com.intellij.util.containers.HashMap<Integer, LessProfile>();
        for (int i = 0; i < myRoot.getChildCount(); i++) {
            final MyNode node = (MyNode) myRoot.getChildAt(i);
            final LessProfile lessProfile = ((LessProfileConfigurableForm) node.getConfigurable()).getEditableObject();
            profiles.put(lessProfile.getId(), lessProfile);
        }
        return profiles;
    }
View Full Code Here

    }

    // TODO: This is a bit quirky and doesn't seem to work if the new CSS directory hasn't been created yet and its parent dir isn't open in the project view
    public void handleMoveEvent(final VirtualFileMoveEvent virtualFileMoveEvent) {
        if (isSupported(virtualFileMoveEvent, false)) {
            final LessProfile lessProfile = getFirstLessProfile(virtualFileMoveEvent);
            if (lessProfile == null) {
                return;
            }
            try {
                VirtualFileLocationChange.moveCssFiles(virtualFileMoveEvent, lessProfile, vfsLocationChangeDialog);
View Full Code Here

        }
    }

    public void handleCopyEvent(final VirtualFileCopyEvent virtualFileCopyEvent) {
        if (isSupported(virtualFileCopyEvent, false)) {
            final LessProfile lessProfile = getFirstLessProfile(virtualFileCopyEvent);
            if (lessProfile == null) {
                return;
            }
            try {
                VirtualFileLocationChange.copyCssFiles(virtualFileCopyEvent, lessProfile, vfsLocationChangeDialog);
View Full Code Here

        }
    }

    public void handleDeleteEvent(final VirtualFileEvent virtualFileEvent) {
        if (isSupported(virtualFileEvent, false)) {
            final LessProfile lessProfile = getFirstLessProfile(virtualFileEvent);
            if (lessProfile == null) {
                return;
            }
            try {
                VirtualFileLocationChange.deleteCssFiles(virtualFileEvent, lessProfile, vfsLocationChangeDialog);
View Full Code Here

TOP

Related Classes of net.andydvorak.intellij.lessc.state.LessProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.