当前位置: 首页>>代码示例>>Java>>正文


Java SWTException类代码示例

本文整理汇总了Java中org.eclipse.swt.SWTException的典型用法代码示例。如果您正苦于以下问题:Java SWTException类的具体用法?Java SWTException怎么用?Java SWTException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SWTException类属于org.eclipse.swt包,在下文中一共展示了SWTException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import org.eclipse.swt.SWTException; //导入依赖的package包/类
@Override
public boolean close(boolean forceClose) {
   // triggerCloseListener
	if (!super.close(forceClose)) {
		return false;
	}

	Utils.execSWTThread(new SWTRunnable() {
		@Override
		public void runWithDisplay(Display display) {
			if (swtItem != null && !swtItem.isDisposed()) {
				// this will triggerCloseListeners
				try {
					swtItem.dispose();
				}catch( SWTException e ){
					// getting internal 'Widget it disposed' here, ignore
				}
				swtItem = null;
			}
		}
	});
	return true;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:24,代码来源:TabbedEntry.java

示例2: isThisThreadSWT

import org.eclipse.swt.SWTException; //导入依赖的package包/类
public static boolean isThisThreadSWT() {
	SWTThread swt = SWTThread.getInstance();

	if (swt == null) {
		//System.err.println("WARNING: SWT Thread not started yet");
	}

	Display display = (swt == null) ? Display.getCurrent() : swt.getDisplay();

	if (display == null) {
		return false;
	}

	// This will throw if we are disposed or on the wrong thread
	// Much better that display.getThread() as that one locks Device.class
	// and may end up causing sync lock when disposing
	try {
		display.getWarnings();
	} catch (SWTException e) {
		return false;
	}

	return (display.getThread() == Thread.currentThread());
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:25,代码来源:Utils.java

示例3: resourceChanged

import org.eclipse.swt.SWTException; //导入依赖的package包/类
public void resourceChanged(IResourceChangeEvent event){
   if(event.getType()==IResourceChangeEvent.PRE_CLOSE){
   	try{
   		if(event.getResource().getProject().isNatureEnabled(CommonNames.DERBY_NATURE)){
   			if(getRunning(event.getResource().getProject())){
   				stopDerbyServer(event.getResource().getProject());
   			}
   		}
   	}catch(SWTException swe){
   		//The SWTException is thrown during the Shell creation
   		//Logger.log("Exception shutting down "+swe,IStatus.ERROR);
   		//e.printStackTrace();
   	}catch(Exception e){
   		Logger.log("Exception shutting down "+e,IStatus.ERROR);
   	}
   }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:18,代码来源:DerbyServerUtils.java

示例4: populate

import org.eclipse.swt.SWTException; //导入依赖的package包/类
public void populate(){
   CoreContext ctx = CoreContext.getContext();
   ProxyItem item = (ProxyItem) ctx.getObject(CoreObjects.PROXY_ITEM);
   try {
      if (item != null) {
         this.proxyItem = item;
         hostBox.setText(BaseUtils.noNull(item.getHost()));
         portBox.setText("" + item.getPort());
         enabledCheck.setSelection(item.isProxy());

      } else {
         this.proxyItem = new ProxyItem();
      }
   } catch (SWTException e) {
      // dispose exception
      ExceptionHandler.handle(e);
   }
}
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:19,代码来源:ProxyDialog.java

示例5: loadImageData

import org.eclipse.swt.SWTException; //导入依赖的package包/类
private ImageData loadImageData() {
	ImageData[] imageDatas;
	try {
		imageDatas = new ImageLoader().load(new ByteArrayInputStream(favIconBytes));
	} catch (SWTException e) {
		return null;
	}
	Optional<ImageData> optionalImageData = Arrays.stream(imageDatas).sorted((imageData1,
			imageData2) -> distanceFrom16x16ImageData(imageData1) - distanceFrom16x16ImageData(imageData2))
			.findFirst();
	if (!optionalImageData.isPresent()) {
		return null;
	}
	ImageData imageData = optionalImageData.get();
	if (imageData.width <= 16 && imageData.height <= 16) {
		return imageData;
	}
	return imageData.scaledTo(16, 16);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:20,代码来源:IconImageDescriptor.java

示例6: initializeWorkbench

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * Performs some weird initialization steps needed to run the tests.
 *
 * @param bot
 *          to work with, must not be {@code null}
 */
public static void initializeWorkbench(final SwtWorkbenchBot bot) {
  Assert.isNotNull(bot, ARGUMENT_BOT);
  // Move mouse outside client area (to prevent problems with context menus)
  PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
    @Override
    public void run() {
      try {
        final Robot robot = new Robot();
        robot.mouseMove(MOUSE_POSITION_X, MOUSE_POSITION_Y);
      } catch (SWTException | AWTException wte) {
        throw new WrappedException("Error during initialisation SWT mouse", wte);
      }
    }
  });
  // The welcome page must be closed before resetting the workbench to avoid trashing the UI:
  bot.closeWelcomePage();
  bot.resetActivePerspective();
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:25,代码来源:CoreSwtbotTools.java

示例7: modifyModel

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * Performs modifications to the Plugin Model.
 *
 * @param modification
 *          a modification
 * @param monitor
 *          progress monitor
 */
public void modifyModel(final ModelModification modification, final IProgressMonitor monitor) {
  if (monitor.isCanceled()) {
    throw new OperationCanceledException();
  }
  try {
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
      @Override
      public void run() {
        PDEModelUtility.modifyModel(modification, monitor);
      }
    });
  } catch (SWTException e) {
    // If the build was cancelled while in syncExec() it will throw an SWTException
    if (monitor.isCanceled()) {
      throw new OperationCanceledException();
    } else {
      throw e;
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:29,代码来源:CheckExtensionGenerator.java

示例8: catchSWTException

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * This can be used to verify an exception that is thrown on the UI thread.
 * 
 * @param runnable
 *            The runnable that would normally be sent to
 *            {@link Display#syncExec(Runnable)}.
 * @return The first {@link SWTException} that was thrown, or {@code null}
 *         if one was not thrown.
 */
protected SWTException catchSWTException(final Runnable runnable) {
	// Use an AtomicReference to catch the exception.
	final AtomicReference<SWTException> exceptionRef;
	exceptionRef = new AtomicReference<SWTException>();
	// Run the runnable synchronously, but try to catch the SWTException.
	getDisplay().syncExec(new Runnable() {
		@Override
		public void run() {
			try {
				runnable.run();
			} catch (SWTException e) {
				exceptionRef.set(e);
			}
		}
	});
	// Return any SWTException that was thrown from the specified runnable.
	return exceptionRef.get();
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:28,代码来源:AbstractSWTTester.java

示例9: enable

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * Enable or disable the ui. Can be called from non ui threads.
 * @param enabled
 */
private void enable(final boolean enabled) {
    try {
        Display d = mParent.getDisplay();
        d.asyncExec(new Runnable() {
            @Override
            public void run() {
                if (mParent.isDisposed() == false) {
                    doEnable(enabled);
                }
            }
        });
    } catch (SWTException e) {
        // disposed. do nothing
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:20,代码来源:EmulatorControlPanel.java

示例10: processCommandResult

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * Processes the result of a command sent to the console.
 * @param result the result of the command.
 */
private boolean processCommandResult(final String result) {
    if (result != EmulatorConsole.RESULT_OK) {
        try {
            mParent.getDisplay().asyncExec(new Runnable() {
                @Override
                public void run() {
                    if (mParent.isDisposed() == false) {
                        MessageDialog.openError(mParent.getShell(), "Emulator Console",
                                result);
                    }
                }
            });
        } catch (SWTException e) {
            // we're quitting, just ignore
        }

        return false;
    }

    return true;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:26,代码来源:EmulatorControlPanel.java

示例11: clientChanged

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * Sent when an existing client information changed.
 * <p/>
 * This is sent from a non UI thread.
 * @param client the updated client.
 * @param changeMask the bit mask describing the changed properties. It can contain
 * any of the following values: {@link Client#CHANGE_INFO}, {@link Client#CHANGE_NAME}
 * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
 * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
 * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
 *
 * @see IClientChangeListener#clientChanged(Client, int)
 */
@Override
public void clientChanged(final Client client, int changeMask) {
    if (client == getCurrentClient()) {
        if ((changeMask & Client.CHANGE_HEAP_MODE) == Client.CHANGE_HEAP_MODE ||
                (changeMask & Client.CHANGE_HEAP_DATA) == Client.CHANGE_HEAP_DATA) {
            try {
                mTop.getDisplay().asyncExec(new Runnable() {
                    @Override
                    public void run() {
                        clientSelected();
                    }
                });
            } catch (SWTException e) {
                // display is disposed (app is quitting most likely), we do nothing.
            }
        }
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:32,代码来源:HeapPanel.java

示例12: openOptionPanel

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * Opens the option panel.
 * </p>
 * <b>This must be called from the UI thread</b>
 */
@UiThread
public void openOptionPanel() {
    try {
        EventDisplayOptions dialog = new EventDisplayOptions(mParent.getShell());
        if (dialog.open(mCurrentEventLogParser, mEventDisplays, mEvents)) {
            synchronized (mLock) {
                // get the new EventDisplay list
                mEventDisplays.clear();
                mEventDisplays.addAll(dialog.getEventDisplays());

                // since the list of EventDisplay changed, we store it.
                saveEventDisplays();

                rebuildUi();
            }
        }
    } catch (SWTException e) {
        Log.e("EventLog", e); //$NON-NLS-1$
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:26,代码来源:EventLogPanel.java

示例13: resetUI

import org.eclipse.swt.SWTException; //导入依赖的package包/类
private void resetUI(boolean inUiThread) {
    mEvents.clear();

    // the ui is static we just empty it.
    if (inUiThread) {
        resetUiFromUiThread();
    } else {
        try {
            Display d = mBottomParentPanel.getDisplay();

            // run sync as we need to update right now.
            d.syncExec(new Runnable() {
                @Override
                public void run() {
                    if (mBottomParentPanel.isDisposed() == false) {
                        resetUiFromUiThread();
                    }
                }
            });
        } catch (SWTException e) {
            // display is disposed, we're quitting. Do nothing.
        }
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:25,代码来源:EventLogPanel.java

示例14: scheduleUIEventHandler

import org.eclipse.swt.SWTException; //导入依赖的package包/类
/**
 * Schedules the UI thread to execute a {@link Runnable} calling {@link #displayNewEvents()}.
 */
private void scheduleUIEventHandler() {
    try  {
        Display d = mBottomParentPanel.getDisplay();
        d.asyncExec(new Runnable() {
            @Override
            public void run() {
                if (mBottomParentPanel.isDisposed() == false) {
                    if (mCurrentEventLogParser != null) {
                        displayNewEvents();
                    }
                }
            }
        });
    } catch (SWTException e) {
        // if the ui is disposed, do nothing
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:21,代码来源:EventLogPanel.java

示例15: run

import org.eclipse.swt.SWTException; //导入依赖的package包/类
public void run() {
    setBlockOnOpen(true);

    try {
        open();
    } catch (SWTException e) {
     // Ignore "widget disposed" errors after we closed.
        if (!getShell().isDisposed()) {
            throw e;
        }
    }

    TreeViewModel.getModel().removeTreeChangeListener(mTreeChangeListener);
    PixelPerfectModel.getModel().removeImageChangeListener(mImageChangeListener);

    ImageLoader.dispose();
    mDirector.stopListenForDevices();
    mDirector.stopDebugBridge();
    mDirector.terminate();
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:21,代码来源:HierarchyViewerApplication.java


注:本文中的org.eclipse.swt.SWTException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。