Search in sources :

Example 6 with OsmorcFacetConfiguration

use of org.osmorc.facet.OsmorcFacetConfiguration in project intellij-plugins by JetBrains.

the class OsmorcFacetManifestGenerationEditorTab method reset.

@Override
public void reset() {
    OsmorcFacetConfiguration configuration = (OsmorcFacetConfiguration) myEditorContext.getFacet().getConfiguration();
    myBundleActivator.setText(configuration.getBundleActivator());
    myBundleSymbolicName.setText(configuration.getBundleSymbolicName());
    myBundleVersion.setText(configuration.getBundleVersion());
    myAdditionalPropertiesEditor.setText(configuration.getAdditionalProperties());
    updateGui();
}
Also used : OsmorcFacetConfiguration(org.osmorc.facet.OsmorcFacetConfiguration)

Example 7 with OsmorcFacetConfiguration

use of org.osmorc.facet.OsmorcFacetConfiguration in project intellij-plugins by JetBrains.

the class OsmorcFacetManifestGenerationEditorTab method apply.

@Override
public void apply() {
    OsmorcFacetConfiguration configuration = (OsmorcFacetConfiguration) myEditorContext.getFacet().getConfiguration();
    configuration.setBundleActivator(myBundleActivator.getText());
    configuration.setBundleSymbolicName(myBundleSymbolicName.getText());
    configuration.setBundleVersion(myBundleVersion.getText());
    configuration.setAdditionalProperties(myAdditionalPropertiesEditor.getText());
}
Also used : OsmorcFacetConfiguration(org.osmorc.facet.OsmorcFacetConfiguration)

Example 8 with OsmorcFacetConfiguration

use of org.osmorc.facet.OsmorcFacetConfiguration in project intellij-plugins by JetBrains.

the class OsmorcFacetGeneralEditorTab method reset.

@Override
public void reset() {
    OsmorcFacetConfiguration configuration = (OsmorcFacetConfiguration) myEditorContext.getFacet().getConfiguration();
    if (configuration.isUseBndFile()) {
        myUseBndFileRadioButton.setSelected(true);
    } else if (configuration.isUseBundlorFile()) {
        myUseBundlorFileRadioButton.setSelected(true);
    } else if (configuration.isOsmorcControlsManifest()) {
        myControlledByOsmorcRadioButton.setSelected(true);
    } else {
        myManuallyEditedRadioButton.setSelected(true);
    }
    myManifestFileChooser.setText(FileUtil.toSystemDependentName(configuration.getManifestLocation()));
    if (configuration.isUseProjectDefaultManifestFileLocation()) {
        myUseProjectDefaultManifestFileLocation.setSelected(true);
    } else {
        myUseModuleSpecificManifestFileLocation.setSelected(true);
    }
    myBndFile.setText(FileUtil.toSystemDependentName(configuration.getBndFileLocation()));
    myBundlorFile.setText(FileUtil.toSystemDependentName(configuration.getBundlorFileLocation()));
    myDoNotSynchronizeFacetCheckBox.setSelected(configuration.isDoNotSynchronizeWithMaven());
    updateGui();
    myModified = false;
}
Also used : OsmorcFacetConfiguration(org.osmorc.facet.OsmorcFacetConfiguration)

Example 9 with OsmorcFacetConfiguration

use of org.osmorc.facet.OsmorcFacetConfiguration in project intellij-plugins by JetBrains.

the class OsmorcFacetJAREditorTab method apply.

@Override
public void apply() throws ConfigurationException {
    String jarFileName = myJarFileTextField.getText();
    if (StringUtil.isEmptyOrSpaces(jarFileName)) {
        throw new ConfigurationException(OsmorcBundle.message("facet.editor.jar.empty.jar.name"));
    }
    OsmorcFacetConfiguration configuration = (OsmorcFacetConfiguration) myEditorContext.getFacet().getConfiguration();
    OutputPathType pathType = getSelectedOutputPathType();
    if (pathType == SpecificOutputPath) {
        String location = myJarOutputPathChooser.getText();
        if (StringUtil.isEmptyOrSpaces(location)) {
            throw new ConfigurationException(OsmorcBundle.message("facet.editor.jar.empty.output.path"));
        }
        String completeOutputPath = new File(location, jarFileName).getPath();
        configuration.setJarFileLocation(completeOutputPath, pathType);
    } else {
        configuration.setJarFileLocation(jarFileName, pathType);
    }
    configuration.setIgnoreFilePattern(myIgnoreFilePatternTextField.getText());
    configuration.setAlwaysRebuildBundleJAR(myAlwaysRebuildBundleJARCheckBox.isSelected());
    configuration.setAdditionalJARContents(myAdditionalJARContentsTableModel.getAdditionalContents());
    myModified = false;
}
Also used : OsmorcFacetConfiguration(org.osmorc.facet.OsmorcFacetConfiguration) OutputPathType(org.jetbrains.osgi.jps.model.OutputPathType) ConfigurationException(com.intellij.openapi.options.ConfigurationException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFile(com.intellij.psi.PsiFile) File(java.io.File)

Example 10 with OsmorcFacetConfiguration

use of org.osmorc.facet.OsmorcFacetConfiguration in project intellij-plugins by JetBrains.

the class AdditionalJARContentsWatcherManager method updateWatcherSetup.

public void updateWatcherSetup() {
    OsmorcFacet osmorcFacet = OsmorcFacet.getInstance(myModule);
    if (osmorcFacet != null) {
        List<VirtualFile> newAdditionalJARContents = new ArrayList<>();
        OsmorcFacetConfiguration osmorcFacetConfiguration = osmorcFacet.getConfiguration();
        List<Pair<String, String>> jarContents = osmorcFacetConfiguration.getAdditionalJARContents();
        for (Pair<String, String> jarContent : jarContents) {
            VirtualFile file = myFileSystem.findFileByPath(jarContent.getFirst());
            if (file != null) {
                newAdditionalJARContents.add(file);
            }
        }
        List<LocalFileSystem.WatchRequest> toRemove = new ArrayList<>();
        for (Iterator<VirtualFile> jarContentsIterator = myAdditionalBundleJARContents.iterator(); jarContentsIterator.hasNext(); ) {
            VirtualFile file = jarContentsIterator.next();
            if (!newAdditionalJARContents.contains(file)) {
                jarContentsIterator.remove();
                for (Iterator<LocalFileSystem.WatchRequest> watchIterator = myWatchRequests.iterator(); watchIterator.hasNext(); ) {
                    LocalFileSystem.WatchRequest watchRequest = watchIterator.next();
                    if (Comparing.strEqual(file.getPath(), watchRequest.getRootPath())) {
                        toRemove.add(watchRequest);
                        watchIterator.remove();
                    }
                }
            }
        }
        List<String> toAdd = new ArrayList<>();
        for (VirtualFile newAdditionalJARContent : newAdditionalJARContents) {
            if (!myAdditionalBundleJARContents.contains(newAdditionalJARContent)) {
                toAdd.add(newAdditionalJARContent.getPath());
                myAdditionalBundleJARContents.add(newAdditionalJARContent);
            }
        }
        Set<LocalFileSystem.WatchRequest> requests = myFileSystem.replaceWatchedRoots(toRemove, toAdd, null);
        myWatchRequests.addAll(requests);
    } else {
        cleanup();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ArrayList(java.util.ArrayList) OsmorcFacetConfiguration(org.osmorc.facet.OsmorcFacetConfiguration) OsmorcFacet(org.osmorc.facet.OsmorcFacet) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) Pair(com.intellij.openapi.util.Pair)

Aggregations

OsmorcFacetConfiguration (org.osmorc.facet.OsmorcFacetConfiguration)12 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 OsmorcFacet (org.osmorc.facet.OsmorcFacet)4 PsiFile (com.intellij.psi.PsiFile)3 File (java.io.File)3 Module (com.intellij.openapi.module.Module)2 Nullable (org.jetbrains.annotations.Nullable)2 ManifestFile (org.jetbrains.lang.manifest.psi.ManifestFile)2 OutputPathType (org.jetbrains.osgi.jps.model.OutputPathType)2 Attrs (aQute.bnd.header.Attrs)1 LocalQuickFix (com.intellij.codeInspection.LocalQuickFix)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 Pair (com.intellij.openapi.util.Pair)1 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)1 LanguageLevel (com.intellij.pom.java.LanguageLevel)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ZipFile (java.util.zip.ZipFile)1 Element (org.jdom.Element)1 NotNull (org.jetbrains.annotations.NotNull)1