Example usage for com.intellij.openapi.ui Messages OK

List of usage examples for com.intellij.openapi.ui Messages OK

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages OK.

Prototype

int OK

To view the source code for com.intellij.openapi.ui Messages OK.

Click Source Link

Usage

From source file:org.jetbrains.idea.svn.treeConflict.TreeConflictRefreshablePanel.java

License:Apache License

private ActionListener createLeft(final SVNTreeConflictDescription description) {
    return new ActionListener() {
        @Override//from  www .  j  a v a  2s.  c  om
        public void actionPerformed(ActionEvent e) {
            int ok = Messages.showOkCancelDialog(myVcs.getProject(),
                    "Accept yours for " + filePath(myPath) + "?", TITLE, Messages.getQuestionIcon());
            if (Messages.OK != ok)
                return;
            FileDocumentManager.getInstance().saveAllDocuments();
            final Paths paths = getPaths(description);
            ProgressManager.getInstance().run(new VcsBackgroundTask<SVNTreeConflictDescription>(
                    myVcs.getProject(), "Accepting yours for: " + filePath(paths.myMainPath),
                    BackgroundFromStartOption.getInstance(), Collections.singletonList(description), true) {
                @Override
                protected void process(SVNTreeConflictDescription d) throws VcsException {
                    new SvnTreeConflictResolver(myVcs, paths.myMainPath, myCommittedRevision,
                            paths.myAdditionalPath).resolveSelectMineFull(d);
                }

                @Override
                public void onSuccess() {
                    super.onSuccess();
                    if (executedOk()) {
                        VcsBalloonProblemNotifier.showOverChangesView(myProject,
                                "Yours accepted for " + filePath(paths.myMainPath), MessageType.INFO);
                    }
                }
            });
        }
    };
}

From source file:org.jetbrains.jet.plugin.refactoring.safeDelete.KotlinSafeDeleteProcessor.java

License:Apache License

@Nullable
private static Collection<? extends PsiElement> checkParametersInMethodHierarchy(
        @NotNull PsiParameter parameter) {
    PsiMethod method = (PsiMethod) parameter.getDeclarationScope();
    int parameterIndex = method.getParameterList().getParameterIndex(parameter);

    Set<PsiElement> parametersToDelete = collectParametersToDelete(method, parameterIndex);
    if (parametersToDelete.size() > 1) {
        if (ApplicationManager.getApplication().isUnitTestMode()) {
            return parametersToDelete;
        }//from w ww.j  a  v  a2  s .  c  om

        String message = JetBundle.message("delete.param.in.method.hierarchy",
                JetRefactoringUtil.formatJavaOrLightMethod(method));
        int exitCode = Messages.showOkCancelDialog(parameter.getProject(), message,
                IdeBundle.message("title.warning"), Messages.getQuestionIcon());
        if (exitCode == Messages.OK) {
            return parametersToDelete;
        } else {
            return null;
        }
    }

    return parametersToDelete;
}

From source file:org.jetbrains.kotlin.idea.refactoring.JetRefactoringUtil.java

License:Apache License

@Nullable
public static Collection<? extends PsiElement> checkParametersInMethodHierarchy(
        @NotNull PsiParameter parameter) {
    PsiMethod method = (PsiMethod) parameter.getDeclarationScope();

    Set<PsiElement> parametersToDelete = collectParametersHierarchy(method, parameter);
    if (parametersToDelete.size() > 1) {
        if (ApplicationManager.getApplication().isUnitTestMode()) {
            return parametersToDelete;
        }//from w w w. j av a2 s  .  co m

        String message = KotlinBundle.message("delete.param.in.method.hierarchy",
                formatJavaOrLightMethod(method));
        int exitCode = Messages.showOkCancelDialog(parameter.getProject(), message,
                IdeBundle.message("title.warning"), Messages.getQuestionIcon());
        if (exitCode == Messages.OK) {
            return parametersToDelete;
        } else {
            return null;
        }
    }

    return parametersToDelete;
}

From source file:org.jetbrains.plugins.gradle.service.project.data.ExternalProjectDataService.java

License:Apache License

@Nullable
private ExternalProject importExternalProject(@NotNull final Project project,
        @NotNull final ProjectSystemId projectSystemId, @NotNull final File projectRootDir) {
    final Boolean result = UIUtil.invokeAndWaitIfNeeded(new Computable<Boolean>() {
        @Override// www  .  j a  v a 2s. co  m
        public Boolean compute() {
            final Ref<Boolean> result = new Ref<Boolean>(false);
            if (project.isDisposed()) {
                return false;
            }

            final String linkedProjectPath = FileUtil.toCanonicalPath(projectRootDir.getPath());
            final ExternalProjectSettings projectSettings = ExternalSystemApiUtil
                    .getSettings(project, projectSystemId).getLinkedProjectSettings(linkedProjectPath);
            if (projectSettings == null) {
                LOG.warn("Unable to get project settings for project path: " + linkedProjectPath);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Available projects paths: " + ContainerUtil.map(
                            ExternalSystemApiUtil.getSettings(project, projectSystemId)
                                    .getLinkedProjectsSettings(),
                            new Function<ExternalProjectSettings, String>() {
                                @Override
                                public String fun(ExternalProjectSettings settings) {
                                    return settings.getExternalProjectPath();
                                }
                            }));
                }
                return false;
            }

            final File projectFile = new File(linkedProjectPath);
            final String projectName;
            if (projectFile.isFile()) {
                projectName = projectFile.getParentFile().getName();
            } else {
                projectName = projectFile.getName();
            }

            // ask a user for the project import if auto-import is disabled
            if (!projectSettings.isUseAutoImport()) {
                String message = String.format(
                        "Project '%s' require synchronization with %s configuration. \nImport the project?",
                        projectName, projectSystemId.getReadableName());
                int returnValue = Messages.showOkCancelDialog(message, "Import Project",
                        CommonBundle.getOkButtonText(), CommonBundle.getCancelButtonText(),
                        Messages.getQuestionIcon());
                if (returnValue != Messages.OK) {
                    return false;
                }
            }

            final String title = ExternalSystemBundle.message("progress.import.text", linkedProjectPath,
                    projectSystemId.getReadableName());
            new Task.Modal(project, title, false) {
                @Override
                public void run(@NotNull ProgressIndicator indicator) {
                    if (project.isDisposed()) {
                        return;
                    }

                    ExternalSystemNotificationManager.getInstance(project).clearNotifications(null,
                            NotificationSource.PROJECT_SYNC, projectSystemId);
                    ExternalSystemResolveProjectTask task = new ExternalSystemResolveProjectTask(
                            projectSystemId, project, linkedProjectPath, false);
                    task.execute(indicator, ExternalSystemTaskNotificationListener.EP_NAME.getExtensions());
                    if (project.isDisposed()) {
                        return;
                    }

                    final Throwable error = task.getError();
                    if (error != null) {
                        ExternalSystemNotificationManager.getInstance(project)
                                .processExternalProjectRefreshError(error, projectName, projectSystemId);
                        return;
                    }
                    final DataNode<ProjectData> projectDataDataNode = task.getExternalProject();
                    if (projectDataDataNode == null) {
                        return;
                    }

                    final Collection<DataNode<ExternalProject>> nodes = ExternalSystemApiUtil
                            .findAll(projectDataDataNode, KEY);
                    if (nodes.size() != 1) {
                        throw new IllegalArgumentException(
                                String.format("Expected to get a single external project but got %d: %s",
                                        nodes.size(), nodes));
                    }

                    ProjectRootManagerEx.getInstanceEx(myProject).mergeRootsChangesDuring(new Runnable() {
                        @Override
                        public void run() {
                            myProjectDataManager.importData(KEY, nodes, project, true);
                        }
                    });

                    result.set(true);
                }
            }.queue();

            return result.get();
        }
    });

    return result ? getRootExternalProject(projectSystemId, projectRootDir) : null;
}

From source file:org.jetbrains.tfsIntegration.ui.ApplyLabelDialog.java

License:Apache License

protected void doOKAction() {
    try {/*from w  w  w .  j  a  va2s . c om*/
        List<VersionControlLabel> labels = myWorkspace.getServer().getVCS().queryLabels(getLabelName(), null,
                null, false, null, null, false, myApplyLabelForm.getContentPane(),
                TFSBundle.message("checking.existing.labels"));
        if (!labels.isEmpty()) {
            String message = MessageFormat.format("Label ''{0}'' already exists.\nDo you want to update it?",
                    getLabelName());
            if (Messages.showOkCancelDialog(myProject, message, getTitle(), "Update Label", "Cancel",
                    Messages.getQuestionIcon()) != Messages.OK) {
                return;
            }
        }
    } catch (TfsException e) {
        Messages.showErrorDialog(myProject, e.getMessage(), getTitle());
        return;
    }
    super.doOKAction();
}

From source file:org.jetbrains.tfsIntegration.ui.CheckInPoliciesForm.java

License:Apache License

public CheckInPoliciesForm(Project project,
        Map<String, ManageWorkspacesForm.ProjectEntry> projectToDescriptors) {
    myProject = project;// ww w.j  ava  2  s  .c o  m
    myProjectToDescriptors = new HashMap<String, ModifyableProjectEntry>(projectToDescriptors.size());
    for (Map.Entry<String, ManageWorkspacesForm.ProjectEntry> e : projectToDescriptors.entrySet()) {
        myProjectToDescriptors.put(e.getKey(),
                new ModifyableProjectEntry(new ModifyableProjectEntry(e.getValue())));
    }

    myProjectCombo.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            updateTable();
            updateCheckboxes();
        }
    });

    myPoliciesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            updateButtons();
        }
    });

    List<String> projects = new ArrayList<String>(myProjectToDescriptors.keySet());
    Collections.sort(projects, new Comparator<String>() {
        public int compare(String s1, String s2) {
            return s1.compareTo(s2);
        }
    });

    myProjectCombo.setModel(new DefaultComboBoxModel(ArrayUtil.toStringArray(projects)));
    myProjectCombo.setRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JLabel component = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
                    cellHasFocus);
            String path = (String) value;
            component.setText(VersionControlPath.getTeamProject(path));
            return component;
        }
    });

    myPoliciesTable
            .setModelAndUpdateColumns(new ListTableModel<Pair<StatefulPolicyDescriptor, Boolean>>(COLUMNS));

    myEditButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            final StatefulPolicyDescriptor descriptor = getSelectedDescriptor();
            editPolicy(descriptor);
        }
    });

    myRemoveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            final StatefulPolicyDescriptor descriptor = getSelectedDescriptor();
            final String message = MessageFormat.format("Are you sure to remove checkin policy ''{0}''?",
                    descriptor.getType().getName());
            if (Messages.showOkCancelDialog(myProject, message, "Remove Checkin Policy",
                    Messages.getQuestionIcon()) == Messages.OK) {
                final ModifyableProjectEntry projectEntry = myProjectToDescriptors.get(getSelectedProject());
                projectEntry.descriptors.remove(descriptor);
                projectEntry.isModified = true;
                updateTable();
                updateButtons();
            }
        }
    });

    myAddButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            final ModifyableProjectEntry projectEntry = myProjectToDescriptors.get(getSelectedProject());

            List<PolicyBase> policies = new ArrayList<PolicyBase>();
            try {
                // do not allow to add the same unconfigurable policy several times
                main_loop: for (PolicyBase installed : CheckinPoliciesManager.getInstalledPolicies()) {
                    if (!installed.canEdit()) {
                        for (StatefulPolicyDescriptor descriptor : projectEntry.descriptors) {
                            if (descriptor.getType().equals(installed.getPolicyType())) {
                                continue main_loop;
                            }
                        }
                    }
                    policies.add(installed);
                }
            } catch (DuplicatePolicyIdException ex) {
                final String message = MessageFormat.format(
                        "Several checkin policies with the same id found: ''{0}''.\nPlease review your extensions.",
                        ex.getDuplicateId());
                Messages.showErrorDialog(myProject, message, "Add Checkin Policy");
                return;
            }

            ChooseCheckinPolicyDialog d = new ChooseCheckinPolicyDialog(myProject, policies);
            if (!d.showAndGet()) {
                return;
            }

            PolicyBase policy = d.getSelectedPolicy();
            StatefulPolicyDescriptor newDescriptor = new StatefulPolicyDescriptor(policy.getPolicyType(), true,
                    StatefulPolicyParser.createEmptyConfiguration(), Collections.<String>emptyList(),
                    StatefulPolicyDescriptor.DEFAULT_PRIORITY, null);

            if (!editPolicy(newDescriptor)) {
                return;
            }

            projectEntry.descriptors.add(newDescriptor);
            projectEntry.isModified = true;
            updateTable();
            int index = projectEntry.descriptors.size() - 1;
            myPoliciesTable.getSelectionModel().setSelectionInterval(index, index);
            updateButtons();
        }
    });

    new DoubleClickListener() {
        @Override
        protected boolean onDoubleClick(MouseEvent e) {
            final StatefulPolicyDescriptor descriptor = getSelectedDescriptor();
            if (descriptor != null) {
                editPolicy(descriptor);
            }
            return true;
        }
    }.installOn(myPoliciesTable);

    myTeampriseCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject());
            entry.policiesCompatibilityOverride.teamprise = myTeampriseCheckBox.isSelected();
            entry.isModified = true;
        }
    });

    myTeamExplorerCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject());
            entry.policiesCompatibilityOverride.teamExplorer = myTeamExplorerCheckBox.isSelected();
            entry.isModified = true;
        }
    });

    myNonInstalledPoliciesCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject());
            entry.policiesCompatibilityOverride.nonInstalled = myNonInstalledPoliciesCheckBox.isSelected();
            entry.isModified = true;
        }
    });

    myOverrideCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject());
            if (myOverrideCheckBox.isSelected()) {
                entry.policiesCompatibilityOverride = new TfsCheckinPoliciesCompatibility(false, false, false);
            } else {
                entry.policiesCompatibilityOverride = null;
            }
            updateCheckboxes();
            entry.isModified = true;
        }
    });

    ActionListener l = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean b = myTeamExplorerCheckBox.isSelected() || myTeampriseCheckBox.isSelected();
            myNonInstalledPoliciesCheckBox.setEnabled(b);
            if (!b) {
                myNonInstalledPoliciesCheckBox.setSelected(false);
                myProjectToDescriptors
                        .get(getSelectedProject()).policiesCompatibilityOverride.nonInstalled = false;
            }
        }
    };
    myTeamExplorerCheckBox.addActionListener(l);
    myTeampriseCheckBox.addActionListener(l);

    updateTable();
    updateCheckboxes();
    updateButtons();
}

From source file:org.zmlx.hg4idea.command.HgUpdateCommand.java

License:Apache License

@Nullable
public HgCommandResult execute() {
    List<String> arguments = new LinkedList<>();
    if (clean) {/*from  w  w  w .j a v  a  2s . c om*/
        arguments.add("--clean");
    }

    if (!StringUtil.isEmptyOrSpaces(revision)) {
        arguments.add("--rev");
        arguments.add(revision);
    }

    final HgPromptCommandExecutor executor = new HgPromptCommandExecutor(project);
    executor.setShowOutput(true);
    HgCommandResult result;
    AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
    try {
        result = executor.executeInCurrentThread(repo, "update", arguments);
        if (!clean && hasUncommittedChangesConflict(result)) {
            final String message = "<html>Your uncommitted changes couldn't be merged into the requested changeset.<br>"
                    + "Would you like to perform force update and discard them?";
            if (showDiscardChangesConfirmation(project, message) == Messages.OK) {
                arguments.add("-C");
                result = executor.executeInCurrentThread(repo, "update", arguments);
            }
        }
    } finally {
        DvcsUtil.workingTreeChangeFinished(project, token);
    }

    VfsUtil.markDirtyAndRefresh(false, true, false, repo);
    return result;
}

From source file:org.zmlx.hg4idea.provider.commit.HgCheckinEnvironment.java

License:Apache License

private boolean mayCommitEverything(final String filesNotIncludedString) {
    final int[] choice = new int[1];
    Runnable runnable = new Runnable() {
        public void run() {
            choice[0] = Messages.showOkCancelDialog(myProject,
                    HgVcsMessages.message("hg4idea.commit.partial.merge.message", filesNotIncludedString),
                    HgVcsMessages.message("hg4idea.commit.partial.merge.title"), null);
        }/*from w  w  w . j  av a 2 s .  com*/
    };
    ApplicationManager.getApplication().invokeAndWait(runnable);
    return choice[0] == Messages.OK;
}

From source file:org.zmlx.hg4idea.provider.HgRollbackEnvironment.java

License:Apache License

private void revert(@NotNull List<FilePath> filePaths) {
    for (Map.Entry<VirtualFile, Collection<FilePath>> entry : HgUtil.groupFilePathsByHgRoots(project, filePaths)
            .entrySet()) {//from   ww  w .  j a v a  2  s  .co m
        final VirtualFile repo = entry.getKey();
        final Collection<FilePath> files = entry.getValue();

        HgRevisionNumber revisionNumber = new HgWorkingCopyRevisionsCommand(project).firstParent(repo);
        for (List<String> chunk : VcsFileUtil.chunkPaths(repo, files)) {
            HgCommandResult revertResult = new HgRevertCommand(project).execute(repo, chunk, revisionNumber,
                    false);
            if (HgErrorUtil.hasUncommittedChangesConflict(revertResult)) {

                String message = String.format("<html>Revert failed due to uncommitted merge.<br>"
                        + "Would you like to discard all changes for repository <it><b>%s</b></it>?</html>",
                        repo.getPresentableName());

                int exitCode = HgUpdateCommand.showDiscardChangesConfirmation(project, message);
                if (exitCode == Messages.OK) {
                    //discard all changes for this repository//
                    HgUpdateCommand updateCommand = new HgUpdateCommand(project, repo);
                    updateCommand.setClean(true);
                    updateCommand.setRevision(".");
                    updateCommand.execute();
                }
                break;
            }
            new HgResolveCommand(project).markResolved(repo, files);
        }
    }
}

From source file:view.PluginViewFactory.java

License:Apache License

private void viewComponentInit() {
    TableCellEditor editor = new DefaultCellEditor(mPropNameComboBox);
    mPropTable.setRowHeight(30);//w w  w. ja  v  a  2  s  . c  o  m
    mPropTable.setModel(new PropertyTableModel());
    mPropTable.setAutoscrolls(true);
    mPropTable.getColumnModel().getColumn(COLUMN_PROPERTY_NAME).setCellEditor(editor);
    mPropTable.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent tableModelEvent) {

            if (mIsUpdateDone == false)
                return;
            int row = tableModelEvent.getFirstRow();
            int col = tableModelEvent.getColumn();
            String name = mPropTable.getValueAt(row, COLUMN_PROPERTY_NAME).toString();
            if (col == COLUMN_PROPERTY_NAME) {
                cellChangeToCurrentValueAtRow(row);
            } else if (col == COLUMN_PROPERTY_VALUE) {
                Property property = mDeviceManager.getProperty(name);
                Object valueObject = mPropTable.getValueAt(row, COLUMN_PROPERTY_VALUE);
                if (valueObject == null) {
                    return;
                } else if ("".equals(name)) {
                    mPropTable.setValueAt(null, row, COLUMN_PROPERTY_VALUE);
                    return;
                }
                String value = valueObject.toString();
                if (property != null) {
                    if (!value.equals(mDeviceManager.getProperty(name))) {
                        try {
                            mDeviceManager.setPropertyValue(name, value);
                            saveTable();
                        } catch (NullValueException e) {
                            cellChangeToCurrentValueAtRow(row);
                            e.printStackTrace();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                } else if (value != null) {
                    mDeviceManager.putProperty(name, new Property(name, value));
                }
            } else {
                System.out.println("Error : Col Number Over");
            }
        }
    });

    mDeviceListComboBox.setPrototypeDisplayValue("XXXXXXXXXXXXX");
    mDeviceListComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            if (ItemEvent.SELECTED == itemEvent.getStateChange()) {
                SelectedDeviceChanged();
            }

        }
    });

    mTableViewListComboBox.setPrototypeDisplayValue("XXXXXXXXXXXXX");
    mTableViewListComboBox.setEditable(true);

    mTableViewListComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            if (itemEvent.getStateChange() == ItemEvent.DESELECTED)
                return;
            String tableView = itemEvent.getItem().toString();
            if (TABLE_VIEW_LIST_PROPERTY_NAME.equals(tableView)) {
                showMessage("Cannot use that table view name", "Error");
                return;
            }
            updateTable(tableView);
        }
    });

    mRefreshButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            mDeviceManager.updatePropFromDevice();
        }
    });

    final JFileChooser jFileChooser = new JFileChooser();
    jFileChooser.setCurrentDirectory(new File(mProject.getBasePath()));
    jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    jFileChooser.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            File selectedFile = jFileChooser.getSelectedFile();
            if (selectedFile == null)
                return;
            mIsChosenFileExist = selectedFile.exists();
            mIsChosenFileWritable = selectedFile.getParentFile().canWrite();
        }
    });

    mSavePropFileButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            if (jFileChooser.showSaveDialog(mPluginViewContent) == JFileChooser.CANCEL_OPTION)
                return;
            if (!mIsChosenFileWritable) {
                showMessage("Please choose writable path.", "Android Property Manager");
                return;
            } else if (mIsChosenFileExist) {
                if (Messages.showOkCancelDialog("Overwrite file?", "Android Property Manager",
                        Messages.getInformationIcon()) != Messages.OK) {
                    return;
                }
            }
            String[] values = mPropertiesComponent
                    .getValues(mTableViewListComboBox.getSelectedItem().toString());
            ArrayList<String> propertyNames;
            if (ALL_TABLE_VIEW_PROPERTY_NAME == mTableViewListComboBox.getSelectedItem().toString()) {
                propertyNames = mDeviceManager.getPropertyNames();
            } else {
                propertyNames = new ArrayList<>(Arrays.asList(values));
            }
            mDeviceManager.savePropFile(jFileChooser.getSelectedFile().getPath(), propertyNames);
        }
    });

    mLoadPropFileButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            if (jFileChooser.showDialog(mPluginViewContent, "Choose") == JFileChooser.CANCEL_OPTION)
                return;

            if (mIsChosenFileExist) {
                mDeviceManager.loadPropFile(jFileChooser.getSelectedFile().getPath());
                mDeviceManager.updatePropFromDevice();
            } else {
                showMessage("Please select exist file.", "Android Property Manager");
            }
        }
    });

    mPushPropFileButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            if (jFileChooser.showDialog(mPluginViewContent, "Choose") == JFileChooser.CANCEL_OPTION)
                return;
            if (mIsChosenFileExist) {
                String oldPropDirPath = mProject.getBasePath();
                mDeviceManager.pushPropFile(jFileChooser.getSelectedFile().getPath(), oldPropDirPath);
                PluginViewFactory.getInstance()
                        .setHint("Property file is saved at system/build.prop of device file system");
            } else {
                showMessage("Please select exist file.", "Android Property Manager");
            }
        }
    });

    mRestartRuntimeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            try {
                PluginViewFactory.getInstance().setHint("Device is restarting runtime...");
                mDeviceManager.restartRuntime();
            } catch (TimeoutException e) {
                e.printStackTrace();
            } catch (AdbCommandRejectedException e) {
                e.printStackTrace();
            } catch (ShellCommandUnresponsiveException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });

    mRebootDeviceButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            try {
                PluginViewFactory.getInstance().setHint("Device is rebooting..., so now it is offline state");
                mDeviceManager.rebootDevice();
            } catch (TimeoutException e) {
                e.printStackTrace();
            } catch (AdbCommandRejectedException e) {
                e.printStackTrace();
            } catch (ShellCommandUnresponsiveException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
}