You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/02/16 16:59:07 UTC

[GitHub] SirIntellegence closed pull request #393: Added a way for a Platform application to customize some text in the ?

SirIntellegence closed pull request #393: Added a way for a Platform application to customize some text in the ?
URL: https://github.com/apache/incubator-netbeans/pull/393
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/debugger.jpda.projectsui/src/org/netbeans/modules/debugger/jpda/projectsui/BreakpointAnnotationProvider.java b/debugger.jpda.projectsui/src/org/netbeans/modules/debugger/jpda/projectsui/BreakpointAnnotationProvider.java
index d5daf0c58..641eae35e 100644
--- a/debugger.jpda.projectsui/src/org/netbeans/modules/debugger/jpda/projectsui/BreakpointAnnotationProvider.java
+++ b/debugger.jpda.projectsui/src/org/netbeans/modules/debugger/jpda/projectsui/BreakpointAnnotationProvider.java
@@ -413,6 +413,9 @@ private void addAnnotationTo(JPDABreakpoint b, FileObject fo, int[] lines) {
         List<DebuggerBreakpointAnnotation> annotations = new ArrayList<DebuggerBreakpointAnnotation>();
         for (int l : lines) {
             try {
+                if (l - 1 < 0){
+                    continue;
+                }
                 Line line = lc.getLineSet().getCurrent(l - 1);
                 DebuggerBreakpointAnnotation annotation = new DebuggerBreakpointAnnotation (annotationType, line, b);
                 annotations.add(annotation);
diff --git a/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java b/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java
index b300dda77..1d8f25f62 100644
--- a/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java
+++ b/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java
@@ -44,7 +44,9 @@
 import javax.swing.event.HyperlinkEvent;
 import javax.swing.event.HyperlinkListener;
 import org.netbeans.core.actions.HTMLViewAction;
+
 import static org.netbeans.core.ui.Bundle.*;
+
 import org.openide.awt.CheckForUpdatesProvider;
 import org.openide.awt.HtmlBrowser;
 import org.openide.awt.HtmlBrowser.URLDisplayer;
@@ -55,9 +57,11 @@
 import org.openide.util.NbBundle;
 import org.openide.util.NbBundle.Messages;
 import org.openide.util.RequestProcessor;
+import org.openide.modules.AboutMessageOverride;
 
 public class ProductInformationPanel extends JPanel implements HyperlinkListener {
-
+    private AboutMessageOverride aboutOverride;
+    private String descripTemplate;
     URL url = null;
     Icon about;
     
@@ -94,8 +98,30 @@
     })
     public ProductInformationPanel() {
         initComponents();
+        descripTemplate = NbBundle.getMessage(ProductInformationPanel.class,
+                "LBL_description");
+        aboutOverride = Lookup.getDefault().lookup(AboutMessageOverride.class);
+        if (aboutOverride == null) {
+            aboutOverride = new AboutMessageOverride() {
+                @Override
+                public String formatAboutText(String bundleString,
+                        String productVersion, String javaVersion,
+                        String vmVersion, String os, String encoding,
+                        String locale, String userDir, String cacheDir,
+                        String updates, int fontSize, String javaRuntime) {
+                    return MessageFormat.format(bundleString, productVersion,
+                            javaVersion, vmVersion, os, encoding, locale,
+                            userDir, cacheDir, updates, fontSize, javaVersion);
+                }
+            };
+        }
         imageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-        description.setText(LBL_description(getProductVersionValue(), getJavaValue(), getVMValue(), getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue(), Places.getCacheDirectory().getAbsolutePath(), "", FONT_SIZE, getJavaRuntime()));
+        description.setText(aboutOverride.formatAboutText(descripTemplate,
+                getProductVersionValue(), getJavaValue(), getVMValue(),
+                getOperatingSystemValue(), getEncodingValue(),
+                getSystemLocaleValue(), getUserDirValue(),
+                Places.getCacheDirectory().getAbsolutePath(), "",
+                FONT_SIZE, getJavaRuntime()));
         description.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
         description.putClientProperty( JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
         RequestProcessor.getDefault().post(new Runnable() {
@@ -107,7 +133,13 @@ public void run() {
 
                     @Override
                     public void run() {
-                        description.setText(LBL_description(getProductVersionValue(), getJavaValue(), getVMValue(), getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue(), Places.getCacheDirectory().getAbsolutePath(), updates, FONT_SIZE, getJavaRuntime()));
+                        description.setText(aboutOverride.formatAboutText(
+                                descripTemplate, getProductVersionValue(),
+                                getJavaValue(), getVMValue(),
+                                getOperatingSystemValue(), getEncodingValue(),
+                                getSystemLocaleValue(), getUserDirValue(),
+                                Places.getCacheDirectory().getAbsolutePath(),
+                                updates, FONT_SIZE, getJavaRuntime()));
                         description.setCursor(null);
                         description.revalidate();
                     }
diff --git a/openide.modules/src/org/openide/modules/AboutMessageOverride.java b/openide.modules/src/org/openide/modules/AboutMessageOverride.java
new file mode 100644
index 000000000..e6acc84ea
--- /dev/null
+++ b/openide.modules/src/org/openide/modules/AboutMessageOverride.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.openide.modules;
+
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ * An interface to allow you to change what is displayed in the about window.
+ * Register it with {@link ServiceProvider}
+ * @author astephens
+ */
+public interface AboutMessageOverride {
+    public String formatAboutText(String bundleString, String productVersion,
+            String javaVersion, String vmVersion, String os, String encoding,
+            String locale, String userDir, String cacheDir, String updates,
+            int fontSize, String javaRuntime);
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists