use of org.jetbrains.osgi.jps.model.OutputPathType in project intellij-plugins by JetBrains.
the class OsmorcFacetType method completeDefaultConfiguration.
private static void completeDefaultConfiguration(OsmorcFacetConfiguration configuration, Module module) {
if (StringUtil.isEmpty(configuration.getJarFileLocation())) {
String jarFileName = module.getName().replaceAll("[\\s]", "_") + ".jar";
// by default put stuff into the compiler output path.
OutputPathType outputPathType = OutputPathType.CompilerOutputPath;
ProjectSettings projectSettings = ProjectSettings.getInstance(module.getProject());
if (projectSettings != null) {
String bundlesOutputPath = projectSettings.getBundlesOutputPath();
if (StringUtil.isNotEmpty(bundlesOutputPath)) {
outputPathType = OutputPathType.OsgiOutputPath;
}
}
configuration.setJarFileLocation(jarFileName, outputPathType);
}
}
use of org.jetbrains.osgi.jps.model.OutputPathType in project intellij-plugins by JetBrains.
the class OsmorcFacetJAREditorTab method reset.
@Override
public void reset() {
OsmorcFacetConfiguration configuration = (OsmorcFacetConfiguration) myEditorContext.getFacet().getConfiguration();
OutputPathType outputPathType = configuration.getOutputPathType();
myPlaceInCompilerOutputPathRadioButton.setSelected(outputPathType == CompilerOutputPath);
myPlaceInProjectWideRadioButton.setSelected(outputPathType == OsgiOutputPath);
myPlaceInThisPathRadioButton.setSelected(outputPathType == SpecificOutputPath);
myJarFileTextField.setText(configuration.getJarFileName());
if (outputPathType == SpecificOutputPath) {
myJarOutputPathChooser.setText(configuration.getJarFilePath());
} else {
myJarOutputPathChooser.setText("");
}
myAdditionalJARContentsTableModel.replaceContent(configuration.getAdditionalJARContents());
myIgnoreFilePatternTextField.setText(configuration.getIgnoreFilePattern());
myAlwaysRebuildBundleJARCheckBox.setSelected(configuration.isAlwaysRebuildBundleJAR());
updateGui();
myModified = false;
}
use of org.jetbrains.osgi.jps.model.OutputPathType 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;
}
use of org.jetbrains.osgi.jps.model.OutputPathType in project intellij-plugins by JetBrains.
the class OsmorcFacetConfiguration method readExternal.
@Override
public void readExternal(Element element) {
if (element.getAttributeValue(MANIFEST_GENERATION_MODE) == null) {
// the new attribute is not there, so we got an old file, to be converted.
// legacy files containing boolean values
boolean osmorcControlsManifest = Boolean.parseBoolean(element.getAttributeValue(OSMORC_CONTROLS_MANIFEST, "true"));
boolean useBndFile = Boolean.parseBoolean(element.getAttributeValue(USE_BND_FILE, "false"));
boolean useBundlorFile = Boolean.parseBoolean(element.getAttributeValue(USE_BUNDLOR_FILE, "false"));
// default is that osmorc controls the manifest, so set this in case the config file has been manually edited or is otherwise invalid
setManifestGenerationMode(ManifestGenerationMode.OsmorcControlled);
if (osmorcControlsManifest && !useBndFile && !useBundlorFile) {
setManifestGenerationMode(ManifestGenerationMode.OsmorcControlled);
} else if ((!osmorcControlsManifest && useBndFile && !useBundlorFile) || (/* workaround */
osmorcControlsManifest && useBndFile && !useBundlorFile)) {
setManifestGenerationMode(ManifestGenerationMode.Bnd);
} else if (!osmorcControlsManifest && !useBndFile && useBundlorFile) {
setManifestGenerationMode(ManifestGenerationMode.Bundlor);
} else if (!osmorcControlsManifest && !useBndFile) {
setManifestGenerationMode(ManifestGenerationMode.Manually);
} else {
String message = "The configuration at least one OSGi facet is invalid and has been reset. Please check your facet settings!";
OsmorcProjectComponent.IMPORTANT_NOTIFICATIONS.createNotification(message, NotificationType.WARNING).notify(myFacet.getModule().getProject());
}
} else {
// attribute it there, read it.
String manifestGenerationModeName = element.getAttributeValue(MANIFEST_GENERATION_MODE, ManifestGenerationMode.OsmorcControlled.name());
ManifestGenerationMode manifestGenerationMode = ManifestGenerationMode.valueOf(manifestGenerationModeName);
setManifestGenerationMode(manifestGenerationMode);
}
setBndFileLocation(element.getAttributeValue(BND_FILE_LOCATION));
setBundlorFileLocation(element.getAttributeValue(BUNDLOR_FILE_LOCATION));
setManifestLocation(element.getAttributeValue(MANIFEST_LOCATION));
String outputPathTypeName = element.getAttributeValue(OUTPUT_PATH_TYPE, OutputPathType.SpecificOutputPath.name());
OutputPathType outputPathType = OutputPathType.valueOf(outputPathTypeName);
setJarFileLocation(element.getAttributeValue(JAR_FILE_LOCATION), outputPathType);
setBundleActivator(element.getAttributeValue(BUNDLE_ACTIVATOR));
setBundleSymbolicName(element.getAttributeValue(BUNDLE_SYMBOLIC_NAME));
setBundleVersion(element.getAttributeValue(BUNDLE_VERSION));
setIgnoreFilePattern(element.getAttributeValue(IGNORE_FILE_PATTERN));
setUseProjectDefaultManifestFileLocation(Boolean.parseBoolean(element.getAttributeValue(USE_PROJECT_DEFAULT_MANIFEST_FILE_LOCATION, "true")));
setAlwaysRebuildBundleJAR(Boolean.parseBoolean(element.getAttributeValue(ALWAYS_REBUILD_BUNDLE_JAR, "false")));
setDoNotSynchronizeWithMaven(Boolean.parseBoolean(element.getAttributeValue(DO_NOT_SYNCHRONIZE_WITH_MAVEN, "false")));
Element props = element.getChild(ADDITIONAL_PROPERTIES);
if (props != null) {
List children = props.getChildren();
if (children.isEmpty()) {
// ok this is a legacy file
setAdditionalProperties(props.getText());
} else {
StringBuilder builder = new StringBuilder();
// new handling as fix for OSMORC-43
for (Object child : children) {
Element prop = (Element) child;
builder.append(prop.getAttributeValue(KEY)).append(":").append(prop.getAttributeValue(VALUE)).append("\n");
}
setAdditionalProperties(builder.toString());
}
}
List<Pair<String, String>> additionalJARContents = getAdditionalJARContents();
Element additionalJARContentsElement = element.getChild("additionalJARContents");
if (additionalJARContentsElement != null) {
@SuppressWarnings({ "unchecked" }) List<Element> children = additionalJARContentsElement.getChildren("entry");
for (Element entryElement : children) {
additionalJARContents.add(Pair.create(entryElement.getAttributeValue("source"), entryElement.getAttributeValue("dest")));
}
}
myModificationCount++;
}
Aggregations