下面列出了怎么用org.eclipse.ui.progress.IProgressConstants的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Called when the job is finished.
*/
protected void doFinish()
{
// setProperty(IProgressConstants.ICON_PROPERTY, image);
if (AbstractJob.isModal(this))
{
Display.getDefault().asyncExec(new Runnable() {
public void run()
{
getJobCompletedAction().run();
}
});
} else
{
setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
setProperty(IProgressConstants.ACTION_PROPERTY, getJobCompletedAction());
}
}
@Override
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, (float) 0.25, editorArea); //$NON-NLS-1$
left.addView(IPageLayout.ID_PROJECT_EXPLORER);
left.addPlaceholder(IPageLayout.ID_RES_NAV);
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
bottom.addView("org.eclipse.tm.terminal.view.ui.TerminalsView");
bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
bottom.addPlaceholder(TemplatesView.ID);
bottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
bottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
bottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
bottom.addPlaceholder(IPageLayout.ID_TASK_LIST);
bottom.addPlaceholder(IPageLayout.ID_PROP_SHEET);
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75, editorArea);
}
protected void addDownloadJob(DownloadJob downloadJob) {
if (downloadJob != null) {
// This is a non-user job, so make sure that it has no presence in the
// Progress View
downloadJob.setSystem(true);
downloadJob.addJobChangeListener(removeJobOnCompleteListener);
// If the job returns an ERROR status, make sure that it does not show
// a modal dialog with the ERROR information; we want a silent failure
downloadJob.setProperty(
IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, true);
synchronized (downloadJobs) {
downloadJob.schedule();
downloadJobs.add(downloadJob);
}
}
}
/**
* @param layout
* @param editorArea
*/
public void defineLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, (float) 0.26, editorArea); //$NON-NLS-1$
topLeft.addView("org.python.pydev.navigator.view");
IFolderLayout outputfolder = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
//outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
//Add the outline only if we're not using the minimap.
if (!MinimapOverviewRulerPreferencesPage.getShowMinimapContents()) {
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75, editorArea);
}
}
public OutgoingInvitationJob(OutgoingSessionNegotiation negotiation) {
super(
MessageFormat.format(
Messages.NegotiationHandler_inviting_user,
getNickname(negotiation.getPeer()),
negotiation.getPeer().getRAW()));
this.negotiation = negotiation;
this.peer = negotiation.getPeer().getBase();
setUser(true);
setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
setProperty(
IProgressConstants.ICON_PROPERTY,
ImageManager.getImageDescriptor("/icons/elcl16/session_tsk.png"));
}
public SlicingFromSinkJob(String name, LapseView view) {
super(name);
this.view = view;
setProperty(IProgressConstants.ACTION_PROPERTY,
new Action("Pop up a dialog") {
public void run() {
MessageDialog.openInformation(getSite().getShell(), "Goto Action", "The job can have an action associated with it");
}
});
}
@VisibleForTesting
MessageConsoleStream createNewMessageConsole() {
MessageConsole console = MessageConsoleUtilities.getMessageConsole(
Messages.getString("configuring.cloud.sdk"), // $NON-NLS-1$
null /* imageDescriptor */);
setProperty(IProgressConstants.ACTION_PROPERTY, new ShowConsoleViewAction(console));
return console.newMessageStream();
}
public EclipseHttpJob( long duration, boolean lock, /*boolean failure,*/ boolean indeterminate/*, boolean reschedule, long rescheduleWait*/) {
super("http4e loading..");
this.duration = duration;
// this.failure = failure;
this.unknown = indeterminate;
// this.reschedule = reschedule;
// this.rescheduleWait = rescheduleWait;
if (lock)
setRule(ResourcesPlugin.getWorkspace().getRoot());
setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.valueOf("true"));
setProperty(IProgressConstants.KEEPONE_PROPERTY, Boolean.valueOf("true"));
schedule(10);
}
private void createVerticalLayout(IPageLayout layout) {
String relativePartId= IPageLayout.ID_EDITOR_AREA;
int relativePos= IPageLayout.LEFT;
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
if (shouldShowProjectsView()) {
layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA);
relativePartId= JavaUI.ID_PROJECTS_VIEW;
relativePos= IPageLayout.BOTTOM;
}
if (shouldShowPackagesView()) {
layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
relativePartId= JavaUI.ID_PACKAGES_VIEW;
relativePos= IPageLayout.BOTTOM;
}
layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.BOTTOM, (float)0.50, JavaUI.ID_TYPES_VIEW);
IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
private void createHorizontalLayout(IPageLayout layout) {
String relativePartId= IPageLayout.ID_EDITOR_AREA;
int relativePos= IPageLayout.TOP;
if (shouldShowProjectsView()) {
layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.TOP, (float)0.25, IPageLayout.ID_EDITOR_AREA);
relativePartId= JavaUI.ID_PROJECTS_VIEW;
relativePos= IPageLayout.RIGHT;
}
if (shouldShowPackagesView()) {
layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
relativePartId= JavaUI.ID_PACKAGES_VIEW;
relativePos= IPageLayout.RIGHT;
}
layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.RIGHT, (float)0.50, JavaUI.ID_TYPES_VIEW);
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
Job updateJob = new UpdateCheckerJob(updateManager);
updateJob.schedule();
updateJob.addJobChangeListener(new UpdateCheckerJobListener(
updateManager, ActiveTab.UPDATE_FEATURES, false));
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().showView(IProgressConstants.PROGRESS_VIEW_ID);
} catch (PartInitException e) {
log.error(e);
}
return null;
}
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
Job updateJob = new UpdateCheckerJob(updateManager);
updateJob.schedule();
updateJob.addJobChangeListener(new UpdateCheckerJobListener(
updateManager, ActiveTab.ALL_FEATURES, false));
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().showView(IProgressConstants.PROGRESS_VIEW_ID);
} catch (PartInitException e) {
log.error(e);
}
return null;
}
public OutgoingProjectJob(AbstractOutgoingResourceNegotiation outgoingProjectNegotiation) {
super(Messages.NegotiationHandler_sharing_project);
negotiation = outgoingProjectNegotiation;
peer = negotiation.getPeer().getBase();
setUser(true);
setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
setProperty(
IProgressConstants.ICON_PROPERTY, ImageManager.getImageDescriptor("/icons/invites.png"));
}
public OutgoingFileTransferJob(JID jid, File file) {
super("File Transfer", jid);
setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
this.file = file;
SarosPluginContext.initComponent(this);
}
@Test
public void testNoActionPropertyIfConsoleGiven() {
Job job = new FakeModifyJob(mock(MessageConsoleStream.class));
Object actionProperty = job.getProperty(IProgressConstants.ACTION_PROPERTY);
assertNull(actionProperty);
}
@Test
public void testShowConsoleActionPropertyIfConsoleCreated() {
Job job = new FakeModifyJob(null /* no console stream given */);
Object actionProperty = job.getProperty(IProgressConstants.ACTION_PROPERTY);
assertTrue(actionProperty instanceof ShowConsoleViewAction);
}
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
folder.addView(JavaUI.ID_PACKAGES);
folder.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
folder.addPlaceholder(JavaPlugin.ID_RES_NAV);
folder.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
outputfolder.addView(JavaUI.ID_JAVADOC_VIEW);
outputfolder.addView(JavaUI.ID_SOURCE_VIEW);
outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
IFolderLayout outlineFolder = layout.createFolder("right", IPageLayout.RIGHT, (float)0.75, editorArea); //$NON-NLS-1$
outlineFolder.addView(IPageLayout.ID_OUTLINE);
outlineFolder.addPlaceholder(TemplatesView.ID);
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet(JavaUI.ID_ACTION_SET);
layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
// views - java
layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW);
// views - search
layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
// views - debugging
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
// views - standard workbench
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
layout.addShowViewShortcut(JavaPlugin.ID_RES_NAV);
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
layout.addShowViewShortcut(TemplatesView.ID);
layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
// new actions - Java project creation wizard
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.JavaProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
// 'Window' > 'Open Perspective' contributions
layout.addPerspectiveShortcut(JavaUI.ID_BROWSING_PERSPECTIVE);
layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
}
public void createInitialLayout(IPageLayout layout) {
if (stackBrowsingViewsVertically())
createVerticalLayout(layout);
else
createHorizontalLayout(layout);
// action sets
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet(JavaUI.ID_ACTION_SET);
layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
// views - java
layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
layout.addShowViewShortcut(JavaUI.ID_PROJECTS_VIEW);
layout.addShowViewShortcut(JavaUI.ID_PACKAGES_VIEW);
layout.addShowViewShortcut(JavaUI.ID_TYPES_VIEW);
layout.addShowViewShortcut(JavaUI.ID_MEMBERS_VIEW);
layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW);
layout.addShowViewShortcut(TemplatesView.ID);
// views - search
layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
// views - debugging
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
// views - standard workbench
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
layout.addShowViewShortcut(JavaPlugin.ID_RES_NAV);
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
// new actions - Java project creation wizard
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.JavaProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
// 'Window' > 'Open Perspective' contributions
layout.addPerspectiveShortcut(JavaUI.ID_PERSPECTIVE);
layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
}
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
folder.addView(JavaUI.ID_TYPE_HIERARCHY);
folder.addPlaceholder(IPageLayout.ID_OUTLINE);
folder.addPlaceholder(JavaUI.ID_PACKAGES);
folder.addPlaceholder(JavaPlugin.ID_RES_NAV);
folder.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
IPlaceholderFolderLayout outputfolder= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
outputfolder.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
outputfolder.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
outputfolder.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet(JavaUI.ID_ACTION_SET);
layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
// views - java
layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
// views - debugging
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
// views - standard workbench
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
layout.addShowViewShortcut(JavaPlugin.ID_RES_NAV);
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
layout.addShowViewShortcut(TemplatesView.ID);
layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.JavaProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
// 'Window' > 'Open Perspective' contributions
layout.addPerspectiveShortcut(JavaUI.ID_PERSPECTIVE);
layout.addPerspectiveShortcut(JavaUI.ID_BROWSING_PERSPECTIVE);
layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
}
@Override
public void createInitialLayout(IPageLayout layout) {
final String editorArea = layout.getEditorArea();
final IFolderLayout folder = layout.createFolder("left", IPageLayout.LEFT, //$NON-NLS-1$
LEFT_PANEL_RATIO, editorArea);
//folder.addView(JavaUI.ID_PACKAGES);
folder.addView(SARLPackageExplorerPart.ID_PACKAGES);
folder.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
folder.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
final IFolderLayout outputfolder = layout.createFolder("bottom", IPageLayout.BOTTOM, //$NON-NLS-1$
BOTTOM_PANEL_RATIO, editorArea);
outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
outputfolder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
outputfolder.addView(IPageLayout.ID_TASK_LIST);
outputfolder.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
outputfolder.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
final IFolderLayout outlineFolder = layout.createFolder("right", IPageLayout.RIGHT, //$NON-NLS-1$
RIGHT_PANEL_RATIO, editorArea);
outlineFolder.addView(IPageLayout.ID_OUTLINE);
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet(JavaUI.ID_ACTION_SET);
layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
// views - java
layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
// views - search
layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
// views - debugging
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
// views - standard workbench
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
// new actions - Java project creation wizard
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlProject"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlScript"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlAgent"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlBehavior"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlCapacity"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlEvent"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlSkill"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlClass"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlInterface"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlEnumeration"); //$NON-NLS-1$
layout.addNewWizardShortcut("io.sarl.eclipse.wizard.newSarlAnnotation"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard"); //$NON-NLS-1$
// 'Window' > 'Open Perspective' contributions
//--- Add the SARL debug perspective
layout.addPerspectiveShortcut(SARLEclipseConfig.ID_SARL_DEBUG_PERSPECTIVE);
//--- Add the Java perspectives
layout.addPerspectiveShortcut(JavaUI.ID_PERSPECTIVE);
layout.addPerspectiveShortcut(JavaUI.ID_BROWSING_PERSPECTIVE);
//--- Add the Debug perspectives
layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
}
/**
* Install selected updates in to developer studio. Note: call
* {@link #setSelectedUpdates(List) setSelectedUpdates} first.
*
* @param monitor
*/
public void installSelectedUpdates(IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_26, 2);
URI[] repos = new URI[] { getDevStudioUpdateSite() };
session = new ProvisioningSession(p2Agent);
updateOperation = new UpdateOperation(session);
updateOperation.getProvisioningContext().setArtifactRepositories(repos);
updateOperation.getProvisioningContext().setMetadataRepositories(repos);
updateOperation.setSelectedUpdates(selectedUpdates);
IStatus status = updateOperation.resolveModal(progress.newChild(1));
if (status.getSeverity() == IStatus.CANCEL) {
throw new OperationCanceledException();
} else if (status.getSeverity() == IStatus.ERROR) {
String message = status.getChildren()[0].getMessage();
UpdateMetaFileReaderJob.promptUserError(message, Messages.UpdateManager_27);
log.error(Messages.UpdateManager_27 + message);
} else {
final ProvisioningJob provisioningJob = updateOperation.getProvisioningJob(progress.newChild(1));
if (provisioningJob != null) {
provisioningJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent arg0) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
boolean restart = MessageDialog.openQuestion(Display.getDefault().getActiveShell(),
Messages.UpdateManager_28,
Messages.UpdateManager_29 + Messages.UpdateManager_30);
if (restart) {
PlatformUI.getWorkbench().restart();
}
}
});
}
});
provisioningJob.schedule();
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.showView(IProgressConstants.PROGRESS_VIEW_ID);
} catch (PartInitException e) {
log.error(e);
}
}
});
} else {
log.error(Messages.UpdateManager_31);
}
}
}
/**
* Install selected features in to developer studio. Note: call
* {@link #setSelectedFeaturesToInstall(List) setSelectedFeaturesToInstall}
* first.
*
* @param monitor
*/
public void installSelectedFeatures(IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_32, 2);
URI[] repos = new URI[] { getDevStudioReleaseSite() };
session = new ProvisioningSession(p2Agent);
installOperation = new InstallOperation(session, selectedFeatures);
installOperation.getProvisioningContext().setArtifactRepositories(repos);
installOperation.getProvisioningContext().setMetadataRepositories(repos);
IStatus status = installOperation.resolveModal(progress.newChild(1));
if (status.getSeverity() == IStatus.CANCEL || progress.isCanceled()) {
throw new OperationCanceledException();
} else if (status.getSeverity() == IStatus.ERROR) {
String message = status.getChildren()[0].getMessage();
log.error(Messages.UpdateManager_33 + message);
UpdateMetaFileReaderJob.promptUserError(message, Messages.UpdateManager_33);
} else {
ProvisioningJob provisioningJob = installOperation.getProvisioningJob(progress.newChild(1));
if (provisioningJob != null) {
provisioningJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent arg0) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
boolean restart = MessageDialog.openQuestion(Display.getDefault().getActiveShell(),
Messages.UpdateManager_34,
Messages.UpdateManager_35 + Messages.UpdateManager_36);
if (restart) {
PlatformUI.getWorkbench().restart();
}
}
});
}
});
provisioningJob.schedule();
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.showView(IProgressConstants.PROGRESS_VIEW_ID);
} catch (PartInitException e) {
log.error(e);
}
}
});
} else {
log.error(Messages.UpdateManager_37);
}
}
}
public IncomingFileTransferJob(XMPPFileTransferRequest request, File file) {
super("File Transfer", request.getContact().getBareJid());
setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
this.request = request;
this.file = file;
}
@Override
public Object[] getElements(Object inputElement){
if (bValid || bUpdating) {
return pats;
}
if (pfilter != null) {
pats = new String[] {
Messages.PatListeContentProvider_LoadingData
};
((TableViewer) commonViewer.getViewerWidget()).setItemCount(1);
}
if (!CoreHub.acl.request(AccessControlDefaults.PATIENT_DISPLAY)) {
return new Object[0];
}
Job job = new Job(Messages.PatListeContentProvider_LoadingPatients) {
@Override
protected IStatus run(IProgressMonitor monitor){
monitor.beginTask(Messages.PatListeContentProvider_LoadPatients,
IProgressMonitor.UNKNOWN);
if (pfilter != null) {
if (pfilter.aboutToStart() == false) {
return Status.CANCEL_STATUS;
}
}
// perform actual loading
syncRefresh();
monitor.done();
return Status.OK_STATUS;
}
};
job.setPriority(Job.SHORT);
job.setUser(false);
bUpdating = true;
IWorkbenchSiteProgressService siteService =
(IWorkbenchSiteProgressService) site.getSite().getAdapter(
IWorkbenchSiteProgressService.class);
siteService.schedule(job, 0, true);
job.setProperty(IProgressConstants.ICON_PROPERTY, Images.IMG_AUSRUFEZ_ROT.getImage());
return pats;
}