本文整理匯總了Java中org.openide.NotifyDescriptor類的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor類的具體用法?Java NotifyDescriptor怎麽用?Java NotifyDescriptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NotifyDescriptor類屬於org.openide包,在下文中一共展示了NotifyDescriptor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDocument
import org.openide.NotifyDescriptor; //導入依賴的package包/類
@NbBundle.Messages("TXT_Question=Question")
private static StyledDocument getDocument(EditorCookie ec) throws IOException {
StyledDocument doc;
try {
doc = ec.openDocument();
} catch (UserQuestionException uqe) {
final Object value = DialogDisplayer.getDefault().notify(
new NotifyDescriptor.Confirmation(uqe.getLocalizedMessage(),
Bundle.TXT_Question(),
NotifyDescriptor.YES_NO_OPTION));
if (value != NotifyDescriptor.YES_OPTION) {
return null;
}
uqe.confirmed();
doc = ec.openDocument();
}
return doc;
}
示例2: setValue
import org.openide.NotifyDescriptor; //導入依賴的package包/類
@Override
public void setValue(Object val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
try {
getDataObject().getPrimaryFile().setAttribute(PROPERTY_ENCODING, val);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
PropertiesEditorSupport propertiesEditor = getPropertiesFileEntry().getPropertiesEditor();
propertiesEditor.resetCharset();
if (propertiesEditor.hasOpenedEditorComponent()) {
NotifyDescriptor.Message message = new NotifyDescriptor.Message(
NbBundle.getMessage(PropertiesDataNode.class, "PROP_ENCODING_Warning", PropertiesDataNode.this.getDisplayName()),
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(message);
propertiesEditor.close();
}
}
示例3: actionPerformed
import org.openide.NotifyDescriptor; //導入依賴的package包/類
@Override
@Messages("OpenBrandingEditorAction_Error_NoApplication=We could not find the application project that is associated with this branding project.\nPlease open it and retry.")
public void actionPerformed(ActionEvent e) {
RP.post(new Runnable() {
@Override public void run() {
final Project project = context.lookup(Project.class);
final MavenProject mavenProject = project.getLookup().lookup(NbMavenProject.class).getMavenProject();
final BrandingModel model = createBrandingModel(project, brandingPath(project));
final boolean hasAppProject = MavenNbModuleImpl.findAppProject(project) != null;
final boolean hasExternalPlatform = MavenNbModuleImpl.findIDEInstallation(project) != null;
EventQueue.invokeLater(new Runnable() {
@Override public void run() {
if (!hasAppProject && !hasExternalPlatform) {
//TODO do we need the external platform check? MavenPLatfomrJarProvider has it, but it's more generic than branding
NotifyDescriptor.Message message = new NotifyDescriptor.Message(OpenBrandingEditorAction_Error_NoApplication(), NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(message);
return;
}
BrandingUtils.openBrandingEditor(mavenProject.getName(), project, model);
}
});
}
});
}
示例4: saveAs
import org.openide.NotifyDescriptor; //導入依賴的package包/類
@Override
public void saveAs(FileObject folder, String fileName) throws IOException {
String fn = FileUtil.getFileDisplayName(folder) + File.separator + fileName;
File existingFile = FileUtil.normalizeFile(new File(fn));
if (existingFile.exists()) {
NotifyDescriptor confirm = new NotifyDescriptor.Confirmation(
NbBundle.getMessage(SQLEditorSupport.class,
"MSG_ConfirmReplace", fileName),
NbBundle.getMessage(SQLEditorSupport.class,
"MSG_ConfirmReplaceFileTitle"),
NotifyDescriptor.YES_NO_OPTION);
DialogDisplayer.getDefault().notify(confirm);
if (!confirm.getValue().equals(NotifyDescriptor.YES_OPTION)) {
return;
}
}
if (isConsole()) {
// #166370 - if console, need to save document before copying
saveDocument();
}
super.saveAs(folder, fileName);
}
示例5: addKeyToBranding
import org.openide.NotifyDescriptor; //導入依賴的package包/類
private boolean addKeyToBranding (String bundlepath, String codenamebase, String key) {
BrandingSupport.BundleKey bundleKey = getBranding().getGeneralBundleKeyForModification(codenamebase, bundlepath, key);
KeyInput inputLine = new KeyInput(key + ":", bundlepath); // NOI18N
String oldValue = bundleKey.getValue();
inputLine.setInputText(oldValue);
if (DialogDisplayer.getDefault().notify(inputLine)==NotifyDescriptor.OK_OPTION) {
String newValue = inputLine.getInputText();
if (newValue.compareTo(oldValue)!=0) {
bundleKey.setValue(newValue);
getBranding().addModifiedGeneralBundleKey(bundleKey);
setModified();
return true;
}
}
return false;
}
示例6: actionPerformed
import org.openide.NotifyDescriptor; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
String title = NbBundle.getMessage(RunTargetsAction.class, "TITLE_run_advanced");
AdvancedActionPanel panel = new AdvancedActionPanel(project, allTargets);
DialogDescriptor dd = new DialogDescriptor(panel, title);
dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
JButton run = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_run"));
run.setDefaultCapable(true);
JButton cancel = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_cancel"));
dd.setOptions(new Object[] {run, cancel});
dd.setModal(true);
Object result = DialogDisplayer.getDefault().notify(dd);
if (result.equals(run)) {
try {
panel.run();
} catch (IOException x) {
AntModule.err.notify(x);
}
}
}
示例7: destroy
import org.openide.NotifyDescriptor; //導入依賴的package包/類
@Override
@NbBundle.Messages({
"# {0} - Database name",
"MSG_Confirm_DB_Delete=Really delete database {0}?",
"MSG_Confirm_DB_Delete_Title=Delete Database"})
public void destroy() {
NotifyDescriptor d =
new NotifyDescriptor.Confirmation(
Bundle.MSG_Confirm_DB_Delete(database),
Bundle.MSG_Confirm_DB_Delete_Title(),
NotifyDescriptor.YES_NO_OPTION);
Object result = DialogDisplayer.getDefault().notify(d);
if (NotifyDescriptor.OK_OPTION.equals(result)) {
server.dropDatabase(database);
}
}
示例8: performAction
import org.openide.NotifyDescriptor; //導入依賴的package包/類
@Override
protected void performAction(Node[] nodes) {
for (Node node : nodes) {
WsdlSaas saas = getWsdlSaas(node);
String location = saas.getWsdlData().getWsdlFile();
FileObject wsdlFileObject = saas.getLocalWsdlFile();
if (wsdlFileObject == null) {
String errorMessage = NbBundle.getMessage(ViewWSDLAction.class, "WSDL_FILE_NOT_FOUND", location); // NOI18N
NotifyDescriptor d = new NotifyDescriptor.Message(errorMessage);
DialogDisplayer.getDefault().notify(d);
continue;
}
//TODO: open in read-only mode
try {
DataObject wsdlDataObject = DataObject.find(wsdlFileObject);
EditorCookie editorCookie = wsdlDataObject.getLookup().lookup(EditorCookie.class);
editorCookie.open();
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
}
}
示例9: askUserToSpecifyRepository
import org.openide.NotifyDescriptor; //導入依賴的package包/類
private RepositoryImpl askUserToSpecifyRepository(RepositoryImpl suggestedRepo) {
Collection<RepositoryImpl> repos = RepositoryRegistry.getInstance().getKnownRepositories(true);
DelegatingConnector[] connectors = BugtrackingManager.getInstance().getConnectors();
final RepositorySelectorBuilder selectorBuilder = new RepositorySelectorBuilder();
selectorBuilder.setDisplayFormForExistingRepositories(true);
selectorBuilder.setExistingRepositories(repos.toArray(new RepositoryImpl[repos.size()]));
selectorBuilder.setBugtrackingConnectors(connectors);
selectorBuilder.setPreselectedRepository(suggestedRepo);
selectorBuilder.setLabelAboveComboBox();
String dialogTitle = NbBundle.getMessage(BugtrackingOwnerSupport.class, "LBL_BugtrackerSelectorTitle"); // NOI18N
DialogDescriptor dialogDescriptor
= selectorBuilder.createDialogDescriptor(dialogTitle);
Object selectedOption = DialogDisplayer.getDefault().notify(dialogDescriptor);
RepositoryImpl repository = selectorBuilder.getSelectedRepository();
if (selectedOption == NotifyDescriptor.OK_OPTION) {
repository.applyChanges();
return repository;
} else {
repository.cancelChanges();
return null;
}
}
示例10: handleDLLException
import org.openide.NotifyDescriptor; //導入依賴的package包/類
/**
* If DDL exception was caused by a closed connection, log info and display
* a simple error dialog. Otherwise let users report the exception.
*/
private void handleDLLException(DatabaseConnection dbConn,
DDLException e) throws SQLException, MissingResourceException {
Connection conn = dbConn == null ? null : dbConn.getJDBCConnection();
if (conn != null && !conn.isValid(1000)) {
LOGGER.log(Level.INFO, e.getMessage(), e);
NotifyDescriptor nd = new NotifyDescriptor.Message(
NbBundle.getMessage(
MakeDefaultCatalogAction.class,
"ERR_ConnectionToServerClosed"), //NOI18N
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(nd);
} else {
Exceptions.printStackTrace(e);
}
}
示例11: importIntoExisting
import org.openide.NotifyDescriptor; //導入依賴的package包/類
/**
* Checks if the target folder already exists in the repository.
* If it does exist, user will be asked to confirm the import into the existing folder.
* @param client
* @param repositoryFileUrl
* @return true if the target does not exist or user wishes to import anyway.
*/
private boolean importIntoExisting(SvnClient client, SVNUrl repositoryFileUrl) {
try {
ISVNInfo info = client.getInfo(repositoryFileUrl);
if (info != null) {
// target folder exists, ask user for confirmation
final boolean flags[] = {true};
NotifyDescriptor nd = new NotifyDescriptor(NbBundle.getMessage(ImportStep.class, "MSG_ImportIntoExisting", SvnUtils.decodeToString(repositoryFileUrl)), //NOI18N
NbBundle.getMessage(ImportStep.class, "CTL_TargetFolderExists"), NotifyDescriptor.YES_NO_CANCEL_OPTION, //NOI18N
NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.YES_OPTION);
if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.YES_OPTION) {
flags[0] = false;
}
return flags[0];
}
} catch (SVNClientException ex) {
// ignore
}
return true;
}
示例12: addKeyToBranding
import org.openide.NotifyDescriptor; //導入依賴的package包/類
private boolean addKeyToBranding (String bundlepath, String codenamebase, String key) {
BrandingSupport.BundleKey bundleKey = getBranding().getGeneralLocalizedBundleKeyForModification(codenamebase, bundlepath, key);
KeyInput inputLine = new KeyInput(key + ":", bundlepath); // NOI18N
String oldValue = bundleKey.getValue();
inputLine.setInputText(oldValue);
if (DialogDisplayer.getDefault().notify(inputLine)==NotifyDescriptor.OK_OPTION) {
String newValue = inputLine.getInputText();
if (newValue.compareTo(oldValue)!=0) {
bundleKey.setValue(newValue);
getBranding().addModifiedInternationalizedBundleKey(bundleKey);
setModified();
branding.updateProjectInternationalizationLocales();
return true;
}
}
return false;
}
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:InternationalizationResourceBundleBrandingPanel.java
示例13: showCategoryNameDialog
import org.openide.NotifyDescriptor; //導入依賴的package包/類
private boolean showCategoryNameDialog(CategoryNamePanel panel, String message) {
categoryNameDialog = new NotifyDescriptor(
panel,
message,
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.PLAIN_MESSAGE,
null,
NotifyDescriptor.OK_OPTION);
categoryNameDialog.setValid(false);
if (categoryNameListener == null) {
categoryNameListener = new CategoryNameDocumentListener();
}
panel.addDocumentListener(categoryNameListener);
boolean confirm = DialogDisplayer.getDefault().notify(categoryNameDialog) == NotifyDescriptor.OK_OPTION;
panel.removeDocumentListener(categoryNameListener);
return confirm;
}
示例14: findMatches
import org.openide.NotifyDescriptor; //導入依賴的package包/類
private List<InputNode> findMatches(String name, String value, InputGraph inputGraph, SearchResponse response) {
try {
RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE);
Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(inputGraph.getNodes());
List<InputNode> matches = selector.selectMultiple(matcher);
return matches.size() == 0 ? null : matches;
} catch (Exception e) {
final String msg = e.getMessage();
response.addResult(new Runnable() {
@Override
public void run() {
Message desc = new NotifyDescriptor.Message("An exception occurred during the search, "
+ "perhaps due to a malformed query string:\n" + msg,
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(desc);
}
},
"(Error during search)"
);
}
return null;
}
示例15: selectPatchContext
import org.openide.NotifyDescriptor; //導入依賴的package包/類
private File selectPatchContext() {
PatchContextChooser chooser = new PatchContextChooser();
ResourceBundle bundle = NbBundle.getBundle(IDEServicesImpl.class);
JButton ok = new JButton(bundle.getString("LBL_Apply")); // NOI18N
JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N
DialogDescriptor descriptor = new DialogDescriptor(
chooser,
bundle.getString("LBL_ApplyPatch"), // NOI18N
true,
NotifyDescriptor.OK_CANCEL_OPTION,
ok,
null);
descriptor.setOptions(new Object [] {ok, cancel});
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.bugtracking.patchContextChooser")); // NOI18N
File context = null;
DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
if (descriptor.getValue() == ok) {
context = chooser.getSelectedFile();
}
return context;
}