本文整理汇总了Java中org.netbeans.api.progress.ProgressHandleFactory类的典型用法代码示例。如果您正苦于以下问题:Java ProgressHandleFactory类的具体用法?Java ProgressHandleFactory怎么用?Java ProgressHandleFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProgressHandleFactory类属于org.netbeans.api.progress包,在下文中一共展示了ProgressHandleFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchStarted
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
public void searchStarted() {
progressHandle = ProgressHandleFactory.createHandle(
NbBundle.getMessage(ResultView.class,
"TEXT_SEARCHING___"), new Cancellable() { //NOI18N
@Override
public boolean cancel() {
searchComposition.terminate();
return true;
}
});
progressHandle.start();
resultViewPanel.searchStarted();
searchComposition.getSearchResultsDisplayer().searchStarted();
Collection<? extends Savable> unsaved =
Savable.REGISTRY.lookupAll(Savable.class);
if (unsaved.size() > 0) {
String msg = NbBundle.getMessage(ResultView.class,
"TEXT_INFO_WARNING_UNSAVED");
eventChildren.addEvent(new EventNode(EventType.WARNING, msg));
}
}
示例2: saveToFile
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
private void saveToFile() {
final File file = new FileChooserBuilder(AttachmentsPanel.class)
.setFilesOnly(true).showSaveDialog();
if (file != null) {
String progressFormat = NbBundle.getMessage(
SaveAttachmentAction.class,
"Attachment.saveToFile.progress"); //NOI18N
String progressMessage = MessageFormat.format(progressFormat, getFilename());
final ProgressHandle handle = ProgressHandleFactory.createHandle(progressMessage);
handle.start();
handle.switchToIndeterminate();
Support.getInstance().getParallelRP().post(new Runnable() {
@Override
public void run() {
try {
getAttachmentData(file);
} catch (IOException ioex) {
LOG.log(Level.INFO, ioex.getMessage(), ioex);
} finally {
handle.finish();
}
}
});
}
}
示例3: applyPatch
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
private void applyPatch() {
String progressFormat = NbBundle.getMessage(AttachmentsPanel.class,"Attachment.applyPatch.progress"); //NOI18N
String progressMessage = MessageFormat.format(progressFormat, getFilename());
final ProgressHandle handle = ProgressHandleFactory.createHandle(progressMessage);
handle.start();
handle.switchToIndeterminate();
Support.getInstance().getParallelRP().post(
new Runnable() {
@Override
public void run() {
IDEServices ideServices = Support.getInstance().getIDEServices();
if(ideServices != null) {
try {
ideServices.applyPatch(saveToTempFile());
} catch (IOException ex) {
LOG.log(Level.WARNING, ex.getMessage(), ex);
} finally {
handle.finish();
}
}
}
});
}
示例4: paste
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
@Override
public Transferable paste() throws IOException {
if (SwingUtilities.isEventDispatchThread()) {
PackageRootNode.PKG_VIEW_RP.post(new java.lang.Runnable() {
@Override
public void run() {
final ProgressHandle h = ProgressHandleFactory.createHandle(getName());
h.start();
h.switchToIndeterminate();
try {
doPaste();
} catch (java.io.IOException ioe) {
Exceptions.printStackTrace(ioe);
} finally {
h.finish();
}
}
});
} else {
doPaste();
}
return ExTransferable.EMPTY;
}
示例5: readSettings
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
@Override
public void readSettings(WizardDescriptor settings) {
sources = null;
sourcesString = null;
javadoc = null;
javadocString = null;
this.wiz = settings;
this.component.progressPanel.setVisible (true);
this.component.progressLabel.setVisible (true);
this.progressHandle = ProgressHandleFactory.createHandle(NbBundle.getMessage(DetectPanel.class,"TXT_PlatfromDetectProgress"));
this.component.progressPanel.removeAll();
this.component.progressPanel.setLayout (new GridBagLayout ());
GridBagConstraints c = new GridBagConstraints ();
c.gridx = c.gridy = GridBagConstraints.RELATIVE;
c.gridheight = c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
JComponent pc = ProgressHandleFactory.createProgressComponent(this.progressHandle);
((GridBagLayout)this.component.progressPanel.getLayout ()).setConstraints(pc,c);
this.component.progressPanel.add (pc);
this.progressHandle.start ();
task.schedule(0);
}
示例6: doActivate
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
private static void doActivate() {
if (!helper.canBundleDerby()) {
LOGGER.fine("Default platform cannot bundle Derby"); // NOI18N
return;
}
ProgressHandle handle = ProgressHandleFactory.createSystemHandle(NbBundle.getMessage(DerbyActivator.class, "MSG_RegisterJavaDB"));
handle.start();
try {
if (registerDerby()) {
registerSampleDatabase();
}
} finally {
handle.finish();
}
}
示例7: createDialog
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
private void createDialog(String title) {
pHandle = ProgressHandleFactory.createHandle(title);
JPanel panel = new ProgressPanel(pHandle);
DialogDescriptor descriptor = new DialogDescriptor(
panel, title
);
final Object[] OPTIONS = new Object[0];
descriptor.setOptions(OPTIONS);
descriptor.setClosingOptions(OPTIONS);
descriptor.setModal(true);
descriptor.setOptionsAlign(DialogDescriptor.BOTTOM_ALIGN);
dialog = DialogDisplayer.getDefault().createDialog(descriptor);
Frame mainWindow = WindowManager.getDefault().getMainWindow();
int windowWidth = mainWindow.getWidth();
int windowHeight = mainWindow.getHeight();
int dialogWidth = dialog.getWidth();
int dialogHeight = dialog.getHeight();
int dialogX = (int)(windowWidth/2.0) - (int)(dialogWidth/2.0);
int dialogY = (int)(windowHeight/2.0) - (int)(dialogHeight/2.0);
dialog.setLocation(dialogX, dialogY);
}
示例8: panelForHandle
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
private static JPanel panelForHandle(ProgressHandle handle) {
JLabel label = ProgressHandleFactory.createDetailLabelComponent(handle);
JComponent progress = ProgressHandleFactory.createProgressComponent(handle);
JPanel panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(label)
.addComponent(progress))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addContainerGap()
.addComponent(label)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(progress)
.addContainerGap()
);
return panel;
}
示例9: ProgressL
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
public ProgressL() {
final String lab = NbBundle.getMessage(RefactoringPanel.class, "LBL_RefactorProgressLabel");
handle = ProgressHandleFactory.createHandle(lab);
JComponent progress = ProgressHandleFactory.createProgressComponent(handle);
JPanel component = new JPanel();
component.setLayout(new BorderLayout());
component.setBorder(new EmptyBorder(12,12,11,11));
JLabel label = new JLabel(lab);
label.setBorder(new EmptyBorder(0, 0, 6, 0));
component.add(label, BorderLayout.NORTH);
component.add(progress, BorderLayout.CENTER);
DialogDescriptor desc = new DialogDescriptor(component, NbBundle.getMessage(RefactoringPanel.class, "LBL_RefactoringInProgress"), true, new Object[]{}, null, 0, null, null);
desc.setLeaf(true);
d = DialogDisplayer.getDefault().createDialog(desc);
((JDialog) d).setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}
示例10: ProgressPanel
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
/** Creates new form ProgressPanel */
public ProgressPanel() {
initComponents();
handle = ProgressHandleFactory.createHandle(
NbBundle.getMessage(ImportProjectAction.class, "CTL_ProgressDialogTitle")); // NOI18N
progress = ProgressHandleFactory.createProgressComponent(handle);
setLayout(new GridBagLayout());
setPreferredSize(new Dimension(450, 80));
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new Insets(0, 5, 0, 5);
add(progress, gridBagConstraints);
}
示例11: testCopyWithInnerProjectSimple
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
public void testCopyWithInnerProjectSimple() throws Exception {
TestUtil.createFileFromContent(DefaultProjectOperationsImplementationTest.class.getResource("data/test.txt"), projdir, "lib/test.txt");
FileObject projdir2 = projdir.createFolder("proj2");
createProject(projdir2);
ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
FileObject newTarget = prj.getProjectDirectory().getParent();
DefaultProjectOperationsImplementation.doCopyProject(handle, prj, "projCopy", newTarget);
File newProject = new File(FileUtil.toFile(newTarget), "projCopy");
assertTrue(newProject.isDirectory());
assertTrue(new File(newProject, "nbproject").isDirectory());
assertTrue(new File(newProject, "src").isDirectory());
assertTrue(new File(newProject, "lib").isDirectory());
assertFalse(new File(newProject, "proj2").exists());
}
示例12: testCopyWithInnerProjectComplex
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
public void testCopyWithInnerProjectComplex() throws Exception {
TestUtil.createFileFromContent(DefaultProjectOperationsImplementationTest.class.getResource("data/test.txt"), projdir, "lib/test.txt");
FileObject projdir2 = projdir.getFileObject("lib").createFolder("proj2");
createProject(projdir2);
ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
FileObject newTarget = prj.getProjectDirectory().getParent();
DefaultProjectOperationsImplementation.doCopyProject(handle, prj, "projCopy", newTarget);
File newProject = new File(FileUtil.toFile(newTarget), "projCopy");
assertTrue(newProject.isDirectory());
assertTrue(new File(newProject, "nbproject").isDirectory());
assertTrue(new File(newProject, "src").isDirectory());
assertTrue(new File(newProject, "lib").isDirectory());
assertFalse(new File(new File(newProject, "lib"), "proj2").exists());
}
示例13: testMainProjectFlagNotMovedWhenCopying
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
public void testMainProjectFlagNotMovedWhenCopying() throws Exception {
OpenProjects.getDefault().close(OpenProjects.getDefault().getOpenProjects());
OpenProjects.getDefault().open(new Project[] {prj}, false);
//set the project to be copied as main.
OpenProjects.getDefault().setMainProject(prj);
assertTrue(prj.getProjectDirectory().equals(OpenProjects.getDefault().getMainProject().getProjectDirectory()));
ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
FileObject oldProject = prj.getProjectDirectory();
File oldProjectFile = FileUtil.toFile(oldProject);
FileObject newTarget = oldProject.getParent();
DefaultProjectOperationsImplementation.doCopyProject(handle, prj, "projCopy", newTarget);
//test that after copying the main project is still the original one.
Project main = OpenProjects.getDefault().getMainProject();
assertTrue(main != null && main.getProjectDirectory().equals(prj.getProjectDirectory()));
}
示例14: testMoveWithLib
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
public void testMoveWithLib() throws Exception {
TestUtil.createFileFromContent(DefaultProjectOperationsImplementationTest.class.getResource("data/test.txt"), projdir, "lib/test.txt");
ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
FileObject oldProject = prj.getProjectDirectory();
File oldProjectFile = FileUtil.toFile(oldProject);
FileObject newTarget = oldProject.getParent();
DefaultProjectOperationsImplementation.doMoveProject(handle, prj, "projMove","projMove", newTarget, "ERR_Cannot_Move");
File newProject = new File(FileUtil.toFile(newTarget), "projMove");
assertTrue(newProject.isDirectory());
assertTrue(new File(newProject, "nbproject").isDirectory());
assertTrue(new File(newProject, "src").isDirectory());
assertTrue(new File(newProject, "lib").isDirectory());
assertFalse(oldProjectFile.exists());
}
示例15: testMoveWithInnerProjectSimple
import org.netbeans.api.progress.ProgressHandleFactory; //导入依赖的package包/类
public void testMoveWithInnerProjectSimple() throws Exception {
TestUtil.createFileFromContent(DefaultProjectOperationsImplementationTest.class.getResource("data/test.txt"), projdir, "lib/test.txt");
FileObject projdir2 = projdir.createFolder("proj2");
createProject(projdir2);
ProgressHandle handle = ProgressHandleFactory.createHandle("test-handle");
handle.start(DefaultProjectOperationsImplementation.MAX_WORK);
FileObject oldProject = prj.getProjectDirectory();
File oldProjectFile = FileUtil.toFile(oldProject);
FileObject newTarget = oldProject.getParent();
DefaultProjectOperationsImplementation.doMoveProject(handle, prj, "projMove", "projMove", newTarget, "ERR_Cannot_Move");
File newProject = new File(FileUtil.toFile(newTarget), "projMove");
assertTrue(newProject.isDirectory());
assertTrue(new File(newProject, "nbproject").isDirectory());
assertTrue(new File(newProject, "src").isDirectory());
assertTrue(new File(newProject, "lib").isDirectory());
// We now try to just move the project directory as is:
assertTrue(new File(newProject, "proj2").isDirectory());
assertFalse(new File(oldProjectFile, "proj2").exists());
}