Lines 42-47
Link Here
|
42 |
package org.netbeans.api.io; |
42 |
package org.netbeans.api.io; |
43 |
|
43 |
|
44 |
import org.netbeans.api.annotations.common.NonNull; |
44 |
import org.netbeans.api.annotations.common.NonNull; |
|
|
45 |
import org.netbeans.api.intent.Intent; |
45 |
import org.netbeans.modules.io.HyperlinkAccessor; |
46 |
import org.netbeans.modules.io.HyperlinkAccessor; |
46 |
import org.openide.util.Parameters; |
47 |
import org.openide.util.Parameters; |
47 |
|
48 |
|
Lines 103-112
Link Here
|
103 |
@NonNull |
104 |
@NonNull |
104 |
public static Hyperlink from(@NonNull Runnable runnable, |
105 |
public static Hyperlink from(@NonNull Runnable runnable, |
105 |
boolean important) { |
106 |
boolean important) { |
106 |
Parameters.notNull("runnable", runnable); |
107 |
Parameters.notNull("runnable", runnable); //NOI18N |
107 |
return new OnClickHyperlink(runnable, important); |
108 |
return new OnClickHyperlink(runnable, important); |
108 |
} |
109 |
} |
109 |
|
110 |
|
|
|
111 |
/** |
112 |
* Create a new hyperlink for specified {@link Intent}, which will be |
113 |
* executed when the line is clicked. |
114 |
* |
115 |
* @param intent The intent to execute on click. |
116 |
* @return The new hyperlink. |
117 |
*/ |
118 |
public static Hyperlink from(@NonNull Intent intent) { |
119 |
return from(intent, false); |
120 |
} |
121 |
|
122 |
/** |
123 |
* Create a new hyperlink for specified {@link Intent}, which will be |
124 |
* executed when the line is clicked. |
125 |
* |
126 |
* <div class="nonnormative"> |
127 |
* <p> |
128 |
* Important hyperlinks can be printed in different color, or can have some |
129 |
* special behavior, e.g. automatic scrolling can be switched off to keep |
130 |
* the important hyperlink visible. |
131 |
* </p> |
132 |
* </div> |
133 |
* |
134 |
* @param intent The intent to execute on click. |
135 |
* @param important True if the hyperlink should be handled as an important |
136 |
* one, false if it is a standard one. |
137 |
* @return The new hyperlink. |
138 |
*/ |
139 |
public static Hyperlink from(@NonNull Intent intent, boolean important) { |
140 |
Parameters.notNull("intent", intent); //NOI18N |
141 |
return new IntentHyperlink(intent, important); |
142 |
} |
143 |
|
110 |
@SuppressWarnings("PackageVisibleInnerClass") |
144 |
@SuppressWarnings("PackageVisibleInnerClass") |
111 |
static class OnClickHyperlink extends Hyperlink { |
145 |
static class OnClickHyperlink extends Hyperlink { |
112 |
|
146 |
|
Lines 121-124
Link Here
|
121 |
return runnable; |
155 |
return runnable; |
122 |
} |
156 |
} |
123 |
} |
157 |
} |
|
|
158 |
|
159 |
@SuppressWarnings("PackageVisibleInnerClass") |
160 |
static class IntentHyperlink extends Hyperlink { |
161 |
|
162 |
private final Intent intent; |
163 |
|
164 |
public IntentHyperlink(Intent intent, boolean important) { |
165 |
super(important); |
166 |
this.intent = intent; |
167 |
} |
168 |
|
169 |
public Intent getIntent() { |
170 |
return intent; |
171 |
} |
172 |
} |
124 |
} |
173 |
} |