List of usage examples for com.intellij.openapi.ui Messages getErrorIcon
@NotNull public static Icon getErrorIcon()
From source file:net.groboclown.idea.p4ic.extension.P4Vcs.java
License:Apache License
@Override protected void start() throws VcsException { if (!CompatFactoryLoader.isSupported()) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override//from www . ja va2 s.c o m public void run() { Messages.showMessageDialog(myProject, P4Bundle.message("ide.not.supported.message", ApplicationInfo.getInstance().getApiVersion(), P4Bundle.getString("p4ic.name"), P4Bundle.getString("p4ic.bug.url")), P4Bundle.message("ide.not.supported.title"), Messages.getErrorIcon()); } }); throw new VcsException(P4Bundle.message("ide.not.supported.title")); } }
From source file:net.groboclown.idea.p4ic.ui.checkin.P4SubmitPanel.java
License:Apache License
public P4SubmitPanel(final SubmitContext context) { this.context = context; // UI setup code - compiler will inject the initialization from the // form./*from w ww. jav a 2 s . c o m*/ $$$setupUI$$$(); // Set the visibility of the expanded panel first. myExpandedPanel.setVisible(false); myJobTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myJobTable.setRowSelectionAllowed(true); myJobTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { // Something in this call is disabling // the currently selected item in the table. updateStatus(); } } }); myAddJobButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { String jobId = getJobIdFieldText(); if (jobId != null) { jobId = jobId.trim(); if (jobId.length() > 0) { if (context.addJobId(jobId) != null) { // job was added successfully myJobIdField.setText(""); jobTableModel.fireTableDataChanged(); } else { Messages.showMessageDialog(context.getProject(), P4Bundle.message("submit.job.error.notfound.message", jobId), P4Bundle.getString("submit.job.error.notfound.title"), Messages.getErrorIcon()); } } } } }); myRemoveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { int rowId = myJobTable.getSelectedRow(); if (rowId >= 0 && rowId < context.getJobs().size()) { context.removeJob(context.getJobs().get(rowId)); jobTableModel.fireTableDataChanged(); } } }); myBrowseButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { // TODO replace with real action Messages.showMessageDialog(context.getProject(), "Browsing for jobs is not yet implemented", "Not implemented", Messages.getErrorIcon()); } }); myJobIdField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(final DocumentEvent e) { updateStatus(); } @Override public void removeUpdate(final DocumentEvent e) { updateStatus(); } @Override public void changedUpdate(final DocumentEvent e) { updateStatus(); } }); myJobStatus.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final Object selected = myJobStatus.getSelectedItem(); if (selected != null) { context.setSubmitStatus(selected.toString()); } } }); myAssociateJobExpander.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { expandState = !expandState; updateStatus(); } }); myAssociateJobExpander.setIcon(Actions.Right); myJobsDisabledLabel.setVisible(false); }
From source file:net.groboclown.idea.p4ic.ui.ErrorDialog.java
License:Apache License
public static void logError(@NotNull final Project project, @NotNull final String action, @NotNull final Throwable t) { // no response from the user is required, so it's fine // to run in an invoke later (there's no Future involved). // using ApplicationManager.getApplication().invokeLater // will cause the dialog to delay displaying until all // other active gui are dismissed. SwingUtilities.invokeLater(new Runnable() { @Override//w ww.j av a 2 s.com public void run() { if (!(t instanceof VcsException) && !(t instanceof CancellationException)) { LOG.warn("Something threw an invalid exception without being properly wrapped", t); } if ( // User explicitly cancelled the operation !VcsExceptionUtil.isCancellation(t) && // User has already been warned of these !(t instanceof P4WorkingOfflineException) && !(t instanceof P4DisconnectedException)) { LOG.warn(t); String message = t.getMessage(); if (message != null) { // Some P4 exceptions can have trailing EOLs. message = message.trim(); } Messages.showMessageDialog(project, P4Bundle.message("errordialog.message", message), P4Bundle.message("errordialog.title", action), Messages.getErrorIcon()); } } }); }
From source file:net.groboclown.idea.p4ic.ui.sync.SyncPanel.java
License:Apache License
public SyncPanel(@NotNull final SyncOptionConfigurable parent) { syncTypeGroup = new ButtonGroup(); $$$setupUI$$$();//from w w w. ja v a 2 s . c om syncTypeGroup.add(mySyncHead); mySyncHead.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setPairState(false, myRevLabel, myRevision); setPairState(false, myOtherLabel, myOther); updateValues(parent); } }); syncTypeGroup.add(mySyncRev); mySyncRev.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setPairState(true, myRevLabel, myRevision); setPairState(false, myOtherLabel, myOther); updateValues(parent); } }); syncTypeGroup.add(mySyncChangelist); mySyncChangelist.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setPairState(false, myRevLabel, myRevision); setPairState(true, myOtherLabel, myOther); updateValues(parent); } }); myRevision.addPropertyChangeListener("value", new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { if (getSelectedSyncType() == SyncType.REV && getRevValue() == null) { Messages.showMessageDialog(P4Bundle.message("sync.options.rev.error"), P4Bundle.message("sync.options.rev.error.title"), Messages.getErrorIcon()); } else { updateValues(parent); } } }); myOther.addPropertyChangeListener("value", new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { updateValues(parent); } }); // initialize the parent values to the current settings. updateValues(parent); }
From source file:net.groboclown.idea.p4ic.v2.ui.alerts.ClientNameMismatchHandler.java
License:Apache License
@Override public void handleError(@NotNull final Date when) { LOG.warn("Cached client " + cachedClientName + " does not match p4 reported client " + p4ClientName); ApplicationManager.getApplication().assertIsDispatchThread(); int result = Messages.showYesNoDialog(getProject(), P4Bundle.message("configuration.client-mismatch-ask", cachedClientName, p4ClientName), P4Bundle.message("configuration.check-connection"), Messages.getErrorIcon()); if (result == Messages.YES) { // Signal to the API to try again only if // the user selected "okay". tryConfigChange();//from w ww . j a v a2s .c o m } else { goOffline(); } }
From source file:net.groboclown.idea.p4ic.v2.ui.alerts.ConfigPanelErrorHandler.java
License:Apache License
@Override public void handleError(@NotNull final Date when) { // using ApplicationManager.getApplication().invokeLater // will cause the dialog to delay displaying until all // other active gui are dismissed. SwingUtilities.invokeLater(new Runnable() { @Override/*from w w w. ja v a 2 s . co m*/ public void run() { Messages.showMessageDialog(project, message, title, Messages.getErrorIcon()); } }); }
From source file:net.groboclown.idea.p4ic.v2.ui.alerts.ConfigurationProblemHandler.java
License:Apache License
@Override public void handleError(@NotNull final Date when) { LOG.warn("Configuration problem", getException()); if (isInvalid()) { return;/*from w ww . ja v a 2 s . c o m*/ } int result = Messages.showYesNoDialog(getProject(), P4Bundle.message("configuration.connection-problem-ask", getExceptionMessage()), P4Bundle.message("configuration.check-connection"), Messages.getErrorIcon()); if (result == Messages.YES) { // Signal to the API to try again only if // the user selected "okay". tryConfigChange(); } else { // Work offline goOffline(); } }
From source file:net.groboclown.idea.p4ic.v2.ui.alerts.DisconnectedHandler.java
License:Apache License
@Override public void handleError(@NotNull final Date when) { LOG.warn("Disconnected from Perforce server"); if (isInvalid() || isWorkingOnline()) { return;/*from w ww . j a v a 2 s . c o m*/ } // We may need to switch to automatically work offline due // to a user setting. if (isAutoOffline()) { LOG.info("User running in auto-offline mode. Will silently work disconnected."); return; } // Ask the user if they want to disconnect. LOG.info("Asking user to reconnect"); int choice = Messages.showDialog(getProject(), P4Bundle.message("dialog.offline.message"), P4Bundle.message("dialog.offline.title"), new String[] { P4Bundle.message("dialog.offline.reconnect"), P4Bundle.message("dialog.offline.offline-mode") }, 1, Messages.getErrorIcon()); if (choice == 0) { connect(); } else { goOffline(); } }
From source file:net.groboclown.idea.p4ic.v2.ui.alerts.InvalidClientHandler.java
License:Apache License
@Override public void handleError(@NotNull final Date when) { LOG.warn("Invalid client " + clientName); ApplicationManager.getApplication().assertIsDispatchThread(); int result = Messages.showYesNoDialog(getProject(), P4Bundle.message("configuration.connection-problem-ask", getExceptionMessage()), P4Bundle.message("configuration.check-connection"), Messages.getErrorIcon()); if (result == Messages.YES) { // Signal to the API to try again only if // the user selected "okay". tryConfigChange();/*ww w.j a v a2 s. c o m*/ } else { // Work offline goOffline(); } }
From source file:net.groboclown.idea.p4ic.v2.ui.alerts.InvalidRootsHandler.java
License:Apache License
@Override public void handleError(@NotNull final Date when) { LOG.warn("Invalid client root", getException()); if (isInvalid()) { return;//from ww w. ja va2 s.c o m } final List<VirtualFile> vcsRoots = getVcs().getVcsRoots(); List<String> vcsPresentableRoots = new ArrayList<String>(vcsRoots.size()); for (VirtualFile vcsRoot : vcsRoots) { vcsPresentableRoots.add(vcsRoot.getPresentableName()); } int result; if (workspaceRoots.isEmpty()) { result = Messages.showYesNoDialog(getProject(), P4Bundle.message("error.config.no-workspace-roots"), P4Bundle.message("error.config.invalid-roots.title", clientServerId.getClientId()), P4Bundle.message("error.config.invalid-roots.yes"), P4Bundle.message("error.config.invalid-roots.no"), Messages.getErrorIcon()); } else { result = Messages.showYesNoDialog(getProject(), P4Bundle.message("error.config.invalid-roots", workspaceRoots, vcsPresentableRoots), P4Bundle.message("error.config.invalid-roots.title", clientServerId.getClientId()), P4Bundle.message("error.config.invalid-roots.yes"), P4Bundle.message("error.config.invalid-roots.no"), Messages.getErrorIcon()); } if (result == Messages.YES) { // Signal to the API to try again only if // the user selected "okay". tryConfigChange(false); } // Don't go offline if not changed. }