This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 186552
Collapse All | Expand All

(-)file_not_specified_in_diff (-1 / +39 lines)
Line  Link Here
0
-- Base (BASE)
0
++ Locally Modified (Based On LOCAL)
Lines 48-54 Link Here
48
import java.util.Collection;
48
import java.util.Collection;
49
import java.util.HashMap;
49
import java.util.HashMap;
50
import java.util.HashSet;
50
import java.util.HashSet;
51
import java.util.Iterator;
51
import java.util.List;
52
import java.util.List;
53
import java.util.Map;
54
import java.util.Properties;
52
import java.util.Set;
55
import java.util.Set;
53
import java.util.logging.Level;
56
import java.util.logging.Level;
54
import java.util.logging.Logger;
57
import java.util.logging.Logger;
Lines 77-82 Link Here
77
import org.netbeans.modules.maven.execute.ui.RunGoalsPanel;
80
import org.netbeans.modules.maven.execute.ui.RunGoalsPanel;
78
import org.netbeans.modules.maven.options.MavenSettings;
81
import org.netbeans.modules.maven.options.MavenSettings;
79
import org.netbeans.modules.maven.configurations.M2ConfigProvider;
82
import org.netbeans.modules.maven.configurations.M2ConfigProvider;
83
import org.netbeans.modules.maven.execute.DefaultReplaceTokenProvider;
80
import org.netbeans.modules.maven.execute.model.ActionToGoalMapping;
84
import org.netbeans.modules.maven.execute.model.ActionToGoalMapping;
81
import org.netbeans.modules.maven.execute.model.NetbeansActionMapping;
85
import org.netbeans.modules.maven.execute.model.NetbeansActionMapping;
82
import org.netbeans.modules.maven.execute.model.io.xpp3.NetbeansBuildActionXpp3Reader;
86
import org.netbeans.modules.maven.execute.model.io.xpp3.NetbeansBuildActionXpp3Reader;
Lines 407-414 Link Here
407
            this.showUI = showUI;
411
            this.showUI = showUI;
408
        }
412
        }
409
413
414
        // helper method for fix for #186552,
415
        // inspired by org.netbeans.modules.maven.spi.actions.AbstractMavenActionsProvider#performDynamicSubstitutions()
416
        protected String performDynamicSubstitutions(final Map replaceMap, final String in) {
417
            StringBuilder buf = new StringBuilder(in);
418
            Iterator it = replaceMap.entrySet().iterator();
419
            while (it.hasNext()) {
420
                Map.Entry elem = (Map.Entry) it.next();
421
                String replaceItem = "${" + elem.getKey() + "}";//NOI18N
422
                int index = buf.indexOf(replaceItem);
423
                while (index > -1) {
424
                    String newItem = (String) elem.getValue();
425
                    if (newItem == null) {
426
                    }
427
                    newItem = newItem == null ? "" : newItem;//NOI18N
428
                    buf.replace(index, index + replaceItem.length(), newItem);
429
                    index = buf.indexOf(replaceItem);
430
                }
431
            }
432
            return buf.toString();
433
        }
434
410
        @Override
435
        @Override
411
        public void actionPerformed(java.awt.event.ActionEvent e) {
436
        public void actionPerformed(java.awt.event.ActionEvent e) {
437
438
            // fix for #186552
439
            Map<String, String> replacements = DefaultReplaceTokenProvider.readVariables(); // reading "IDE Variables"
440
            Properties mappingProperties = mapping.getProperties();
441
442
            Iterator<Object> iterator = mappingProperties.keySet().iterator();
443
            while (iterator.hasNext()) {
444
                String prop = (String) iterator.next();
445
                String value = mappingProperties.getProperty(prop);
446
                mappingProperties.put(prop, performDynamicSubstitutions(replacements, value));
447
            }
448
            // end of fix for #186552
449
412
            if (!showUI) {
450
            if (!showUI) {
413
                ModelRunConfig rc = new ModelRunConfig(project, mapping, mapping.getActionName(), null);
451
                ModelRunConfig rc = new ModelRunConfig(project, mapping, mapping.getActionName(), null);
414
                rc.setShowDebug(MavenSettings.getDefault().isShowDebug());
452
                rc.setShowDebug(MavenSettings.getDefault().isShowDebug());

Return to bug 186552