本文整理汇总了Java中com.tagmycode.plugin.Framework类的典型用法代码示例。如果您正苦于以下问题:Java Framework类的具体用法?Java Framework怎么用?Java Framework使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Framework类属于com.tagmycode.plugin包,在下文中一共展示了Framework类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performOperation
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Override
public Void performOperation() throws Exception {
if (tagMyCode.isServiceAvailable()) {
syncProcess.setNetworkAvailable(true);
Framework.LOGGER.info(String.format("Fetching snippets since: %s", tagMyCode.getLastSnippetsUpdate()));
try {
processSync();
} catch (TagMyCodeApiException apiException) {
Framework.LOGGER.error(apiException.getMessage());
framework.resetLastSnippetsUpdate();
snippetsStorage.deleteNonDirty();
processSync();
}
Framework.LOGGER.info(String.format("Last snippets update: %s", tagMyCode.getLastSnippetsUpdate()));
} else {
syncProcess.setNetworkAvailable(false);
Framework.LOGGER.warn("Fetching snippets: Network unreachable");
}
return null;
}
示例2: manageChangedSnippets
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
private void manageChangedSnippets(SnippetsCollection changedSnippets) throws SQLException {
for (Snippet snippet : changedSnippets) {
Snippet foundSnippet = snippetsStorage.findBySnippetId(snippet.getId());
if (foundSnippet == null) {
Snippet newSnippetWithLocalId = snippetsStorage.findByLocalId(snippet.getLocalId());
if (newSnippetWithLocalId == null) {
createSnippet(snippet);
} else {
updateSnippet(snippet);
}
} else {
snippet.setLocalId(foundSnippet.getLocalId());
updateSnippet(snippet);
}
}
Framework.LOGGER.debug("Changed: " + changedSnippets.size() + " snippets");
}
示例3: AboutDialog
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
public AboutDialog(Framework framework, Frame parent) {
super(framework, parent);
configureButtons();
GuiUtil.addClickableLink(framework, tagmycodeLinkLabel, "https://tagmycode.com");
AbstractVersion version = framework.getVersion();
if (version.getPluginTitle().length() > 0) {
title.setText(version.getPluginTitle());
}
appendTextToJLabel(pluginVersionLabel, version.getPluginVersion());
appendTextToJLabel(frameworkVersionLabel, version.getFrameworkVersion());
appendTextToJLabel(frameworkBuildDateLabel, version.getFrameworkBuildDate());
defaultInitWindow();
initWindow();
}
示例4: FilterSnippetsTextField
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
public FilterSnippetsTextField(Framework framework, SnippetsTable snippetsTable) {
assert framework != null;
assert snippetsTable != null;
this.framework = framework;
this.snippetsTable = snippetsTable;
getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
doFilter();
}
@Override
public void removeUpdate(DocumentEvent e) {
doFilter();
}
@Override
public void changedUpdate(DocumentEvent e) {
doFilter();
}
});
}
示例5: SnippetsTable
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
public SnippetsTable(Framework framework) {
this.framework = framework;
model = new SnippetsTableModel(framework.getData());
jTable = new JTable(model);
sorter = new TableRowSorter<>(model);
jTable.setRowSorter(sorter);
jTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
jTable.setIntercellSpacing(new Dimension(0, 0));
jTable.setCellSelectionEnabled(false);
jTable.setRowSelectionAllowed(true);
jTable.setShowGrid(false);
scrollPane = new JScrollPane(jTable);
GuiUtil.removeBorder(scrollPane);
cellSelectionModel = jTable.getSelectionModel();
cellSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
configureTableHeader();
sortByColumn(SnippetsTableModel.MODIFIED);
}
示例6: testOnSuccessForceScheduleUpdate
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Test
public void testOnSuccessForceScheduleUpdate() throws Exception {
Framework frameworkMock = mock(Framework.class);
SnippetDialog snippetDialogMock = mock(SnippetDialog.class);
when(snippetDialogMock.getFramework()).thenReturn(frameworkMock);
SnippetsUpdatePollingProcess snippetsUpdatePollingProcess = mock(SnippetsUpdatePollingProcess.class);
when(frameworkMock.getPollingProcess()).thenReturn(snippetsUpdatePollingProcess);
EditSnippetOperation createAndEditSnippetOperation = new EditSnippetOperation(snippetDialogMock);
Snippet snippet = resourceGenerate.aSnippet();
createAndEditSnippetOperation.onSuccess(snippet);
verify(snippetDialogMock, times(1)).closeDialog();
verify(snippetsUpdatePollingProcess, times(1)).forceScheduleUpdate();
}
开发者ID:massimozappino,项目名称:tagmycode-java-plugin-framework,代码行数:17,代码来源:CreateAndEditSnippetOperationTest.java
示例7: testSelection
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Test
public void testSelection() throws Exception {
Framework framework = createFramework();
framework.restoreData();
SnippetsPanel snippetsTab = new SnippetsPanel(framework);
SnippetsTable snippetsTable = snippetsTab.getSnippetsTable();
snippetsTable.fireSnippetsChanged();
JPanel snippetViewFormPanel = snippetsTab.getSnippetViewFormPane();
JTable jTable = snippetsTable.getJTable();
assertEquals(1, snippetViewFormPanel.getComponentCount());
assertEquals(2, jTable.getRowCount());
jTable.setRowSelectionInterval(0, 0);
assertEquals(1, snippetViewFormPanel.getComponentCount());
jTable.setRowSelectionInterval(1, 0);
jTable.setRowSelectionInterval(0, 0);
assertEquals(1, snippetViewFormPanel.getComponentCount());
}
示例8: populateSnippetDialogWithExistentLanguageOverridePreferredLanguage
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Test
public void populateSnippetDialogWithExistentLanguageOverridePreferredLanguage() throws Exception {
final Framework framework = createFramework();
LanguagesCollection languageCollection = resourceGenerate.aLanguageCollection();
Language customLanguage = new Language();
customLanguage.setId(88);
customLanguage.setName("Custom");
customLanguage.setCode("custom");
languageCollection.add(customLanguage);
framework.setLanguageCollection(languageCollection);
framework.getStorageEngine().saveLastLanguageUsed(customLanguage);
SnippetDialog snippetDialog = createSnippetDialog(framework);
assertEquals(customLanguage, snippetDialog.getLanguageComboBox().getSelectedItem());
Snippet expectedSnippet = resourceGenerate.aSnippet();
snippetDialog.populateFieldsWithSnippet(expectedSnippet);
assertEquals(expectedSnippet.getLanguage(), snippetDialog.getLanguageComboBox().getSelectedItem());
}
示例9: testPerformValidation
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Test
public void testPerformValidation() throws Exception {
AbstractFieldValidation abstractFieldValidation;
JTextField fieldMock = mock(JTextField.class);
Framework spyFramework = createSpyFramework();
abstractFieldValidation = createAbstractFieldValidation(fieldMock, spyFramework, true);
assertTrue(abstractFieldValidation.performValidation());
verify(spyFramework, times(0)).showErrorDialog(eq("Message error"));
verify(fieldMock, times(0)).requestFocus();
abstractFieldValidation = createAbstractFieldValidation(fieldMock, spyFramework, false);
assertFalse(abstractFieldValidation.performValidation());
verify(spyFramework, times(1)).showErrorDialog(eq("Message error"));
verify(fieldMock, times(1)).requestFocus();
}
开发者ID:massimozappino,项目名称:tagmycode-java-plugin-framework,代码行数:17,代码来源:AbstractFieldValidationTest.java
示例10: afterLoginInitializeIsCalled
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Test
public void afterLoginInitializeIsCalled() throws Exception {
Framework framework = createFramework(createStorageEngineWithData());
Framework frameworkSpy = spy(framework);
final LoginDialog loginDialog = frameworkSpy.showLoginDialog();
String verificationCode = "verification-code";
loginDialog.getVerificationCodeTextField().setText(verificationCode);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
loginDialog.getButtonOk().doClick();
}
});
Thread.sleep(200);
verify(frameworkSpy, times(1)).initialize(verificationCode);
}
示例11: selectASnippetAndSeeDetailsOnRightPanel
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Test
public void selectASnippetAndSeeDetailsOnRightPanel() throws Exception {
Framework framework = createFramework(createStorageEngineWithData());
mockTagMyCodeReturningValidAccountData(framework);
framework.getData().setAccount(resourceGenerate.aUser());
framework.getData().setSnippets(resourceGenerate.aSnippetCollection());
framework.getData().saveAll();
framework.start();
JFrame jFrame = new JFrame();
jFrame.add(framework.getMainWindow().getMainComponent());
jFrame.pack();
JPanel snippetViewFormPane = framework.getMainWindow().getSnippetsPanel().getSnippetViewFormPane();
assertEquals("welcome view", snippetViewFormPane.getComponent(0).getName());
framework.getMainWindow().getSnippetsPanel().getSnippetsTable().getJTable().setRowSelectionInterval(1, 1);
assertEquals("snippet view", snippetViewFormPane.getComponent(0).getName());
}
示例12: editASnippet
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Test
public void editASnippet() throws Exception {
Framework framework = new FrameworkBuilder().
setStorageEngine(createStorageEngineWithData())
.build();
SnippetsCollection snippetCollection = new SnippetsCollection();
Snippet originalSnippet = resourceGenerate.aSnippet().setId(0).setTitle("original title");
snippetCollection.add(originalSnippet);
framework.getData().getStorageEngine().saveSnippets(snippetCollection);
framework.restoreData();
framework.getData().saveAll();
SnippetDialog snippetDialog = new SnippetDialog(framework, null);
snippetDialog.setSnippet(originalSnippet);
snippetDialog.getTitleBox().setText("new title");
clickOnButton(snippetDialog.getButtonOk());
assertEquals(1, framework.getData().getSnippets().size());
assertEquals("new title", framework.getData().getSnippets().firstElement().getTitle());
}
开发者ID:massimozappino,项目名称:tagmycode-java-plugin-framework,代码行数:23,代码来源:SyncSnippetsAcceptanceTest.java
示例13: create
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Override
public void create(final Runnable runnable, final String title) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Framework.LOGGER.info(title + "... START");
runnable.run();
Framework.LOGGER.info(title + "... END");
}
});
thread.start();
}
示例14: performOperation
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
@Override
protected Object performOperation() throws Exception {
Framework framework = loginDialog.getFramework();
try {
framework.initialize(verificationCode);
} catch (TagMyCodeException e) {
framework.showErrorDialog("Verification code is not valid");
throw e;
}
return null;
}
示例15: manageDeletions
import com.tagmycode.plugin.Framework; //导入依赖的package包/类
private void manageDeletions(SnippetsDeletions snippetsDeletions) throws SQLException, JSONException {
int snippetsDeleted = 0;
for (Integer deletion : snippetsDeletions) {
Snippet foundSnippetToDelete = snippetsStorage.findBySnippetId(deletion);
if (foundSnippetToDelete != null) {
dbService.snippetDao().deleteById(String.valueOf(foundSnippetToDelete.getLocalId()));
snippetsDeleted++;
Framework.LOGGER.debug("Deleting: " + foundSnippetToDelete.toJson());
}
}
Framework.LOGGER.debug("Deleted: " + snippetsDeleted + " snippets");
}